diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-23 10:10:42 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-03-23 12:19:35 +0100 |
commit | 0e3d0ee939b646ef61f640c830ea5ad3196f763b (patch) | |
tree | dada61cc79663948f732ac268004ae63c7acae3b /sw | |
parent | c5c4dc5fc90e775537dd98439a581ba7764a4fd0 (diff) |
CppunitTest_sw_ww8export*: use getProperty<Color> when possible
Change-Id: I099467a1682af692ca41031a3f1ee947de942a87
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131963
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 10 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 20 |
3 files changed, 19 insertions, 21 deletions
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index 5e316eff4202..35bff9a42124 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -843,8 +843,7 @@ DECLARE_WW8EXPORT_TEST(testN325936, "n325936.doc") * xray ThisComponent.DrawPage(0).BackColorTransparency */ - sal_Int32 nValue = getProperty< sal_Int32 >(getShape(1), "BackColorTransparency"); - CPPUNIT_ASSERT_EQUAL(sal_Int32(100), nValue); + CPPUNIT_ASSERT_EQUAL(Color(0x000064), getProperty< Color >(getShape(1), "BackColorTransparency")); } DECLARE_WW8EXPORT_TEST(testTscp, "tscp.doc") @@ -893,7 +892,7 @@ DECLARE_WW8EXPORT_TEST(testFdo45724, "fdo45724.odt") // The text and background color of the control shape was not correct. uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY); uno::Reference<form::validation::XValidatableFormComponent> xComponent(xControlShape->getControl(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(COL_WHITE, Color(ColorTransparency, getProperty<sal_uInt32>(xComponent, "BackgroundColor"))); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xComponent, "BackgroundColor")); CPPUNIT_ASSERT_EQUAL(OUString("xxx"), xComponent->getCurrentValue().get<OUString>()); } @@ -1277,7 +1276,7 @@ DECLARE_WW8EXPORT_TEST(testCellBgColor, "cell-bg-color.odt") 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(0xCC0000), Color(ColorTransparency, getProperty<sal_Int32>(xTable->getCellByName("A1"), "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xCC0000), getProperty<Color>(xTable->getCellByName("A1"), "BackColor")); } DECLARE_WW8EXPORT_TEST(testBnc636128, "bnc636128.doc") @@ -1564,8 +1563,7 @@ DECLARE_WW8EXPORT_TEST(testTdf99474, "tdf99474.odt") uno::Reference<beans::XPropertySet> xStyle( getStyles("CharacterStyles")->getByName(charStyleName), uno::UNO_QUERY); - Color charColor(ColorTransparency, getProperty<util::Color>(xStyle, "CharColor")); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(COL_AUTO), sal_uInt32(charColor)); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xStyle, "CharColor")); } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 723fbf43a4c3..f46743d8b1e5 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -99,11 +99,11 @@ DECLARE_WW8EXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground 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")); xCell.set(xTable->getCellByName("A6")); - CPPUNIT_ASSERT_EQUAL(Color(0x81D41A), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0x81D41A), getProperty<Color>(xCell, "BackColor")); xCell.set(xTable->getCellByName("B6")); - CPPUNIT_ASSERT_EQUAL(Color(0xFFFBCC), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL(Color(0xFFFBCC), getProperty<Color>(xCell, "BackColor")); } DECLARE_WW8EXPORT_TEST(testTdf37153, "tdf37153_considerWrapOnObjPos.doc") @@ -131,9 +131,9 @@ DECLARE_WW8EXPORT_TEST(testTdf49102_mergedCellNumbering, "tdf49102_mergedCellNum DECLARE_WW8EXPORT_TEST(testTdf55427_footnote2endnote, "tdf55427_footnote2endnote.odt") { 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); diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 6da63bbeb336..bce5fdfbe2af 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -484,10 +484,10 @@ DECLARE_WW8EXPORT_TEST(testTdf132726, "tdf132726.odt") CPPUNIT_ASSERT_EQUAL(1, getShapes()); CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XTextRange> xRun = getRun(getParagraph(1), 1, "What sentence has a yellow background? "); - CPPUNIT_ASSERT_EQUAL( COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xRun, "CharBackColor")) ); + CPPUNIT_ASSERT_EQUAL( COL_AUTO, getProperty<Color>(xRun, "CharBackColor")); xRun = getRun(getParagraph(1), 2, "Why, this sentence of course"); - CPPUNIT_ASSERT_EQUAL( COL_YELLOW, Color(ColorTransparency, getProperty<sal_uInt32>(xRun, "CharBackColor")) ); + CPPUNIT_ASSERT_EQUAL( COL_YELLOW, getProperty<Color>(xRun, "CharBackColor")); } DECLARE_WW8EXPORT_TEST(testTdf127316_autoEscapement, "tdf127316_autoEscapement.odt") @@ -532,18 +532,18 @@ DECLARE_WW8EXPORT_TEST(testTdf133453_realFontSize, "tdf133453_realFontSize.doc") DECLARE_WW8EXPORT_TEST(testTdf116194, "tdf116194.doc") { - CPPUNIT_ASSERT_EQUAL( Color(192,0,0), Color(ColorTransparency, getProperty<sal_uInt32>(getRun(getParagraph(1), 1), "CharColor")) ); + CPPUNIT_ASSERT_EQUAL( Color(0xc00000), getProperty<Color>(getRun(getParagraph(1), 1), "CharColor")); } DECLARE_WW8EXPORT_TEST(testTdf121111_fillStyleNone, "tdf121111_fillStyleNone.docx") { uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Numbering - First level"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(Color(184,204,228), Color(ColorTransparency, getProperty<sal_uInt32>(xStyle, "ParaBackColor")));//R:184 G:204 B:228 + CPPUNIT_ASSERT_EQUAL(Color(0xb8cce4), getProperty<Color>(xStyle, "ParaBackColor"));//R:184 G:204 B:228 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xStyle, "FillStyle")); uno::Reference<text::XTextRange> xText(getParagraph(12)); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); } @@ -551,7 +551,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_fillStyleNoneB, "tdf128608_fillStyleNoneB.o { CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference<text::XTextRange> xText(getParagraph(1)); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xText, "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xText, "ParaBackColor")); CPPUNIT_ASSERT_EQUAL_MESSAGE("No fill", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xText, "FillStyle")); } @@ -586,7 +586,7 @@ DECLARE_WW8EXPORT_TEST(testTdf123433_fillStyleStop, "tdf123433_fillStyleStop.doc { uno::Reference<text::XTextRange> xText(getParagraph(12)); 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_WW8EXPORT_TEST(testTdf127862_pageFillStyle, "tdf127862_pageFillStyle.odt") @@ -607,7 +607,7 @@ DECLARE_WW8EXPORT_TEST(testTdf128608_tableParaBackColor, "tdf128608_tableParaBac uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY); // ParaBackColor doesn't seem to be used in this case, but keep it here to make sure it stays as AUTO. - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xPara, "ParaBackColor"))); + CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xPara, "ParaBackColor")); // No paragraph background colour/fill. (The cell background colour should be used.) CPPUNIT_ASSERT_EQUAL_MESSAGE("No fillstyle", drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xPara, "FillStyle")); } @@ -620,9 +620,9 @@ DECLARE_WW8EXPORT_TEST(testTdf117217_largeTableBackgrounds, "tdf117217_largeTabl uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Cell 22: light-red == 16711680 uno::Reference<text::XTextRange> xCell(xTable->getCellByName("V1"), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), getProperty<Color>(xCell, "BackColor")); xCell.set(xTable->getCellByName("Z1"), uno::UNO_QUERY_THROW); - CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), Color(ColorTransparency, getProperty<sal_Int32>(xCell, "BackColor"))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("light red", Color(0xE0C2CD), getProperty<Color>(xCell, "BackColor")); } DECLARE_WW8EXPORT_TEST(testTdf94009_zeroPgMargin, "tdf94009_zeroPgMargin.odt") |