[Libreoffice-commits] core.git: 2 commits - sc/inc sc/qa sc/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Wed Apr 15 19:07:08 PDT 2015
sc/inc/colorscale.hxx | 1
sc/qa/unit/data/xlsx/condformat_theme_color.xlsx |binary
sc/qa/unit/helper/qahelper.cxx | 2 -
sc/qa/unit/helper/qahelper.hxx | 10 +++---
sc/qa/unit/subsequent_filters-test.cxx | 35 +++++++++++++++++++++++
sc/source/core/data/colorscale.cxx | 8 +++++
6 files changed, 50 insertions(+), 6 deletions(-)
New commits:
commit 2a88873e96d5aa916146a74c20b34b2715418350
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Apr 16 03:57:32 2015 +0200
add test for tdf#90511
Change-Id: Id4f338d8f19b796be10f035df0bdf28076f6511e
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 110a27a..593a662 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -282,6 +282,7 @@ public:
const_iterator end() const;
ScColorScaleEntry* GetEntry(size_t nPos);
+ const ScColorScaleEntry* GetEntry(size_t nPos) const;
size_t size() const;
diff --git a/sc/qa/unit/data/xlsx/condformat_theme_color.xlsx b/sc/qa/unit/data/xlsx/condformat_theme_color.xlsx
new file mode 100644
index 0000000..8bab237
Binary files /dev/null and b/sc/qa/unit/data/xlsx/condformat_theme_color.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 07b224f..dbc5ac1 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -131,6 +131,7 @@ public:
void testColorScaleXLSX();
void testNewCondFormatODS();
void testNewCondFormatXLSX();
+ void testCondFormatThemeColorXLSX();
void testLiteralInFormulaXLS();
@@ -237,6 +238,7 @@ public:
CPPUNIT_TEST(testColorScaleXLSX);
CPPUNIT_TEST(testNewCondFormatODS);
CPPUNIT_TEST(testNewCondFormatXLSX);
+ CPPUNIT_TEST(testCondFormatThemeColorXLSX);
CPPUNIT_TEST(testLiteralInFormulaXLS);
CPPUNIT_TEST(testNumberFormatHTML);
@@ -2342,6 +2344,39 @@ void ScFiltersTest::testNewCondFormatXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testCondFormatThemeColorXLSX()
+{
+ ScDocShellRef xDocSh = ScBootstrapFixture::loadDoc( "condformat_theme_color.", XLSX );
+
+ CPPUNIT_ASSERT_MESSAGE("Failed to load condformat_theme_color.xlsx", xDocSh.Is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScConditionalFormat* pFormat = rDoc.GetCondFormat(0, 0, 0);
+ const ScFormatEntry* pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::DATABAR);
+ const ScDataBarFormat* pDataBar = static_cast<const ScDataBarFormat*>(pEntry);
+ const ScDataBarFormatData* pDataBarFormatData = pDataBar->GetDataBarData();
+
+ CPPUNIT_ASSERT_EQUAL(Color(157, 195, 230), pDataBarFormatData->maPositiveColor);
+ CPPUNIT_ASSERT(pDataBarFormatData->mpNegativeColor.get());
+ CPPUNIT_ASSERT_EQUAL(Color(COL_LIGHTRED), *pDataBarFormatData->mpNegativeColor.get());
+
+ pFormat = rDoc.GetCondFormat(0, 0, 1);
+ pEntry = pFormat->GetEntry(0);
+ CPPUNIT_ASSERT(pEntry);
+ CPPUNIT_ASSERT_EQUAL(pEntry->GetType(), condformat::COLORSCALE);
+ const ScColorScaleFormat* pColorScale = static_cast<const ScColorScaleFormat*>(pEntry);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), pColorScale->size());
+ const ScColorScaleEntry* pColorScaleEntry = pColorScale->GetEntry(0);
+ CPPUNIT_ASSERT(pColorScaleEntry);
+ CPPUNIT_ASSERT_EQUAL(Color(255, 230, 153), pColorScaleEntry->GetColor());
+
+ pColorScaleEntry = pColorScale->GetEntry(1);
+ CPPUNIT_ASSERT(pColorScaleEntry);
+ CPPUNIT_ASSERT_EQUAL(Color(157, 195, 230), pColorScaleEntry->GetColor());
+}
+
void ScFiltersTest::testLiteralInFormulaXLS()
{
ScDocShellRef xDocSh = loadDoc("shared-string/literal-in-formula.", XLS);
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 15fc616..c41fc68 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -679,6 +679,14 @@ ScColorScaleEntry* ScColorScaleFormat::GetEntry(size_t nPos)
return &maColorScales[nPos];
}
+const ScColorScaleEntry* ScColorScaleFormat::GetEntry(size_t nPos) const
+{
+ if (maColorScales.size() <= nPos)
+ return NULL;
+
+ return &maColorScales[nPos];
+}
+
size_t ScColorScaleFormat::size() const
{
return maColorScales.size();
commit 514433a819102e8463d90a907fcdb8e429e07917
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Apr 16 03:58:07 2015 +0200
export and fix pretty printers for calc unit tests
Change-Id: Ifa5d097e3c09fa0c96339b4eb6fd2be81516856d
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index d45340a..96307e1 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -62,7 +62,7 @@ std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList)
std::ostream& operator<<(std::ostream& rStrm, const Color& rColor)
{
- rStrm << "Color: R:" << rColor.GetRed() << " G:" << rColor.GetGreen() << " B: << rColor.GetBlue()";
+ rStrm << "Color: R:" << (int)rColor.GetRed() << " G:" << (int)rColor.GetGreen() << " B: " << (int)rColor.GetBlue();
return rStrm;
}
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index 460d0fca..829c127 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -97,15 +97,15 @@ struct FileFormat {
// Printers for the calc data structures. Needed for the EQUAL assertion
// macros from CPPUNIT.
-std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr);
+SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const ScAddress& rAddr);
-std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange);
+SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const ScRange& rRange);
-std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList);
+SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const ScRangeList& rList);
-std::ostream& operator<<(std::ostream& rStrm, const Color& rColor);
+SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const Color& rColor);
-std::ostream& operator<<(std::ostream& rStrm, const OpCode& rCode);
+SCQAHELPER_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const OpCode& rCode);
// Why is this here and not in osl, and using the already existing file
// handling APIs? Do we really want to add arbitrary new file handling
More information about the Libreoffice-commits
mailing list