diff options
author | Eike Rathke <erack@redhat.com> | 2017-02-21 15:32:35 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-02-21 15:40:47 +0100 |
commit | b8c50df5d66d5c29bf3af4e48978888dd72b19b8 (patch) | |
tree | 41f041a6cefa2758f9a08233aedb84663f6015c8 /sc | |
parent | 5c99f2c8524625491ba1b4d736bdd457d258eea3 (diff) |
move ScDocShell de-/init related to getNewDocShell() and closeDocShell()
In preparation for being able to handle two documents.
Change-Id: Ie7ea65136bcd6719031af6b1034d002058bfd81a
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 27 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 5 |
2 files changed, 24 insertions, 8 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f09a0a4e12dd..c94ddca932cf 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -127,25 +127,36 @@ ScDocShell& Test::getDocShell() return *m_pImpl->m_xDocShell; } +void Test::getNewDocShell( ScDocShellRef& rDocShellRef ) +{ + rDocShellRef = new ScDocShell( + SfxModelFlags::EMBEDDED_OBJECT | + SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | + SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + + rDocShellRef->SetIsInUcalc(); + rDocShellRef->DoInitUnitTest(); +} + +void Test::closeDocShell( ScDocShellRef& rDocShellRef ) +{ + rDocShellRef->DoClose(); + rDocShellRef.clear(); +} + void Test::setUp() { BootstrapFixture::setUp(); ScDLL::Init(); - m_pImpl->m_xDocShell = new ScDocShell( - SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); - m_pImpl->m_xDocShell->SetIsInUcalc(); - m_pImpl->m_xDocShell->DoInitUnitTest(); + getNewDocShell(m_pImpl->m_xDocShell); m_pDoc = &m_pImpl->m_xDocShell->GetDocument(); } void Test::tearDown() { - m_pImpl->m_xDocShell->DoClose(); - m_pImpl->m_xDocShell.clear(); + closeDocShell(m_pImpl->m_xDocShell); BootstrapFixture::tearDown(); } diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 7b3b8fe4e210..cc38693db48e 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -99,6 +99,11 @@ public: ScDocShell& getDocShell(); + /** Get a separate new ScDocShell with ScDocument that suits unit test needs. */ + void getNewDocShell( ScDocShellRef& rDocShellRef ); + /** Close such new ScDocShell. */ + void closeDocShell( ScDocShellRef& rDocShellRef ); + virtual void setUp() override; virtual void tearDown() override; |