diff options
Diffstat (limited to 'tools/qa')
-rw-r--r-- | tools/qa/cppunit/test_color.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_color.cxx b/tools/qa/cppunit/test_color.cxx index 6846fada04a4..99f311fc5a4c 100644 --- a/tools/qa/cppunit/test_color.cxx +++ b/tools/qa/cppunit/test_color.cxx @@ -13,6 +13,7 @@ #include "cppunit/extensions/HelperMacros.h" #include "cppunit/plugin/TestPlugIn.h" #include <tools/color.hxx> +#include <tools/stream.hxx> namespace { @@ -21,9 +22,11 @@ class Test: public CppUnit::TestFixture { public: void test_asRGBColor(); + void test_readAndWriteStream(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(test_asRGBColor); + CPPUNIT_TEST(test_readAndWriteStream); CPPUNIT_TEST_SUITE_END(); }; @@ -54,6 +57,25 @@ void Test::test_asRGBColor() CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("ffffff")); } +void Test::test_readAndWriteStream() +{ + { + SvMemoryStream aStream; + Color aWriteColor(0x12, 0x34, 0x56); + Color aReadColor; + + WriteColor(aStream, aWriteColor); + + aStream.Seek(STREAM_SEEK_TO_BEGIN); + + ReadColor(aStream, aReadColor); + + CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x12), aReadColor.GetRed()); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x34), aReadColor.GetGreen()); + CPPUNIT_ASSERT_EQUAL(sal_uInt8(0x56), aReadColor.GetBlue()); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } |