1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <test/bootstrapfixture.hxx>
11 #include <unotest/macros_test.hxx>
13 #include <com/sun/star/awt/UnoControlDialog.hpp>
14 #include <com/sun/star/awt/XUnoControlDialog.hpp>
15 #include <com/sun/star/awt/XControlModel.hpp>
16 #include <com/sun/star/beans/XPropertySet.hpp>
17 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
19 #include <comphelper/processfactory.hxx>
20 #include <toolkit/helper/vclunohelper.hxx>
21 #include <vcl/vclptr.hxx>
22 #include <vcl/window.hxx>
28 /// Test dialogs constructed via UNO
29 class DialogTest
: public test::BootstrapFixture
, public unotest::MacrosTest
33 CPPUNIT_TEST_FIXTURE(DialogTest
, testDialogSizeable
)
35 uno::Reference
<awt::XDialog
> xDialog
;
36 uno::Reference
<lang::XMultiComponentFactory
> xFactory(m_xContext
->getServiceManager(),
38 uno::Reference
<awt::XControlModel
> xControlModel(
39 xFactory
->createInstanceWithContext(u
"com.sun.star.awt.UnoControlDialogModel"_ustr
,
41 uno::UNO_QUERY_THROW
);
43 uno::Reference
<beans::XPropertySet
> xPropSet(xControlModel
, uno::UNO_QUERY_THROW
);
44 xPropSet
->setPropertyValue(u
"Sizeable"_ustr
, uno::Any(true));
46 uno::Reference
<awt::XUnoControlDialog
> xControl
= awt::UnoControlDialog::create(m_xContext
);
47 xControl
->setModel(xControlModel
);
48 xControl
->setVisible(true);
49 xDialog
.set(xControl
, uno::UNO_QUERY_THROW
);
52 VclPtr
<vcl::Window
> pWindow
= VCLUnoHelper::GetWindow(xControl
->getPeer());
53 CPPUNIT_ASSERT(pWindow
);
54 CPPUNIT_ASSERT(pWindow
->GetStyle() & WB_SIZEABLE
);
56 xDialog
->endExecute();
57 css::uno::Reference
<css::lang::XComponent
>(xDialog
, css::uno::UNO_QUERY_THROW
)->dispose();
58 css::uno::Reference
<css::lang::XComponent
>(xControlModel
, css::uno::UNO_QUERY_THROW
)->dispose();
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */