From c89e590fb0bbf387e3d43f1cc9c26c7a4c429f64 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 24 Apr 2015 12:36:48 +0900 Subject: extend color test - check read & write from stream Change-Id: Iac3c8d30acff0984a98a4b705957c0361a5ead2f --- tools/qa/cppunit/test_color.cxx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 +#include 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); } -- cgit