diff options
author | Jan Holesovsky <kendy@collabora.com> | 2018-06-19 01:18:08 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-20 21:33:57 +0200 |
commit | f6b9e4a8d95f2987386e55f244a7f6ea00995b74 (patch) | |
tree | 3f86e56d14e7f615dde6209cc36a1e6af8d10cec /desktop/qa/unit | |
parent | 666edd059b360b38add0acd959ea7e2ab5c7c5fd (diff) |
lok: Unit test for passing table borders via jsonToPropertyValuesVector.
Change-Id: Iadc0d76a1903d76fcd84f316d4796cc1dec13277
Reviewed-on: https://gerrit.libreoffice.org/56150
Tested-by: Jenkins
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'desktop/qa/unit')
-rw-r--r-- | desktop/qa/unit/desktop-lok-init.cxx | 99 |
1 files changed, 96 insertions, 3 deletions
diff --git a/desktop/qa/unit/desktop-lok-init.cxx b/desktop/qa/unit/desktop-lok-init.cxx index fa751bb64eaa..180b95c33a6a 100644 --- a/desktop/qa/unit/desktop-lok-init.cxx +++ b/desktop/qa/unit/desktop-lok-init.cxx @@ -18,12 +18,13 @@ #include <string> #include <stdio.h> -#include <osl/file.hxx> -#include <rtl/bootstrap.hxx> -#include <vcl/scheduler.hxx> +#include <tools/color.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. @@ -33,9 +34,11 @@ public: LOKInitTest() {} void testJsonToPropertyValues(); + void testJsonToPropertyValuesBorder(); CPPUNIT_TEST_SUITE(LOKInitTest); CPPUNIT_TEST(testJsonToPropertyValues); + CPPUNIT_TEST(testJsonToPropertyValuesBorder); CPPUNIT_TEST_SUITE_END(); }; @@ -71,6 +74,96 @@ void LOKInitTest::testJsonToPropertyValues() 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] <<= aLine; // left + aOuterSeq[1] <<= aLine; // right + aOuterSeq[2] <<= aLine; // bottom + aOuterSeq[3] <<= aLine; // top + aOuterSeq[4] <<= static_cast<sal_Int32>(0); + aOuterSeq[5] <<= static_cast<sal_Int32>(0); + aOuterSeq[6] <<= static_cast<sal_Int32>(0); + aOuterSeq[7] <<= static_cast<sal_Int32>(0); + aOuterSeq[8] <<= static_cast<sal_Int32>(0); + + // see SvxBoxInfoItem::QueryValue() for details + uno::Sequence<uno::Any> aInnerSeq(5); + aInnerSeq[0] <<= aLine; // horizontal + aInnerSeq[1] <<= aLine; // vertical + aInnerSeq[2] <<= static_cast<sal_Int16>(0); + aInnerSeq[3] <<= static_cast<sal_Int16>(0x7F); + aInnerSeq[4] <<= static_cast<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(); |