vcl/CppunitTest_vcl_lifecycle.mk | 1 + vcl/qa/cppunit/lifecycle.cxx | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
New commits: commit 1aa73339103eb79f84d3a5ad958b44ab9460cf45 Author: Michael Meeks <[email protected]> Date: Tue Jul 7 06:33:09 2015 +0100 Add vcl lifecycle test for Toolkit / XWindow peers. Change-Id: I0114595dcecaddde343a16f096de16f53f9b7a5a diff --git a/vcl/CppunitTest_vcl_lifecycle.mk b/vcl/CppunitTest_vcl_lifecycle.mk index ca79b00..75b133e 100644 --- a/vcl/CppunitTest_vcl_lifecycle.mk +++ b/vcl/CppunitTest_vcl_lifecycle.mk @@ -27,6 +27,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_lifecycle, \ sal \ svt \ test \ + tk \ tl \ unotest \ vcl \ diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 34a40a1..2222364 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -20,6 +20,8 @@ #include <vcl/dialog.hxx> #include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/lang/XComponent.hpp> class LifecycleTest : public test::BootstrapFixture { @@ -37,6 +39,7 @@ public: void testPostDispose(); void testFocus(); void testLeakage(); + void testToolkit(); CPPUNIT_TEST_SUITE(LifecycleTest); CPPUNIT_TEST(testCast); @@ -48,6 +51,7 @@ public: CPPUNIT_TEST(testPostDispose); CPPUNIT_TEST(testFocus); CPPUNIT_TEST(testLeakage); + CPPUNIT_TEST(testToolkit); CPPUNIT_TEST_SUITE_END(); }; @@ -289,6 +293,28 @@ void LifecycleTest::testLeakage() 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_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
