Kaydet (Commit) 4cb874c1 authored tarafından Jens Carl's avatar Jens Carl

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: 's avatarJens Carl <j.carl43@gmx.de>
üst 76fbe494
/* -*- 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/.
*/
#ifndef INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
#define INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <test/testdllapi.hxx>
namespace apitest
{
class OOO_DLLPUBLIC_TEST XControlAccess
{
public:
virtual css::uno::Reference<css::uno::XInterface> init() = 0;
virtual css::uno::Reference<css::uno::XInterface> getXComponent() = 0;
void testGetControl();
protected:
~XControlAccess() {}
};
} // namespace apitest
#endif // INCLUDED_TEST_VIEW_XCONTROLACCESS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
"ScViewPaneObj";"com::sun::star::view::XControlAccess#optional";"getControl()"
"ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"getFromController()"
"ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"isFormDesignMode()"
"ScViewPaneObj";"com::sun::star::view::XFormLayerAccess#optional";"setFormDesignMode()"
......
......@@ -10,6 +10,7 @@
#include <test/calc_unoapi_test.hxx>
#include <test/sheet/xcellrangereferrer.hxx>
#include <test/sheet/xviewpane.hxx>
#include <test/view/xcontrolaccess.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/frame/XController.hpp>
......@@ -26,12 +27,14 @@ namespace sc_apitest {
class ScViewPaneObj : public CalcUnoApiTest,
public apitest::XCellRangeReferrer,
public apitest::XControlAccess,
public apitest::XViewPane
{
public:
ScViewPaneObj();
virtual uno::Reference< uno::XInterface > init() override;
virtual uno::Reference< uno::XInterface > getXComponent() override;
virtual void setUp() override;
virtual void tearDown() override;
......@@ -40,6 +43,9 @@ public:
// XCellRangeReferrer
CPPUNIT_TEST(testGetReferredCells);
// XControlAccess
CPPUNIT_TEST(testGetControl);
// XViewPane
CPPUNIT_TEST(testFirstVisibleColumn);
CPPUNIT_TEST(testFirstVisibleRow);
......@@ -56,6 +62,11 @@ ScViewPaneObj::ScViewPaneObj()
{
}
uno::Reference<uno::XInterface> ScViewPaneObj::getXComponent()
{
return mxComponent;
}
uno::Reference< uno::XInterface > ScViewPaneObj::init()
{
uno::Reference< sheet::XSpreadsheetDocument > xSheetDoc(mxComponent, uno::UNO_QUERY_THROW);
......
......@@ -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:
/* -*- 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: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment