[Libreoffice-commits] core.git: Branch 'feature/vclref' - vcl/qa vcl/source
vcl/qa/cppunit/lifecycle.cxx | 40 +++- vcl/source/outdev/outdev.cxx |1 - 2 files changed, 19 insertions(+), 22 deletions(-) New commits: commit aee4dc9c3e935a99a771e4331ee4dc5da9955e80 Author: Michael Meeks michael.me...@collabora.com Date: Tue Mar 31 20:31:49 2015 +0100 Fix misc. issues in lifecycle unit tests. Change-Id: I667852d1c854259ed698541b868a49322c6fbe64 diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 5f5f4e3..b505088 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -46,12 +46,12 @@ public: // A compile time sanity check void LifecycleTest::testCast() { -VclPtrPushButton xButton(new PushButton(NULL, 0)); -VclPtrvcl::Window xWindow(xButton); +ScopedVclPtrInstance PushButton xButton( nullptr, 0 ); +ScopedVclPtrvcl::Window xWindow(xButton); -VclPtrMetricField xField(new MetricField(NULL, 0)); -VclPtrSpinField xSpin(xField); -VclPtrEdit xEdit(xField); +ScopedVclPtrInstance MetricField xField( nullptr, 0 ); +ScopedVclPtrSpinField xSpin(xField); +ScopedVclPtrEdit xEdit(xField); // the following line should NOT compile //VclPtrPushButton xButton2(xWindow); @@ -59,8 +59,8 @@ void LifecycleTest::testCast() void LifecycleTest::testVirtualDevice() { -VclPtrVirtualDevice pVDev( new VirtualDevice() ); -ScopedVclPtrVirtualDevice pVDev2( new VirtualDevice() ); +VclPtrInstance VirtualDevice pVDev; +ScopedVclPtrInstance VirtualDevice pVDev2; VclPtrInstanceVirtualDevice pVDev3; VclPtrInstanceVirtualDevice pVDev4( 1 ); CPPUNIT_ASSERT(!!pVDev !!pVDev2 !!pVDev3 !!pVDev4); @@ -80,18 +80,18 @@ void LifecycleTest::testMultiDispose() void LifecycleTest::testWidgets(vcl::Window *pParent) { -{ VclPtrPushButton aPtr(new PushButton(pParent)); } -{ VclPtrOKButton aPtr(new OKButton(pParent)); } -{ VclPtrCancelButton aPtr(new CancelButton(pParent)); } -{ VclPtrHelpButton aPtr(new HelpButton(pParent)); } +{ ScopedVclPtrInstance PushButton aPtr( pParent ); } +{ ScopedVclPtrInstance OKButton aPtr( pParent ); } +{ ScopedVclPtrInstance CancelButton aPtr( pParent ); } +{ ScopedVclPtrInstance HelpButton aPtr( pParent ); } // Some widgets really insist on adoption. if (pParent) { -{ VclPtrCheckBox aPtr(new CheckBox(pParent)); } -{ VclPtrEdit aPtr(new Edit(pParent)); } -{ VclPtrComboBox aPtr(new ComboBox(pParent)); } -{ VclPtrRadioButton aPtr(new RadioButton(pParent)); } +{ ScopedVclPtrInstance CheckBox aPtr( pParent ); } +{ ScopedVclPtrInstance Edit aPtr( pParent ); } +{ ScopedVclPtrInstance ComboBox aPtr( pParent ); } +{ ScopedVclPtrInstance RadioButton aPtr( pParent ); } } } @@ -102,8 +102,7 @@ void LifecycleTest::testIsolatedWidgets() void LifecycleTest::testParentedWidgets() { -ScopedVclPtrInstanceWorkWindow xWin(new WorkWindow((vcl::Window *)NULL, - WB_APP|WB_STDWORK)); +ScopedVclPtrInstanceWorkWindow xWin(nullptr, WB_APP|WB_STDWORK); CPPUNIT_ASSERT(xWin.get() != NULL); xWin-Show(); testWidgets(xWin); @@ -121,10 +120,9 @@ public: void LifecycleTest::testChildDispose() { -VclPtrInstanceWorkWindow xWin((vcl::Window *)NULL, -WB_APP|WB_STDWORK); +VclPtrInstanceWorkWindow xWin(nullptr, WB_APP|WB_STDWORK); CPPUNIT_ASSERT(xWin.get() != NULL); -VclPtrDisposableChild xChild(new DisposableChild(xWin.get())); +VclPtrInstance DisposableChild xChild( xWin.get() ); xWin-Show(); xChild-disposeOnce(); xWin-disposeOnce(); @@ -132,7 +130,7 @@ void LifecycleTest::testChildDispose() void LifecycleTest::testPostDispose() { -VclPtrInstanceWorkWindow xWin((vcl::Window *)NULL, WB_STDWORK); +VclPtrInstanceWorkWindow xWin(nullptr, WB_APP|WB_STDWORK); xWin-disposeOnce(); // check selected methods continue to work post-dispose diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index db93e11..e5b8aa6 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -86,7 +86,6 @@ OutputDevice::OutputDevice() : maTextLineColor( COL_TRANSPARENT ), mxSettings( new AllSettings(Application::GetSettings()) ) { - mpGraphics = NULL; mpUnoGraphicsList = NULL; mpPrevGraphics = NULL; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/vclref' - vcl/qa vcl/source
vcl/qa/cppunit/lifecycle.cxx | 17 + vcl/source/window/window2.cxx | 16 2 files changed, 25 insertions(+), 8 deletions(-) New commits: commit 12ad7b84dcb07e8bf799bdfaca32279fb1940ec0 Author: Michael Meeks michael.me...@collabora.com Date: Thu Mar 26 21:45:50 2015 + Fix LazyDelete crasher, and add test more post-dispose robustness. Change-Id: I0e9460cb33b7cb5da9ddb950ff27bac8cbf7fed8 diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 8be94a5..12b0a51 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -30,6 +30,7 @@ public: void testIsolatedWidgets(); void testParentedWidgets(); void testChildDispose(); +void testPostDispose(); CPPUNIT_TEST_SUITE(LifecycleTest); CPPUNIT_TEST(testCast); @@ -38,6 +39,7 @@ public: CPPUNIT_TEST(testIsolatedWidgets); CPPUNIT_TEST(testParentedWidgets); CPPUNIT_TEST(testChildDispose); +CPPUNIT_TEST(testPostDispose); CPPUNIT_TEST_SUITE_END(); }; @@ -125,6 +127,21 @@ void LifecycleTest::testChildDispose() xWin-disposeOnce(); } +void LifecycleTest::testPostDispose() +{ +VclPtrWorkWindow xWin(new WorkWindow((vcl::Window *)NULL, WB_STDWORK)); +xWin-disposeOnce(); + +// check selected methods continue to work post-dispose +CPPUNIT_ASSERT(!xWin-GetParent()); +xWin-Show(); +CPPUNIT_ASSERT(!xWin-IsReallyShown()); +CPPUNIT_ASSERT(!xWin-IsEnabled()); +CPPUNIT_ASSERT(!xWin-IsInputEnabled()); +CPPUNIT_ASSERT(!xWin-GetChild(0)); +CPPUNIT_ASSERT(!xWin-GetWindow(0)); +} + CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 58a2664..b3ee05a 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -975,27 +975,27 @@ vcl::Window* Window::ImplGetWindow() ImplFrameData* Window::ImplGetFrameData() { -return mpWindowImpl-mpFrameData; +return mpWindowImpl ? mpWindowImpl-mpFrameData : NULL; } SalFrame* Window::ImplGetFrame() const { -return mpWindowImpl-mpFrame; +return mpWindowImpl ? mpWindowImpl-mpFrame : NULL; } vcl::Window* Window::ImplGetParent() const { -return mpWindowImpl-mpParent; +return mpWindowImpl ? mpWindowImpl-mpParent.get() : NULL; } vcl::Window* Window::ImplGetClientWindow() const { -return mpWindowImpl-mpClientWindow; +return mpWindowImpl ? mpWindowImpl-mpClientWindow.get() : NULL; } vcl::Window* Window::ImplGetBorderWindow() const { -return mpWindowImpl-mpBorderWindow; +return mpWindowImpl ? mpWindowImpl-mpBorderWindow.get() : NULL; } vcl::Window* Window::ImplGetFirstOverlapWindow() @@ -1237,7 +1237,7 @@ bool Window::IsReallyVisible() const bool Window::IsReallyShown() const { -return mpWindowImpl-mbReallyShown; +return mpWindowImpl ? mpWindowImpl-mbReallyShown : false; } bool Window::IsInInitShow() const @@ -1247,12 +1247,12 @@ bool Window::IsInInitShow() const bool Window::IsEnabled() const { -return !mpWindowImpl-mbDisabled; +return mpWindowImpl ? !mpWindowImpl-mbDisabled : false; } bool Window::IsInputEnabled() const { -return !mpWindowImpl-mbInputDisabled; +return mpWindowImpl ? !mpWindowImpl-mbInputDisabled : false; } bool Window::IsAlwaysEnableInput() const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'feature/vclref' - vcl/qa
vcl/qa/cppunit/lifecycle.cxx | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) New commits: commit a486815fad8f243708eeef0860d1e6eb4f250283 Author: Michael Meeks michael.me...@collabora.com Date: Fri Mar 13 21:18:16 2015 + vcl: fix lifecycle test to disposeOnce. Change-Id: Idef33e0b8e6c986c8808c2b611c5f4b6632e7511 diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index d73dcc8..04a4719 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -57,9 +57,9 @@ void LifecycleTest::testMultiDispose() VclPtrWorkWindow xWin(new WorkWindow((vcl::Window *)NULL, WB_APP|WB_STDWORK)); CPPUNIT_ASSERT(xWin.get() != NULL); -xWin-dispose(); -xWin-dispose(); -xWin-dispose(); +xWin-disposeOnce(); +xWin-disposeOnce(); +xWin-disposeOnce(); CPPUNIT_ASSERT(xWin-GetWindow(0) == NULL); CPPUNIT_ASSERT(xWin-GetChild(0) == NULL); CPPUNIT_ASSERT(xWin-GetChildCount() == 0); @@ -113,8 +113,8 @@ void LifecycleTest::testChildDispose() CPPUNIT_ASSERT(xWin.get() != NULL); VclPtrDisposableChild xChild(new DisposableChild(xWin.get())); xWin-Show(); -xChild-dispose(); -xWin-dispose(); +xChild-disposeOnce(); +xWin-disposeOnce(); } CPPUNIT_TEST_SUITE_REGISTRATION(LifecycleTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits