summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2015-03-29 23:01:28 +0200
committerJan Holesovsky <kendy@collabora.com>2015-04-09 11:39:30 +0200
commita57eee4842f97aad1fd7bda0add15c967a2c5ebb (patch)
tree5a73bca27ca42b3553bc99d6631abbd7530eb840
parentfix condition (diff)
downloadcore-a57eee4842f97aad1fd7bda0add15c967a2c5ebb.tar.gz
core-a57eee4842f97aad1fd7bda0add15c967a2c5ebb.zip
start work on data property tests
Change-Id: I1f1722aa3566555816df19e68aa7eaa97e7a13d9
-rw-r--r--sc/qa/extras/new_cond_format.cxx87
-rw-r--r--sc/qa/extras/testdocuments/new_cond_format_api.odsbin7843 -> 8010 bytes
2 files changed, 87 insertions, 0 deletions
diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx
index 0bd96d4cb2c2..7b76f6e1a4c2 100644
--- a/sc/qa/extras/new_cond_format.cxx
+++ b/sc/qa/extras/new_cond_format.cxx
@@ -14,6 +14,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/sheet/DataBarAxis.hpp>
#include <unonames.hxx>
using namespace css;
@@ -36,6 +37,7 @@ public:
void testCondFormatListFormats();
void testCondFormatProperties();
void testCondFormatXIndex();
+ void testDataBarProperties();
CPPUNIT_TEST_SUITE(ScConditionalFormatTest);
CPPUNIT_TEST(testRequestCondFormatListFromSheet);
@@ -43,6 +45,7 @@ public:
CPPUNIT_TEST(testCondFormatListFormats);
CPPUNIT_TEST(testCondFormatProperties);
CPPUNIT_TEST(testCondFormatXIndex);
+ CPPUNIT_TEST(testDataBarProperties);
CPPUNIT_TEST_SUITE_END();
private:
@@ -174,6 +177,90 @@ void ScConditionalFormatTest::testCondFormatXIndex()
*/
}
+namespace {
+
+void testAxisPosition(uno::Reference<beans::XPropertySet> xPropSet, sal_Int32 ePos)
+{
+ sal_Int32 eAxisPos;
+ uno::Any aAny = xPropSet->getPropertyValue("AxisPosition");
+ CPPUNIT_ASSERT(aAny >>= eAxisPos);
+ CPPUNIT_ASSERT_EQUAL(ePos, eAxisPos);
+}
+
+void testShowValue(uno::Reference<beans::XPropertySet> xPropSet, bool bShowVal)
+{
+ bool bShow;
+ uno::Any aAny = xPropSet->getPropertyValue("ShowValue");
+ CPPUNIT_ASSERT(aAny >>= bShow);
+ CPPUNIT_ASSERT_EQUAL(bShowVal, bShow);
+}
+
+void testUseGradient(uno::Reference<beans::XPropertySet> xPropSet, bool bUseGradient)
+{
+ bool bGradient;
+ uno::Any aAny = xPropSet->getPropertyValue("UseGradient");
+ CPPUNIT_ASSERT(aAny >>= bGradient);
+ CPPUNIT_ASSERT_EQUAL(bUseGradient, bGradient);
+}
+
+void testPositiveColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
+{
+ sal_Int32 nColor;
+ uno::Any aAny = xPropSet->getPropertyValue("Color");
+ CPPUNIT_ASSERT(aAny >>= nColor);
+ CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
+}
+
+void testNegativeColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
+{
+ sal_Int32 nColor;
+ uno::Any aAny = xPropSet->getPropertyValue("NegativeColor");
+ CPPUNIT_ASSERT(aAny >>= nColor);
+ CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
+}
+
+void testAxisColor(uno::Reference<beans::XPropertySet> xPropSet, Color aColor)
+{
+ sal_Int32 nColor;
+ uno::Any aAny = xPropSet->getPropertyValue("AxisColor");
+ CPPUNIT_ASSERT(aAny >>= nColor);
+ CPPUNIT_ASSERT_EQUAL(aColor.GetColor(), sal_uInt32(nColor));
+}
+
+}
+
+void ScConditionalFormatTest::testDataBarProperties()
+{
+ uno::Reference<sheet::XConditionalFormats> xCondFormatList =
+ getConditionalFormatList(init(2));
+
+ uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats =
+ xCondFormatList->getConditionalFormats();
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xCondFormats.getLength());
+
+ uno::Reference<sheet::XConditionalFormat> xCondFormat = xCondFormats[0];
+ CPPUNIT_ASSERT(xCondFormat.is());
+
+ uno::Type aType = xCondFormat->getElementType();
+ CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.beans.XPropertySet"), aType.getTypeName());
+
+ CPPUNIT_ASSERT(xCondFormat->hasElements());
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xCondFormat->getCount());
+
+ uno::Reference<beans::XPropertySet> xPropSet;
+ {
+ uno::Any aAny = xCondFormat->getByIndex(0);
+ CPPUNIT_ASSERT(aAny.hasValue());
+ CPPUNIT_ASSERT(aAny >>= xPropSet);
+ testAxisPosition(xPropSet, sheet::DataBarAxis::AXIS_AUTOMATIC);
+ testShowValue(xPropSet, true);
+ testUseGradient(xPropSet, true);
+ testPositiveColor(xPropSet, COL_LIGHTBLUE);
+ testNegativeColor(xPropSet, COL_LIGHTRED);
+ testAxisColor(xPropSet, COL_BLACK);
+ }
+}
+
void ScConditionalFormatTest::setUp()
{
nTest++;
diff --git a/sc/qa/extras/testdocuments/new_cond_format_api.ods b/sc/qa/extras/testdocuments/new_cond_format_api.ods
index 3660f454c2c0..480ee2454c89 100644
--- a/sc/qa/extras/testdocuments/new_cond_format_api.ods
+++ b/sc/qa/extras/testdocuments/new_cond_format_api.ods
Binary files differ