[Libreoffice-commits] core.git: starmath/qa
Takeshi Abe
tabe at fixedpoint.jp
Fri Apr 10 03:24:49 PDT 2015
starmath/qa/cppunit/test_starmath.cxx | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
New commits:
commit 68219ae542b9a92d53d0b794bd92719b3f219c9f
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date: Wed Apr 8 18:26:13 2015 +0900
cppcheck: provide a ctor
This also employs smart pointers for some variables in Test, and
drops unused code which b3edb2410387e0ad63ee663cd3b706076bea3edb
left behind.
Change-Id: I6c19d4b8f65b057bad2106c3e9d081446a2619a1
Signed-off-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index 5184b38..4be2fd7 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -10,7 +10,6 @@
#include <sal/config.h>
#include <test/bootstrapfixture.hxx>
-#include <vcl/svapp.hxx>
#include <smdll.hxx>
#include <document.hxx>
#include <view.hxx>
@@ -20,12 +19,11 @@
#include <sfx2/request.hxx>
#include <sfx2/dispatch.hxx>
-#include <svl/stritem.hxx>
-
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <sfx2/zoomitem.hxx>
+#include <memory>
typedef tools::SvRef<SmDocShell> SmDocShellRef;
@@ -36,6 +34,8 @@ namespace {
class Test : public test::BootstrapFixture
{
public:
+ Test();
+
// init
virtual void setUp() SAL_OVERRIDE;
virtual void tearDown() SAL_OVERRIDE;
@@ -55,17 +55,19 @@ public:
CPPUNIT_TEST_SUITE_END();
private:
- uno::Reference<uno::XComponentContext> m_xContext;
- uno::Reference<lang::XMultiComponentFactory> m_xFactory;
-
SfxBindings m_aBindings;
- SfxDispatcher *m_pDispatcher;
- SmCmdBoxWindow *m_pSmCmdBoxWindow;
- SmEditWindow *m_pEditWindow;
+ std::unique_ptr<SfxDispatcher> m_pDispatcher;
+ std::unique_ptr<SmCmdBoxWindow> m_pSmCmdBoxWindow;
+ std::unique_ptr<SmEditWindow> m_pEditWindow;
SmDocShellRef m_xDocShRef;
SmViewShell *m_pViewShell;
};
+Test::Test()
+ : m_pViewShell(nullptr)
+{
+}
+
void Test::setUp()
{
BootstrapFixture::setUp();
@@ -82,21 +84,21 @@ void Test::setUp()
CPPUNIT_ASSERT_MESSAGE("Should have a SfxViewFrame", pViewFrame);
- m_pDispatcher = new SfxDispatcher(pViewFrame);
- m_aBindings.SetDispatcher(m_pDispatcher);
+ m_pDispatcher.reset(new SfxDispatcher(pViewFrame));
+ m_aBindings.SetDispatcher(m_pDispatcher.get());
m_aBindings.EnterRegistrations();
- m_pSmCmdBoxWindow = new SmCmdBoxWindow(&m_aBindings, NULL, NULL);
+ m_pSmCmdBoxWindow.reset(new SmCmdBoxWindow(&m_aBindings, NULL, NULL));
m_aBindings.LeaveRegistrations();
- m_pEditWindow = new SmEditWindow(*m_pSmCmdBoxWindow);
+ m_pEditWindow.reset(new SmEditWindow(*m_pSmCmdBoxWindow));
m_pViewShell = m_pEditWindow->GetView();
CPPUNIT_ASSERT_MESSAGE("Should have a SmViewShell", m_pViewShell);
}
void Test::tearDown()
{
- delete m_pEditWindow;
- delete m_pSmCmdBoxWindow;
- delete m_pDispatcher;
+ m_pEditWindow.reset();
+ m_pSmCmdBoxWindow.reset();
+ m_pDispatcher.reset();
m_xDocShRef->DoClose();
m_xDocShRef.Clear();
More information about the Libreoffice-commits
mailing list