summaryrefslogtreecommitdiff
path: root/sc/qa/extras/new_cond_format.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-04-02 15:58:51 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-04-02 17:31:25 +0200
commitae7cfa6a9bef89bbe0f7d827925b606a3f59adef (patch)
treececa3f8d88b677832dc0b1ddb2fba785d51164e6 /sc/qa/extras/new_cond_format.cxx
parentb44acb8c559a98ffcee28e995f696055e022a7f5 (diff)
add a test for databar entries
Change-Id: I38c025481d3135a708668cad00816f22cdd66cc8
Diffstat (limited to 'sc/qa/extras/new_cond_format.cxx')
-rw-r--r--sc/qa/extras/new_cond_format.cxx43
1 files changed, 43 insertions, 0 deletions
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index edefc1f0f0a5..e067080b4ef9 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -15,6 +15,8 @@
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/sheet/DataBarAxis.hpp>
+#include <com/sun/star/sheet/XDataBarEntry.hpp>
+#include <com/sun/star/sheet/DataBarEntryType.hpp>
#include <unonames.hxx>
using namespace css;
@@ -227,6 +229,45 @@ void testAxisColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
}
+void testDataBarEntryValue(uno::Reference<sheet::XDataBarEntry> xEntry,
+ const OUString& rExpectedValue, sal_Int32 nType)
+{
+ switch (nType)
+ {
+ case sheet::DataBarEntryType::DATABAR_VALUE:
+ case sheet::DataBarEntryType::DATABAR_PERCENT:
+ case sheet::DataBarEntryType::DATABAR_PERCENTILE:
+ case sheet::DataBarEntryType::DATABAR_FORMULA:
+ {
+ OUString aString = xEntry->getFormula();
+ CPPUNIT_ASSERT_EQUAL(rExpectedValue, aString);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+void testDataBarEntries(uno::Reference<beans::XPropertySet> xPropSet,
+ const OUString& rExpectedMinString, sal_Int32 nExpectedMinType,
+ const OUString& rExpectedMaxString, sal_Int32 nExpectedMaxType)
+{
+ uno::Any aAny = xPropSet->getPropertyValue("DataBarEntries");
+ uno::Sequence<uno::Reference<sheet::XDataBarEntry> > aEntries;
+ CPPUNIT_ASSERT(aAny >>= aEntries);
+
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), aEntries.getLength());
+
+ sal_Int32 nMinType = aEntries[0]->getType();
+ CPPUNIT_ASSERT_EQUAL(nExpectedMinType, nMinType);
+
+ sal_Int32 nMaxType = aEntries[1]->getType();
+ CPPUNIT_ASSERT_EQUAL(nExpectedMaxType, nMaxType);
+
+ testDataBarEntryValue(aEntries[0], rExpectedMinString, nMinType);
+ testDataBarEntryValue(aEntries[1], rExpectedMaxString, nMaxType);
+}
+
}
void ScConditionalFormatTest::testDataBarProperties()
@@ -258,6 +299,8 @@ void ScConditionalFormatTest::testDataBarProperties()
testPositiveColor(xPropSet, COL_LIGHTBLUE);
testNegativeColor(xPropSet, COL_LIGHTRED);
testAxisColor(xPropSet, COL_BLACK);
+ testDataBarEntries(xPropSet, "", sheet::DataBarEntryType::DATABAR_AUTO,
+ "", sheet::DataBarEntryType::DATABAR_MAX);
}
}