Kaydet (Commit) c89e590f authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

extend color test - check read & write from stream

Change-Id: Iac3c8d30acff0984a98a4b705957c0361a5ead2f
üst 6e78bf76
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "cppunit/extensions/HelperMacros.h" #include "cppunit/extensions/HelperMacros.h"
#include "cppunit/plugin/TestPlugIn.h" #include "cppunit/plugin/TestPlugIn.h"
#include <tools/color.hxx> #include <tools/color.hxx>
#include <tools/stream.hxx>
namespace namespace
{ {
...@@ -21,9 +22,11 @@ class Test: public CppUnit::TestFixture ...@@ -21,9 +22,11 @@ class Test: public CppUnit::TestFixture
{ {
public: public:
void test_asRGBColor(); void test_asRGBColor();
void test_readAndWriteStream();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_asRGBColor); CPPUNIT_TEST(test_asRGBColor);
CPPUNIT_TEST(test_readAndWriteStream);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -54,6 +57,25 @@ void Test::test_asRGBColor() ...@@ -54,6 +57,25 @@ void Test::test_asRGBColor()
CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("ffffff")); 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); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment