diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 890841a79849..0b8acca9a3ab 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -632,11 +632,11 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testBnc889755) CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.25, 0.25, 0.25)); + CPPUNIT_ASSERT_EQUAL(Color(0x404040), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.070000000000000007)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.25, 0.25, 0.25)); + CPPUNIT_ASSERT_EQUAL(Color(0x404040), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 0.080000000000000002)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), basegfx::BColor(1.0, 1.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xffffff), Color(aColorStops[2].getStopColor())); } CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testBnc882383) @@ -676,9 +676,9 @@ CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testTransparencyGradientValue) // MCGR: Use the whole completely imported transparency gradient to check for correctness CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.3, 0.3, 0.3)); + CPPUNIT_ASSERT_EQUAL(Color(0x4d4d4d), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.2, 0.2, 0.2)); + CPPUNIT_ASSERT_EQUAL(Color(0x333333), Color(aColorStops[1].getStopColor())); } CPPUNIT_TEST_FIXTURE(Chart2ImportTest, testSimpleStrictXLSX) diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx index 3f2876c97e41..0eeec8ab7488 100644 --- a/oox/qa/unit/drawingml.cxx +++ b/oox/qa/unit/drawingml.cxx @@ -194,8 +194,16 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testGradientMultiStepTransparency) const basegfx::BColorStops aColorStops(aTransparence.ColorStops); CPPUNIT_ASSERT_EQUAL(size_t(5), aColorStops.size()); - CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[4].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[4].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.00, aColorStops[0].getStopOffset(), 1E-3); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.19, aColorStops[1].getStopOffset(), 1E-3); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.35, aColorStops[2].getStopOffset(), 1E-3); + CPPUNIT_ASSERT_DOUBLES_EQUAL(0.58, aColorStops[3].getStopOffset(), 1E-3); + CPPUNIT_ASSERT_DOUBLES_EQUAL(1.00, aColorStops[4].getStopOffset(), 1E-3); + CPPUNIT_ASSERT_EQUAL(Color(0xffffff), Color(aColorStops[0].getStopColor())); + CPPUNIT_ASSERT_EQUAL(Color(0x9e9e9e), Color(aColorStops[1].getStopColor())); + CPPUNIT_ASSERT_EQUAL(Color(0x363636), Color(aColorStops[2].getStopColor())); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[3].getStopColor())); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[4].getStopColor())); } CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAlignment) diff --git a/oox/qa/unit/shape.cxx b/oox/qa/unit/shape.cxx index 605834d6c0fc..522673803ae0 100644 --- a/oox/qa/unit/shape.cxx +++ b/oox/qa/unit/shape.cxx @@ -475,11 +475,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.0, 0.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x0000ff), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[1].getStopColor(), - basegfx::BColor(0.96862745098039216, 0.58823529411764708, 0.27450980392156865)); + CPPUNIT_ASSERT_EQUAL(Color(0xf79646), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(sal_Int16(690), aGradient.Angle); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), aGradient.XOffset); @@ -500,11 +498,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.40000000000000002)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[0].getStopColor(), - basegfx::BColor(0.96862745098039216, 0.58823529411764708, 0.27450980392156865)); + CPPUNIT_ASSERT_EQUAL(Color(0xf79646), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x0000ff), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aGradient.Angle); CPPUNIT_ASSERT_EQUAL(sal_Int16(50), aGradient.XOffset); @@ -525,11 +521,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testWriterFontwork3) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[0].getStopColor(), - basegfx::BColor(0.96862745098039216, 0.58823529411764708, 0.27450980392156865)); + CPPUNIT_ASSERT_EQUAL(Color(0xf79646), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x0000ff), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aGradient.Angle); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aGradient.XOffset); @@ -642,11 +636,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), - basegfx::BColor(1.0, 0.75294117647058822, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xffc000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), - basegfx::BColor(0.75294117647058822, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xc00000), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); CPPUNIT_ASSERT_EQUAL(sal_Int16(690), aGradient.Angle); @@ -675,11 +667,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), - basegfx::BColor(0.0, 0.51372549019607838, 0.8784313725490196)); + CPPUNIT_ASSERT_EQUAL(Color(0x0083e0), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), - basegfx::BColor(0.90196078431372551, 0.90196078431372551, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xe6e600), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL, aGradient.Style); CPPUNIT_ASSERT_EQUAL(sal_Int16(50), aGradient.XOffset); @@ -692,13 +682,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) // Transparency is encoded in gray color. CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[0].getStopColor(), - basegfx::BColor(0.40000000000000002, 0.40000000000000002, 0.40000000000000002)); + CPPUNIT_ASSERT_EQUAL(Color(0x666666), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[1].getStopColor(), - basegfx::BColor(0.29999999999999999, 0.29999999999999999, 0.29999999999999999)); + CPPUNIT_ASSERT_EQUAL(Color(0x4d4d4d), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL, aGradient.Style); CPPUNIT_ASSERT_EQUAL(sal_Int16(50), aGradient.XOffset); @@ -732,13 +718,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[0].getStopColor(), - basegfx::BColor(0.26666666666666666, 0.44705882352941179, 0.7686274509803922)); + CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[1].getStopColor(), - basegfx::BColor(0.26666666666666666, 0.44705882352941179, 0.7686274509803922)); + CPPUNIT_ASSERT_EQUAL(Color(0x4472c4), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RECT, aGradient.Style); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aGradient.XOffset); @@ -751,9 +733,9 @@ CPPUNIT_TEST_FIXTURE(OoxShapeTest, testImportWordArtGradient) // Transparency is encoded in gray color. CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(1.0, 1.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xFFFFFF), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RECT, aGradient.Style); CPPUNIT_ASSERT_EQUAL(sal_Int16(100), aGradient.XOffset); diff --git a/sc/qa/unit/subsequent_filters_test3.cxx b/sc/qa/unit/subsequent_filters_test3.cxx index 54d5061d2cd9..d277e0858905 100644 --- a/sc/qa/unit/subsequent_filters_test3.cxx +++ b/sc/qa/unit/subsequent_filters_test3.cxx @@ -1653,12 +1653,9 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf129789) CPPUNIT_ASSERT_EQUAL(size_t(2), rColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL( - rColorStops[0].getStopColor(), - basegfx::BColor(0.8666666666666667, 0.90980392156862744, 0.79607843137254897)); + CPPUNIT_ASSERT_EQUAL(Color(0xdde8cb), Color(rColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(rColorStops[1].getStopColor(), - basegfx::BColor(1.0, 0.84313725490196079, 0.84313725490196079)); + CPPUNIT_ASSERT_EQUAL(Color(0xffd7d7), Color(rColorStops[1].getStopColor())); SdrCaptionObj* const pCaptionH9 = checkCaption(*pDoc, ScAddress(7, 8, 0), false); @@ -1670,12 +1667,9 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf129789) CPPUNIT_ASSERT_EQUAL(size_t(2), rColorStops2.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops2[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL( - rColorStops2[0].getStopColor(), - basegfx::BColor(0.8666666666666667, 0.90980392156862744, 0.79607843137254897)); + CPPUNIT_ASSERT_EQUAL(Color(0xdde8cb), Color(rColorStops2[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops2[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(rColorStops2[1].getStopColor(), - basegfx::BColor(1.0, 0.84313725490196079, 0.84313725490196079)); + CPPUNIT_ASSERT_EQUAL(Color(0xffd7d7), Color(rColorStops2[1].getStopColor())); } { diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 1e7c05390d39..e939f1be031d 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -1233,13 +1233,11 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf94238) // was incorrect. CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.39000000000000001)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[2].getStopColor(), - basegfx::BColor(0.54509803921568623, 0.54509803921568623, 0.54509803921568623)); + CPPUNIT_ASSERT_EQUAL(Color(0x8b8b8b), Color(aColorStops[2].getStopColor())); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testPictureTransparency) @@ -1491,11 +1489,11 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf128345GradientAxial) CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(1.0, 1.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xffffff), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), basegfx::BColor(1.0, 1.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xffffff), Color(aColorStops[2].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aTransparenceGradient.Style); } diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index db9e19e98662..1dc0e711cde1 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -1015,10 +1015,9 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf105739) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), - basegfx::BColor(0.0, 0.69019607843137254, 0.31372549019607843)); + CPPUNIT_ASSERT_EQUAL(Color(0x00b050), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(int(awt::GradientStyle_LINEAR), static_cast(aFillGradient.Style)); } } diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 32a64cc5fba4..b7a23c777ce8 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -1253,9 +1253,9 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf127372) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[1].getStopColor())); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf127379) @@ -1285,11 +1285,9 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf127379) CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL( - aColorStops[1].getStopColor(), - basegfx::BColor(0.16470588235294117, 0.37647058823529411, 0.59999999999999998)); + CPPUNIT_ASSERT_EQUAL(Color(0x2a6099), Color(aColorStops[1].getStopColor())); } CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf98603) diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx index 2d914c2947b8..7f2d4ee7edfa 100644 --- a/sd/qa/unit/misc-tests.cxx +++ b/sd/qa/unit/misc-tests.cxx @@ -290,9 +290,9 @@ void SdMiscTest::testFillGradient() CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 1.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x00ff00), Color(aColorStops[1].getStopColor())); } void SdMiscTest::testTdf44774() diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 5ebbf0805f72..c99d4bd5df49 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -819,9 +819,9 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testPageFillGradient) CPPUNIT_ASSERT_EQUAL(size_t(2), rColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(rColorStops[0].getStopColor(), basegfx::BColor(1.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), Color(rColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(rColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(rColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 1.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x0000ff), Color(rColorStops[1].getStopColor())); } CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf134053) diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 4acb18d36025..cec7e24fc795 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -794,9 +794,9 @@ DECLARE_ODFEXPORT_TEST(testTextframeGradient, "textframe-gradient.odt") CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.75294117647058822, 0.31372549019607843, 0.30196078431372547)); + CPPUNIT_ASSERT_EQUAL(Color(0xc0504d), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.85098039215686272, 0.58431372549019611, 0.58039215686274515)); + CPPUNIT_ASSERT_EQUAL(Color(0xd99594), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style); xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY); @@ -808,9 +808,9 @@ DECLARE_ODFEXPORT_TEST(testTextframeGradient, "textframe-gradient.odt") CPPUNIT_ASSERT_EQUAL(size_t(2), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.40000000000000002, 0.40000000000000002, 0.40000000000000002)); + CPPUNIT_ASSERT_EQUAL(Color(0x666666), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_AXIAL, aGradient.Style); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 05559dc49e18..a4f0ba6d31ad 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -575,11 +575,11 @@ DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx") CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.85098039215686272, 0.58431372549019611, 0.58039215686274515)); + CPPUNIT_ASSERT_EQUAL(Color(0xd99594), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.75294117647058822, 0.31372549019607843, 0.30196078431372547)); + CPPUNIT_ASSERT_EQUAL(Color(0xc0504d), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), basegfx::BColor(0.85098039215686272, 0.58431372549019611, 0.58039215686274515)); + CPPUNIT_ASSERT_EQUAL(Color(0xd99594), Color(aColorStops[2].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); xFrame.set(getShape(2), uno::UNO_QUERY); @@ -591,11 +591,11 @@ DECLARE_OOXMLEXPORT_TEST(testTextframeGradient, "textframe-gradient.docx") CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), basegfx::BColor(0.40000000000000002, 0.40000000000000002, 0.40000000000000002)); + CPPUNIT_ASSERT_EQUAL(Color(0x666666), Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), basegfx::BColor(0.0, 0.0, 0.0)); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), basegfx::BColor(0.40000000000000002, 0.40000000000000002, 0.40000000000000002)); + CPPUNIT_ASSERT_EQUAL(Color(0x666666), Color(aColorStops[2].getStopColor())); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); // Left / right margin was incorrect: the attribute was missing and we diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 341e688bad8e..eda655283c7d 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -616,10 +616,10 @@ DECLARE_RTFEXPORT_TEST(testTextframeGradient, "textframe-gradient.rtf") awt::Gradient2 aGradient = getProperty(xFrame, "FillGradient"); // prepare compare colors - const basegfx::BColor aColA(0.85098039215686272, 0.58431372549019611, 0.58039215686274515); - const basegfx::BColor aColB(0.75294117647058822, 0.31372549019607843, 0.30196078431372547); - const basegfx::BColor aColC(0.40000000000000002, 0.40000000000000002, 0.40000000000000002); - const basegfx::BColor aColD(0.0, 0.0, 0.0); + const Color aColA(0xd99594); + const Color aColB(0xc0504d); + const Color aColC(0x666666); + const Color aColD(0x000000); // MCGR: Use the completely imported transparency gradient to check for correctness basegfx::BColorStops aColorStops(aGradient.ColorStops); @@ -627,11 +627,11 @@ DECLARE_RTFEXPORT_TEST(testTextframeGradient, "textframe-gradient.rtf") CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), aColA); + CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), aColB); + CPPUNIT_ASSERT_EQUAL(aColB, Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), aColA); + CPPUNIT_ASSERT_EQUAL(aColA, Color(aColorStops[2].getStopColor())); xFrame.set(xIndexAccess->getByIndex(1), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_GRADIENT, @@ -644,11 +644,11 @@ DECLARE_RTFEXPORT_TEST(testTextframeGradient, "textframe-gradient.rtf") CPPUNIT_ASSERT_EQUAL(size_t(3), aColorStops.size()); CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_LINEAR, aGradient.Style); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[0].getStopOffset(), 0.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[0].getStopColor(), aColC); + CPPUNIT_ASSERT_EQUAL(aColC, Color(aColorStops[0].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[1].getStopOffset(), 0.5)); - CPPUNIT_ASSERT_EQUAL(aColorStops[1].getStopColor(), aColD); + CPPUNIT_ASSERT_EQUAL(aColD, Color(aColorStops[1].getStopColor())); CPPUNIT_ASSERT(basegfx::fTools::equal(aColorStops[2].getStopOffset(), 1.0)); - CPPUNIT_ASSERT_EQUAL(aColorStops[2].getStopColor(), aColC); + CPPUNIT_ASSERT_EQUAL(aColC, Color(aColorStops[2].getStopColor())); } DECLARE_RTFEXPORT_TEST(testRecordChanges, "record-changes.rtf") diff --git a/xmloff/CppunitTest_xmloff_style.mk b/xmloff/CppunitTest_xmloff_style.mk index 22d37dffaa83..d2edb42986b9 100644 --- a/xmloff/CppunitTest_xmloff_style.mk +++ b/xmloff/CppunitTest_xmloff_style.mk @@ -21,9 +21,11 @@ $(eval $(call gb_CppunitTest_add_exception_objects,xmloff_style, \ )) $(eval $(call gb_CppunitTest_use_libraries,xmloff_style, \ + basegfx \ comphelper \ cppu \ cppuhelper \ + docmodel \ subsequenttest \ embobj \ sal \ diff --git a/xmloff/qa/unit/style.cxx b/xmloff/qa/unit/style.cxx index bde981d38864..132caa08c346 100644 --- a/xmloff/qa/unit/style.cxx +++ b/xmloff/qa/unit/style.cxx @@ -17,9 +17,9 @@ #include #include #include -#include #include +#include #include #include #include @@ -80,6 +80,12 @@ struct XmlFont return aFontFamilyGeneric.compareTo(rOther.aFontFamilyGeneric) < 0; } }; + +Color asColor(com::sun::star::rendering::RGBColor const& rRGBColor) +{ + basegfx::BColor aBColor(rRGBColor.Red, rRGBColor.Green, rRGBColor.Blue); + return Color(aBColor); +} } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testFontSorting) @@ -369,16 +375,16 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew) // Test new properties auto aColorStopSeq = aGradient.ColorStops; - awt::ColorStop aColorStop = aColorStopSeq[0]; - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Blue); - aColorStop = aColorStopSeq[1]; - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Blue); + { + awt::ColorStop aColorStop = aColorStopSeq[0]; + CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), asColor(aColorStop.StopColor)); + } + { + awt::ColorStop aColorStop = aColorStopSeq[1]; + CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0xffff00), asColor(aColorStop.StopColor)); + } } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew_opacity) @@ -429,18 +435,16 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_OldToNew_opacity) // Test new properties auto aColorStopSeq = aGradient.ColorStops; - awt::ColorStop aColorStop = aColorStopSeq[0]; - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); - // Rounding error because of converting through color: 90% => 0.9 * 255 => 229 - // 299.0 / 255.0 = 0.898039215686275 - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.9, aColorStop.StopColor.Red, 0.002); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.9, aColorStop.StopColor.Green, 0.002); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.9, aColorStop.StopColor.Blue, 0.002); - aColorStop = aColorStopSeq[1]; - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Blue); + { + awt::ColorStop aColorStop = aColorStopSeq[0]; + CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0xe5e5e5), asColor(aColorStop.StopColor)); + } + { + awt::ColorStop aColorStop = aColorStopSeq[1]; + CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0x000000), asColor(aColorStop.StopColor)); + } } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_threeStops) @@ -497,22 +501,21 @@ CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testMCGR_threeStops) // Test new properties auto aColorStopSeq = aGradient.ColorStops; - awt::ColorStop aColorStop = aColorStopSeq[0]; - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Blue); - aColorStop = aColorStopSeq[1]; - CPPUNIT_ASSERT_EQUAL(0.3, aColorStop.StopOffset); - // 0x99 = 153 => 153/255 = 0.6, 0xbb = 187 => 187/255 = 0.733... - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(0.6, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_DOUBLES_EQUAL(0.733333333333333, aColorStop.StopColor.Blue, 0.0000001); - aColorStop = aColorStopSeq[2]; - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Red); - CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopColor.Green); - CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopColor.Blue); + { + awt::ColorStop aColorStop = aColorStopSeq[0]; + CPPUNIT_ASSERT_EQUAL(0.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0xff0000), asColor(aColorStop.StopColor)); + } + { + awt::ColorStop aColorStop = aColorStopSeq[1]; + CPPUNIT_ASSERT_EQUAL(0.3, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0x0099bb), asColor(aColorStop.StopColor)); + } + { + awt::ColorStop aColorStop = aColorStopSeq[2]; + CPPUNIT_ASSERT_EQUAL(1.0, aColorStop.StopOffset); + CPPUNIT_ASSERT_EQUAL(Color(0xffff00), asColor(aColorStop.StopColor)); + } } CPPUNIT_TEST_FIXTURE(XmloffStyleTest, testBorderRestoration)