diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-15 12:19:39 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-22 08:23:53 +0200 |
commit | a62513e1e80e39f9928e9e1815a84761403a4f2b (patch) | |
tree | 7d0cc6030242c41986838922fd5149f31d28cb40 /basegfx/test | |
parent | 25aa310b923ac26b62a97c0e95549e053d294da4 (diff) |
tdf#155735: Add support for hueRotate type
Change-Id: I9c7ada2908c0739708fbc9e28ac58430350da7a9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153112
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'basegfx/test')
-rwxr-xr-x | basegfx/test/BColorModifierTest.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/basegfx/test/BColorModifierTest.cxx b/basegfx/test/BColorModifierTest.cxx index 053540018206..d6e0648d2c17 100755 --- a/basegfx/test/BColorModifierTest.cxx +++ b/basegfx/test/BColorModifierTest.cxx @@ -237,6 +237,38 @@ public: CPPUNIT_ASSERT(aBColorModifier->operator==(*aBColorModifier2)); } + void testHueRotate() + { + const basegfx::BColorModifierSharedPtr aBColorModifier + = std::make_shared<basegfx::BColorModifier_hueRotate>(basegfx::deg2rad(180.0)); + + CPPUNIT_ASSERT_EQUAL(maWhite, aBColorModifier->getModifiedColor(maWhite)); + CPPUNIT_ASSERT_EQUAL(maGray, aBColorModifier->getModifiedColor(maGray)); + CPPUNIT_ASSERT_EQUAL(maBlack, aBColorModifier->getModifiedColor(maBlack)); + + BColor aExpectedRed(0.0, 0.426, 0.426); + CPPUNIT_ASSERT_EQUAL(aExpectedRed, aBColorModifier->getModifiedColor(maRed)); + BColor aExpectedGreen(1.0, 0.43, 1.0); + CPPUNIT_ASSERT_EQUAL(aExpectedGreen, aBColorModifier->getModifiedColor(maGreen)); + BColor aExpectedBlue(0.144, 0.144, 0); + CPPUNIT_ASSERT_EQUAL(aExpectedBlue, aBColorModifier->getModifiedColor(maBlue)); + BColor aExpectedYellow(0.856, 0.856, 1.0); + CPPUNIT_ASSERT_EQUAL(aExpectedYellow, aBColorModifier->getModifiedColor(maYellow)); + BColor aExpectedMagenta(0.0, 0.57, 0.0); + CPPUNIT_ASSERT_EQUAL(aExpectedMagenta, aBColorModifier->getModifiedColor(maMagenta)); + BColor aExpectedCyan(1.0, 0.574, 0.574); + CPPUNIT_ASSERT_EQUAL(aExpectedCyan, aBColorModifier->getModifiedColor(maCyan)); + + CPPUNIT_ASSERT(aBColorModifier->operator==(*aBColorModifier)); + const basegfx::BColorModifierSharedPtr aBColorModifierInvert + = std::make_shared<basegfx::BColorModifier_invert>(); + CPPUNIT_ASSERT(*aBColorModifier != *aBColorModifierInvert); + + const basegfx::BColorModifierSharedPtr aBColorModifier2 + = std::make_shared<basegfx::BColorModifier_hueRotate>(basegfx::deg2rad(180.0)); + CPPUNIT_ASSERT(aBColorModifier->operator==(*aBColorModifier2)); + } + CPPUNIT_TEST_SUITE(bcolormodifier); CPPUNIT_TEST(testGray); CPPUNIT_TEST(testInvert); @@ -244,6 +276,7 @@ public: CPPUNIT_TEST(testStack); CPPUNIT_TEST(testSaturate); CPPUNIT_TEST(testLuminanceToAlpha); + CPPUNIT_TEST(testHueRotate); CPPUNIT_TEST_SUITE_END(); }; |