diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-22 13:01:27 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-06-22 19:49:43 +0200 |
commit | 83ff25f09c4b897a19b9de14980c83c1236813c1 (patch) | |
tree | 6398b3850bc35cc4dc9858a942408866592e0868 /basegfx/test | |
parent | 94297e037dd963b7e74dfff369145d0e0db30c97 (diff) |
basegfx: Add test for BColorModifier_black_and_white
Change-Id: I35193c68034e5500f12a2e474886c6aa9c2307ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153457
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'basegfx/test')
-rwxr-xr-x | basegfx/test/BColorModifierTest.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/basegfx/test/BColorModifierTest.cxx b/basegfx/test/BColorModifierTest.cxx index 17b6a0c22257..6be160ce43ae 100755 --- a/basegfx/test/BColorModifierTest.cxx +++ b/basegfx/test/BColorModifierTest.cxx @@ -352,6 +352,32 @@ public: CPPUNIT_ASSERT(aBColorModifier->operator==(*aBColorModifier2)); } + void testBlackAndWhite() + { + const basegfx::BColorModifierSharedPtr aBColorModifier + = std::make_shared<basegfx::BColorModifier_black_and_white>(0.5); + + CPPUNIT_ASSERT_EQUAL(maWhite, aBColorModifier->getModifiedColor(maWhite)); + CPPUNIT_ASSERT_EQUAL(maWhite, aBColorModifier->getModifiedColor(maGray)); + CPPUNIT_ASSERT_EQUAL(maBlack, aBColorModifier->getModifiedColor(maBlack)); + + CPPUNIT_ASSERT_EQUAL(maBlack, aBColorModifier->getModifiedColor(maRed)); + CPPUNIT_ASSERT_EQUAL(maWhite, aBColorModifier->getModifiedColor(maGreen)); + CPPUNIT_ASSERT_EQUAL(maBlack, aBColorModifier->getModifiedColor(maBlue)); + CPPUNIT_ASSERT_EQUAL(maWhite, aBColorModifier->getModifiedColor(maYellow)); + CPPUNIT_ASSERT_EQUAL(maBlack, aBColorModifier->getModifiedColor(maMagenta)); + CPPUNIT_ASSERT_EQUAL(maWhite, 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_black_and_white>(0.5); + CPPUNIT_ASSERT(aBColorModifier->operator==(*aBColorModifier2)); + } + CPPUNIT_TEST_SUITE(bcolormodifier); CPPUNIT_TEST(testGray); CPPUNIT_TEST(testInvert); @@ -362,6 +388,7 @@ public: CPPUNIT_TEST(testHueRotate); CPPUNIT_TEST(testMatrix); CPPUNIT_TEST(testIdentityMatrix); + CPPUNIT_TEST(testBlackAndWhite); CPPUNIT_TEST_SUITE_END(); }; |