diff options
author | Laurent BP <laurent.balland-poirier@laposte.net> | 2017-10-22 19:38:19 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-11-01 15:32:07 +0100 |
commit | f04c354a8288e2f60685e55cf89e5e580beb1c1a (patch) | |
tree | ef492673f2552a9d098f3326fbd2ebea576f546d /svl | |
parent | a4bf4aa86d5560bd7bd740d4a9637e5c637c9116 (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')
-rw-r--r-- | svl/qa/unit/svl.cxx | 24 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 11 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 4 |
3 files changed, 39 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); } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 29d66a073d4f..1f2012f998ca 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -5531,9 +5531,20 @@ const NfKeywordTable & SvNumberformat::GetKeywords() const { return rScan.GetKeywords(); } + const ::std::vector<OUString> & SvNumberformat::GetEnglishKeywords() const { return ImpSvNumberformatScan::GetEnglishKeywords(); } +const ::std::vector<Color> & SvNumberformat::GetStandardColor() const +{ + return ImpSvNumberformatScan::GetStandardColor(); +} + +size_t SvNumberformat::GetMaxDefaultColors() const +{ + return ImpSvNumberformatScan::GetMaxDefaultColors(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index 37c59c5010be..fe08984e5c77 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -87,6 +87,10 @@ public: { return StandardColor; } + static size_t GetMaxDefaultColors() + { + return NF_MAX_DEFAULT_COLORS; + } const Date& GetNullDate() const { return maNullDate; } const OUString& GetStandardName() const |