summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-06-19 01:18:08 +0200
committerJan Holesovsky <kendy@collabora.com>2018-06-19 13:55:53 +0200
commit749780c9b5e2922417a7686efc3e4f609bb20264 (patch)
treee9642fc4368adf222797eec915696b2b9d28ff3a
parentf4e8bbe596cb337c36c3e80b53cac3f4beb85685 (diff)
lok: Unit test for passing table borders via jsonToPropertyValuesVector.
Change-Id: Iadc0d76a1903d76fcd84f316d4796cc1dec13277
-rw-r--r--desktop/CppunitTest_desktop_lokinit.mk2
-rw-r--r--desktop/qa/unit/desktop-lok-init.cxx65
2 files changed, 66 insertions, 1 deletions
diff --git a/desktop/CppunitTest_desktop_lokinit.mk b/desktop/CppunitTest_desktop_lokinit.mk
index 91493dee4530..07d235861d90 100644
--- a/desktop/CppunitTest_desktop_lokinit.mk
+++ b/desktop/CppunitTest_desktop_lokinit.mk
@@ -19,6 +19,8 @@ $(eval $(call gb_CppunitTest_use_external,desktop_lok_init,boost_headers))
$(eval $(call gb_CppunitTest_use_sdk_api,desktop_lok_init))
+$(eval $(call gb_CppunitTest_use_ure,desktop_lok_init))
+
$(eval $(call gb_CppunitTest_set_include,desktop_lok_init,\
-I$(SRCDIR)/desktop/source/inc \
-I$(SRCDIR)/desktop/inc \
diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx
index 07abe887ccfd..69c209e9055e 100644
--- a/desktop/qa/unit/desktop-lok-init.cxx
+++ b/desktop/qa/unit/desktop-lok-init.cxx
@@ -20,10 +20,13 @@
#include <osl/file.hxx>
#include <rtl/bootstrap.hxx>
-#include <vcl/scheduler.hxx>
+#include <tools/colordata.hxx>
#include <lib/init.hxx>
+#include <com/sun/star/table/BorderLine2.hpp>
+#include <com/sun/star/table/BorderLineStyle.hpp>
+
using namespace css;
/// Unit tests for desktop/source/lib/init.cxx internals.
@@ -35,9 +38,11 @@ public:
}
void testJsonToPropertyValues();
+ void testJsonToPropertyValuesBorder();
CPPUNIT_TEST_SUITE(LOKInitTest);
CPPUNIT_TEST(testJsonToPropertyValues);
+ CPPUNIT_TEST(testJsonToPropertyValuesBorder);
CPPUNIT_TEST_SUITE_END();
};
@@ -70,6 +75,64 @@ void LOKInitTest::testJsonToPropertyValues()
assertSequencesEqual(aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments)));
}
+void LOKInitTest::testJsonToPropertyValuesBorder()
+{
+ const char arguments[] = "{"
+ "\"OuterBorder\": {"
+ "\"type\" : \"[]any\","
+ "\"value\" : ["
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"long\", \"value\" : 0 },"
+ "{ \"type\" : \"long\", \"value\" : 0 },"
+ "{ \"type\" : \"long\", \"value\" : 0 },"
+ "{ \"type\" : \"long\", \"value\" : 0 },"
+ "{ \"type\" : \"long\", \"value\" : 0 }"
+ "]"
+ "},"
+ "\"InnerBorder\":{"
+ "\"type\" : \"[]any\","
+ "\"value\" : ["
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"com.sun.star.table.BorderLine2\", \"value\" : { \"Color\" : { \"type\" : \"com.sun.star.util.Color\", \"value\" : 0 }, \"InnerLineWidth\" : { \"type\" : \"short\", \"value\" : 0 }, \"OuterLineWidth\" : { \"type\" : \"short\", \"value\" : 1 }, \"LineDistance\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineStyle\" : { \"type\" : \"short\", \"value\" : 0 }, \"LineWidth\" : { \"type\" : \"unsigned long\", \"value\" : 1 } } },"
+ "{ \"type\" : \"short\", \"value\" : 0 },"
+ "{ \"type\" : \"short\", \"value\" : 127 },"
+ "{ \"type\" : \"long\", \"value\" : 0 }"
+ "]"
+ "}}";
+
+ // see SvxBoxItem::QueryValue for details
+ uno::Sequence<uno::Any> aOuterSeq(9);
+ table::BorderLine2 aLine(sal_Int32(COL_BLACK), 0, 1, 0, table::BorderLineStyle::SOLID, 1);
+ aOuterSeq[0] = uno::makeAny(aLine); // left
+ aOuterSeq[1] = uno::makeAny(aLine); // right
+ aOuterSeq[2] = uno::makeAny(aLine); // bottom
+ aOuterSeq[3] = uno::makeAny(aLine); // top
+ aOuterSeq[4] = uno::makeAny((sal_Int32)(0));
+ aOuterSeq[5] = uno::makeAny((sal_Int32)(0));
+ aOuterSeq[6] = uno::makeAny((sal_Int32)(0));
+ aOuterSeq[7] = uno::makeAny((sal_Int32)(0));
+ aOuterSeq[8] = uno::makeAny((sal_Int32)(0));
+
+ // see SvxBoxInfoItem::QueryValue() for details
+ uno::Sequence<uno::Any> aInnerSeq(5);
+ aInnerSeq[0] = uno::makeAny(aLine); // horizontal
+ aInnerSeq[1] = uno::makeAny(aLine); // vertical
+ aInnerSeq[2] = uno::makeAny((sal_Int16)(0));
+ aInnerSeq[3] = uno::makeAny((sal_Int16)(0x7F));
+ aInnerSeq[4] = uno::makeAny((sal_Int32)(0));
+
+ uno::Sequence<beans::PropertyValue> aArgs(2);
+ aArgs[0].Name = "OuterBorder";
+ aArgs[0].Value <<= aOuterSeq;
+ aArgs[1].Name = "InnerBorder";
+ aArgs[1].Value <<= aInnerSeq;
+
+ assertSequencesEqual(aArgs, comphelper::containerToSequence(desktop::jsonToPropertyValuesVector(arguments)));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(LOKInitTest);
CPPUNIT_PLUGIN_IMPLEMENT();