diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-15 11:40:06 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-15 12:30:13 +0100 |
commit | 9b6a44a3d58cb050156f6f5253c14f6e0f79eabf (patch) | |
tree | d5dee140da05e1d3b8c15a4f31ea6ee5e3646579 /sw | |
parent | 34636bea78020e98bb5db6c3165d98d984e022dd (diff) |
CppunitTest_sw_ooxmlexport*: use getProperty<Color> when possible
Change-Id: I87116aeb0c176d67588ecfcff94098346e17dd6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131584
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport10.cxx | 11 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 22 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 3 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport2.cxx | 19 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport6.cxx | 18 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 7 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 18 |
12 files changed, 60 insertions, 66 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index d1a348612779..7ff6b11f1baa 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -522,7 +522,7 @@ DECLARE_OOXMLEXPORT_TEST(testWpsCharColor, "wps-char-color.docx") { uno::Reference<text::XTextRange> xShape(getShape(1), uno::UNO_QUERY); // This was -1, i.e. the character color was default (-1), not white. - CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_Int32>(xShape->getStart(), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xShape->getStart(), "CharColor")); } DECLARE_OOXMLEXPORT_TEST(testTableStyleCellBackColor, "table-style-cell-back-color.docx") @@ -533,7 +533,7 @@ DECLARE_OOXMLEXPORT_TEST(testTableStyleCellBackColor, "table-style-cell-back-col uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); // This was 0xffffff. - CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), getProperty<Color>(xCell, "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testTableStyleBorder, "table-style-border.docx") @@ -880,7 +880,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf97090, "tdf97090.docx") uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0x95B3D7), Color(ColorTransparency, getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x95B3D7), getProperty<Color>(xTable->getCellByName("A1"), "BackColor")); uno::Reference<container::XEnumerationAccess> paraEnumAccess(xTable->getCellByName("A1"), uno::UNO_QUERY); assert( paraEnumAccess.is() ); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx index 29996d119812..21f81b619bda 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx @@ -120,9 +120,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xGroup->getCount()); // background, 3 rectangles and an arrow in the group uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(2), uno::UNO_QUERY); - sal_Int32 nValue(0); - xPropertySet->getPropertyValue("FillColor") >>= nValue; - CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), Color(ColorTransparency, nValue)); // If fill color is right, theme import is OK + CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), getProperty<Color>(xPropertySet, "FillColor")); // If fill color is right, theme import is OK uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(2), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text @@ -130,8 +128,7 @@ DECLARE_OOXMLEXPORT_TEST(testSmartart, "smartart.docx") uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY); - xPropertySet->getPropertyValue("ParaAdjust") >>= nValue; - CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported + CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), getProperty<sal_Int32>( xPropertySet, "ParaAdjust")); // Paragraph properties are imported } CPPUNIT_TEST_FIXTURE(Test, testFdo69548) @@ -248,7 +245,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx") // positionV's posOffset from the bugdoc, was 0. CPPUNIT_ASSERT(6879 <= getProperty<sal_Int32>(xShape, "VertOrientPosition")); // This was -1 (default), make sure the background color is set. - CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), Color(ColorTransparency, getProperty<sal_Int32>(xShape, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), getProperty<Color>(xShape, "FillColor")); uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor = getShape(2); // This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox. @@ -259,7 +256,7 @@ DECLARE_OOXMLEXPORT_TEST(testMceNested, "mce-nested.docx") uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xGroup->getByIndex(1), uno::UNO_QUERY_THROW)->getText(); uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText, "[Year]"); CPPUNIT_ASSERT_EQUAL(48.f, getProperty<float>(getRun(xParagraph, 1), "CharHeight")); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(getRun(xParagraph, 1), "CharColor")); CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, getProperty<float>(getRun(xParagraph, 1), "CharWeight")); //FIXME: CPPUNIT_ASSERT_EQUAL(drawing::TextVerticalAdjust_BOTTOM, getProperty<drawing::TextVerticalAdjust>(xGroup->getByIndex(1), "TextVerticalAdjust")); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index facb455d560e..8af29d6d7683 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -45,9 +45,9 @@ protected: DECLARE_OOXMLEXPORT_TEST(testTdf57589_hashColor, "tdf57589_hashColor.docx") { CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTMAGENTA, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTMAGENTA, getProperty<Color>(getParagraph(1), "ParaBackColor")); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(2), "FillStyle")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(2), "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getParagraph(2), "ParaBackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAuto, "tdf90906_colAuto.docx") @@ -59,7 +59,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAuto, "tdf90906_colAuto.docx") uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getRun(xPara, 1, "Nazwa"), "CharBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getRun(xPara, 1, "Nazwa"), "CharBackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAutoB, "tdf90906_colAutoB.docx") @@ -69,23 +69,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf90906_colAutoB, "tdf90906_colAutoB.docx") uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTGREEN, getProperty<Color>(xCell, "BackColor")); xCell.set(xTable->getCellByName("A2")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xCell, "BackColor")); xCell.set(xTable->getCellByName("B1")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xCell, "BackColor")); xCell.set(xTable->getCellByName("B2")); - CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_LIGHTBLUE, getProperty<Color>(xCell, "BackColor")); uno::Reference<text::XTextRange> xText(getParagraph(2, "Paragraphs too")); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf92524_autoColor, "tdf92524_autoColor.doc") { CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(getParagraph(1), "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getParagraph(1), "ParaBackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt") @@ -95,7 +95,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf116436_rowFill, "tdf116436_rowFill.odt") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); - CPPUNIT_ASSERT_EQUAL(Color(0xF8DF7C), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xF8DF7C), getProperty<Color>(xCell, "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf121665_back2backColumnBreaks, "tdf121665_back2backColumnBreaks.docx") @@ -793,7 +793,7 @@ DECLARE_OOXMLEXPORT_TEST(testNoDefault, "noDefault.docx") uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); // Row 1: color directly applied to the paragraph, overrides table and style colors - CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), Color(ColorTransparency, getProperty<sal_Int32>(getRun(xPara,1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), getProperty<Color>(getRun(xPara,1), "CharColor")); // Row2: (still part of firstRow table-style) ought to use the Normal style color, not the table-style color(5B9BD5) //xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index 5d1af7159fcf..16ac47ce8a9a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -1860,8 +1860,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf123189_tableBackground, "table-black_fill.docx") uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); - CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, - Color(ColorTransparency, getProperty<sal_uInt32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, getProperty<Color>(xCell, "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf116084, "tdf116084.docx") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 34f19aa5054a..2bfe6c68a0f7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -459,7 +459,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118947_tableStyle, "tdf118947_tableStyle.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("Table style sets 0 right margin", sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaRightMargin")); CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("TextBody has 1.07 line-spacing", sal_Int16(107), getProperty<style::LineSpacing>(xPara, "ParaLineSpacing").Height, 1); // table-style based paragraph background color - CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing paragraph background color in cell A1", Color(0xCCFFCC), Color(ColorTransparency, getProperty<sal_Int32>(xPara, "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Missing paragraph background color in cell A1", Color(0xCCFFCC), getProperty<Color>(xPara, "ParaBackColor")); // This cell is affected by compatSetting overrideTableStyleFontSizeAndJustification=0 (the default value) xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index d270cec19a21..8ee4c8c3650c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -213,7 +213,7 @@ CPPUNIT_TEST_FIXTURE(Test, Tdf133065) DECLARE_OOXMLEXPORT_TEST(testTdf130814model, "tdf130814.docx") { - CPPUNIT_ASSERT_EQUAL(Color(0x1F497D), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraph(2), 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x1F497D), getProperty<Color>(getRun(getParagraph(2), 1), "CharColor")); CPPUNIT_ASSERT_EQUAL(double(16), getProperty<double>(getRun(getParagraph(2), 1), "CharHeight")); CPPUNIT_ASSERT_EQUAL(awt::FontUnderline::SINGLE, getProperty<sal_Int16>(getRun(getParagraph(2), 1), "CharUnderline")); CPPUNIT_ASSERT_EQUAL(OUString("Candara"), getProperty<OUString>(getRun(getParagraph(2), 1), "CharFontName")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 4af9267e46b8..4af48b2feb15 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -555,7 +555,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextFrameBorders, "textframe-borders.docx") { // After import, a TextFrame is created by the VML import. uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency, getProperty<sal_Int32>(xFrame, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xD99594), getProperty<Color>(xFrame, "BackColor")); table::BorderLine2 aBorder = getProperty<table::BorderLine2>(xFrame, "TopBorder"); CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency, aBorder.Color)); @@ -570,14 +570,14 @@ DECLARE_OOXMLEXPORT_TEST(testTextFrameBorders, "textframe-borders.docx") { // After export and import, the result is a shape. uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0xD99594), Color(ColorTransparency, getProperty<sal_Int32>(xShape, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xD99594), getProperty<Color>(xShape, "FillColor")); - CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), Color(ColorTransparency, getProperty<sal_Int32>(xShape, "LineColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xC0504D), getProperty<Color>(xShape, "LineColor")); CPPUNIT_ASSERT_EQUAL(sal_Int32(35), getProperty<sal_Int32>(xShape, "LineWidth")); CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty<sal_Int32>(xShape, "ShadowXDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(48), getProperty<sal_Int32>(xShape, "ShadowYDistance")); - CPPUNIT_ASSERT_EQUAL(Color(0x622423), Color(ColorTransparency, getProperty<sal_Int32>(xShape, "ShadowColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x622423), getProperty<Color>(xShape, "ShadowColor")); } } @@ -695,7 +695,7 @@ DECLARE_OOXMLEXPORT_TEST(testPageBackground, "page-background.docx") { // 'Document Background' wasn't exported. uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0x92D050), Color(ColorTransparency, getProperty<sal_Int32>(xPageStyle, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x92D050), getProperty<Color>(xPageStyle, "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testFdo65265, "fdo65265.docx") @@ -857,7 +857,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo56679, "fdo56679.docx") uno::Reference< text::XTextRange > xText = getRun( xParagraph, 2, "This is a simple sentence."); CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xText, "CharUnderlineHasColor")); - CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), Color(ColorTransparency, getProperty<sal_Int32>(xText, "CharUnderlineColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), getProperty<Color>(xText, "CharUnderlineColor")); } DECLARE_OOXMLEXPORT_TEST(testFdo65400, "fdo65400.docx") @@ -1028,11 +1028,11 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo60990) CPPUNIT_ASSERT_EQUAL(1, getPages()); // The shape had no background, no paragraph adjust and no font color. uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0x00CFE7F5), Color(ColorTransparency, getProperty<sal_Int32>(xShape, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x00CFE7F5), getProperty<Color>(xShape, "FillColor")); uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText(); uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, xText); CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xParagraph, "ParaAdjust"))); - CPPUNIT_ASSERT_EQUAL(Color(0x00FF00), Color(ColorTransparency, getProperty<sal_Int32>(getRun(xParagraph, 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x00FF00), getProperty<Color>(getRun(xParagraph, 1), "CharColor")); } DECLARE_OOXMLEXPORT_TEST(testFdo65718, "fdo65718.docx") @@ -1172,9 +1172,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo67737, "fdo67737.docx") DECLARE_OOXMLEXPORT_TEST(testTransparentShadow, "transparent-shadow.docx") { uno::Reference<drawing::XShape> xPicture = getShape(1); - sal_Int32 nShadowColor = getProperty<sal_Int32>(xPicture, "ShadowColor"); sal_Int16 nShadowTransparence = getProperty<sal_Int16>(xPicture, "ShadowTransparence"); - CPPUNIT_ASSERT_EQUAL(Color(0x808080), Color(ColorTransparency, nShadowColor)); + CPPUNIT_ASSERT_EQUAL(Color(0x808080), getProperty<Color>(xPicture, "ShadowColor")); CPPUNIT_ASSERT_EQUAL(sal_Int16(50), nShadowTransparence); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 56e1e364634c..8b698be6855d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -311,11 +311,11 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar3, "calendar3.docx") // TableStyle:firstRow (for header rows 1 and 2) color and size overrides document rPrDefault uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0x5B9BD5), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x5B9BD5), getProperty<Color>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharColor")); CPPUNIT_ASSERT_EQUAL(16.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()),1), "CharHeight")); // direct formatting in A1 uno::Reference<text::XTextRange> xCell2(xTable->getCellByName("A1"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraphOfText(1, xCell2->getText()), 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), getProperty<Color>(getRun(getParagraphOfText(1, xCell2->getText()), 1), "CharColor")); CPPUNIT_ASSERT_EQUAL(20.f, getProperty<float>(getRun(getParagraphOfText(1, xCell2->getText()),1), "CharHeight")); // tdf#132149 Despite specifying portrait, the page size's specified width is greater than its height. @@ -340,10 +340,10 @@ DECLARE_OOXMLEXPORT_TEST(testCalendar5, "calendar5.docx") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // text portions with direct formatting - CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraphOfText(1, xCell->getText()), 2), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x2E74B5), getProperty<Color>(getRun(getParagraphOfText(1, xCell->getText()), 1), "CharColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xFF0000), getProperty<Color>(getRun(getParagraphOfText(1, xCell->getText()), 2), "CharColor")); // default paragraph text color - CPPUNIT_ASSERT_EQUAL(Color(0x5B9BD5), Color(ColorTransparency, getProperty<sal_Int32>(getRun(getParagraphOfText(1, xCell->getText()), 3), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x5B9BD5), getProperty<Color>(getRun(getParagraphOfText(1, xCell->getText()), 3), "CharColor")); // text portions with direct formatting CPPUNIT_ASSERT_EQUAL(20.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()),1), "CharHeight")); CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(getRun(getParagraphOfText(1, xCell->getText()),2), "CharHeight")); @@ -829,7 +829,7 @@ DECLARE_OOXMLEXPORT_TEST(testOoxmlTriangle, "ooxml-triangle.docx") DECLARE_OOXMLEXPORT_TEST(testMce, "mce.docx") { // The shape is red in Word2007, green in Word2010. Check that our import follows the later. - CPPUNIT_ASSERT_EQUAL(Color(0x9bbb59), Color(ColorTransparency, getProperty<sal_Int32>(getShape(1), "FillColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x9bbb59), getProperty<Color>(getShape(1), "FillColor")); } CPPUNIT_TEST_FIXTURE(Test, testThemePreservation) diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 9d3bed3d6b44..b208c303204d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1061,13 +1061,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf117297_tableStyle, "tdf117297_tableStyle.docx") uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference<text::XText> xText = xPara->getText(); CPPUNIT_ASSERT_EQUAL(OUString("Green text, default size (9), 1.5 spaced"), xPara->getString()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph1 green font", Color(0x70AD47), Color(ColorTransparency, getProperty<sal_Int32>(getRun(xPara, 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph1 green font", Color(0x70AD47), getProperty<Color>(getRun(xPara, 1), "CharColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph1 1.5 line spacing", sal_Int16(150), getProperty<style::LineSpacing>(xPara, "ParaLineSpacing").Height); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY); xText = xPara->getText(); CPPUNIT_ASSERT_EQUAL(OUString("TableGrid color (blue), TableGrid size (9), double spacing"), xPara->getString()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph3 blue font", Color(0x00B0F0), Color(ColorTransparency, getProperty<sal_Int32>(getRun(xPara, 1), "CharColor"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph3 blue font", Color(0x00B0F0), getProperty<Color>(getRun(xPara, 1), "CharColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell B1 Paragraph3 double spacing", sal_Int16(200), getProperty<style::LineSpacing>(xPara, "ParaLineSpacing").Height); } @@ -1317,7 +1317,7 @@ DECLARE_OOXMLEXPORT_TEST(testOO47778_2, "ooo47778-4.odt") uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference<table::XCell> xCell = xTable->getCellByName("A1"); - CPPUNIT_ASSERT_EQUAL(Color(0xffffff), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xCell, "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testOO67471, "ooo67471-2.odt") diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index e79b531b39ac..1ed0acf0562a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -160,18 +160,18 @@ DECLARE_OOXMLEXPORT_TEST(testDMLTextFrameNoFill, "frame.fodt") // CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xShape1, "FillStyle")); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape1, "FillStyle")); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xShape1, "FillTransparence")); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_Int32>(xShape1, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xShape1, "FillColor")); uno::Reference<beans::XPropertySet> xShape2(getShape(2), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape2, "FillStyle")); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xShape2, "FillTransparence")); - CPPUNIT_ASSERT_EQUAL(Color(0xE8F2A1), Color(ColorTransparency, getProperty<sal_Int32>(xShape2, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xE8F2A1), getProperty<Color>(xShape2, "FillColor")); uno::Reference<beans::XPropertySet> xShape3(getShape(3), uno::UNO_QUERY); // it is re-imported as solid // CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xShape3, "FillStyle")); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xShape3, "FillStyle")); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_Int32>(xShape3, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xShape3, "FillColor")); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xShape3, "FillTransparence")); } @@ -868,12 +868,12 @@ CPPUNIT_TEST_FIXTURE(Test, testShapeThemePreservation) uno::Reference<drawing::XShape> xShape3 = getShape(3); // check colors are properly applied to shapes on import - CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), Color(ColorTransparency, getProperty<sal_Int32>(xShape1, "FillColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0xfcd5b5), Color(ColorTransparency, getProperty<sal_Int32>(xShape2, "FillColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0x00b050), Color(ColorTransparency, getProperty<sal_Int32>(xShape3, "FillColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0x3a5f8b), Color(ColorTransparency, getProperty<sal_Int32>(xShape1, "LineColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0x4f6228), Color(ColorTransparency, getProperty<sal_Int32>(xShape2, "LineColor"))); - CPPUNIT_ASSERT_EQUAL(Color(0xff0000), Color(ColorTransparency, getProperty<sal_Int32>(xShape3, "LineColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x4f81bd), getProperty<Color>(xShape1, "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xfcd5b5), getProperty<Color>(xShape2, "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x00b050), getProperty<Color>(xShape3, "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x3a5f8b), getProperty<Color>(xShape1, "LineColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x4f6228), getProperty<Color>(xShape2, "LineColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), getProperty<Color>(xShape3, "LineColor")); // check line properties are properly applied to shapes on import CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_SOLID, getProperty<drawing::LineStyle>(xShape1, "LineStyle")); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 392831f9387c..a8ecf1e0fa3f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -900,7 +900,7 @@ DECLARE_OOXMLEXPORT_TEST(testConditionalstylesTablelook, "conditionalstyles-tbll uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Background was -1. - CPPUNIT_ASSERT_EQUAL(Color(0x7F7F7F), Color(ColorTransparency, getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x7F7F7F), getProperty<Color>(xTable->getCellByName("A1"), "BackColor")); } DECLARE_OOXMLEXPORT_TEST(testFdo63685, "fdo63685.docx") @@ -1056,9 +1056,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo46361, "fdo46361.docx") // This was BLACK CPPUNIT_ASSERT_EQUAL( Color(0x008000), - Color(ColorTransparency, - getProperty<sal_Int32>(getRun(getParagraphOfText(1, xTextBox->getText()), 1), - "CharColor"))); + getProperty<Color>(getRun(getParagraphOfText(1, xTextBox->getText()), 1), + "CharColor")); // Count the paragraphs xTextBox.set(xGroupShape->getByIndex(1), uno::UNO_QUERY_THROW); const auto& sText1 = xTextBox->getString(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 54c30d9f5fe9..e9b2c0a1ef39 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -919,11 +919,11 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_footnoteStyle, "tdf82173_footnoteStyle.doc uno::Reference<beans::XPropertySet> xPageStyle(getStyles("CharacterStyles")->getByName("Footnote Characters"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, "CharEscapementHeight") ); - CPPUNIT_ASSERT_EQUAL( Color(0x00FF00), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0x00FF00), getProperty<Color>(xPageStyle, "CharColor")); xPageStyle.set(getStyles("CharacterStyles")->getByName("Footnote anchor"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, "CharEscapementHeight") ); - CPPUNIT_ASSERT_EQUAL( Color(0x00FF00), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0x00FF00), getProperty<Color>(xPageStyle, "CharColor")); //tdf#118361 - in RTL locales, the footnote separator should still be left aligned. uno::Any aPageStyle = getStyles("PageStyles")->getByName("Standard"); @@ -938,30 +938,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf82173_endnoteStyle, "tdf82173_endnoteStyle.docx" xEndnotes->getByIndex(0) >>= xEndnote; // character properties were previously not assigned to the footnote/endnote in-text anchor. CPPUNIT_ASSERT_EQUAL( 24.0f, getProperty< float >(xEndnote->getAnchor(), "CharHeight") ); - CPPUNIT_ASSERT_EQUAL( Color(0xFF0000), Color(ColorTransparency, getProperty< sal_Int32 >(xEndnote->getAnchor(), "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0xFF0000), getProperty<Color>(xEndnote->getAnchor(), "CharColor")); uno::Reference<text::XText> xEndnoteText; xEndnotes->getByIndex(0) >>= xEndnoteText; // This was Endnote Symbol CPPUNIT_ASSERT_EQUAL(OUString("Endnote"), getProperty<OUString>(getParagraphOfText(1, xEndnoteText), "ParaStyleName")); - CPPUNIT_ASSERT_EQUAL(Color(0x993300), Color(ColorTransparency, getProperty<sal_Int32>(getParagraphOfText(1, xEndnoteText), "CharColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x993300), getProperty<Color>(getParagraphOfText(1, xEndnoteText), "CharColor")); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("CharacterStyles")->getByName("Endnote Characters"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, "CharEscapementHeight") ); - CPPUNIT_ASSERT_EQUAL( Color(0xFF00FF), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0xFF00FF), getProperty<Color>(xPageStyle, "CharColor")); xPageStyle.set(getStyles("CharacterStyles")->getByName("Endnote anchor"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL( sal_Int32(58), getProperty< sal_Int32 >(xPageStyle, "CharEscapementHeight") ); - CPPUNIT_ASSERT_EQUAL( Color(0xFF00FF), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0xFF00FF), getProperty<Color>(xPageStyle, "CharColor")); } DECLARE_OOXMLEXPORT_TEST(testTdf55427_footnote2endnote, "tdf55427_footnote2endnote.odt") { CPPUNIT_ASSERT_EQUAL(4, getPages()); uno::Reference<beans::XPropertySet> xPageStyle(getStyles("ParagraphStyles")->getByName("Footnote"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote style is rose color", Color(0xFF007F), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Footnote style is rose color", Color(0xFF007F), getProperty<Color>(xPageStyle, "CharColor")); xPageStyle.set(getStyles("ParagraphStyles")->getByName("Endnote"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", Color(0x2BD0D2), Color(ColorTransparency, getProperty< sal_Int32 >(xPageStyle, "CharColor")) ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Endnote style is cyan3 color", Color(0x2BD0D2), getProperty<Color>(xPageStyle, "CharColor")); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); CPPUNIT_ASSERT(pTextDoc); @@ -1274,7 +1274,7 @@ DECLARE_OOXMLEXPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" ) CPPUNIT_ASSERT_EQUAL( sal_Int32( 0x316AC5 ), getProperty<sal_Int32>(xPropertySet, "BackgroundColor") ); // Check Text color (active border system color) - CPPUNIT_ASSERT_EQUAL(Color(0xD4D0C8), Color(ColorTransparency, getProperty<sal_Int32>(xPropertySet, "TextColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xD4D0C8), getProperty<Color>(xPropertySet, "TextColor")); // Check state of the checkbox CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPropertySet, "State")); |