Kaydet (Commit) 1aa73339 authored tarafından Michael Meeks's avatar Michael Meeks

Add vcl lifecycle test for Toolkit / XWindow peers.

Change-Id: I0114595dcecaddde343a16f096de16f53f9b7a5a
üst ec47717b
...@@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_lifecycle, \ ...@@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_lifecycle, \
sal \ sal \
svt \ svt \
test \ test \
tk \
tl \ tl \
unotest \ unotest \
vcl \ vcl \
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include <vcl/dialog.hxx> #include <vcl/dialog.hxx>
#include <vcl/layout.hxx> #include <vcl/layout.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/lang/XComponent.hpp>
class LifecycleTest : public test::BootstrapFixture class LifecycleTest : public test::BootstrapFixture
{ {
...@@ -37,6 +39,7 @@ public: ...@@ -37,6 +39,7 @@ public:
void testPostDispose(); void testPostDispose();
void testFocus(); void testFocus();
void testLeakage(); void testLeakage();
void testToolkit();
CPPUNIT_TEST_SUITE(LifecycleTest); CPPUNIT_TEST_SUITE(LifecycleTest);
CPPUNIT_TEST(testCast); CPPUNIT_TEST(testCast);
...@@ -48,6 +51,7 @@ public: ...@@ -48,6 +51,7 @@ public:
CPPUNIT_TEST(testPostDispose); CPPUNIT_TEST(testPostDispose);
CPPUNIT_TEST(testFocus); CPPUNIT_TEST(testFocus);
CPPUNIT_TEST(testLeakage); CPPUNIT_TEST(testLeakage);
CPPUNIT_TEST(testToolkit);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -289,6 +293,28 @@ void LifecycleTest::testLeakage() ...@@ -289,6 +293,28 @@ void LifecycleTest::testLeakage()
delete *i; delete *i;
} }
void LifecycleTest::testToolkit()
{
LeakTestObject *pVclWin = LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK);
css::uno::Reference<css::awt::XWindow> xWindow(pVclWin->getRef()->GetComponentInterface(), css::uno::UNO_QUERY);
CPPUNIT_ASSERT(xWindow.is());
// test UNO dispose
css::uno::Reference<css::lang::XComponent> xWinComponent(xWindow, css::uno::UNO_QUERY);
CPPUNIT_ASSERT(xWinComponent.is());
CPPUNIT_ASSERT(!pVclWin->getRef()->IsDisposed());
xWinComponent->dispose();
CPPUNIT_ASSERT(pVclWin->getRef()->IsDisposed());
// test UNO cleanup
xWinComponent.clear();
xWindow.clear();
pVclWin->disposeAndClear();
pVclWin->assertDeleted();
delete pVclWin;
}
CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest); CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
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