sc/qa/unit/ucalc.cxx | 27 +++++++++++++++++++-------- sc/qa/unit/ucalc.hxx | 5 +++++ 2 files changed, 24 insertions(+), 8 deletions(-)
New commits: commit b8c50df5d66d5c29bf3af4e48978888dd72b19b8 Author: Eike Rathke <er...@redhat.com> Date: Tue Feb 21 15:32:35 2017 +0100 move ScDocShell de-/init related to getNewDocShell() and closeDocShell() In preparation for being able to handle two documents. Change-Id: Ie7ea65136bcd6719031af6b1034d002058bfd81a diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index f09a0a4..c94ddca 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 7b3b8fe..cc38693 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits