summaryrefslogtreecommitdiff
path: root/desktop/qa/desktop_lib
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-05 13:53:57 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-05 13:25:34 +0000
commit9dd8a0dcfdff21269f6423224d39d168519fb67e (patch)
tree50f908927005fcf5e7534b09fb38838ed50da212 /desktop/qa/desktop_lib
parente50a95b829b327b07ba35e831ae10fb8c40a71ee (diff)
desktop: add undo/redo support to lok::Document::getCommandValues()
Expose the undo/redo stack and the metadata of each item. Change-Id: I66b81e855a945c97be3d491ed709959f310d4b73 Reviewed-on: https://gerrit.libreoffice.org/27905 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'desktop/qa/desktop_lib')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index f5faecf2dcd5..017439160ef7 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -79,6 +79,7 @@ public:
void testSaveAsCalc();
void testPasteWriter();
void testPasteWriterJPEG();
+ void testUndoWriter();
void testRowColumnHeaders();
void testHiddenRowHeaders();
void testCellCursor();
@@ -105,6 +106,7 @@ public:
CPPUNIT_TEST(testSaveAsCalc);
CPPUNIT_TEST(testPasteWriter);
CPPUNIT_TEST(testPasteWriterJPEG);
+ CPPUNIT_TEST(testUndoWriter);
CPPUNIT_TEST(testRowColumnHeaders);
CPPUNIT_TEST(testHiddenRowHeaders);
CPPUNIT_TEST(testCellCursor);
@@ -502,6 +504,27 @@ void DesktopLOKTest::testPasteWriterJPEG()
comphelper::LibreOfficeKit::setActive(false);
}
+void DesktopLOKTest::testUndoWriter()
+{
+ // Load a Writer document and press a key.
+ comphelper::LibreOfficeKit::setActive();
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 't', 0);
+
+ // Get undo info.
+ boost::property_tree::ptree aTree;
+ char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:Undo");
+ std::stringstream aStream(pJSON);
+ free(pJSON);
+ CPPUNIT_ASSERT(!aStream.str().empty());
+ boost::property_tree::read_json(aStream, aTree);
+ // Make sure that pressing a key creates exactly one undo action.
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aTree.get_child("actions").size());
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
void DesktopLOKTest::testRowColumnHeaders()
{
/*