summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2019-03-29 22:06:59 +0000
committerJens Carl <j.carl43@gmx.de>2019-03-30 22:40:23 +0100
commit2e0e7a15f66f5cb55f2a424fae6a9050c2c7f9ca (patch)
treeba1500b99dc070cd0a33eb5acb39c24295cebb6b /test
parentbcecc4a2943632030dcd71964bc0aa5690c03735 (diff)
tdf#45904 Move XFormLayerAccess Java tests to C++
Move XFormLayerAccess Java tests to C++ for ScViewPaneObj. Change-Id: I7ed6ff51d435b6f3de85daec99a13583e50a450a Reviewed-on: https://gerrit.libreoffice.org/69942 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/helper/form.cxx8
-rw-r--r--test/source/view/xformlayeraccess.cxx58
3 files changed, 67 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 42cec9343c75..c636235913bf 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -187,6 +187,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/util/xreplaceable \
test/source/util/xsearchable \
test/source/view/xcontrolaccess \
+ test/source/view/xformlayeraccess \
))
# vim: set noet sw=4 ts=4:
diff --git a/test/source/helper/form.cxx b/test/source/helper/form.cxx
index 3dbf079af59d..018a33ca4532 100644
--- a/test/source/helper/form.cxx
+++ b/test/source/helper/form.cxx
@@ -29,6 +29,14 @@ namespace helper
{
namespace form
{
+uno::Reference<drawing::XControlShape>
+ OOO_DLLPUBLIC_TEST createCommandButton(const uno::Reference<lang::XComponent>& r_xComponent,
+ const sal_Int32 nX, const sal_Int32 nY,
+ const sal_Int32 nHeight, const sal_Int32 nWidth)
+{
+ return createControlShape(r_xComponent, "CommandButton", nX, nY, nHeight, nWidth);
+}
+
uno::Reference<drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
const uno::Reference<lang::XComponent>& r_xComponent, const OUString& r_aKind,
const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth)
diff --git a/test/source/view/xformlayeraccess.cxx b/test/source/view/xformlayeraccess.cxx
new file mode 100644
index 000000000000..699da4882da8
--- /dev/null
+++ b/test/source/view/xformlayeraccess.cxx
@@ -0,0 +1,58 @@
+/* -*- 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/view/xformlayeraccess.hxx>
+
+#include <com/sun/star/form/XForm.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
+#include <com/sun/star/view/XFormLayerAccess.hpp>
+
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+
+namespace apitest
+{
+void XFormLayerAccess::testGetFormController()
+{
+ uno::Reference<view::XFormLayerAccess> xFLA(init(), uno::UNO_QUERY_THROW);
+
+ const bool bCurrentMode = xFLA->isFormDesignMode();
+
+ // delibritly don't use UNO_QUERY_THROW, so we can use
+ // uno::XInterface::is() in CPPUNIT_ASSERT()
+ xFLA->setFormDesignMode(false);
+ uno::Reference<form::runtime::XFormController> xFC(xFLA->getFormController(m_xForm),
+ uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xFC.is());
+
+ xFLA->setFormDesignMode(bCurrentMode);
+}
+
+void XFormLayerAccess::testIsFormDesignMode() { testSetFormDesignMode(); }
+
+void XFormLayerAccess::testSetFormDesignMode()
+{
+ uno::Reference<view::XFormLayerAccess> xFLA(init(), uno::UNO_QUERY_THROW);
+
+ const bool bCurrentMode = xFLA->isFormDesignMode();
+ xFLA->setFormDesignMode(!bCurrentMode);
+
+ const bool bNewMode = xFLA->isFormDesignMode();
+ CPPUNIT_ASSERT_EQUAL(!bCurrentMode, bNewMode);
+
+ xFLA->setFormDesignMode(bCurrentMode);
+ CPPUNIT_ASSERT_EQUAL(bCurrentMode, static_cast<bool>(xFLA->isFormDesignMode()));
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */