[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - desktop/CppunitTest_desktop_lokinit.mk desktop/qa
Jan Holesovsky
kendy at collabora.com
Wed Jun 20 19:36:55 UTC 2018
desktop/CppunitTest_desktop_lokinit.mk | 2
desktop/qa/unit/desktop-lok-init.cxx | 99 ++++++++++++++++++++++++++++++++-
2 files changed, 98 insertions(+), 3 deletions(-)
New commits:
commit 740e204b481a3d742ef7c240e081a9ddc45a11a2
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue Jun 19 01:18:08 2018 +0200
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 at collabora.com>
(cherry picked from commit f6b9e4a8d95f2987386e55f244a7f6ea00995b74)
Reviewed-on: https://gerrit.libreoffice.org/56205
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/desktop/CppunitTest_desktop_lokinit.mk b/desktop/CppunitTest_desktop_lokinit.mk
index fb9e71bccfe2..502f0807075b 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 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();
More information about the Libreoffice-commits
mailing list