summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-07-07 06:33:09 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-07-07 08:37:32 +0100
commit1aa73339103eb79f84d3a5ad958b44ab9460cf45 (patch)
tree3aab29f01eb2676d3f0c28769f27a744d417528b
parentec47717b352dfa194d183be7aba5fa237045cd11 (diff)
Add vcl lifecycle test for Toolkit / XWindow peers.
Change-Id: I0114595dcecaddde343a16f096de16f53f9b7a5a
-rw-r--r--vcl/CppunitTest_vcl_lifecycle.mk1
-rw-r--r--vcl/qa/cppunit/lifecycle.cxx26
2 files changed, 27 insertions, 0 deletions
diff --git a/vcl/CppunitTest_vcl_lifecycle.mk b/vcl/CppunitTest_vcl_lifecycle.mk
index ca79b0062ca1..75b133eae394 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 34a40a126c98..222236474071 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();