summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-04 09:13:33 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-04 08:41:33 +0000
commit7cbb0664b94bb9f4587098c1940de98e4f7aae16 (patch)
treeb0f4aa00173ef868f2fadd8d164e251f2e1512d5 /sc/qa
parent2b3112b30a8dea8a009c11ddb209e12697f72e32 (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>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 093fa181db52..d5258c2d0447 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -61,6 +61,7 @@ public:
void testDocumentSizeChanged();
void testViewLock();
void testColRowResize();
+ void testUndoShells();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -73,6 +74,7 @@ public:
CPPUNIT_TEST(testDocumentSizeChanged);
CPPUNIT_TEST(testViewLock);
CPPUNIT_TEST(testColRowResize);
+ CPPUNIT_TEST(testUndoShells);
CPPUNIT_TEST_SUITE_END();
private:
@@ -582,6 +584,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);