sw/qa/extras/odfimport/odfimport.cxx | 16 ++++++++-------- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 +- sw/qa/extras/rtfexport/rtfexport.cxx | 3 +-- sw/qa/extras/rtfexport/rtfexport2.cxx | 2 +- sw/qa/extras/rtfexport/rtfexport3.cxx | 2 +- sw/qa/extras/rtfexport/rtfexport5.cxx | 2 +- sw/qa/extras/uiwriter/uiwriter2.cxx | 6 +++--- sw/qa/extras/uiwriter/uiwriter4.cxx | 4 ++-- 8 files changed, 18 insertions(+), 19 deletions(-)
New commits: commit 8351179b787a10167e9e68584d3b3573fbdb6ebc Author: Siddhant Chaudhary <urss...@gmail.com> AuthorDate: Sat Mar 12 00:37:20 2022 +0530 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Mar 21 10:27:46 2022 +0100 tdf#141908 Replaced usage of sal_Int32 and sal_uInt32 with Color in unit tests. Change-Id: Ieb8b6b3c3bfab0ab49bc55cf42db7be4f08e964b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131408 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index b8ebcb490d6c..253fd16cdc9c 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -600,10 +600,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75872_ooo33) load(mpTestDocumentPath, "fdo75872_ooo33.odt"); // graphics default style: line color and fill color changed uno::Reference<drawing::XShape> xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_BLACK), - getProperty<sal_Int32>(xShape, "LineColor")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(Color(153, 204, 255)), - getProperty<sal_Int32>(xShape, "FillColor")); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, + getProperty<Color>(xShape, "LineColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x99ccff), + getProperty<Color>(xShape, "FillColor")); } CPPUNIT_TEST_FIXTURE(Test, testFdo75872_aoo40) @@ -611,10 +611,10 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo75872_aoo40) load(mpTestDocumentPath, "fdo75872_aoo40.odt"); // graphics default style: line color and fill color changed uno::Reference<drawing::XShape> xShape = getShape(1); - CPPUNIT_ASSERT_EQUAL(sal_Int32(Color(128, 128, 128)), - getProperty<sal_Int32>(xShape, "LineColor")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(Color(0xCF, 0xE7, 0xF5)), - getProperty<sal_Int32>(xShape, "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x808080), + getProperty<Color>(xShape, "LineColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xcfe7f5), + getProperty<Color>(xShape, "FillColor")); } CPPUNIT_TEST_FIXTURE(Test, testFdo55814) diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index f66748c3ebff..29b44675b33c 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -711,7 +711,7 @@ CPPUNIT_TEST_FIXTURE(Test, testN820504) uno::Reference<container::XNameAccess> xStylesAccess(xFamiliesAccess->getByName("ParagraphStyles"), uno::UNO_QUERY); uno::Reference<beans::XPropertySet> xStyle(xStylesAccess->getByName("Default Paragraph Style"), uno::UNO_QUERY); // The problem was that the CharColor was set to AUTO (-1) even if we have some default char color set - CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getProperty<sal_Int32>(xStyle, "CharColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x3da7bb), getProperty<Color>(xStyle, "CharColor")); // Also, the groupshape was anchored at-page instead of at-character // (that's incorrect as Word only supports at-character and as-character). diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 2b824d83a71e..fba142c6d0cf 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -961,8 +961,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf88583) // This was FillStyle_NONE, as background color was missing from the color table during export. CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(getParagraph(1), "FillStyle")); - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), - getProperty<sal_Int32>(getParagraph(1), "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0x00cc00), getProperty<Color>(getParagraph(1), "FillColor")); } DECLARE_RTFEXPORT_TEST(testMargmirror, "margmirror.rtf") diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 74f13413c954..5204b503ae16 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -901,7 +901,7 @@ DECLARE_RTFEXPORT_TEST(testFdo60722, "fdo60722.rtf") // Color of the line was blue, and it had zero width. xShape.set(getShape(3), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<sal_uInt32>(xShape, "LineWidth")); - CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor")); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<Color>(xShape, "LineColor")); } DECLARE_RTFEXPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf") diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 7f6c3fc4d30e..df7ffcca69b4 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -267,7 +267,7 @@ DECLARE_RTFEXPORT_TEST(testTdf112520, "tdf112520.docx") CPPUNIT_ASSERT_EQUAL(Color(0xffff00), getProperty<Color>(getShape(2), "FillColor")); CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(2), "AnchorType")); - CPPUNIT_ASSERT_EQUAL(Color(0xffffff), getProperty<Color>(getShape(3), "FillColor")); + CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(getShape(3), "FillColor")); // Without the accompanying fix in place, this test would have failed with // 'expected: 4, actual: 2'. // This means the draw page was 0/at-char/white, 1/at-char/yellow, 2/at-page/white, diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx index 6ff7136a81ce..04c857ade582 100644 --- a/sw/qa/extras/rtfexport/rtfexport5.cxx +++ b/sw/qa/extras/rtfexport/rtfexport5.cxx @@ -1012,7 +1012,7 @@ DECLARE_RTFEXPORT_TEST(testTdf82073, "tdf82073.rtf") uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY); uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); // This was -1: the background color was automatic, not black. - CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xCell, "BackColor")); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<Color>(xCell, "BackColor")); } DECLARE_RTFEXPORT_TEST(testTdf74795, "tdf74795.rtf") diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 63a56621a47e..f1a841542380 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -73,7 +73,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) CPPUNIT_ASSERT_EQUAL(OUString("00Background"), getProperty<OUString>(getParagraph(2), "ParaStyleName")); - CPPUNIT_ASSERT_EQUAL(sal_Int32(14729933), getProperty<sal_Int32>(getParagraph(2), "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xe0c2cd), getProperty<Color>(getParagraph(2), "FillColor")); pWrtShell->EndPara(/*bSelect=*/true); pWrtShell->EndPara(/*bSelect=*/true); @@ -81,7 +81,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) dispatchCommand(mxComponent, ".uno:ResetAttributes", {}); // the background color should revert to the color for 00Background style - CPPUNIT_ASSERT_EQUAL(sal_Int32(14605542), getProperty<sal_Int32>(getParagraph(2), "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xdedce6), getProperty<Color>(getParagraph(2), "FillColor")); // the paragraph style should not be reset CPPUNIT_ASSERT_EQUAL(OUString("00Background"), getProperty<OUString>(getParagraph(2), "ParaStyleName")); @@ -91,7 +91,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf47471_paraStyleBackground) // Save it and load it back. reload("writer8", "tdf47471_paraStyleBackgroundRT.odt"); - CPPUNIT_ASSERT_EQUAL(sal_Int32(14605542), getProperty<sal_Int32>(getParagraph(2), "FillColor")); + CPPUNIT_ASSERT_EQUAL(Color(0xdedce6), getProperty<Color>(getParagraph(2), "FillColor")); // on round-trip, the paragraph style name was lost CPPUNIT_ASSERT_EQUAL(OUString("00Background"), getProperty<OUString>(getParagraph(2), "ParaStyleName")); diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx index c18216eed770..d710155dc763 100644 --- a/sw/qa/extras/uiwriter/uiwriter4.cxx +++ b/sw/qa/extras/uiwriter/uiwriter4.cxx @@ -1206,8 +1206,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf91292) uno::Reference<beans::XPropertySet> xPropertySet(getParagraph(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE("Solid background color", drawing::FillStyle_SOLID, getProperty<drawing::FillStyle>(xPropertySet, "FillStyle")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Background Color", static_cast<sal_Int32>(0x5C2D91), - getProperty<sal_Int32>(xPropertySet, "FillColor")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Background Color", Color(0x5C2D91), + getProperty<Color>(xPropertySet, "FillColor")); // remove background color xPropertySet->setPropertyValue("FillStyle", uno::makeAny(drawing::FillStyle_NONE));