[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/qa
Jan Holesovsky
kendy at collabora.com
Sat May 7 19:57:22 UTC 2016
desktop/qa/desktop_lib/test_desktop_lib.cxx | 41 +++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
New commits:
commit 6afeaee7055bdadf22e2935203cfc99b63172215
Author: Jan Holesovsky <kendy at collabora.com>
Date: Thu Feb 11 14:34:07 2016 +0100
lok: Extend the StatusModified unit test with Save As.
(cherry picked from commit cfa9404319ac5310dc772b3b4a9a3d05721e6940)
(cherry picked from commit c0dfafab6459ef06ada37ea7ed5c7ebd59388057)
Change-Id: Ie9bbce6892fe1dcf55e23028e68037f996d7c71f
ad6bb5ba62d114ca760c4215aa8eec872c5d181b
Reviewed-on: https://gerrit.libreoffice.org/24726
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 829563d..fdd6e41 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -691,10 +691,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();
@@ -702,6 +702,41 @@ 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_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);
}
More information about the Libreoffice-commits
mailing list