From 125895c355ebc9f60e792cdfffdf790c10c950cc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 12 Feb 2015 15:29:18 +0200 Subject: vcl:fixes towards unit test happiness Change-Id: Ic0a3075c7616f604b93228dff149931cf25a5ed8 --- starmath/qa/cppunit/test_starmath.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'starmath/qa') diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 054af675bfd1..d19c2972d2e9 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -60,8 +60,8 @@ private: SfxBindings m_aBindings; SfxDispatcher *m_pDispatcher; - SmCmdBoxWindow *m_pSmCmdBoxWindow; - SmEditWindow *m_pEditWindow; + VclPtr m_pSmCmdBoxWindow; + VclPtr m_pEditWindow; SmDocShellRef m_xDocShRef; SmViewShell *m_pViewShell; }; @@ -94,8 +94,8 @@ void Test::setUp() void Test::tearDown() { - delete m_pEditWindow; - delete m_pSmCmdBoxWindow; + m_pEditWindow.disposeAndClear(); + m_pSmCmdBoxWindow.disposeAndClear(); delete m_pDispatcher; m_xDocShRef->DoClose(); m_xDocShRef.Clear(); -- cgit From 8fa63f31ab84131fc1551563ae5d9bf86208c906 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 19 Mar 2015 15:39:43 +0000 Subject: Fix OutputDevice members / stack allocation: slideshow, starmath, sd, sc. Change-Id: I6d6d41b8a6501ce7d35c78e5b730ea45143d6b73 --- starmath/qa/cppunit/test_nodetotextvisitors.cxx | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'starmath/qa') diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 4e4de168d476..424e10c25e05 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -519,12 +519,12 @@ void Test::testBinomInBinHor() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - VirtualDevice aOutputDevice; + ScopedVclPtr pOutputDevice( new VirtualDevice() ); // move forward (more than) enough places to be at the end int i; for (i = 0; i < 8; ++i) - aCursor.Move(&aOutputDevice, MoveRight); + aCursor.Move(pOutputDevice, MoveRight); // tack +d on the end, which will put the binom into an SmBinHorNode aCursor.InsertElement(PlusElement); @@ -547,18 +547,18 @@ void Test::testBinVerInUnary() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - VirtualDevice aOutputDevice; + ScopedVclPtr pOutputDevice( new VirtualDevice() ); // move forward (more than) enough places to be at the end int i; for (i = 0; i < 3; ++i) - aCursor.Move(&aOutputDevice, MoveRight); + aCursor.Move(pOutputDevice, MoveRight); // select the operand - aCursor.Move(&aOutputDevice, MoveLeft, false); + aCursor.Move(pOutputDevice, MoveLeft, false); // set up a fraction aCursor.InsertFraction(); - aCursor.Move(&aOutputDevice, MoveDown); + aCursor.Move(pOutputDevice, MoveDown); aCursor.InsertText("2"); sExpected += " - { 1 over 2 } "; @@ -576,7 +576,7 @@ void Test::testBinHorInSubSup() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - VirtualDevice aOutputDevice; + ScopedVclPtr pOutputDevice( new VirtualDevice() ); // Insert an RSup expression with a BinHor for the exponent aCursor.InsertText("a"); @@ -586,7 +586,7 @@ void Test::testBinHorInSubSup() aCursor.InsertText("c"); // Move to the end and add d to the expression - aCursor.Move(&aOutputDevice, MoveRight); + aCursor.Move(pOutputDevice, MoveRight); aCursor.InsertElement(PlusElement); aCursor.InsertText("d"); @@ -604,30 +604,30 @@ void Test::testUnaryInMixedNumberAsNumerator() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - VirtualDevice aOutputDevice; + ScopedVclPtr pOutputDevice( new VirtualDevice() ); // move forward (more than) enough places to be at the end for (size_t i = 0; i < 3; ++i) - aCursor.Move(&aOutputDevice, MoveRight); + aCursor.Move(pOutputDevice, MoveRight); // Select the whole Unary Horizontal Node - aCursor.Move(&aOutputDevice, MoveLeft, false); - aCursor.Move(&aOutputDevice, MoveLeft, false); + aCursor.Move(pOutputDevice, MoveLeft, false); + aCursor.Move(pOutputDevice, MoveLeft, false); // Set up a fraction aCursor.InsertFraction(); - aCursor.Move(&aOutputDevice, MoveDown); + aCursor.Move(pOutputDevice, MoveDown); aCursor.InsertText("2"); // Move left and turn this into a mixed number // (bad form, but this could happen right?) - aCursor.Move(&aOutputDevice, MoveLeft); - aCursor.Move(&aOutputDevice, MoveLeft); + aCursor.Move(pOutputDevice, MoveLeft); + aCursor.Move(pOutputDevice, MoveLeft); aCursor.InsertText("2"); // move forward (more than) enough places to be at the end for (size_t i = 0; i < 8; ++i) - aCursor.Move(&aOutputDevice, MoveRight); + aCursor.Move(pOutputDevice, MoveRight); // add 4 to the end aCursor.InsertElement(PlusElement); -- cgit From 8a65284fe31e6c0a927cb88b75df7845cd248572 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 31 Mar 2015 23:04:14 +0100 Subject: Automated conversion of VclPtr construction to use Instance template. Change-Id: I8be9141b9653e73ebd23a5a3d810f240c376f97e --- starmath/qa/cppunit/test_nodetotextvisitors.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'starmath/qa') diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 424e10c25e05..29d554a7e477 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -519,7 +519,7 @@ void Test::testBinomInBinHor() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - ScopedVclPtr pOutputDevice( new VirtualDevice() ); + ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end int i; @@ -547,7 +547,7 @@ void Test::testBinVerInUnary() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - ScopedVclPtr pOutputDevice( new VirtualDevice() ); + ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end int i; @@ -576,7 +576,7 @@ void Test::testBinHorInSubSup() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - ScopedVclPtr pOutputDevice( new VirtualDevice() ); + ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // Insert an RSup expression with a BinHor for the exponent aCursor.InsertText("a"); @@ -604,7 +604,7 @@ void Test::testUnaryInMixedNumberAsNumerator() pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef); SmCursor aCursor(pTree, xDocShRef); - ScopedVclPtr pOutputDevice( new VirtualDevice() ); + ScopedVclPtrInstance< VirtualDevice > pOutputDevice; // move forward (more than) enough places to be at the end for (size_t i = 0; i < 3; ++i) -- cgit From 5be108ee578a4000ee77f2ccb9a2c2d5d2bcc39c Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Thu, 16 Apr 2015 20:31:36 +0100 Subject: starmath: convert new to ::Create to get initial ref-counting right. Change-Id: I4382f4a9cf74f87766c76412698b4031574b6107 --- starmath/qa/cppunit/test_starmath.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'starmath/qa') diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index d19c2972d2e9..0e3c1dead415 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -85,9 +85,9 @@ void Test::setUp() m_pDispatcher = new SfxDispatcher(pViewFrame); m_aBindings.SetDispatcher(m_pDispatcher); m_aBindings.EnterRegistrations(); - m_pSmCmdBoxWindow = new SmCmdBoxWindow(&m_aBindings, NULL, NULL); + m_pSmCmdBoxWindow.reset(VclPtr::Create(&m_aBindings, nullptr, nullptr)); m_aBindings.LeaveRegistrations(); - m_pEditWindow = new SmEditWindow(*m_pSmCmdBoxWindow); + m_pEditWindow = VclPtr::Create(*m_pSmCmdBoxWindow); m_pViewShell = m_pEditWindow->GetView(); CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", m_pViewShell); } -- cgit