summaryrefslogtreecommitdiff
path: root/vcl/qa/cppunit/lifecycle.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-12-22 20:47:47 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-09 19:51:08 +0100
commitf3add7029e5778818283d48803e46ac4ecf875f5 (patch)
tree31fa9cea7dfa609fcb2108223ba163076d4f5bc2 /vcl/qa/cppunit/lifecycle.cxx
parentb72c6feba87bd8707f39902a3066ba476188cb1d (diff)
vcl: more rtl::Reference cleanup
Change-Id: Idef6b4259d784120a06d2a6c51b77029566da59f
Diffstat (limited to 'vcl/qa/cppunit/lifecycle.cxx')
-rw-r--r--vcl/qa/cppunit/lifecycle.cxx64
1 files changed, 64 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
new file mode 100644
index 000000000000..d635dd6aea7e
--- /dev/null
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -0,0 +1,64 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
+
+#include <vcl/wrkwin.hxx>
+#include <vcl/button.hxx>
+
+class LifecycleTest : public test::BootstrapFixture
+{
+ void testWidgets(vcl::Window *pParent);
+
+public:
+ LifecycleTest() : BootstrapFixture(true, false) {}
+
+ void testIsolatedWidgets();
+ void testParentedWidgets();
+
+ CPPUNIT_TEST_SUITE(LifecycleTest);
+ CPPUNIT_TEST(testIsolatedWidgets);
+ CPPUNIT_TEST(testParentedWidgets);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void LifecycleTest::testWidgets(vcl::Window *pParent)
+{
+ { PushButtonPtr aPtr(new PushButton(pParent)); }
+ { OKButtonPtr aPtr(new OKButton(pParent)); }
+ { CancelButtonPtr aPtr(new CancelButton(pParent)); }
+ { HelpButtonPtr aPtr(new HelpButton(pParent)); }
+
+ // Some widgets really insist on adoption.
+ if (pParent)
+ {
+ { CheckBoxPtr aPtr(new CheckBox(pParent)); }
+ }
+// { RadioButtonPtr aPtr(new RadioButton(pParent)); }
+}
+
+void LifecycleTest::testIsolatedWidgets()
+{
+ testWidgets(NULL);
+}
+
+void LifecycleTest::testParentedWidgets()
+{
+ VclReference<WorkWindow> xWin(new WorkWindow((vcl::Window *)NULL,
+ WB_APP|WB_STDWORK));
+ CPPUNIT_ASSERT(xWin.get() != NULL);
+ testWidgets(xWin.get());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */