summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-29 17:09:47 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-09-29 17:26:51 +0200
commit1a142d1dbdc33c9c4694e04f3b8b89848da47da6 (patch)
tree7cd7bf66e720eb968ff55344c2f1c127a9ab6484 /uitest
parent3da8806e079c8fa75330100e5c17658b4f7e79a0 (diff)
add complete test for tdf#96453
This is the fourth and final part of the UI test tutorial. The test combines the previous 3 items in the final test. The original test from the first tutorial is used as a template, the SvSimpleTable support is used to assert that the table contains the correct amount of entries, and the UNO helper methods that the document contains the correct amount of conditional formats. Change-Id: Ibe2047e10ff6368c145c88b2bcca9648aa7f8f54
Diffstat (limited to 'uitest')
-rw-r--r--uitest/calc_tests/tdf96453.py58
1 files changed, 57 insertions, 1 deletions
diff --git a/uitest/calc_tests/tdf96453.py b/uitest/calc_tests/tdf96453.py
index 478a7a1d3836..020b901c3f6c 100644
--- a/uitest/calc_tests/tdf96453.py
+++ b/uitest/calc_tests/tdf96453.py
@@ -10,6 +10,10 @@ from uitest.framework import UITestCase
import os
import pathlib
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
+
def get_data_dir():
current_dir = os.path.dirname(os.path.realpath(__file__))
return os.path.join(current_dir, "data")
@@ -23,7 +27,6 @@ class ConditionalFormatDlgTest(UITestCase):
def test_simple_open_manager(self):
calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods"))
- print(dir(calc_doc))
self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
@@ -34,4 +37,57 @@ class ConditionalFormatDlgTest(UITestCase):
self.ui_test.close_doc()
+ def test_tdf96453(self):
+
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods"))
+
+ sheet = get_sheet_from_doc(calc_doc, 0)
+ conditional_format_list = get_conditional_format_from_sheet(sheet)
+ self.assertEqual(conditional_format_list.getLength(), 2)
+
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly two conditional formats in the beginning
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '2')
+
+ # remove one conditional format
+ xRemoveBtn = xCondFormatMgr.getChild("remove")
+ xRemoveBtn.executeAction("CLICK", tuple())
+
+ # check that the table only shows one
+ # but the document still contains two
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ self.assertEqual(conditional_format_list.getLength(), 2)
+
+ # add a new conditional format through the add button
+ xAddBtn = xCondFormatMgr.getChild("add")
+ self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible")
+
+ xCondFormatDlg = self.xUITest.getTopFocusWindow()
+ xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
+
+ # we need to get a pointer again as the old window has been deleted
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check again that we now have 2 and not 3 entries in the list
+ # and still only 2 conditional formats in the document
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '2')
+
+ self.assertEqual(conditional_format_list.getLength(), 2)
+
+ # close the conditional format manager
+ xCancelBtn = xCondFormatMgr.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.close_doc()
+
# vim:set shiftwidth=4 softtabstop=4 expandtab: */