diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-15 14:49:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-16 10:07:07 +0100 |
commit | 63a68064bb33f180b8a231f7524d99405d910226 (patch) | |
tree | 7ecf05b057c5ca4d80a48af045998a4b34484561 /sw/qa/extras/rtfexport | |
parent | d534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff) |
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place,
and add a clang plugin to detect when the value passed to the
existing constructor may contain transparency/alpha data.
i.e. we leave expressions like Color(0xffffff) alone, but
warn about any non-constant expression, and any expression
like Color(0xff000000)
Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/extras/rtfexport')
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport.cxx | 4 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport2.cxx | 6 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 9cd64eebf6f6..737821f73286 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -690,7 +690,7 @@ DECLARE_RTFEXPORT_TEST(testParaShadow, "para-shadow.rtf") // The problem was that \brdrsh was ignored. table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(getParagraph(2), "ParaShadowFormat"); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); CPPUNIT_ASSERT_EQUAL(sal_Int16(convertTwipToMm100(60)), aShadow.ShadowWidth); } @@ -733,7 +733,7 @@ DECLARE_RTFEXPORT_TEST(testCharacterBorder, "charborder.odt") { const table::ShadowFormat aShadow = getProperty<table::ShadowFormat>(xRun, "CharShadowFormat"); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(aShadow.Color)); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(ColorTransparency, aShadow.Color)); CPPUNIT_ASSERT_EQUAL(table::ShadowLocation_BOTTOM_RIGHT, aShadow.Location); CPPUNIT_ASSERT_EQUAL(sal_Int16(318), aShadow.ShadowWidth); } diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 62154c0eaaca..d34e8cb5a969 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -922,7 +922,8 @@ DECLARE_RTFEXPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf") xShape.set(getShape(2), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder")); - CPPUNIT_ASSERT_EQUAL(COL_BLACK, Color(getProperty<sal_uInt32>(xShape, "FillColor"))); + CPPUNIT_ASSERT_EQUAL(COL_BLACK, + Color(ColorTransparency, getProperty<sal_uInt32>(xShape, "FillColor"))); xShape.set(getShape(3), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xShape, "ZOrder")); @@ -935,7 +936,8 @@ DECLARE_RTFEXPORT_TEST(testFdo61909, "fdo61909.rtf") // Was the Writer default font. CPPUNIT_ASSERT_EQUAL(OUString("Courier New"), getProperty<OUString>(xTextRange, "CharFontName")); - CPPUNIT_ASSERT_EQUAL(COL_AUTO, Color(getProperty<sal_uInt32>(xTextRange, "CharBackColor"))); + CPPUNIT_ASSERT_EQUAL( + COL_AUTO, Color(ColorTransparency, getProperty<sal_uInt32>(xTextRange, "CharBackColor"))); } DECLARE_RTFEXPORT_TEST(testFdo62288, "fdo62288.rtf") diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index 55eb4a2b8c48..cf9a25e40d7c 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -275,7 +275,7 @@ DECLARE_RTFEXPORT_TEST(testTdf129631_lostBorders, "tdf129631_lostBorders.rtf") CPPUNIT_ASSERT(sal_uInt32(0) != aBorderLine.LineWidth); CPPUNIT_ASSERT_EQUAL_MESSAGE( "The border style has normal black borders", COL_BLACK, - Color(getProperty<table::BorderLine>(xStyleProps, "RightBorder").Color)); + Color(ColorTransparency, getProperty<table::BorderLine>(xStyleProps, "RightBorder").Color)); aBorderLine = getProperty<table::BorderLine2>(getParagraph(2), "RightBorder"); CPPUNIT_ASSERT(sal_uInt32(0) != aBorderLine.LineWidth); |