diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-08-01 22:06:31 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-08-21 08:57:15 +0200 |
commit | 73ec9c71689525ff14db219238083ff75028f8c8 (patch) | |
tree | 0afd210299bc810296ed9cb3d9a0297a54123b83 /sd | |
parent | e60ef8651cfb30335471d1622e58c13eebc7d58b (diff) |
Tests with color stops to assert Color and not BColor values
For testing color stops of a gradient we don't need to assert super
precise values (doubls to the n-th decimal point) as long the end
results in the same (8-bit) Color value. So change the tests to
convert the BColor that is in gradient color stops to Color and
assert the Color value.
Change-Id: Ibd7661e2f72955a0778e822df1fae568973be357
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155360
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/export-tests-ooxml1.cxx | 14 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 5 | ||||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml3.cxx | 10 | ||||
-rw-r--r-- | sd/qa/unit/misc-tests.cxx | 4 | ||||
-rw-r--r-- | sd/qa/unit/uiimpress.cxx | 4 |
5 files changed, 16 insertions, 21 deletions
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<int>(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) |