diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-04 09:13:33 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-05 14:31:26 +0200 |
commit | 392635220aad1c361897fedeff1c4e7ca5c8476d (patch) | |
tree | 0d86d181b5218b21e4f386f3e9f4c70c8a6d6e39 /sc/qa | |
parent | ed91412a2f12f59d98575ccd1baa8bbf06d71896 (diff) |
sc: implement SfxUndoAction::GetViewShellId() interface ...
... in SfxUndoAction subclasses
Change-Id: I1504e2cfb0f58ff97e2de7a641d72e4867238164
Reviewed-on: https://gerrit.libreoffice.org/27861
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 7cbb0664b94bb9f4587098c1940de98e4f7aae16)
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/tiledrendering/tiledrendering.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index f049f4ed1cf4..8b088baaf771 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -60,6 +60,7 @@ public: void testDocumentSizeChanged(); void testViewLock(); void testColRowResize(); + void testUndoShells(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -71,6 +72,7 @@ public: CPPUNIT_TEST(testDocumentSizeChanged); CPPUNIT_TEST(testViewLock); CPPUNIT_TEST(testColRowResize); + CPPUNIT_TEST(testUndoShells); CPPUNIT_TEST_SUITE_END(); private: @@ -560,6 +562,26 @@ void ScTiledRenderingTest::testColRowResize() comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testUndoShells() +{ + comphelper::LibreOfficeKit::setActive(); + ScModelObj* pModelObj = createDoc("small.ods"); + // Clear the currently selected cell. + comphelper::dispatchCommand(".uno:ClearContents", {}); + + auto pDocShell = dynamic_cast<ScDocShell*>(pModelObj->GetEmbeddedObject()); + CPPUNIT_ASSERT(pDocShell); + ScDocument& rDoc = pDocShell->GetDocument(); + SfxUndoManager* pUndoManager = rDoc.GetUndoManager(); + CPPUNIT_ASSERT(pUndoManager); + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pUndoManager->GetUndoActionCount()); + sal_Int32 nView1 = SfxLokHelper::getView(); + // This was -1: ScSimpleUndo did not remember what view shell created it. + CPPUNIT_ASSERT_EQUAL(nView1, pUndoManager->GetUndoAction()->GetViewShellId()); + + comphelper::LibreOfficeKit::setActive(false); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); |