lwp build fixes
[LibreOffice.git] / tools / qa / cppunit / test_color.cxx
blob6846fada04a43a906ad95043283ddce5678ab2bc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/types.h>
11 #include "cppunit/TestAssert.h"
12 #include "cppunit/TestFixture.h"
13 #include "cppunit/extensions/HelperMacros.h"
14 #include "cppunit/plugin/TestPlugIn.h"
15 #include <tools/color.hxx>
17 namespace
20 class Test: public CppUnit::TestFixture
22 public:
23 void test_asRGBColor();
25 CPPUNIT_TEST_SUITE(Test);
26 CPPUNIT_TEST(test_asRGBColor);
27 CPPUNIT_TEST_SUITE_END();
30 void Test::test_asRGBColor()
32 Color aColor;
33 aColor = COL_BLACK;
34 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("000000"));
36 aColor = COL_WHITE;
37 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("ffffff"));
39 aColor = COL_RED;
40 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("800000"));
42 aColor = COL_TRANSPARENT;
43 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("ffffff"));
45 aColor = COL_BLUE;
46 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("000080"));
48 aColor.SetRed(0x12);
49 aColor.SetGreen(0x34);
50 aColor.SetBlue(0x56);
51 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("123456"));
53 aColor = COL_AUTO;
54 CPPUNIT_ASSERT_EQUAL(aColor.AsRGBHexString(), OUString("ffffff"));
57 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */