summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-02-11 14:34:07 +0100
committerJan Holesovsky <kendy@collabora.com>2016-02-11 15:14:22 +0100
commitcfa9404319ac5310dc772b3b4a9a3d05721e6940 (patch)
treed4f5bf0ba6ea22dd4a0e84b3fd56b5b48f46d8b2 /desktop
parent645ec0a7498932d4f1767353a89576cdf33f9c23 (diff)
lok: Extend the StatusModified unit test with Save As.
Change-Id: Ie9bbce6892fe1dcf55e23028e68037f996d7c71f
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx42
1 files changed, 39 insertions, 3 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 705fa2439333..1d6c5620a00f 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -644,10 +644,10 @@ void DesktopLOKTest::testModifiedStatus()
pDocument->pClass->initializeForRendering(pDocument, nullptr);
pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
- // Set the document as modified.
+ // Type "t" and check that the document was set as modified
+ m_bModified = false;
m_aStateChangedCondition.reset();
- uno::Reference<util::XModifiable> xModifiable(mxComponent, uno::UNO_QUERY);
- xModifiable->setModified(true);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
TimeValue aTimeValue = { 2 , 0 }; // 2 seconds max
m_aStateChangedCondition.wait(aTimeValue);
Scheduler::ProcessEventsToIdle();
@@ -655,6 +655,42 @@ void DesktopLOKTest::testModifiedStatus()
// This was false, there was no callback about the modified status change.
CPPUNIT_ASSERT(m_bModified);
+ // Perform SaveAs with "TakeOwnership" option set, and check that the
+ // modification state was reset
+ m_aStateChangedCondition.reset();
+ utl::TempFile aTempFile;
+ //aTempFile.EnableKillingFile();
+ CPPUNIT_ASSERT(pDocument->pClass->saveAs(pDocument, aTempFile.GetURL().toUtf8().getStr(), "odt", "TakeOwnership"));
+ m_aStateChangedCondition.wait(aTimeValue);
+ Scheduler::ProcessEventsToIdle();
+
+ // There was no callback about the modified status change.
+ CPPUNIT_ASSERT(!m_bModified);
+
+ // Modify the document again
+ m_bModified = false;
+ m_aStateChangedCondition.reset();
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 't', 0);
+ m_aStateChangedCondition.wait(aTimeValue);
+ Scheduler::ProcessEventsToIdle();
+
+ // There was no callback about the modified status change.
+ CPPUNIT_ASSERT(m_bModified);
+
+ /*
+ // TODO: move this to a test where LOK is fully bootstrapped, so that we can
+ // get back the notification about ".uno:Save" too
+ // Now perform a normal "Save", and check the modified state was reset
+ // again
+ m_aStateChangedCondition.reset();
+ pDocument->pClass->postUnoCommand(pDocument, ".uno:Save", nullptr, false);
+ m_aStateChangedCondition.wait(aTimeValue);
+ Scheduler::ProcessEventsToIdle();
+
+ // There was no callback about the modified status change.
+ CPPUNIT_ASSERT(!m_bModified);
+ */
+
comphelper::LibreOfficeKit::setActive(false);
}