basegfx/test/BColorModifierTest.cxx      |   27 +++++++++++++++++++++++++++
 include/basegfx/color/bcolormodifier.hxx |    2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit 83ff25f09c4b897a19b9de14980c83c1236813c1
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Jun 22 13:01:27 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 22 19:49:43 2023 +0200

    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 <xiscofa...@libreoffice.org>

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();
 };
 
diff --git a/include/basegfx/color/bcolormodifier.hxx 
b/include/basegfx/color/bcolormodifier.hxx
index ceffae841847..586e203ae66b 100644
--- a/include/basegfx/color/bcolormodifier.hxx
+++ b/include/basegfx/color/bcolormodifier.hxx
@@ -294,7 +294,7 @@ namespace basegfx
         returns black when the luminance of the given color is less than
         the given threshold value in the range [0.0 .. 1.0], else white
     */
-    class SAL_WARN_UNUSED UNLESS_MERGELIBS(BASEGFX_DLLPUBLIC) 
BColorModifier_black_and_white final : public BColorModifier
+    class SAL_WARN_UNUSED BASEGFX_DLLPUBLIC BColorModifier_black_and_white 
final : public BColorModifier
     {
     private:
         double                      mfValue;

Reply via email to