summaryrefslogtreecommitdiff
path: root/tools/qa
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-04-24 12:36:48 +0900
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2015-05-07 08:54:08 +0900
commitc89e590fb0bbf387e3d43f1cc9c26c7a4c429f64 (patch)
tree2cd5d20a95c9afb158c53f3d9129840b26a0b291 /tools/qa
parent6e78bf76f3a10b43475e1bd801bdcbb9ce62f668 (diff)
extend color test - check read & write from stream
Change-Id: Iac3c8d30acff0984a98a4b705957c0361a5ead2f
Diffstat (limited to 'tools/qa')
-rw-r--r--tools/qa/cppunit/test_color.cxx22
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);
}