[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Tue Apr 14 19:04:36 UTC 2020
sc/qa/uitest/calc_tests4/trackedChanges.py | 147 ++++++++++++++++++++++++++++-
1 file changed, 143 insertions(+), 4 deletions(-)
New commits:
commit b752631d18b5c8d68616de8eb4a5f28bd751b748
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Apr 14 19:19:37 2020 +0200
Commit: Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Apr 14 21:03:57 2020 +0200
uitest: improve tests in trackedChanges.py
Change-Id: I644a6e64ab7da002915a43745a35517a144b6cf5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92217
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py
index 2cc737ae18e0..13cdb1319088 100644
--- a/sc/qa/uitest/calc_tests4/trackedChanges.py
+++ b/sc/qa/uitest/calc_tests4/trackedChanges.py
@@ -8,9 +8,10 @@
from uitest.framework import UITestCase
from uitest.debug import sleep
from libreoffice.calc.document import get_cell_by_position
-import time
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+import datetime
class CalcTrackedChanges(UITestCase):
@@ -48,11 +49,45 @@ class CalcTrackedChanges(UITestCase):
#track changes; enter text to cell
self.xUITest.executeCommand(".uno:TraceChangeMode")
enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
#accept tracked changes
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
xAccBtn = xTrackDlg.getChild("accept")
xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted")
+
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(1, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2))
+
xCancBtn = xTrackDlg.getChild("close")
xCancBtn.executeAction("CLICK", tuple())
@@ -68,12 +103,37 @@ class CalcTrackedChanges(UITestCase):
#track changes; enter text to cell
self.xUITest.executeCommand(".uno:TraceChangeMode")
enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
#accept All tracked changes
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
xAccBtn = xTrackDlg.getChild("acceptall")
xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(1, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2))
+
xCancBtn = xTrackDlg.getChild("close")
xCancBtn.executeAction("CLICK", tuple())
@@ -89,12 +149,57 @@ class CalcTrackedChanges(UITestCase):
#track changes; enter text to cell
self.xUITest.executeCommand(".uno:TraceChangeMode")
enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
#accept tracked changes
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
xRejBtn = xTrackDlg.getChild("reject")
xRejBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(3, len(xChangesList.getChildren()))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('2'))["Text"], "Rejected")
+
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected")
+
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')"
+ textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd3))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd4))
+
+ xChangesList.getChild('1').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('1').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2))
+
xCancBtn = xTrackDlg.getChild("close")
xCancBtn.executeAction("CLICK", tuple())
@@ -103,8 +208,6 @@ class CalcTrackedChanges(UITestCase):
def test_tracked_changes_rejectall(self):
- # FIXME flaky test, passed once, but broke multiple times.
- return
calc_doc = self.ui_test.create_doc_in_start_center("calc")
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
@@ -112,16 +215,52 @@ class CalcTrackedChanges(UITestCase):
#track changes; enter text to cell
self.xUITest.executeCommand(".uno:TraceChangeMode")
enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
#accept tracked changes
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
xTrackDlg = self.xUITest.getTopFocusWindow()
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
xAccBtn = xTrackDlg.getChild("rejectall")
xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected")
+
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')"
+ textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd4))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd3))
+
+ xChangesList.getChild('1').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('1').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2))
+
xCancBtn = xTrackDlg.getChild("close")
xCancBtn.executeAction("CLICK", tuple())
self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list