summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-12-05 05:01:27 +0000
committerJens Carl <j.carl43@gmx.de>2018-12-05 18:47:23 +0100
commit4cb874c1b068d45039d7eed6f47c5ae5229fa301 (patch)
tree03298a864b3f385d98e81c6e64f78f2a2980673d /test
parent76fbe494785faee1313d1c0be8ed2ca7b0d74f68 (diff)
tdf#45904 Move XControlAccess Java test to C++
Move XControlAccess Java test to C++ for ScViewPaneObj. Change-Id: If18596b41fccc140186820c9e370f502fb2b6458 Reviewed-on: https://gerrit.libreoffice.org/64606 Tested-by: Jenkins Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test')
-rw-r--r--test/Library_subsequenttest.mk2
-rw-r--r--test/source/view/xcontrolaccess.cxx56
2 files changed, 58 insertions, 0 deletions
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 78c2e7f6a727..1b71ab44270b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -10,6 +10,7 @@
$(eval $(call gb_Library_Library,subsequenttest))
$(eval $(call gb_Library_set_include,subsequenttest,\
+ -I$(SRCDIR)/test/inc \
$$(INCLUDE) \
))
@@ -162,6 +163,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/util/xrefreshable \
test/source/util/xreplaceable \
test/source/util/xsearchable \
+ test/source/view/xcontrolaccess \
))
# vim: set noet sw=4 ts=4:
diff --git a/test/source/view/xcontrolaccess.cxx b/test/source/view/xcontrolaccess.cxx
new file mode 100644
index 000000000000..29ca1fa339aa
--- /dev/null
+++ b/test/source/view/xcontrolaccess.cxx
@@ -0,0 +1,56 @@
+/* -*- 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/xcontrolaccess.hxx>
+#include <helper/form.hxx>
+
+#include <com/sun/star/awt/XControl.hpp>
+#include <com/sun/star/awt/XControlModel.hpp>
+#include <com/sun/star/drawing/XControlShape.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/view/XControlAccess.hpp>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XControlAccess::testGetControl()
+{
+ uno::Reference<view::XControlAccess> xCA(init(), uno::UNO_QUERY_THROW);
+
+ uno::Reference<lang::XComponent> xComponent(getXComponent(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPagesSupplier> xDPS(xComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xDP(xDPS->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+
+ uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(
+ createControlShape(xComponent, 100, 100, 10000, 50000, "CommandButton"),
+ uno::UNO_QUERY_THROW);
+
+ xShapes->add(xShape);
+
+ uno::Reference<drawing::XControlShape> xCS(xShape, uno::UNO_QUERY_THROW);
+ uno::Reference<awt::XControlModel> xCM(xCS->getControl(), uno::UNO_QUERY_THROW);
+ uno::Reference<awt::XControl> xControl(xCA->getControl(xCM), uno::UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT(xControl.is());
+}
+
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */