summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-04-02 15:58:51 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-09 14:33:58 +0200
commit79ba592cfb631df98b2d7ac86b6d2d325d8a7349 (patch)
tree98ac178e4f00c53aae0d33bf0a90984be61e17e9
parentfix error in databar entry type api map (diff)
downloadcore-79ba592cfb631df98b2d7ac86b6d2d325d8a7349.tar.gz
core-79ba592cfb631df98b2d7ac86b6d2d325d8a7349.zip
add a test for databar entries
Change-Id: I38c025481d3135a708668cad00816f22cdd66cc8
-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 815d556a4127..6acba5c2c6b0 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);
}
}