diff options
Diffstat (limited to 'tools/qa/cppunit')
-rw-r--r-- | tools/qa/cppunit/test_color.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_color.cxx b/tools/qa/cppunit/test_color.cxx index 05616b8f64a2..f3ffd9c692cd 100644 --- a/tools/qa/cppunit/test_color.cxx +++ b/tools/qa/cppunit/test_color.cxx @@ -25,6 +25,7 @@ public: void testGetColorError(); void testInvert(); void testBColor(); + void testLuminance(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testVariables); @@ -33,6 +34,7 @@ public: CPPUNIT_TEST(testGetColorError); CPPUNIT_TEST(testInvert); CPPUNIT_TEST(testBColor); + CPPUNIT_TEST(testLuminance); CPPUNIT_TEST_SUITE_END(); }; @@ -218,6 +220,18 @@ void Test::testBColor() } +void Test::testLuminance() +{ + CPPUNIT_ASSERT_EQUAL(sal_uInt8(0), COL_BLACK.GetLuminance()); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(255), COL_WHITE.GetLuminance()); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(128), Color(128, 128, 128).GetLuminance()); + CPPUNIT_ASSERT(COL_WHITE.IsBright()); + CPPUNIT_ASSERT(COL_BLACK.IsDark()); + CPPUNIT_ASSERT(Color(249, 250, 251).IsBright()); + CPPUNIT_ASSERT(Color(9, 10, 11).IsDark()); + CPPUNIT_ASSERT(COL_WHITE.GetLuminance() > COL_BLACK.GetLuminance()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |