nss: upgrade to release 3.73
[LibreOffice.git] / test / source / view / xcontrolaccess.cxx
blob1e7583f2b137cbd826fc54a06a957ecc110862d9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <test/view/xcontrolaccess.hxx>
11 #include <test/helper/form.hxx>
13 #include <com/sun/star/awt/XControl.hpp>
14 #include <com/sun/star/awt/XControlModel.hpp>
15 #include <com/sun/star/drawing/XControlShape.hpp>
16 #include <com/sun/star/drawing/XDrawPage.hpp>
17 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
18 #include <com/sun/star/drawing/XShape.hpp>
19 #include <com/sun/star/drawing/XShapes.hpp>
20 #include <com/sun/star/lang/XComponent.hpp>
21 #include <com/sun/star/view/XControlAccess.hpp>
23 #include <com/sun/star/uno/Reference.hxx>
25 #include <cppunit/TestAssert.h>
27 using namespace css;
29 namespace apitest
31 void XControlAccess::testGetControl()
33 uno::Reference<view::XControlAccess> xCA(init(), uno::UNO_QUERY_THROW);
35 uno::Reference<lang::XComponent> xComponent(getXComponent(), uno::UNO_QUERY_THROW);
36 uno::Reference<drawing::XDrawPagesSupplier> xDPS(xComponent, uno::UNO_QUERY_THROW);
37 uno::Reference<drawing::XDrawPage> xDP(xDPS->getDrawPages()->getByIndex(0),
38 uno::UNO_QUERY_THROW);
40 uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW);
41 uno::Reference<drawing::XShape> xShape(
42 helper::form::createControlShape(xComponent, "CommandButton", 10000, 50000, 100, 100),
43 uno::UNO_QUERY_THROW);
45 xShapes->add(xShape);
47 uno::Reference<drawing::XControlShape> xCS(xShape, uno::UNO_QUERY_THROW);
48 uno::Reference<awt::XControlModel> xCM(xCS->getControl(), uno::UNO_SET_THROW);
49 uno::Reference<awt::XControl> xControl(xCA->getControl(xCM), uno::UNO_SET_THROW);
51 CPPUNIT_ASSERT(xControl.is());
54 } // namespace apitest
56 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */