diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2015-04-08 18:26:13 +0900 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-04-10 12:22:00 +0200 |
commit | 68219ae542b9a92d53d0b794bd92719b3f219c9f (patch) | |
tree | 3a57cf43fb5e8b2237ff9b947c11e9a1b2de6908 /starmath | |
parent | 8e6c335c1999ffd8381d1f61bfda8110b03c211e (diff) |
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@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/qa/cppunit/test_starmath.cxx | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 5184b38529ae..4be2fd77ac50 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(); |