summaryrefslogtreecommitdiff
path: root/svl/qa/unit
diff options
context:
space:
mode:
authorLaurent BP <laurent.balland-poirier@laposte.net>2017-10-22 19:38:19 +0200
committerEike Rathke <erack@redhat.com>2017-11-01 15:32:07 +0100
commitf04c354a8288e2f60685e55cf89e5e580beb1c1a (patch)
treeef492673f2552a9d098f3326fbd2ebea576f546d /svl/qa/unit
parenta4bf4aa86d5560bd7bd740d4a9637e5c637c9116 (diff)
QA test of StandardColor
Change-Id: Ib5b414d533ea3dcce55f4e6a02f329e98acf6e83 Reviewed-on: https://gerrit.libreoffice.org/43791 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl/qa/unit')
-rw-r--r--svl/qa/unit/svl.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index db3c1c35d699..558047bec5a2 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -37,6 +37,7 @@
#include <svl/zformat.hxx>
#include <svl/sharedstringpool.hxx>
#include <svl/sharedstring.hxx>
+#include <tools/color.hxx>
#include <unotools/syslocale.hxx>
#include <memory>
@@ -65,6 +66,7 @@ public:
void testIsNumberFormat();
void testUserDefinedNumberFormats();
void testNfEnglishKeywordsIntegrity();
+ void testStandardColorIntegrity();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testNumberFormat);
@@ -78,6 +80,7 @@ public:
CPPUNIT_TEST(testIsNumberFormat);
CPPUNIT_TEST(testUserDefinedNumberFormats);
CPPUNIT_TEST(testNfEnglishKeywordsIntegrity);
+ CPPUNIT_TEST(testStandardColorIntegrity);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1451,6 +1454,27 @@ void Test::testNfEnglishKeywordsIntegrity()
CPPUNIT_ASSERT_EQUAL( sEnglishKeywords[NF_KEY_THAI_T], OUString("t") );
}
+void Test::testStandardColorIntegrity()
+{
+ SvNumberFormatter aFormatter(m_xContext, LANGUAGE_ENGLISH_US);
+ const SvNumberformat* pNumberFormat = aFormatter.GetEntry(0);
+ const ::std::vector<Color> & aStandardColors = pNumberFormat->GetStandardColor();
+ const size_t nMaxDefaultColors = pNumberFormat->GetMaxDefaultColors();
+ CPPUNIT_ASSERT_EQUAL( nMaxDefaultColors, size_t(NF_KEY_LASTCOLOR) - size_t(NF_KEY_FIRSTCOLOR) + 1 );
+ CPPUNIT_ASSERT_EQUAL( nMaxDefaultColors, aStandardColors.size() );
+ // Colors must follow same order as in sEnglishKeyword
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[0].GetColor(), COL_BLACK );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[1].GetColor(), COL_LIGHTBLUE );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[2].GetColor(), COL_LIGHTGREEN );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[3].GetColor(), COL_LIGHTCYAN );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[4].GetColor(), COL_LIGHTRED );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[5].GetColor(), COL_LIGHTMAGENTA );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[6].GetColor(), COL_BROWN );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[7].GetColor(), COL_GRAY );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[8].GetColor(), COL_YELLOW );
+ CPPUNIT_ASSERT_EQUAL( aStandardColors[9].GetColor(), COL_WHITE );
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}