summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-01-03 22:45:19 +0000
committerJens Carl <j.carl43@gmx.de>2018-01-04 06:39:00 +0100
commit5de151f0fd7b590ae13560086b46ea84e4d9cf9c (patch)
treeed4188418ecdc9e02f369ff489e317f93a6ce868 /test
parentb0ab92eaa70dd6d6986b348525a901b75dfd7c69 (diff)
tdf#45904 Move _TableAutoFormat Java tests to C++
Change-Id: Ib26a2d2a05d926a0d031c86812456996cb368792 Reviewed-on: https://gerrit.libreoffice.org/47361 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/sheet/tableautoformat.cxx95
2 files changed, 96 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 6768f10fc692..d4152b3290e6 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/datapilotfield \
test/source/sheet/datapilotitem \
test/source/sheet/scenario \
+ test/source/sheet/tableautoformat \
test/source/sheet/tablevalidation \
test/source/sheet/xarealink \
test/source/sheet/xarealinks \
diff --git a/test/source/sheet/tableautoformat.cxx b/test/source/sheet/tableautoformat.cxx
new file mode 100644
index 000000000000..28f98eb172f6
--- /dev/null
+++ b/test/source/sheet/tableautoformat.cxx
@@ -0,0 +1,95 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/sheet/tableautoformat.hxx>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void TableAutoFormat::testTableAutoFormatProperties()
+{
+ uno::Reference<beans::XPropertySet> xTableAutoFormat(init(), UNO_QUERY_THROW);
+ OUString propName;
+ uno::Any aNewValue;
+
+ propName = "IncludeFont";
+ bool aIncludeFont = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeFont", aIncludeFont);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeFont);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeFont", !aIncludeFont);
+
+ propName = "IncludeJustify";
+ bool aIncludeJustify = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeJustify", aIncludeJustify);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeJustify);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeJustify", !aIncludeJustify);
+
+ propName = "IncludeBorder";
+ bool aIncludeBorder = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBorder", aIncludeBorder);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBorder);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBorder", !aIncludeBorder);
+
+ propName = "IncludeBackground";
+ bool aIncludeBackground = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeBackground", aIncludeBackground);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeBackground);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeBackground", !aIncludeBackground);
+
+ propName = "IncludeNumberFormat";
+ bool aIncludeNumberFormat = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeNumberFormat",
+ aIncludeNumberFormat);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeNumberFormat);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeNumberFormat",
+ !aIncludeNumberFormat);
+
+ propName = "IncludeWidthAndHeight";
+ bool aIncludeWidthAndHeight = false;
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
+ CPPUNIT_ASSERT_MESSAGE("Unable to get property value IncludeWidthAndHeight",
+ aIncludeWidthAndHeight);
+
+ aNewValue <<= false;
+ xTableAutoFormat->setPropertyValue(propName, aNewValue);
+ CPPUNIT_ASSERT(xTableAutoFormat->getPropertyValue(propName) >>= aIncludeWidthAndHeight);
+ CPPUNIT_ASSERT_MESSAGE("Unable to set property value IncludeWidthAndHeight",
+ !aIncludeWidthAndHeight);
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */