diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-10 17:45:55 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-13 10:36:51 +0200 |
commit | 47847b879bf6b5bb6e0f6117e0f9683b3a932a08 (patch) | |
tree | f22e2316b69fa74630d8ec7ed48da0e9077a16df /sc/qa | |
parent | a917d4abd8577cf7d6655f0484ff55dd86a0a8a1 (diff) |
uitest: guard execute_modeless_dialog_through_command in sc
Change-Id: Ifd03ae26659ff56d36bfe8d4938d690ada761d5f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121912
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
52 files changed, 1198 insertions, 1514 deletions
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py index 4c1b8194fb06..3765640ff7e9 100644 --- a/sc/qa/uitest/autofilter/autofilter.py +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -443,14 +443,11 @@ class AutofilterTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xval1 = xDialog.getChild("val1") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xval1 = xDialog.getChild("val1") - select_by_text(xval1, "0.365") + select_by_text(xval1, "0.365") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertFalse(is_row_hidden(doc, 0)) self.assertFalse(is_row_hidden(doc, 1)) @@ -467,19 +464,16 @@ class AutofilterTest(UITestCase): #Test '<' condition xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") - select_by_text(xfield1, "Values") - select_by_text(xcond1, "<") - select_by_text(xval1, "0.365") + select_by_text(xfield1, "Values") + select_by_text(xcond1, "<") + select_by_text(xval1, "0.365") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertFalse(is_row_hidden(doc, 0)) self.assertTrue(is_row_hidden(doc, 1)) @@ -492,18 +486,15 @@ class AutofilterTest(UITestCase): #Test '>=' condition xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "Values") - select_by_text(xcond1, ">=") - select_by_text(xval1, "0.046") - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "Values") + select_by_text(xcond1, ">=") + select_by_text(xval1, "0.046") + self.assertFalse(is_row_hidden(doc, 0)) self.assertFalse(is_row_hidden(doc, 1)) diff --git a/sc/qa/uitest/calc_tests/fillRandomNumber.py b/sc/qa/uitest/calc_tests/fillRandomNumber.py index 34927bf98099..ac325e5303fc 100644 --- a/sc/qa/uitest/calc_tests/fillRandomNumber.py +++ b/sc/qa/uitest/calc_tests/fillRandomNumber.py @@ -16,29 +16,26 @@ class fillRandomNumber(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform Integer") + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") - xparameter1spin.executeAction("UP", tuple()) - xparameter2spin.executeAction("UP", tuple()) - xenableseedcheck.executeAction("CLICK", tuple()) - xseedspin.executeAction("UP", tuple()) - xenableroundingcheck.executeAction("CLICK", tuple()) - xdecimalplacesspin.executeAction("UP", tuple()) + xparameter1spin.executeAction("UP", tuple()) + xparameter2spin.executeAction("UP", tuple()) + xenableseedcheck.executeAction("CLICK", tuple()) + xseedspin.executeAction("UP", tuple()) + xenableroundingcheck.executeAction("CLICK", tuple()) + xdecimalplacesspin.executeAction("UP", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Verify self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) @@ -47,10 +44,9 @@ class fillRandomNumber(UITestCase): self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) #close dialog without doing anything - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RandomNumberGeneratorDialog", close_button="close"): + pass + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/printRange.py b/sc/qa/uitest/calc_tests/printRange.py index 1082e10de3fc..6334153fdd9e 100644 --- a/sc/qa/uitest/calc_tests/printRange.py +++ b/sc/qa/uitest/calc_tests/printRange.py @@ -18,50 +18,41 @@ class printRange(UITestCase): #Set print range self.xUITest.executeCommand(".uno:DefinePrintArea") # Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xlbprintarea = xDialog.getChild("lbprintarea") - xedprintarea = xDialog.getChild("edprintarea") - #verify range - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - #set Row - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) - #set Column - xedrepeatcol = xDialog.getChild("edrepeatcol") - xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:EditPrintArea") as xDialog: + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok #Verify Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xCancel = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancel) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:EditPrintArea", close_button="cancel") as xDialog: + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") #delete print ranges self.xUITest.executeCommand(".uno:DeletePrintArea") #Verify Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xlbprintarea = xDialog.getChild("lbprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "") - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- entire sheet -") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:EditPrintArea") as xDialog: + xedprintarea = xDialog.getChild("edprintarea") + xlbprintarea = xDialog.getChild("lbprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "") + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- entire sheet -") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") def test_tdf33341_copy_sheet_with_print_range(self): with self.ui_test.create_doc_in_start_center("calc"): @@ -72,37 +63,31 @@ class printRange(UITestCase): #Set print range self.xUITest.executeCommand(".uno:DefinePrintArea") # Print Range dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xlbprintarea = xDialog.getChild("lbprintarea") - xedprintarea = xDialog.getChild("edprintarea") - #verify range - self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - #set Row - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) - #set Column - xedrepeatcol = xDialog.getChild("edrepeatcol") - xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) - # Click Ok - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:EditPrintArea") as xDialog: + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok #Copy sheet with self.ui_test.execute_dialog_through_command(".uno:Move"): pass #Verify Print Range dialog on new sheet - self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") - xDialog = self.xUITest.getTopFocusWindow() - xedprintarea = xDialog.getChild("edprintarea") - xedrepeatrow = xDialog.getChild("edrepeatrow") - xedrepeatcol = xDialog.getChild("edrepeatcol") - self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") - self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") - self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") - xOK = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOK) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:EditPrintArea") as xDialog: + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/consolidate.py b/sc/qa/uitest/calc_tests2/consolidate.py index 83ed3587dad1..91bc581250ae 100644 --- a/sc/qa/uitest/calc_tests2/consolidate.py +++ b/sc/qa/uitest/calc_tests2/consolidate.py @@ -16,32 +16,30 @@ class consolidate(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") - xDialog = self.xUITest.getTopFocusWindow() - xfunc = xDialog.getChild("func") - xlbdataarea = xDialog.getChild("lbdataarea") - xadd = xDialog.getChild("add") - xbyrow = xDialog.getChild("byrow") - xbycol = xDialog.getChild("bycol") - xeddestarea = xDialog.getChild("eddestarea") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") - select_by_text(xfunc, "Sum") + select_by_text(xfunc, "Sum") + + select_by_text(xlbdataarea, "range1") + xadd.executeAction("CLICK", tuple()) + select_by_text(xlbdataarea, "range2") + xadd.executeAction("CLICK", tuple()) + propsC = {"TEXT": "range3"} + actionPropsC = mkPropertyValues(propsC) + xlbdataarea.executeAction("SELECT", actionPropsC) + xadd.executeAction("CLICK", tuple()) + xbyrow.executeAction("CLICK", tuple()) + xbycol.executeAction("CLICK", tuple()) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Total.$A$2"})) - select_by_text(xlbdataarea, "range1") - xadd.executeAction("CLICK", tuple()) - select_by_text(xlbdataarea, "range2") - xadd.executeAction("CLICK", tuple()) - propsC = {"TEXT": "range3"} - actionPropsC = mkPropertyValues(propsC) - xlbdataarea.executeAction("SELECT", actionPropsC) - xadd.executeAction("CLICK", tuple()) - xbyrow.executeAction("CLICK", tuple()) - xbycol.executeAction("CLICK", tuple()) - xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xeddestarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Total.$A$2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 300) self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 303) @@ -63,27 +61,24 @@ class consolidate(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 315) self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 318) #verify dialog - self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") - xDialog = self.xUITest.getTopFocusWindow() - xfunc = xDialog.getChild("func") - xlbdataarea = xDialog.getChild("lbdataarea") - xdelete = xDialog.getChild("delete") - xbyrow = xDialog.getChild("byrow") - xbycol = xDialog.getChild("bycol") - xeddestarea = xDialog.getChild("eddestarea") - xconsareas = xDialog.getChild("consareas") - self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum") - self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3") - self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2") - self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true") - self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true") - #delete first range - xFirstEntry = xconsareas.getChild("0") - xFirstEntry.executeAction("SELECT", tuple()) - xdelete.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xdelete = xDialog.getChild("delete") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + xconsareas = xDialog.getChild("consareas") + self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum") + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3") + self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2") + self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true") + self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true") + #delete first range + xFirstEntry = xconsareas.getChild("0") + xFirstEntry.executeAction("SELECT", tuple()) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2") self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 200) self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 202) @@ -106,9 +101,7 @@ class consolidate(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 212) # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataConsolidate", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/standardFilter.py b/sc/qa/uitest/calc_tests2/standardFilter.py index 008edc521e9b..5f6c456977f3 100644 --- a/sc/qa/uitest/calc_tests2/standardFilter.py +++ b/sc/qa/uitest/calc_tests2/standardFilter.py @@ -20,21 +20,18 @@ class standardFilter(UITestCase): gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xconnect2 = xDialog.getChild("connect2") - xfield2 = xDialog.getChild("field2") - xval2 = xDialog.getChild("val2") - - select_by_text(xfield1, "a") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - select_by_text(xconnect2, "OR") - select_by_text(xfield2, "b") - xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) #3x down - should be on row 9 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) @@ -46,21 +43,18 @@ class standardFilter(UITestCase): gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xconnect2 = xDialog.getChild("connect2") - xfield2 = xDialog.getChild("field2") - xval2 = xDialog.getChild("val2") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a") - self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b") - self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR") - self.assertEqual(get_state_as_dict(xval1)["Text"], "1") - self.assertEqual(get_state_as_dict(xval2)["Text"], "3") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a") + self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b") + self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR") + self.assertEqual(get_state_as_dict(xval1)["Text"], "1") + self.assertEqual(get_state_as_dict(xval2)["Text"], "3") def test_standard_filter_copy_result(self): with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc: @@ -68,24 +62,21 @@ class standardFilter(UITestCase): gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xconnect2 = xDialog.getChild("connect2") - xfield2 = xDialog.getChild("field2") - xval2 = xDialog.getChild("val2") - xcopyresult = xDialog.getChild("copyresult") - xedcopyarea = xDialog.getChild("edcopyarea") - select_by_text(xfield1, "a") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - select_by_text(xconnect2, "OR") - select_by_text(xfield2, "b") - xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xcopyresult.executeAction("CLICK", tuple()) - xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "a") self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "b") @@ -103,24 +94,21 @@ class standardFilter(UITestCase): gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xconnect2 = xDialog.getChild("connect2") - xfield2 = xDialog.getChild("field2") - xval2 = xDialog.getChild("val2") - xcopyresult = xDialog.getChild("copyresult") - xedcopyarea = xDialog.getChild("edcopyarea") - select_by_text(xfield1, "a") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - select_by_text(xconnect2, "OR") - select_by_text(xfield2, "b") - xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xcopyresult.executeAction("CLICK", tuple()) - xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) #verify self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 0).getString(), "a") self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 0).getString(), "b") @@ -146,17 +134,14 @@ class standardFilter(UITestCase): enter_text_to_cell(gridwin, "B3", "5") enter_text_to_cell(gridwin, "B4", "6") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcase = xDialog.getChild("case") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) - xcase.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) + xcase.executeAction("CLICK", tuple()) #2x down - should be on row 5 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) @@ -166,17 +151,14 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcase = xDialog.getChild("case") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") - self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") + self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") def test_standard_filter_regular_expression(self): with self.ui_test.create_doc_in_start_center("calc"): @@ -196,17 +178,14 @@ class standardFilter(UITestCase): enter_text_to_cell(gridwin, "B5", "4") enter_text_to_cell(gridwin, "B6", "5") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) - xregexp.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) #3x down - should be on row 7 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) @@ -218,17 +197,14 @@ class standardFilter(UITestCase): gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") - self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") def test_standard_filter_condition_contains(self): with self.ui_test.create_doc_in_start_center("calc"): @@ -248,17 +224,14 @@ class standardFilter(UITestCase): enter_text_to_cell(gridwin, "B5", "4") enter_text_to_cell(gridwin, "B6", "5") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - select_by_text(xfield1, "first") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) - xregexp.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) #3x down - should be on row 7 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) @@ -270,17 +243,14 @@ class standardFilter(UITestCase): gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xregexp = xDialog.getChild("regexp") - - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") - self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") - self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") #from testcasespecification OOo def test_standard_filter_condition_contains2(self): @@ -312,17 +282,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Contains"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Contains") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Contains") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) #Verify that row 1,3, 4 are visible (2 and 5 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -335,16 +302,13 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") def test_standard_filter_condition_does_not_contains(self): with self.ui_test.create_doc_in_start_center("calc"): @@ -375,17 +339,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not contain") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not contain") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) #Verify that row 1,2, 5 are visible (3 and 4 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -398,16 +359,13 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") def test_standard_filter_condition_Begins_with(self): @@ -439,17 +397,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Begins with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Begins with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) #Verify that row 1,3, 4 are visible (2 and 5 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -462,16 +417,13 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "so") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") def test_standard_filter_condition_Does_not_begin_with(self): @@ -503,17 +455,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not begin with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not begin with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) #Verify that row 1,2, 5 are visible (3 and 4 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -526,16 +475,13 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "so") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") def test_standard_filter_condition_Ends_with(self): @@ -567,17 +513,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Ends with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Ends with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) #Verify that row 1,2, 5 are visible (3 and 4 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -590,16 +533,13 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "s") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") def test_standard_filter_condition_Does_not_end_with(self): @@ -631,17 +571,14 @@ class standardFilter(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) #Choose DATA-FILTER-STANDARDFILTER #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - - select_by_text(xfield1, "A") - select_by_text(xcond1, "Does not end with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) #Verify that row 1,3, 4 are visible (2 and 5 are hidden) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -654,15 +591,12 @@ class standardFilter(UITestCase): #reopen filter and verify gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") - self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") - self.assertEqual(get_state_as_dict(xval1)["Text"], "s") - self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf104117.py b/sc/qa/uitest/calc_tests2/tdf104117.py index c58d68bd7432..b1ef140b73a7 100644 --- a/sc/qa/uitest/calc_tests2/tdf104117.py +++ b/sc/qa/uitest/calc_tests2/tdf104117.py @@ -16,25 +16,22 @@ class tdf104117(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform Integer") - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Verify self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) diff --git a/sc/qa/uitest/calc_tests3/tdf77509.py b/sc/qa/uitest/calc_tests3/tdf77509.py index 40e741a7dd42..a63d9c98183a 100644 --- a/sc/qa/uitest/calc_tests3/tdf77509.py +++ b/sc/qa/uitest/calc_tests3/tdf77509.py @@ -20,30 +20,28 @@ class tdf77509(UITestCase): #2. Select any empty cell, eg. cell D1 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) #3. Tab: Data > Consolidate - self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") - xDialog = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataConsolidate") as xDialog: - xfunc = xDialog.getChild("func") - xeddataarea = xDialog.getChild("eddataarea") - xadd = xDialog.getChild("add") - xbyrow = xDialog.getChild("byrow") - xbycol = xDialog.getChild("bycol") - xeddestarea = xDialog.getChild("eddestarea") + xfunc = xDialog.getChild("func") + xeddataarea = xDialog.getChild("eddataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") - select_by_text(xfunc, "Sum") - #4. Source data ranges: $Sheet1.$A$1:$B$7 - #5. Click 'Add' so that ranges appear in "Consolidation ranges" - xeddataarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$7"})) - xadd.executeAction("CLICK", tuple()) + select_by_text(xfunc, "Sum") + #4. Source data ranges: $Sheet1.$A$1:$B$7 + #5. Click 'Add' so that ranges appear in "Consolidation ranges" + xeddataarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$7"})) + xadd.executeAction("CLICK", tuple()) - xConsAreas = xDialog.getChild("consareas") - self.assertEqual(1, len(xConsAreas.getChildren())) - self.assertEqual("$Sheet1.$A$1:$B$7", get_state_as_dict(xConsAreas.getChild("0"))['Text']) + xConsAreas = xDialog.getChild("consareas") + self.assertEqual(1, len(xConsAreas.getChildren())) + self.assertEqual("$Sheet1.$A$1:$B$7", get_state_as_dict(xConsAreas.getChild("0"))['Text']) + + #6. Click 'Options' > check 'Row labels' > click OK + xbyrow.executeAction("CLICK", tuple()) - #6. Click 'Options' > check 'Row labels' > click OK - xbyrow.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #verify self.assertEqual("A 1", get_cell_by_position(calc_doc, 0, 3, 0).getString()) self.assertEqual("AB 1", get_cell_by_position(calc_doc, 0, 3, 1).getString()) diff --git a/sc/qa/uitest/calc_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py index 6345c53f91a8..5e97df56d7a1 100644 --- a/sc/qa/uitest/calc_tests3/tdf80693.py +++ b/sc/qa/uitest/calc_tests3/tdf80693.py @@ -16,29 +16,26 @@ class tdf80693(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcellrangeedit = xDialog.getChild("cell-range-edit") - xdistributioncombo = xDialog.getChild("distribution-combo") - xparameter1spin = xDialog.getChild("parameter1-spin") - xparameter2spin = xDialog.getChild("parameter2-spin") - xenableseedcheck = xDialog.getChild("enable-seed-check") - xseedspin = xDialog.getChild("seed-spin") - xenableroundingcheck = xDialog.getChild("enable-rounding-check") - xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") - xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) - select_by_text(xdistributioncombo, "Uniform") + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform") - xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Verify self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 2) diff --git a/sc/qa/uitest/calc_tests4/tdf138089.py b/sc/qa/uitest/calc_tests4/tdf138089.py index c59838df86db..a59b7ce29798 100644 --- a/sc/qa/uitest/calc_tests4/tdf138089.py +++ b/sc/qa/uitest/calc_tests4/tdf138089.py @@ -27,13 +27,10 @@ class tdf138089(UITestCase): self.assertFalse(is_row_hidden(calc_doc, 6)) # Without the fix in place, this test would have crashed here - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("2017-12-01", get_state_as_dict(xDialog.getChild("val1"))['Text']) - self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + self.assertEqual("2017-12-01", get_state_as_dict(xDialog.getChild("val1"))['Text']) + self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) self.assertFalse(is_row_hidden(calc_doc, 0)) self.assertTrue(is_row_hidden(calc_doc, 1)) diff --git a/sc/qa/uitest/calc_tests4/tdf141547.py b/sc/qa/uitest/calc_tests4/tdf141547.py index cfe8e1d33cb0..e0203847e30c 100644 --- a/sc/qa/uitest/calc_tests4/tdf141547.py +++ b/sc/qa/uitest/calc_tests4/tdf141547.py @@ -23,15 +23,12 @@ class tdf141547(UITestCase): self.assertTrue(is_row_hidden(calc_doc, i)) # Without the fix in place, this test would have crashed here - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - self.assertEqual("0", get_state_as_dict(xDialog.getChild("val1"))['Text']) - self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) - self.assertEqual("Empty", get_state_as_dict(xDialog.getChild("val2"))['Text']) - self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field2"))["DisplayText"]) - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + self.assertEqual("0", get_state_as_dict(xDialog.getChild("val1"))['Text']) + self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) + self.assertEqual("Empty", get_state_as_dict(xDialog.getChild("val2"))['Text']) + self.assertEqual("过帐日期", get_state_as_dict(xDialog.getChild("field2"))["DisplayText"]) + self.assertFalse(is_row_hidden(calc_doc, 0)) for i in range(1, 7): diff --git a/sc/qa/uitest/calc_tests4/tdf89958.py b/sc/qa/uitest/calc_tests4/tdf89958.py index 1f97bc57ceca..1e36bb48fd54 100644 --- a/sc/qa/uitest/calc_tests4/tdf89958.py +++ b/sc/qa/uitest/calc_tests4/tdf89958.py @@ -22,17 +22,14 @@ class tdf89958(UITestCase): #Menu: Data->Filter->Standard Filter ... #Field Name "Column A", Condition "Does not end with", Value: "CTORS" - self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") - xDialog = self.xUITest.getTopFocusWindow() - xfield1 = xDialog.getChild("field1") - xval1 = xDialog.getChild("val1") - xcond1 = xDialog.getChild("cond1") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") - select_by_text(xfield1, "Column A") - select_by_text(xcond1, "Does not end with") - xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + select_by_text(xfield1, "Column A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"})) #Expected behaviours: A2 is not filtered as it does not end with "CTORS". gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py index e4f06577aa9c..07c1c8db768e 100644 --- a/sc/qa/uitest/calc_tests4/trackedChanges.py +++ b/sc/qa/uitest/calc_tests4/trackedChanges.py @@ -17,27 +17,24 @@ class CalcTrackedChanges(UITestCase): def test_tdf131907(self): with self.ui_test.load_file(get_url_for_data_file("tdf131907.ods")) as calc_doc: xCalcDoc = self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(1, len(xChangesList.getChildren())) + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(1, len(xChangesList.getChildren())) - textStart = "Row inserted \tSheet1.1:1\t \t" - textEnd = "(Row 1:1 inserted)" - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) - self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) + textStart = "Row inserted \tSheet1.1:1\t \t" + textEnd = "(Row 1:1 inserted)" + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd)) - #it would crash here - xRejBtn = xTrackDlg.getChild("reject") - xRejBtn.executeAction("CLICK", tuple()) + #it would crash here + xRejBtn = xTrackDlg.getChild("reject") + xRejBtn.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") + 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") - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) def test_tdf66263_Protect_Records(self): with self.ui_test.create_doc_in_start_center("calc") as document: @@ -68,45 +65,42 @@ class CalcTrackedChanges(UITestCase): 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() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) + 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)) + 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()) + 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") + 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()) + 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(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.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)) + 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()) self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") @@ -121,37 +115,34 @@ class CalcTrackedChanges(UITestCase): 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() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) + 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)) + 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()) + 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(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.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)) + 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()) self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") @@ -166,57 +157,54 @@ class CalcTrackedChanges(UITestCase): 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()) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + 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)) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") @@ -231,48 +219,45 @@ class CalcTrackedChanges(UITestCase): 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() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(2, len(xChangesList.getChildren())) + 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)) + 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()) + 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") + 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())) + 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)) + 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())) + 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)) + 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(), "") @@ -282,25 +267,22 @@ class CalcTrackedChanges(UITestCase): self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges") - xTrackDlg = self.xUITest.getTopFocusWindow() + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AcceptChanges", close_button="close") as xTrackDlg: - xChangesList = xTrackDlg.getChild("calcchanges") - self.assertEqual(1, len(xChangesList.getChildren())) + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(1, len(xChangesList.getChildren())) - xRejectAllBtn = xTrackDlg.getChild("rejectall") - xRejectBtn = xTrackDlg.getChild("reject") - xAcceptAllBtn = xTrackDlg.getChild("acceptall") - xAcceptBtn = xTrackDlg.getChild("accept") + xRejectAllBtn = xTrackDlg.getChild("rejectall") + xRejectBtn = xTrackDlg.getChild("reject") + xAcceptAllBtn = xTrackDlg.getChild("acceptall") + xAcceptBtn = xTrackDlg.getChild("accept") - # Without the fix in place, it would have failed with - # AssertionError: 'R~eject All' != 'R~eject All/Clear formatting' - self.assertEqual('R~eject All', get_state_as_dict(xRejectAllBtn)['Text']) - self.assertEqual('~Reject', get_state_as_dict(xRejectBtn)['Text']) - self.assertEqual('A~ccept All', get_state_as_dict(xAcceptAllBtn)['Text']) - self.assertEqual('~Accept', get_state_as_dict(xAcceptBtn)['Text']) + # Without the fix in place, it would have failed with + # AssertionError: 'R~eject All' != 'R~eject All/Clear formatting' + self.assertEqual('R~eject All', get_state_as_dict(xRejectAllBtn)['Text']) + self.assertEqual('~Reject', get_state_as_dict(xRejectBtn)['Text']) + self.assertEqual('A~ccept All', get_state_as_dict(xAcceptAllBtn)['Text']) + self.assertEqual('~Accept', get_state_as_dict(xAcceptBtn)['Text']) - xCancBtn = xTrackDlg.getChild("close") - xCancBtn.executeAction("CLICK", tuple()) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py index d649bb8dea9d..ade3008f9af1 100644 --- a/sc/qa/uitest/calc_tests6/multipleOperations.py +++ b/sc/qa/uitest/calc_tests6/multipleOperations.py @@ -38,15 +38,12 @@ class multipleOperations(UITestCase): #Select the range D2:E11 xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"})) #Choose Data > Multiple Operations. - self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") - xDialog = self.xUITest.getTopFocusWindow() - #Formulas = B5 ; Column input cell = B4 - formulas = xDialog.getChild("formulas") - col = xDialog.getChild("col") - formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) - col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:TableOperationDialog") as xDialog: + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) #verify self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) @@ -85,15 +82,12 @@ class multipleOperations(UITestCase): #Select the range D2:F11 xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"})) #Choose Data > Multiple Operations. - self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") - xDialog = self.xUITest.getTopFocusWindow() - #Formulas = B5 ; Column input cell = B4 - formulas = xDialog.getChild("formulas") - col = xDialog.getChild("col") - formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) - col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:TableOperationDialog") as xDialog: + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) #verify self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) diff --git a/sc/qa/uitest/calc_tests9/forms.py b/sc/qa/uitest/calc_tests9/forms.py index aceb5a8b589d..54f3e1538952 100644 --- a/sc/qa/uitest/calc_tests9/forms.py +++ b/sc/qa/uitest/calc_tests9/forms.py @@ -19,10 +19,10 @@ class Forms(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "form"})) # Without the fix in place, this test would have hung here - self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ControlProperties", close_button=""): - xCellRange = self.ui_test.wait_until_child_is_available('textfield-Source cell range') + xCellRange = self.ui_test.wait_until_child_is_available('textfield-Source cell range') - self.assertEqual("A1:A7000", get_state_as_dict(xCellRange)['Text']) + self.assertEqual("A1:A7000", get_state_as_dict(xCellRange)['Text']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105351.py b/sc/qa/uitest/conditional_format/tdf105351.py index 240fd14f79a4..64dea784748b 100644 --- a/sc/qa/uitest/conditional_format/tdf105351.py +++ b/sc/qa/uitest/conditional_format/tdf105351.py @@ -22,41 +22,35 @@ class tdf105351(UITestCase): enter_text_to_cell(gridwin, "A1", "5") #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcolscalemin = xDialog.getChild("colscalemin") - xedcolscalemin = xDialog.getChild("edcolscalemin") - xcolscalemax = xDialog.getChild("colscalemax") - xedcolscalemax = xDialog.getChild("edcolscalemax") - #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" - #and change it to "Value". In the text field below it enter 0. - #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 - select_by_text(xcolscalemin, "Value") - xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataBarFormatDialog") as xDialog: + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" + #and change it to "Value". In the text field below it enter 0. + #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 + select_by_text(xcolscalemin, "Value") + xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - select_by_text(xcolscalemax, "Value") - xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + select_by_text(xcolscalemax, "Value") + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Verify : The conditions set for cell A1 should be shown and editable. - self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") - xDialog = self.xUITest.getTopFocusWindow() - xcolscalemin = xDialog.getChild("colscalemin") - xedcolscalemin = xDialog.getChild("edcolscalemin") - xcolscalemax = xDialog.getChild("colscalemax") - xedcolscalemax = xDialog.getChild("edcolscalemax") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DataBarFormatDialog") as xDialog: + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") - self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") - self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") - self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") - #editable - change value and then verify - xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") + self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") + self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") + #editable - change value and then verify + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105411.py b/sc/qa/uitest/conditional_format/tdf105411.py index e7f7dd745fdf..3a8ca687f3db 100644 --- a/sc/qa/uitest/conditional_format/tdf105411.py +++ b/sc/qa/uitest/conditional_format/tdf105411.py @@ -13,22 +13,18 @@ class tdf105411(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ConditionalFormatDialog", close_button="") as xCondFormatDlg: + xDeleteBtn = xCondFormatDlg.getChild("delete") + xDeleteBtn.executeAction("CLICK", tuple()) - xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatDlg = self.xUITest.getTopFocusWindow() - xDeleteBtn = xCondFormatDlg.getChild("delete") - xDeleteBtn.executeAction("CLICK", tuple()) + xDeleteBtn = xCondFormatDlg.getChild("add") + xDeleteBtn.executeAction("CLICK", tuple()) - xCondFormatDlg = self.xUITest.getTopFocusWindow() - - xDeleteBtn = xCondFormatDlg.getChild("add") - xDeleteBtn.executeAction("CLICK", tuple()) - - xCondFormatDlg = self.xUITest.getTopFocusWindow() - - xOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105466.py b/sc/qa/uitest/conditional_format/tdf105466.py index 5214e3f7d21f..a28af15cabf0 100644 --- a/sc/qa/uitest/conditional_format/tdf105466.py +++ b/sc/qa/uitest/conditional_format/tdf105466.py @@ -17,17 +17,13 @@ class tdf105466(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ConditionalFormatDialog") as xCondFormatDlg: - for i in range(0,4): - with self.subTest(i = i): - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xTypeLstBox = xCondFormatDlg.getChild("type") - xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) + for i in range(0,4): + with self.subTest(i = i): + xTypeLstBox = xCondFormatDlg.getChild("type") + xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) - xCondFormatDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCondFormatDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/function_wizard.py b/sc/qa/uitest/function_wizard/function_wizard.py index f2356e9ba4fc..b31649edb0cf 100644 --- a/sc/qa/uitest/function_wizard/function_wizard.py +++ b/sc/qa/uitest/function_wizard/function_wizard.py @@ -14,15 +14,12 @@ class FunctionWizardTest(UITestCase): def test_open_function_wizard(self): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: - xFunctionDlg = self.xUITest.getTopFocusWindow() - xArrayChkBox = xFunctionDlg.getChild("array") - xArrayChkBox.executeAction("CLICK", tuple()) + xArrayChkBox = xFunctionDlg.getChild("array") + xArrayChkBox.executeAction("CLICK", tuple()) - xCancelBtn = xFunctionDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf123479.py b/sc/qa/uitest/function_wizard/tdf123479.py index b94037855c16..d37e8e879683 100644 --- a/sc/qa/uitest/function_wizard/tdf123479.py +++ b/sc/qa/uitest/function_wizard/tdf123479.py @@ -25,19 +25,16 @@ class tdf123479(UITestCase): #Select D14:D16 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"})) #Open Formula Wizard (Ctrl+F2) - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xDialog = self.xUITest.getTopFocusWindow() - edArg1 = xDialog.getChild("ED_ARG1") - edArg2 = xDialog.getChild("ED_ARG2") - formulaRes = xDialog.getChild("formula_result") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog") as xDialog: + edArg1 = xDialog.getChild("ED_ARG1") + edArg2 = xDialog.getChild("ED_ARG2") + formulaRes = xDialog.getChild("formula_result") - #check formula wizard data - self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)") - self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)") - self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}") + #check formula wizard data + self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)") + self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)") + self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}") - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) #verify; no crashes self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "Pass/Fail") diff --git a/sc/qa/uitest/function_wizard/tdf132173.py b/sc/qa/uitest/function_wizard/tdf132173.py index cad38a306d64..f29cc32171b9 100644 --- a/sc/qa/uitest/function_wizard/tdf132173.py +++ b/sc/qa/uitest/function_wizard/tdf132173.py @@ -13,15 +13,12 @@ class tdf132173(UITestCase): def test_tdf132173(self): with self.ui_test.create_doc_in_start_center("calc") as document: - self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xDialog = self.xUITest.getTopFocusWindow() - xFormula = xDialog.getChild("ed_formula") - xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FunctionDialog") as xDialog: + xFormula = xDialog.getChild("ed_formula") + xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) - self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') + self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') - xOk = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOk) #Without the fix in place, cell's value would have been #NAME? diff --git a/sc/qa/uitest/goalSeek/goalSeek.py b/sc/qa/uitest/goalSeek/goalSeek.py index 784614e46d12..ac3c3f8ef437 100644 --- a/sc/qa/uitest/goalSeek/goalSeek.py +++ b/sc/qa/uitest/goalSeek/goalSeek.py @@ -17,17 +17,16 @@ class goalSeek(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") - xDialog = self.xUITest.getTopFocusWindow() - xformulaedit = xDialog.getChild("formulaedit") - xtarget = xDialog.getChild("target") - xvaredit = xDialog.getChild("varedit") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"15000"})) - xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) - xOKBtn = xDialog.getChild("ok") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:GoalSeekDialog", close_button="") as xDialog: + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"15000"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + xOKBtn = xDialog.getChild("ok") - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): - pass + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 200000) diff --git a/sc/qa/uitest/goalSeek/tdf37341.py b/sc/qa/uitest/goalSeek/tdf37341.py index 14e359c8644f..48a240c12d02 100644 --- a/sc/qa/uitest/goalSeek/tdf37341.py +++ b/sc/qa/uitest/goalSeek/tdf37341.py @@ -19,17 +19,16 @@ class tdf37341(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F111"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") - xDialog = self.xUITest.getTopFocusWindow() - xformulaedit = xDialog.getChild("formulaedit") - xtarget = xDialog.getChild("target") - xvaredit = xDialog.getChild("varedit") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"})) - xOKBtn = xDialog.getChild("ok") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:GoalSeekDialog", close_button="") as xDialog: + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"})) + xOKBtn = xDialog.getChild("ok") - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): - pass + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 6).getValue() > 0, True) diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py index 93c286389e1b..229e488cf290 100644 --- a/sc/qa/uitest/goalSeek/tdf43693.py +++ b/sc/qa/uitest/goalSeek/tdf43693.py @@ -19,17 +19,16 @@ class tdf43693(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "K248"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") - xDialog = self.xUITest.getTopFocusWindow() - xformulaedit = xDialog.getChild("formulaedit") - xtarget = xDialog.getChild("target") - xvaredit = xDialog.getChild("varedit") - xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"})) - xOKBtn = xDialog.getChild("ok") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:GoalSeekDialog", close_button="") as xDialog: + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"})) + xOKBtn = xDialog.getChild("ok") - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): - pass + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 4).getValue(), 0.04) diff --git a/sc/qa/uitest/manual_tests/calc.py b/sc/qa/uitest/manual_tests/calc.py index 68d1a7a82aa5..27fb0597d044 100644 --- a/sc/qa/uitest/manual_tests/calc.py +++ b/sc/qa/uitest/manual_tests/calc.py @@ -23,15 +23,12 @@ class ManualCalcTests(UITestCase): xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D10"})) # Execute "Define DB Range dialog" - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName") as xDefineNameDlg: - xDefineNameDlg = self.xUITest.getTopFocusWindow() - xEntryBox = xDefineNameDlg.getChild("entry") - type_text(xEntryBox, "my_database") + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "my_database") - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) # Deselect range xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) @@ -170,31 +167,28 @@ class ManualCalcTests(UITestCase): xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A10"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") - xRandomNumberDlg = self.xUITest.getTopFocusWindow() - xDistributionLstBox = xRandomNumberDlg.getChild("distribution-combo") - xDistributionLstBox.executeAction("SELECT", mkPropertyValues({"POS": "1"})) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RandomNumberGeneratorDialog") as xRandomNumberDlg: + xDistributionLstBox = xRandomNumberDlg.getChild("distribution-combo") + xDistributionLstBox.executeAction("SELECT", mkPropertyValues({"POS": "1"})) - xMin = xRandomNumberDlg.getChild("parameter1-spin") - xMin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xMin.executeAction("TYPE", mkPropertyValues({"TEXT": "-2"})) - xMax = xRandomNumberDlg.getChild("parameter2-spin") - xMax.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xMax.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + xMin = xRandomNumberDlg.getChild("parameter1-spin") + xMin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMin.executeAction("TYPE", mkPropertyValues({"TEXT": "-2"})) + xMax = xRandomNumberDlg.getChild("parameter2-spin") + xMax.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMax.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) - xApplyBtn = xRandomNumberDlg.getChild("apply") - xApplyBtn.executeAction("CLICK", tuple()) + xApplyBtn = xRandomNumberDlg.getChild("apply") + xApplyBtn.executeAction("CLICK", tuple()) - def check_random_values(): - for i in range(1, 9): - val = get_cell_by_position(document, 0, 0, i).getValue() - self.assertTrue(val <= 10 and val >= -2) + def check_random_values(): + for i in range(1, 9): + val = get_cell_by_position(document, 0, 0, i).getValue() + self.assertTrue(val <= 10 and val >= -2) - check_random_values() + check_random_values() - xOkBtn = xRandomNumberDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) # we might want to check that clicking 'ok' actually changes the values check_random_values() diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py index 8a7adfd6d236..1b400b1c6e03 100644 --- a/sc/qa/uitest/range_name/create_range_name.py +++ b/sc/qa/uitest/range_name/create_range_name.py @@ -23,15 +23,12 @@ class CreateRangeNameTest(UITestCase): xPosWindow = calcDoc.getChild('pos_window') self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="add") as xAddNameDlg: - xAddNameDlg = self.xUITest.getTopFocusWindow() - xEdit = xAddNameDlg.getChild("edit") - type_text(xEdit, "globalRangeName") + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "globalRangeName") - xAddBtn = xAddNameDlg.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) self.assertEqual('globalRangeName', get_state_as_dict(xPosWindow)['Text']) @@ -93,18 +90,15 @@ class CreateRangeNameTest(UITestCase): xPosWindow = calcDoc.getChild('pos_window') self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="add") as xAddNameDlg: - xAddNameDlg = self.xUITest.getTopFocusWindow() - xEdit = xAddNameDlg.getChild("edit") - type_text(xEdit, "localRangeName") + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "localRangeName") - xScope = xAddNameDlg.getChild("scope") - select_pos(xScope, "1") + xScope = xAddNameDlg.getChild("scope") + select_pos(xScope, "1") - xAddBtn = xAddNameDlg.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) # tdf#67007: Without the fix in place, this test would have failed with # AssertionError: 'localRangeName' != 'A1' diff --git a/sc/qa/uitest/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py index 78b844c4ea13..f90c73fe097d 100644 --- a/sc/qa/uitest/range_name/tdf119954.py +++ b/sc/qa/uitest/range_name/tdf119954.py @@ -30,30 +30,23 @@ class tdf119954(UITestCase): # => see that the formula is =aaa instead of =bbb gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - - xEntryBox = xDefineNameDlg.getChild("entry") - type_text(xEntryBox, "aaa") - add = xDefineNameDlg.getChild("add") - assign = xDefineNameDlg.getChild("assign") - add.executeAction("CLICK", tuple()) - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "aaa") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + add.executeAction("CLICK", tuple()) gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - xEntryBox = xDefineNameDlg.getChild("entry") - assign = xDefineNameDlg.getChild("assign") - select_all(xEntryBox) - type_text(xEntryBox, "bbb") - select_all(assign) - type_text(assign, "$Sheet2.$C$3") - add.executeAction("CLICK", tuple()) - - xOkBtn = xDefineNameDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + select_all(xEntryBox) + type_text(xEntryBox, "bbb") + select_all(assign) + type_text(assign, "$Sheet2.$C$3") + add.executeAction("CLICK", tuple()) enter_text_to_cell(gridwin, "B2", "=bbb") gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) @@ -71,9 +64,7 @@ class tdf119954(UITestCase): self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getFormula(), "") # check cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") - xDefineNameDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xDefineNameDlg.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineDBName", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf138822.py b/sc/qa/uitest/range_name/tdf138822.py index 9fd53b58192c..4e84ec53a4eb 100644 --- a/sc/qa/uitest/range_name/tdf138822.py +++ b/sc/qa/uitest/range_name/tdf138822.py @@ -17,12 +17,8 @@ class tdf138822(UITestCase): xPosWindow = calcDoc.getChild('pos_window') self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") - - xManageNamesDialog = self.xUITest.getTopFocusWindow() - - xAddBtn = xManageNamesDialog.getChild("add") - self.ui_test.close_dialog_through_button(xAddBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineName", close_button="add"): + pass xDefineNamesDialog = self.xUITest.getTopFocusWindow() @@ -46,17 +42,12 @@ class tdf138822(UITestCase): self.ui_test.close_dialog_through_button(xCancelBtn) # Open the dialog again - self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") - - xManageNamesDialog = self.xUITest.getTopFocusWindow() - xNamesList = xManageNamesDialog.getChild('names') - - # Without the fix in place, this test would have failed with - # AssertionError: 0 != 1 - self.assertEqual(0, len(xNamesList.getChildren())) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DefineName") as xManageNamesDialog: - xOkBtn = xManageNamesDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOkBtn) + xNamesList = xManageNamesDialog.getChild('names') + # Without the fix in place, this test would have failed with + # AssertionError: 0 != 1 + self.assertEqual(0, len(xNamesList.getChildren())) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py index 1f3caea47c01..3048e4d83927 100644 --- a/sc/qa/uitest/range_name/tdf86214.py +++ b/sc/qa/uitest/range_name/tdf86214.py @@ -17,43 +17,41 @@ class InvalidNames(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AddName", close_button="add") as xAddNameDlg: - xAddNameDlg = self.xUITest.getTopFocusWindow() - invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \ - "test+", "test-", "test*", "test!abc", "test#", \ - "test^", "test°", "test$", "test§", "test%", \ - "test&", "test/", "test(", "test)", "test[", "test]", \ - "test\\", "test`", "test´", "test'", "test~", "test<", \ - "tst>", "test|", "test:t", "test;z"] + invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \ + "test+", "test-", "test*", "test!abc", "test#", \ + "test^", "test°", "test$", "test§", "test%", \ + "test&", "test/", "test(", "test)", "test[", "test]", \ + "test\\", "test`", "test´", "test'", "test~", "test<", \ + "tst>", "test|", "test:t", "test;z"] - xLabel = xAddNameDlg.getChild("label") - xAddBtn = xAddNameDlg.getChild("add") - xEdit = xAddNameDlg.getChild("edit") + xLabel = xAddNameDlg.getChild("label") + xAddBtn = xAddNameDlg.getChild("add") + xEdit = xAddNameDlg.getChild("edit") - success_text = get_state_as_dict(xLabel)["Text"] + success_text = get_state_as_dict(xLabel)["Text"] - for name in invalid_names: - with self.subTest(name = name): - select_all(xEdit) - type_text(xEdit, name) + for name in invalid_names: + with self.subTest(name = name): + select_all(xEdit) + type_text(xEdit, name) - # tdf#132869 - Without the fix in place, this test would have failed with - # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." - # - Actual : "" - self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) - self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") + # tdf#132869 - Without the fix in place, this test would have failed with + # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." + # - Actual : "" + self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") - select_all(xEdit) - type_text(xEdit, "valid_name") + select_all(xEdit) + type_text(xEdit, "valid_name") - self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) - self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) - self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") + self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) + self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") - self.ui_test.close_dialog_through_button(xAddBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py index 2a6d2a3cd424..2ee5b950e504 100644 --- a/sc/qa/uitest/search_replace/replace.py +++ b/sc/qa/uitest/search_replace/replace.py @@ -16,43 +16,40 @@ class ReplaceTest(UITestCase): xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xSearchDlg: - xSearchDlg = self.xUITest.getTopFocusWindow() - xSearchTerm = xSearchDlg.getChild("searchterm") - xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) - xReplaceTerm = xSearchDlg.getChild("replaceterm") - xReplaceTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + xSearchTerm = xSearchDlg.getChild("searchterm") + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xReplaceTerm = xSearchDlg.getChild("replaceterm") + xReplaceTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) - xSearchBtn = xSearchDlg.getChild("search") - xSearchBtn.executeAction("CLICK", tuple()) + xSearchBtn = xSearchDlg.getChild("search") + xSearchBtn.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") - lastTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") + lastTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - # start replacing - xReplaceBtn = xSearchDlg.getChild("replace") - xReplaceBtn.executeAction("CLICK", tuple()) + # start replacing + xReplaceBtn = xSearchDlg.getChild("replace") + xReplaceBtn.executeAction("CLICK", tuple()) - # check position and visible range - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "199") - currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "199") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) - lastTopVisibleRow = currentTopVisibleRow + lastTopVisibleRow = currentTopVisibleRow - # replace again - xReplaceBtn.executeAction("CLICK", tuple()) + # replace again + xReplaceBtn.executeAction("CLICK", tuple()) - # check position and visible range - self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "499") - currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) - self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "499") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) - xReplaceBtn.executeAction("CLICK", tuple()) + xReplaceBtn.executeAction("CLICK", tuple()) - xCloseBtn = xSearchDlg.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) diff --git a/sc/qa/uitest/search_replace/tdf132097.py b/sc/qa/uitest/search_replace/tdf132097.py index 8e9f3eb40b97..0a3926b989bf 100644 --- a/sc/qa/uitest/search_replace/tdf132097.py +++ b/sc/qa/uitest/search_replace/tdf132097.py @@ -14,25 +14,22 @@ class tdf132097(UITestCase): with self.ui_test.create_doc_in_start_center("calc"): xCalcDoc = self.xUITest.getTopFocusWindow() - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCols = xDialog.getChild('cols') - xSearchTerm = xDialog.getChild("searchterm") - xBackSearch = xDialog.getChild("backsearch") - xSeachLabel = xDialog.getChild("searchlabel") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + xCols = xDialog.getChild('cols') + xSearchTerm = xDialog.getChild("searchterm") + xBackSearch = xDialog.getChild("backsearch") + xSeachLabel = xDialog.getChild("searchlabel") - xCols.executeAction("CLICK", tuple()) - xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"})) + xCols.executeAction("CLICK", tuple()) + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"})) - for i in range(10): - # without the fix in place it would crash here. - # Sometimes it doesn't crash at first so try a few times to be sure - xBackSearch.executeAction("CLICK", tuple()) + for i in range(10): + # without the fix in place it would crash here. + # Sometimes it doesn't crash at first so try a few times to be sure + xBackSearch.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found") + self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found") - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf132783.py b/sc/qa/uitest/search_replace/tdf132783.py index 5795a5afcf2c..7f7232b6e396 100644 --- a/sc/qa/uitest/search_replace/tdf132783.py +++ b/sc/qa/uitest/search_replace/tdf132783.py @@ -14,17 +14,14 @@ class tdf132783(UITestCase): with self.ui_test.load_file(get_url_for_data_file("tdf132783.ods")) as calc_doc: for i in range(5): - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - xSearchTerm = xDialog.getChild("searchterm") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + xSearchTerm = xDialog.getChild("searchterm") - xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xSearch = xDialog.getChild("search") - xSearch.executeAction("CLICK", tuple()) + xSearch = xDialog.getChild("search") + xSearch.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") diff --git a/sc/qa/uitest/search_replace/tdf143759.py b/sc/qa/uitest/search_replace/tdf143759.py index 8fd0c79a1501..c64e06d8493b 100644 --- a/sc/qa/uitest/search_replace/tdf143759.py +++ b/sc/qa/uitest/search_replace/tdf143759.py @@ -22,31 +22,28 @@ class tdf143759(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F6"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - xSearchterm = xDialog.getChild("searchterm") - xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) - - xRegexp = xDialog.getChild("regexp") - if get_state_as_dict(xRegexp)['Selected'] == 'false': - xRegexp.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) - - xSelection = xDialog.getChild("selection") - if get_state_as_dict(xSelection)['Selected'] == 'false': - xSelection.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(xSelection)['Selected']) - - xSearchall = xDialog.getChild("searchall") - with self.ui_test.execute_dialog_through_action( - xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as dialog: - # Without the fix in place, this test would have failed with - # AssertionError: 13 != 0 - self.assertEqual(13, len(dialog.getChild("results").getChildren())) - - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) + + xRegexp = xDialog.getChild("regexp") + if get_state_as_dict(xRegexp)['Selected'] == 'false': + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) + + xSelection = xDialog.getChild("selection") + if get_state_as_dict(xSelection)['Selected'] == 'false': + xSelection.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xSelection)['Selected']) + + xSearchall = xDialog.getChild("searchall") + with self.ui_test.execute_dialog_through_action( + xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as dialog: + # Without the fix in place, this test would have failed with + # AssertionError: 13 != 0 + self.assertEqual(13, len(dialog.getChild("results").getChildren())) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf35020.py b/sc/qa/uitest/search_replace/tdf35020.py index bf148704f687..650405eb35dc 100644 --- a/sc/qa/uitest/search_replace/tdf35020.py +++ b/sc/qa/uitest/search_replace/tdf35020.py @@ -20,22 +20,19 @@ class tdf35020(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"X6"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) #replace textbox - allsheets = xDialog.getChild("allsheets") - allsheets.executeAction("CLICK", tuple()) - calcsearchin = xDialog.getChild("calcsearchin") - select_by_text(calcsearchin, "Formulas") - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"X6"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) #replace textbox + allsheets = xDialog.getChild("allsheets") + allsheets.executeAction("CLICK", tuple()) + calcsearchin = xDialog.getChild("calcsearchin") + select_by_text(calcsearchin, "Formulas") + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) #verify Sheet1.A13 A14 = 2 self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 2) diff --git a/sc/qa/uitest/search_replace/tdf39917.py b/sc/qa/uitest/search_replace/tdf39917.py index f37151b9eea2..bddb237214fb 100644 --- a/sc/qa/uitest/search_replace/tdf39917.py +++ b/sc/qa/uitest/search_replace/tdf39917.py @@ -60,19 +60,16 @@ class tdf39917(UITestCase): # Find: Page2 # Replace: Page3 # 6. Press Replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox - replace = xDialog.getChild("replace") - replace.executeAction("CLICK", tuple()) - replace.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox + replace = xDialog.getChild("replace") + replace.executeAction("CLICK", tuple()) + replace.executeAction("CLICK", tuple()) #verify enter_text_to_cell(gridwin, "A1", "=FORMULA(R[3]C[1])") diff --git a/sc/qa/uitest/search_replace/tdf39959.py b/sc/qa/uitest/search_replace/tdf39959.py index 4e5f022fe61f..737dd0f4b03b 100644 --- a/sc/qa/uitest/search_replace/tdf39959.py +++ b/sc/qa/uitest/search_replace/tdf39959.py @@ -25,21 +25,18 @@ class tdf39959(UITestCase): # 4. Try Find-and-replace (Ctrl+Alt+F) to search for "asdf" # Whether the checkbox "in allen Tabellen suchen" is activated or not: LibO Calc never seems to find the text - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"asdf"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bbb"})) #replace textbox - allsheets = xDialog.getChild("allsheets") - allsheets.executeAction("CLICK", tuple()) - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - # print(xDialog.getChildren()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"asdf"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bbb"})) #replace textbox + allsheets = xDialog.getChild("allsheets") + allsheets.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + # print(xDialog.getChildren()) #verify Sheet2.A1 = "bbb" self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 0).getString(), "bbb ") diff --git a/sc/qa/uitest/search_replace/tdf44398.py b/sc/qa/uitest/search_replace/tdf44398.py index 948ba2a73eea..ab54541c7a65 100644 --- a/sc/qa/uitest/search_replace/tdf44398.py +++ b/sc/qa/uitest/search_replace/tdf44398.py @@ -29,20 +29,17 @@ class tdf44398(UITestCase): # check regular expression # hit replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox - regexp = xDialog.getChild("regexp") - regexp.executeAction("CLICK", tuple()) #regular expressions - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) #verify 3. A1 => 123456 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456") @@ -63,25 +60,22 @@ class tdf44398(UITestCase): # check case # hit replace all - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox - regexp = xDialog.getChild("regexp") - if (get_state_as_dict(regexp)["Selected"]) == "false": - regexp.executeAction("CLICK", tuple()) #regular expressions - matchcase = xDialog.getChild("matchcase") - matchcase.executeAction("CLICK", tuple()) #case + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox + regexp = xDialog.getChild("regexp") + if (get_state_as_dict(regexp)["Selected"]) == "false": + regexp.executeAction("CLICK", tuple()) #regular expressions + matchcase = xDialog.getChild("matchcase") + matchcase.executeAction("CLICK", tuple()) #case - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) #verify A1 => ' Var Number A' self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A") diff --git a/sc/qa/uitest/search_replace/tdf44861.py b/sc/qa/uitest/search_replace/tdf44861.py index 64cece075ab2..565f4533ec3b 100644 --- a/sc/qa/uitest/search_replace/tdf44861.py +++ b/sc/qa/uitest/search_replace/tdf44861.py @@ -24,21 +24,18 @@ class tdf44861(UITestCase): # check option "Enable regular expressions" # Press "Replace all" - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9]{2})([0-9]{2})"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1.$2"})) #replace textbox - regexp = xDialog.getChild("regexp") - if (get_state_as_dict(regexp)["Selected"]) == "false": - regexp.executeAction("CLICK", tuple()) #regular expressions - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9]{2})([0-9]{2})"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1.$2"})) #replace textbox + regexp = xDialog.getChild("regexp") + if (get_state_as_dict(regexp)["Selected"]) == "false": + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) #Expected: instead of 1345-1430 appears 13.45-14.30 self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "13.45-14.30") diff --git a/sc/qa/uitest/search_replace/tdf57523.py b/sc/qa/uitest/search_replace/tdf57523.py index 273847a44dc2..10303b6416b6 100644 --- a/sc/qa/uitest/search_replace/tdf57523.py +++ b/sc/qa/uitest/search_replace/tdf57523.py @@ -22,26 +22,23 @@ class tdf57523(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) - - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"})) - regexp = xDialog.getChild("regexp") - - if get_state_as_dict(regexp)['Selected'] == 'false': - regexp.executeAction("CLICK", tuple()) - self.assertEqual("true", get_state_as_dict(regexp)['Selected']) - - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SearchDialog", close_button="close") as xDialog: + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) + + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"})) + regexp = xDialog.getChild("regexp") + + if get_state_as_dict(regexp)['Selected'] == 'false': + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + # Without the fix in place, this test would have failed with # AssertionError: '' != 'BBB' diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py index ed3925447822..02b5e2142178 100644 --- a/sc/qa/uitest/solver/solver.py +++ b/sc/qa/uitest/solver/solver.py @@ -18,31 +18,30 @@ class solver(UITestCase): xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SolverDialog") - xDialog = self.xUITest.getTopFocusWindow() - xtargetedit = xDialog.getChild("targetedit") - xvalue = xDialog.getChild("value") - xvalueedit = xDialog.getChild("valueedit") - xchangeedit = xDialog.getChild("changeedit") - xref1edit = xDialog.getChild("ref1edit") - xval1edit = xDialog.getChild("val1edit") - xref2edit = xDialog.getChild("ref2edit") - xval2edit = xDialog.getChild("val2edit") - xop2list = xDialog.getChild("op2list") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SolverDialog", close_button="") as xDialog: + xtargetedit = xDialog.getChild("targetedit") + xvalue = xDialog.getChild("value") + xvalueedit = xDialog.getChild("valueedit") + xchangeedit = xDialog.getChild("changeedit") + xref1edit = xDialog.getChild("ref1edit") + xval1edit = xDialog.getChild("val1edit") + xref2edit = xDialog.getChild("ref2edit") + xval2edit = xDialog.getChild("val2edit") + xop2list = xDialog.getChild("op2list") - xvalue.executeAction("CLICK", tuple()) - xvalueedit.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) - xchangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) - xref1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) - xval1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) - xref2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) - select_by_text(xop2list, "=>") + xvalue.executeAction("CLICK", tuple()) + xvalueedit.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) + xchangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) + xref1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) + xval1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) + xref2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) + select_by_text(xop2list, "=>") - xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) - xOKBtn = xDialog.getChild("ok") + xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xOKBtn = xDialog.getChild("ok") - with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())): - pass + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())): + pass #verify self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 400) diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py index 0c15c15ba43b..df095644a2e8 100644 --- a/sc/qa/uitest/statistics/anova.py +++ b/sc/qa/uitest/statistics/anova.py @@ -57,28 +57,25 @@ class anova(UITestCase): enter_text_to_cell(gridwin, "C10", "12") enter_text_to_cell(gridwin, "C11", "60") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xradiotwofactor = xDialog.getChild("radio-two-factor") - xradiosinglefactor = xDialog.getChild("radio-single-factor") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xalphaspin = xDialog.getChild("alpha-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AnalysisOfVarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiotwofactor = xDialog.getChild("radio-two-factor") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xalphaspin = xDialog.getChild("alpha-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xradiosinglefactor.executeAction("CLICK", tuple()) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xradiosinglefactor.executeAction("CLICK", tuple()) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") @@ -137,9 +134,7 @@ class anova(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AnalysisOfVarianceDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/chiSquare.py b/sc/qa/uitest/statistics/chiSquare.py index a8ae58259a97..fc9a97d39695 100644 --- a/sc/qa/uitest/statistics/chiSquare.py +++ b/sc/qa/uitest/statistics/chiSquare.py @@ -49,22 +49,19 @@ class chiSquare(UITestCase): enter_text_to_cell(gridwin, "B13", "33") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ChiSquareTestDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Test of Independence (Chi-Square)") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") @@ -84,10 +81,7 @@ class chiSquare(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ChiSquareTestDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/correlation.py b/sc/qa/uitest/statistics/correlation.py index 262afd5aed42..30c84a0e15c8 100644 --- a/sc/qa/uitest/statistics/correlation.py +++ b/sc/qa/uitest/statistics/correlation.py @@ -57,23 +57,20 @@ class correlation(UITestCase): enter_text_to_cell(gridwin, "C10", "12") enter_text_to_cell(gridwin, "C11", "60") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CorrelationDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Correlations") @@ -98,11 +95,8 @@ class correlation(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CorrelationDialog", close_button="cancel"): + pass def test_statistic_correlation_row(self): with self.ui_test.create_doc_in_start_center("calc") as document: @@ -157,22 +151,19 @@ class correlation(UITestCase): enter_text_to_cell(gridwin, "M1", "26") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CorrelationDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Correlations") self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") diff --git a/sc/qa/uitest/statistics/covariance.py b/sc/qa/uitest/statistics/covariance.py index 3d539706f9a6..141d2e1eac17 100644 --- a/sc/qa/uitest/statistics/covariance.py +++ b/sc/qa/uitest/statistics/covariance.py @@ -57,22 +57,19 @@ class covariance(UITestCase): enter_text_to_cell(gridwin, "C10", "12") enter_text_to_cell(gridwin, "C11", "60") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CovarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Covariances") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") @@ -96,11 +93,8 @@ class covariance(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CovarianceDialog", close_button="cancel"): + pass def test_statistic_covariance_row(self): with self.ui_test.create_doc_in_start_center("calc") as document: @@ -155,22 +149,19 @@ class covariance(UITestCase): enter_text_to_cell(gridwin, "M1", "26") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:CovarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Covariances") self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py index 4552381a19d1..29024f6ad5e2 100644 --- a/sc/qa/uitest/statistics/descriptiveStatistics.py +++ b/sc/qa/uitest/statistics/descriptiveStatistics.py @@ -59,27 +59,24 @@ class descriptiveStatistics(UITestCase): enter_text_to_cell(gridwin, "C11", "60") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DescriptiveStatisticsDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString() , "Mean") @@ -153,9 +150,7 @@ class descriptiveStatistics(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:DescriptiveStatisticsDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/exponentialSmoothing.py b/sc/qa/uitest/statistics/exponentialSmoothing.py index a338f90d4be0..6ef75f3f1ed3 100644 --- a/sc/qa/uitest/statistics/exponentialSmoothing.py +++ b/sc/qa/uitest/statistics/exponentialSmoothing.py @@ -48,25 +48,22 @@ class exponentialSmoothing(UITestCase): enter_text_to_cell(gridwin, "B13", "0") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ExponentialSmoothingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) @@ -107,10 +104,8 @@ class exponentialSmoothing(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ExponentialSmoothingDialog", close_button="cancel"): + pass def test_exponential_smoothing_row(self): @@ -146,26 +141,23 @@ class exponentialSmoothing(UITestCase): enter_text_to_cell(gridwin, "B13", "0") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ExponentialSmoothingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) diff --git a/sc/qa/uitest/statistics/fTest.py b/sc/qa/uitest/statistics/fTest.py index 8dd67e87ade2..60ea83bde62b 100644 --- a/sc/qa/uitest/statistics/fTest.py +++ b/sc/qa/uitest/statistics/fTest.py @@ -49,26 +49,23 @@ class tTest(UITestCase): enter_text_to_cell(gridwin, "B13", "33") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "F-test") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") @@ -110,10 +107,7 @@ class tTest(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:FTestDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/movingAverage.py b/sc/qa/uitest/statistics/movingAverage.py index 668d943c2338..1fade5fb7e0d 100644 --- a/sc/qa/uitest/statistics/movingAverage.py +++ b/sc/qa/uitest/statistics/movingAverage.py @@ -48,25 +48,22 @@ class movingAverage(UITestCase): enter_text_to_cell(gridwin, "B13", "0") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xintervalspin = xDialog.getChild("interval-spin") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:MovingAverageDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Column 1") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") @@ -103,10 +100,8 @@ class movingAverage(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:MovingAverageDialog", close_button="cancel"): + pass def test_moving_average_row(self): @@ -142,26 +137,23 @@ class movingAverage(UITestCase): enter_text_to_cell(gridwin, "B13", "0") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xintervalspin = xDialog.getChild("interval-spin") - - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) - xgroupedbyrowsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:MovingAverageDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Row 1") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py index b77582ad5657..af1784db4778 100644 --- a/sc/qa/uitest/statistics/regression.py +++ b/sc/qa/uitest/statistics/regression.py @@ -37,76 +37,70 @@ class regression(UITestCase): def _do_regression(self, regression_type, data_groupedby_column = True, calc_intercept = True): assert(regression_type == "LINEAR" or regression_type == "LOG" or regression_type == "POWER") - self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xwithlabelscheck = xDialog.getChild("withlabels-check") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xlinearradio = xDialog.getChild("linear-radio") - xlogarithmicradio = xDialog.getChild("logarithmic-radio") - xpowerradio = xDialog.getChild("power-radio") - xnointerceptcheck = xDialog.getChild("nointercept-check") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RegressionDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xwithlabelscheck = xDialog.getChild("withlabels-check") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xlinearradio = xDialog.getChild("linear-radio") + xlogarithmicradio = xDialog.getChild("logarithmic-radio") + xpowerradio = xDialog.getChild("power-radio") + xnointerceptcheck = xDialog.getChild("nointercept-check") - ## Set the X, Y and output ranges - xvariable1rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - if data_groupedby_column: - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$A$1:$C$11"})) - else: - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$1:$K$3"})) + ## Set the X, Y and output ranges + xvariable1rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if data_groupedby_column: + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$A$1:$C$11"})) + else: + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$1:$K$3"})) - xvariable2rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - if data_groupedby_column: - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$D$1:$D$11"})) - else: - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$4:$K$4"})) - # The data ranges have labels in them - if (get_state_as_dict(xwithlabelscheck)["Selected"]) == "false": - xwithlabelscheck.executeAction("CLICK", tuple()) + xvariable2rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if data_groupedby_column: + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$D$1:$D$11"})) + else: + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$4:$K$4"})) + # The data ranges have labels in them + if (get_state_as_dict(xwithlabelscheck)["Selected"]) == "false": + xwithlabelscheck.executeAction("CLICK", tuple()) - xoutputrangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - if regression_type == "LINEAR": - if calc_intercept: - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinear.$A$1"})) + xoutputrangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if regression_type == "LINEAR": + if calc_intercept: + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinear.$A$1"})) + else: + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinearNoIntercept.$A$1"})) + elif regression_type == "LOG": + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLog.$A$1"})) else: - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinearNoIntercept.$A$1"})) - elif regression_type == "LOG": - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLog.$A$1"})) - else: - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualPower.$A$1"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualPower.$A$1"})) - if data_groupedby_column: - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - else: - xgroupedbyrowsradio.executeAction("CLICK", tuple()) + if data_groupedby_column: + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + else: + xgroupedbyrowsradio.executeAction("CLICK", tuple()) - if regression_type == "LINEAR": - xlinearradio.executeAction("CLICK", tuple()) - elif regression_type == "LOG": - xlogarithmicradio.executeAction("CLICK", tuple()) - else: - xpowerradio.executeAction("CLICK", tuple()) + if regression_type == "LINEAR": + xlinearradio.executeAction("CLICK", tuple()) + elif regression_type == "LOG": + xlogarithmicradio.executeAction("CLICK", tuple()) + else: + xpowerradio.executeAction("CLICK", tuple()) - if not calc_intercept: - xnointerceptcheck.executeAction("CLICK", tuple()) + if not calc_intercept: + xnointerceptcheck.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) def test_regression_cancel(self): with self.ui_test.create_doc_in_start_center("calc"): - self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:RegressionDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/sampling.py b/sc/qa/uitest/statistics/sampling.py index 88f3784b5e76..82f304d25ab6 100644 --- a/sc/qa/uitest/statistics/sampling.py +++ b/sc/qa/uitest/statistics/sampling.py @@ -50,28 +50,25 @@ class sampling(UITestCase): enter_text_to_cell(gridwin, "C8", "38") enter_text_to_cell(gridwin, "C9", "39") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C9"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xrandommethodradio = xDialog.getChild("random-method-radio") - xsamplesizespin = xDialog.getChild("sample-size-spin") - xperiodicmethodradio = xDialog.getChild("periodic-method-radio") - xperiodspin = xDialog.getChild("period-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SamplingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xrandommethodradio = xDialog.getChild("random-method-radio") + xsamplesizespin = xDialog.getChild("sample-size-spin") + xperiodicmethodradio = xDialog.getChild("periodic-method-radio") + xperiodspin = xDialog.getChild("period-spin") - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) - xperiodicmethodradio.executeAction("CLICK", tuple()) + xperiodicmethodradio.executeAction("CLICK", tuple()) - xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 12) self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 14) @@ -105,9 +102,7 @@ class sampling(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0) # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:SamplingDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/tTest.py b/sc/qa/uitest/statistics/tTest.py index 7ff546647315..251064f45264 100644 --- a/sc/qa/uitest/statistics/tTest.py +++ b/sc/qa/uitest/statistics/tTest.py @@ -49,26 +49,23 @@ class tTest(UITestCase): enter_text_to_cell(gridwin, "B13", "33") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:TTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Paired t-test") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") @@ -111,10 +108,7 @@ class tTest(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:TTestDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/tdf76731.py b/sc/qa/uitest/statistics/tdf76731.py index a1aa96c79944..5fa78bd46c8a 100644 --- a/sc/qa/uitest/statistics/tdf76731.py +++ b/sc/qa/uitest/statistics/tdf76731.py @@ -25,25 +25,22 @@ class anova(UITestCase): gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) #3. Choose Data - Analysis of Variance (ANOVA). #4. Choose an arbitrary output cell and click OK. - self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") - xDialog = self.xUITest.getTopFocusWindow() - xinputrangeedit = xDialog.getChild("input-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xradiotwofactor = xDialog.getChild("radio-two-factor") - xradiosinglefactor = xDialog.getChild("radio-single-factor") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xalphaspin = xDialog.getChild("alpha-spin") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:AnalysisOfVarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiotwofactor = xDialog.getChild("radio-two-factor") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xalphaspin = xDialog.getChild("alpha-spin") - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) - xradiosinglefactor.executeAction("CLICK", tuple()) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xradiosinglefactor.executeAction("CLICK", tuple()) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value. self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "ANOVA - Single Factor") self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getString(), "Alpha") diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py index 12bebf983670..d3cfe40d4a59 100644 --- a/sc/qa/uitest/statistics/zTest.py +++ b/sc/qa/uitest/statistics/zTest.py @@ -49,26 +49,23 @@ class zTest(UITestCase): enter_text_to_cell(gridwin, "B13", "33") gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) - self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xvariable1rangeedit = xDialog.getChild("variable1-range-edit") - xvariable2rangeedit = xDialog.getChild("variable2-range-edit") - xoutputrangeedit = xDialog.getChild("output-range-edit") - xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") - xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ZTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) - xgroupedbycolumnsradio.executeAction("CLICK", tuple()) - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) #Verify self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "z-test") self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") @@ -101,10 +98,7 @@ class zTest(UITestCase): self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") # test cancel button - self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") - xDialog = self.xUITest.getTopFocusWindow() - xCancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(xCancelBtn) - + with self.ui_test.execute_modeless_dialog_through_command_guarded(".uno:ZTestDialog", close_button="cancel"): + pass # vim: set shiftwidth=4 softtabstop=4 expandtab: |