summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/qa/uitest/autofilter/autofilter.py561
-rw-r--r--sc/qa/uitest/autofilter/autofilterBugs.py298
-rw-r--r--sc/qa/uitest/autofilter/tdf101165.py21
-rw-r--r--sc/qa/uitest/autofilter/tdf117276.py161
-rw-r--r--sc/qa/uitest/autofilter/tdf122260.py46
-rw-r--r--sc/qa/uitest/autofilter/tdf130070.py77
-rw-r--r--sc/qa/uitest/autofilter/tdf140754.py132
-rw-r--r--sc/qa/uitest/autofilter/tdf92767.py72
-rw-r--r--sc/qa/uitest/autofilter/tdf97340.py39
-rw-r--r--sc/qa/uitest/calc_tests/autofill.py208
-rw-r--r--sc/qa/uitest/calc_tests/autosum.py414
-rw-r--r--sc/qa/uitest/calc_tests/mergedRowsColumns.py315
-rw-r--r--sc/qa/uitest/calc_tests/tdf133855.py50
-rw-r--r--sc/qa/uitest/calc_tests2/consolidate.py178
-rw-r--r--sc/qa/uitest/calc_tests2/standardFilter.py233
-rw-r--r--sc/qa/uitest/calc_tests2/tdf114992.py26
-rw-r--r--sc/qa/uitest/calc_tests2/tdf37623.py33
-rw-r--r--sc/qa/uitest/calc_tests3/tdf57274.py41
-rw-r--r--sc/qa/uitest/calc_tests3/tdf62267.py62
-rw-r--r--sc/qa/uitest/calc_tests3/tdf63805.py77
-rw-r--r--sc/qa/uitest/calc_tests3/tdf65856.py136
-rw-r--r--sc/qa/uitest/calc_tests3/tdf69981.py110
-rw-r--r--sc/qa/uitest/calc_tests3/tdf77509.py102
-rw-r--r--sc/qa/uitest/calc_tests4/tdf131170.py56
-rw-r--r--sc/qa/uitest/calc_tests4/tdf138089.py60
-rw-r--r--sc/qa/uitest/calc_tests4/tdf141547.py48
-rw-r--r--sc/qa/uitest/calc_tests4/tdf85403.py34
-rw-r--r--sc/qa/uitest/calc_tests4/tdf85979.py66
-rw-r--r--sc/qa/uitest/calc_tests4/tdf86253.py84
-rw-r--r--sc/qa/uitest/calc_tests4/tdf89958.py82
-rw-r--r--sc/qa/uitest/calc_tests4/tdf99386.py18
-rw-r--r--sc/qa/uitest/calc_tests4/textToColumns.py933
-rw-r--r--sc/qa/uitest/calc_tests4/trackedChanges.py76
-rw-r--r--sc/qa/uitest/calc_tests6/tdf107267.py102
-rw-r--r--sc/qa/uitest/calc_tests6/tdf107869.py136
-rw-r--r--sc/qa/uitest/calc_tests6/tdf118638.py74
-rw-r--r--sc/qa/uitest/calc_tests7/tdf122509.py63
-rw-r--r--sc/qa/uitest/calc_tests7/tdf124818.py21
-rw-r--r--sc/qa/uitest/calc_tests7/tdf124896.py23
-rw-r--r--sc/qa/uitest/calc_tests7/tdf137397.py30
-rw-r--r--sc/qa/uitest/calc_tests7/tdf31805.py45
-rw-r--r--sc/qa/uitest/calc_tests7/tdf91425.py35
-rw-r--r--sc/qa/uitest/calc_tests8/navigator.py207
-rw-r--r--sc/qa/uitest/calc_tests8/tdf114710.py50
-rw-r--r--sc/qa/uitest/calc_tests8/tdf119343.py25
-rw-r--r--sc/qa/uitest/calc_tests8/tdf124829.py21
-rw-r--r--sc/qa/uitest/calc_tests9/forms.py18
-rw-r--r--sc/qa/uitest/calc_tests9/pivotTable.py64
-rw-r--r--sc/qa/uitest/calc_tests9/tdf113571.py31
-rw-r--r--sc/qa/uitest/calc_tests9/tdf124318.py28
-rw-r--r--sc/qa/uitest/calc_tests9/tdf125440.py35
-rw-r--r--sc/qa/uitest/calc_tests9/tdf126673.py52
-rw-r--r--sc/qa/uitest/calc_tests9/tdf130371.py100
-rw-r--r--sc/qa/uitest/calc_tests9/tdf137446.py52
-rw-r--r--sc/qa/uitest/calc_tests9/tdf91217.py34
-rw-r--r--sc/qa/uitest/chart/chartArea.py299
-rw-r--r--sc/qa/uitest/chart/chartAxes.py79
-rw-r--r--sc/qa/uitest/chart/chartDataLabels.py563
-rw-r--r--sc/qa/uitest/chart/chartGrid.py425
-rw-r--r--sc/qa/uitest/chart/chartGrids.py151
-rw-r--r--sc/qa/uitest/chart/chartLegend.py4
-rw-r--r--sc/qa/uitest/chart/chartTitles.py197
-rw-r--r--sc/qa/uitest/chart/chartWall.py329
-rw-r--r--sc/qa/uitest/chart/chartXAxis.py483
-rw-r--r--sc/qa/uitest/chart/chartYAxis.py487
-rw-r--r--sc/qa/uitest/chart/copyPaste.py84
-rw-r--r--sc/qa/uitest/chart/formatDataSeries.py181
-rw-r--r--sc/qa/uitest/chart/tdf101894.py120
-rw-r--r--sc/qa/uitest/chart/tdf107097.py68
-rw-r--r--sc/qa/uitest/chart/tdf120348.py65
-rw-r--r--sc/qa/uitest/chart/tdf122398.py135
-rw-r--r--sc/qa/uitest/chart/tdf123013.py75
-rw-r--r--sc/qa/uitest/chart/tdf123231.py111
-rw-r--r--sc/qa/uitest/chart/tdf123520.py107
-rw-r--r--sc/qa/uitest/chart/tdf124111.py95
-rw-r--r--sc/qa/uitest/chart/tdf129587.py63
-rw-r--r--sc/qa/uitest/chart/tdf133630.py75
-rw-r--r--sc/qa/uitest/chart/tdf134059.py34
-rw-r--r--sc/qa/uitest/chart/tdf136011.py43
-rw-r--r--sc/qa/uitest/chart/tdf43175.py46
-rw-r--r--sc/qa/uitest/chart/tdf62057.py60
-rw-r--r--sc/qa/uitest/chart/tdf62349.py42
-rw-r--r--sc/qa/uitest/chart/tdf93506_trendline.py889
-rw-r--r--sc/qa/uitest/chart/tdf96432.py101
-rw-r--r--sc/qa/uitest/chart/tdf98690.py42
-rw-r--r--sc/qa/uitest/chart/tdf99069.py93
-rw-r--r--sc/qa/uitest/conditional_format/tdf100793.py154
-rw-r--r--sc/qa/uitest/conditional_format/tdf104026.py20
-rw-r--r--sc/qa/uitest/conditional_format/tdf105544.py70
-rw-r--r--sc/qa/uitest/conditional_format/tdf117899.py59
-rw-r--r--sc/qa/uitest/conditional_format/tdf118206.py45
-rw-r--r--sc/qa/uitest/conditional_format/tdf81696.py43
-rw-r--r--sc/qa/uitest/conditional_format/tdf96453.py72
-rw-r--r--sc/qa/uitest/function_wizard/tdf123479.py41
-rw-r--r--sc/qa/uitest/goalSeek/goalSeek.py37
-rw-r--r--sc/qa/uitest/goalSeek/tdf37341.py35
-rw-r--r--sc/qa/uitest/goalSeek/tdf43693.py35
-rw-r--r--sc/qa/uitest/key_f4/tdf102525.py40
-rw-r--r--sc/qa/uitest/manual_tests/calc.py20
-rw-r--r--sc/qa/uitest/pageFormat/tdf123508.py65
-rw-r--r--sc/qa/uitest/range_name/tdf119954.py105
-rw-r--r--sc/qa/uitest/search_replace/replace.py59
-rw-r--r--sc/qa/uitest/search_replace/tdf132783.py28
-rw-r--r--sc/qa/uitest/search_replace/tdf35020.py55
-rw-r--r--sc/qa/uitest/search_replace/tdf39959.py61
-rw-r--r--sc/qa/uitest/search_replace/tdf44861.py62
-rw-r--r--sc/qa/uitest/solver/solver.py59
-rw-r--r--sc/qa/uitest/sort/sorting.py2
-rw-r--r--sc/qa/uitest/sort/stableSorting.py80
-rw-r--r--sc/qa/uitest/sort/subtotals.py230
-rw-r--r--sc/qa/uitest/sort/tdf105301.py54
-rw-r--r--sc/qa/uitest/sort/tdf49531.py79
-rw-r--r--sc/qa/uitest/sort/tdf53482.py58
-rw-r--r--sc/qa/uitest/sort/tdf54018.py54
-rw-r--r--sc/qa/uitest/sort/tdf57465.py54
-rw-r--r--sc/qa/uitest/sort/tdf91305.py2
-rw-r--r--sc/qa/uitest/sort/tdf95192.py54
-rw-r--r--sc/qa/uitest/sort/tdf99208.py84
-rw-r--r--sc/qa/uitest/sort/tdf99627.py54
-rw-r--r--sc/qa/uitest/statistics/regression.py29
-rw-r--r--sc/qa/uitest/statistics/tdf76731.py89
-rw-r--r--sc/qa/uitest/textCase/textCase.py51
-rw-r--r--sc/qa/uitest/validity/tdf137945.py28
-rw-r--r--sd/qa/uitest/findReplace/findReplace.py214
-rw-r--r--sd/qa/uitest/impress_tests/embedded.py30
-rw-r--r--sd/qa/uitest/impress_tests/tdf141297.py20
-rw-r--r--sfx2/qa/uitest/doc/objserv.py20
-rw-r--r--sw/qa/uitest/chapterNumbering/tdf123547.py23
-rw-r--r--sw/qa/uitest/findReplace/findReplace.py254
-rw-r--r--sw/qa/uitest/findReplace/tdf118208.py96
-rw-r--r--sw/qa/uitest/findSimilarity/findSimilarity.py104
-rw-r--r--sw/qa/uitest/navigator/tdf114724.py49
-rw-r--r--sw/qa/uitest/navigator/tdf140661.py20
-rw-r--r--sw/qa/uitest/navigator/tdf40427.py103
-rw-r--r--sw/qa/uitest/sidebar/tdf99711.py30
-rw-r--r--sw/qa/uitest/styleInspector/styleInspector.py660
-rw-r--r--sw/qa/uitest/table/sheetToTable.py117
-rw-r--r--sw/qa/uitest/table/splitTable.py120
-rw-r--r--sw/qa/uitest/table/tableProperties.py407
-rw-r--r--sw/qa/uitest/table/tableToText.py119
-rw-r--r--sw/qa/uitest/table/tdf134881_colProportionalAdjust.py64
-rw-r--r--sw/qa/uitest/table/tdf135693.py28
-rw-r--r--sw/qa/uitest/table/tdf81292.py49
-rw-r--r--sw/qa/uitest/table/tdf99334.py45
-rw-r--r--sw/qa/uitest/table/textToTable.py55
-rw-r--r--sw/qa/uitest/writer_tests/compareDocuments.py96
-rw-r--r--sw/qa/uitest/writer_tests/tdf81457.py46
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py172
-rw-r--r--sw/qa/uitest/writer_tests/versionDialog.py30
-rw-r--r--sw/qa/uitest/writer_tests/wordCount.py262
-rw-r--r--sw/qa/uitest/writer_tests3/goToPage.py47
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py48
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113284.py59
-rw-r--r--sw/qa/uitest/writer_tests4/tdf122449.py63
-rw-r--r--sw/qa/uitest/writer_tests4/tdf134439.py52
-rw-r--r--sw/qa/uitest/writer_tests4/tdf135636.py36
-rw-r--r--sw/qa/uitest/writer_tests4/tdf136578.py22
-rw-r--r--sw/qa/uitest/writer_tests4/tdf138546.py46
-rw-r--r--sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py186
-rw-r--r--sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py440
-rw-r--r--sw/qa/uitest/writer_tests5/tdf117039.py15
-rw-r--r--sw/qa/uitest/writer_tests5/tdf118540.py23
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard.py392
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard2.py242
-rw-r--r--sw/qa/uitest/writer_tests6/tdf120731.py19
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124586.py35
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124675.py30
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126017.py71
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126226.py21
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126627.py63
-rw-r--r--sw/qa/uitest/writer_tests7/apply_line_cap.py120
-rw-r--r--sw/qa/uitest/writer_tests7/forms.py246
-rw-r--r--sw/qa/uitest/writer_tests7/tdf104795.py20
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py20
-rw-r--r--sw/qa/uitest/writer_tests7/tdf122780.py18
-rw-r--r--sw/qa/uitest/writer_tests7/tdf131936.py20
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132169.py46
-rw-r--r--sw/qa/uitest/writer_tests7/tdf134243.py14
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137802.py76
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137803.py55
-rw-r--r--sw/qa/uitest/writer_tests7/tdf139301.py70
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140117.py90
-rw-r--r--sw/qa/uitest/writer_tests7/tdf141158.py53
-rw-r--r--sw/qa/uitest/writer_tests7/tdf141557.py30
-rw-r--r--sw/qa/uitest/writer_tests7/tdf46561.py138
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py129
-rw-r--r--uitest/demo_ui/handle_multiple_files.py44
-rw-r--r--uitest/uitest/test.py9
-rw-r--r--uitest/uitest/uihelper/guarded.py9
189 files changed, 9865 insertions, 10293 deletions
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 060ada717844..1b5bcb1f113f 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -14,122 +14,116 @@ from uitest.uihelper.calc import enter_text_to_cell
class AutofilterTest(UITestCase):
def test_tdf106214(self):
- doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_tree_box")
- xFirstEntry = xTreeList.getChild("0")
+ xTreeList = xCheckListMenu.getChild("check_tree_box")
+ xFirstEntry = xTreeList.getChild("0")
- xFirstEntry.executeAction("CLICK", tuple())
+ xFirstEntry.executeAction("CLICK", tuple())
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertFalse(is_row_hidden(doc, 0))
- self.assertFalse(is_row_hidden(doc, 1))
- self.assertFalse(is_row_hidden(doc, 2))
- self.assertTrue(is_row_hidden(doc, 3))
- self.assertFalse(is_row_hidden(doc, 4))
-
- self.ui_test.close_doc()
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertFalse(is_row_hidden(doc, 1))
+ self.assertFalse(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertFalse(is_row_hidden(doc, 4))
def test_filter_multiple_rows(self):
- doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- xFirstEntry = xTreeList.getChild("1")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ xFirstEntry = xTreeList.getChild("1")
- xFirstEntry.executeAction("CLICK", tuple())
+ xFirstEntry.executeAction("CLICK", tuple())
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertFalse(is_row_hidden(doc, 0))
- self.assertFalse(is_row_hidden(doc, 1))
- self.assertTrue(is_row_hidden(doc, 2))
- self.assertTrue(is_row_hidden(doc, 3))
- self.assertFalse(is_row_hidden(doc, 4))
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertFalse(is_row_hidden(doc, 1))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertFalse(is_row_hidden(doc, 4))
def test_tdf133160(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf133160.ods"))
-
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
-
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertTrue(size1 < size2) # for me they were size1=176 size2=212 size3=459 size4=1012
- self.assertTrue(size2 < size3) # size1 is the minimum window width, size2 based on its column width
- self.assertTrue(size3 < size4) # size3 is a long text width
- self.assertTrue(size4 < 1500) # size4 is the maximum window width with a really long text
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf133160.ods")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0])
+
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertTrue(size1 < size2) # for me they were size1=176 size2=212 size3=459 size4=1012
+ self.assertTrue(size2 < size3) # size1 is the minimum window width, size2 based on its column width
+ self.assertTrue(size3 < size4) # size3 is a long text width
+ self.assertTrue(size4 < 1500) # size4 is the maximum window width with a really long text
def test_tdf134351(self):
- doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_tree_box")
+ xTreeList = xCheckListMenu.getChild("check_tree_box")
- self.assertEqual(2, len(xTreeList.getChildren()))
- self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected'])
- self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected'])
+ self.assertEqual(2, len(xTreeList.getChildren()))
+ self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected'])
+ self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected'])
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertFalse(is_row_hidden(doc, 0))
- # Without the fix in place, this test would have failed here
- self.assertFalse(is_row_hidden(doc, 1))
- self.assertFalse(is_row_hidden(doc, 2))
- self.assertFalse(is_row_hidden(doc, 3))
- self.assertFalse(is_row_hidden(doc, 4))
-
- self.ui_test.close_doc()
+ self.assertFalse(is_row_hidden(doc, 0))
+ # Without the fix in place, this test would have failed here
+ self.assertFalse(is_row_hidden(doc, 1))
+ self.assertFalse(is_row_hidden(doc, 2))
+ self.assertFalse(is_row_hidden(doc, 3))
+ self.assertFalse(is_row_hidden(doc, 4))
def test_differentSearches(self):
self.ui_test.create_doc_in_start_center("calc")
@@ -229,165 +223,153 @@ class AutofilterTest(UITestCase):
self.ui_test.close_doc()
def test_tdf116818(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx"))
-
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_tree_box")
- self.assertEqual(3, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(5, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(3, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_tree_box")
+ self.assertEqual(3, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(5, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(3, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
def test_tdf140469(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(9, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(9, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
def test_tdf140462(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf140462.ods"))
-
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_tree_box")
- self.assertEqual(3, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(3, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(4, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf140462.ods")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_tree_box")
+ self.assertEqual(3, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(3, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(4, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
def test_tdf137626(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(3, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(3, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
def test_time_value(self):
- doc = self.ui_test.load_file(get_url_for_data_file("time_value.xlsx"))
-
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(5, len(xTreeList.getChildren()))
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
- self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
- self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(2, len(xTreeList.getChildren()))
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("time_value.xlsx")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(5, len(xTreeList.getChildren()))
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+ self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+ self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(2, len(xTreeList.getChildren()))
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
def test_tdf140968(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
-
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
-
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(5, len(xTreeList.getChildren()))
- self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text'])
- self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text'])
- self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text'])
- self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text'])
- self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text'])
-
- self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
- self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
- self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
-
- xFirstEntry = xTreeList.getChild("0")
- xFirstEntry.executeAction("CLICK", tuple())
- xFirstEntry = xTreeList.getChild("1")
- xFirstEntry.executeAction("CLICK", tuple())
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(doc, 0))
- self.assertTrue(is_row_hidden(doc, 1))
- self.assertTrue(is_row_hidden(doc, 2))
- self.assertTrue(is_row_hidden(doc, 3))
- self.assertTrue(is_row_hidden(doc, 4))
- self.assertFalse(is_row_hidden(doc, 5))
- self.assertFalse(is_row_hidden(doc, 6))
- self.assertFalse(is_row_hidden(doc, 7))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(5, len(xTreeList.getChildren()))
+ self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+ self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+ self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text'])
+ self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text'])
+ self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text'])
+
+ self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked'])
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked'])
+ self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked'])
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked'])
+ self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked'])
+
+ xFirstEntry = xTreeList.getChild("0")
+ xFirstEntry.executeAction("CLICK", tuple())
+ xFirstEntry = xTreeList.getChild("1")
+ xFirstEntry.executeAction("CLICK", tuple())
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertTrue(is_row_hidden(doc, 1))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertTrue(is_row_hidden(doc, 4))
+ self.assertFalse(is_row_hidden(doc, 5))
+ self.assertFalse(is_row_hidden(doc, 6))
+ self.assertFalse(is_row_hidden(doc, 7))
def test_tdf142350(self):
self.ui_test.create_doc_in_start_center("calc")
@@ -440,64 +422,61 @@ class AutofilterTest(UITestCase):
self.ui_test.close_doc()
def test_tdf138438(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf138438.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ # Top 10 filer
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xMenu = xFloatWindow.getChild("menu")
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertTrue(is_row_hidden(doc, 1))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertFalse(is_row_hidden(doc, 3))
+ self.assertFalse(is_row_hidden(doc, 4))
+ self.assertFalse(is_row_hidden(doc, 5))
+ self.assertFalse(is_row_hidden(doc, 6))
+ self.assertTrue(is_row_hidden(doc, 7))
+ self.assertFalse(is_row_hidden(doc, 8))
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ def test_tdf142402(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc:
- # Top 10 filer
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xMenu = xFloatWindow.getChild("menu")
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
- self.assertFalse(is_row_hidden(doc, 0))
- self.assertTrue(is_row_hidden(doc, 1))
- self.assertTrue(is_row_hidden(doc, 2))
- self.assertFalse(is_row_hidden(doc, 3))
- self.assertFalse(is_row_hidden(doc, 4))
- self.assertFalse(is_row_hidden(doc, 5))
- self.assertFalse(is_row_hidden(doc, 6))
- self.assertTrue(is_row_hidden(doc, 7))
- self.assertFalse(is_row_hidden(doc, 8))
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- self.ui_test.close_doc()
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ #Choose Standard Filter... button
+ xMenu = xFloatWindow.getChild("menu")
- def test_tdf142402(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx"))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+ xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xval1 = xDialog.getChild("val1")
- xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- #Choose Standard Filter... button
- xMenu = xFloatWindow.getChild("menu")
-
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
- xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
-
- xDialog = self.xUITest.getTopFocusWindow()
- xval1 = xDialog.getChild("val1")
-
- 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))
- self.assertTrue(is_row_hidden(doc, 2))
- self.assertTrue(is_row_hidden(doc, 3))
- self.assertTrue(is_row_hidden(doc, 4))
- self.assertTrue(is_row_hidden(doc, 5))
- self.assertTrue(is_row_hidden(doc, 6))
+ 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))
+ self.assertTrue(is_row_hidden(doc, 2))
+ self.assertTrue(is_row_hidden(doc, 3))
+ self.assertTrue(is_row_hidden(doc, 4))
+ self.assertTrue(is_row_hidden(doc, 5))
+ self.assertTrue(is_row_hidden(doc, 6))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py
index fabde9aabce9..ffb6419690ea 100644
--- a/sc/qa/uitest/autofilter/autofilterBugs.py
+++ b/sc/qa/uitest/autofilter/autofilterBugs.py
@@ -12,20 +12,18 @@ from uitest.uihelper.calc import enter_text_to_cell
class autofilter(UITestCase):
def test_tdf115046(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf115046.ods"))
- document = self.ui_test.get_component()
- #autofilter exist
- self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf115046.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ #autofilter exist
+ self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
- xcancBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancBtn)
- #autofilter still exist
- self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
- self.ui_test.close_doc()
+ xcancBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancBtn)
+ #autofilter still exist
+ self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
def test_tdf94055(self):
self.ui_test.create_doc_in_start_center("calc")
@@ -59,181 +57,165 @@ class autofilter(UITestCase):
#tdf77479.ods
def test_tdf77479(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77479.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
- #autofilter exist
- self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
- xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"}))
-
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #autofilter still exist
- self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf77479.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
+ #autofilter exist
+ self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
+
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"}))
+
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #autofilter still exist
+ self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
#112656
def test_tdf112656(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf112656.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
-
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_list_box")
- xFirstEntry = xTreeList.getChild("0")
- xSecondEntry = xTreeList.getChild("1")
- self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit")
- self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf112656.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
+
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_list_box")
+ xFirstEntry = xTreeList.getChild("0")
+ xSecondEntry = xTreeList.getChild("1")
+ self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit")
+ self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables")
#tdf81124
def test_tdf81124(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
-
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
- xUnselect = xFloatWindow.getChild("unselect_current")
- xUnselect.executeAction("CLICK", tuple())
- xokBtn = xFloatWindow.getChild("ok")
- self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
- xSelect = xFloatWindow.getChild("select_current")
- xSelect.executeAction("CLICK", tuple())
- xokBtn = xFloatWindow.getChild("ok")
- self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")
+ xUnselect = xFloatWindow.getChild("unselect_current")
+ xUnselect.executeAction("CLICK", tuple())
+ xokBtn = xFloatWindow.getChild("ok")
+ self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")
- xCancel = xFloatWindow.getChild("cancel")
- xCancel.executeAction("CLICK", tuple())
+ xSelect = xFloatWindow.getChild("select_current")
+ xSelect.executeAction("CLICK", tuple())
+ xokBtn = xFloatWindow.getChild("ok")
+ self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")
- self.ui_test.close_doc()
+ xCancel = xFloatWindow.getChild("cancel")
+ xCancel.executeAction("CLICK", tuple())
#tdf73565
def test_tdf73565(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf73565.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf73565.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_tree_box")
- xFirstEntry = xTreeList.getChild("0")
- self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014")
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_tree_box")
+ xFirstEntry = xTreeList.getChild("0")
+ self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014")
- xCancel = xFloatWindow.getChild("cancel")
- xCancel.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xCancel = xFloatWindow.getChild("cancel")
+ xCancel.executeAction("CLICK", tuple())
#tdf65505
def test_tdf65505(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_list_box")
- xFirstEntry = xTreeList.getChild("0")
- self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)")
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_list_box")
+ xFirstEntry = xTreeList.getChild("0")
+ self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)")
- xCancel = xFloatWindow.getChild("cancel")
- xCancel.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xCancel = xFloatWindow.getChild("cancel")
+ xCancel.executeAction("CLICK", tuple())
#tdf74857
def test_tdf74857(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf74857.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
-
- xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"}))
- # Assert that the correct range has been selected
- gridWinState = get_state_as_dict(xGridWindow)
- self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")
+ with self.ui_test.load_file(get_url_for_data_file("tdf74857.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
- self.ui_test.close_doc()
+ xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"}))
+ # Assert that the correct range has been selected
+ gridWinState = get_state_as_dict(xGridWindow)
+ self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")
#tdf35294
def test_tdf35294(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35294.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
-
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_list_box")
- x1Entry = xTreeList.getChild("0")
- x2Entry = xTreeList.getChild("1")
- x3Entry = xTreeList.getChild("2")
- x4Entry = xTreeList.getChild("3")
- x5Entry = xTreeList.getChild("4")
- x6Entry = xTreeList.getChild("5")
- x7Entry = xTreeList.getChild("6")
-
- self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a")
- self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á")
- self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b")
- self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č")
- self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é")
- self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř")
- self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž")
-
- xCancel = xFloatWindow.getChild("cancel")
- xCancel.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf35294.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
+
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_list_box")
+ x1Entry = xTreeList.getChild("0")
+ x2Entry = xTreeList.getChild("1")
+ x3Entry = xTreeList.getChild("2")
+ x4Entry = xTreeList.getChild("3")
+ x5Entry = xTreeList.getChild("4")
+ x6Entry = xTreeList.getChild("5")
+ x7Entry = xTreeList.getChild("6")
+
+ self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a")
+ self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á")
+ self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b")
+ self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č")
+ self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é")
+ self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř")
+ self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž")
+
+ xCancel = xFloatWindow.getChild("cancel")
+ xCancel.executeAction("CLICK", tuple())
#tdf55712
def test_tdf55712(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods"))
- document = self.ui_test.get_component()
- calcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = calcDoc.getChild("grid_window")
-
- xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_list_box")
- x1Entry = xTreeList.getChild("0")
- x2Entry = xTreeList.getChild("1")
- x3Entry = xTreeList.getChild("2")
- x4Entry = xTreeList.getChild("3")
- x5Entry = xTreeList.getChild("4")
- x6Entry = xTreeList.getChild("5")
- x7Entry = xTreeList.getChild("6")
- x8Entry = xTreeList.getChild("7")
- x9Entry = xTreeList.getChild("8")
-
- self.assertEqual(get_state_as_dict(x1Entry)["Text"], "(empty)")
- self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0")
- self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1")
- self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2")
- self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3")
- self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5")
- self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8")
- self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9")
- self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1")
- self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
-
- xCancel = xFloatWindow.getChild("cancel")
- xCancel.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf55712.ods")) as calc_doc:
+ document = self.ui_test.get_component()
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = calcDoc.getChild("grid_window")
+
+ xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_list_box")
+ x1Entry = xTreeList.getChild("0")
+ x2Entry = xTreeList.getChild("1")
+ x3Entry = xTreeList.getChild("2")
+ x4Entry = xTreeList.getChild("3")
+ x5Entry = xTreeList.getChild("4")
+ x6Entry = xTreeList.getChild("5")
+ x7Entry = xTreeList.getChild("6")
+ x8Entry = xTreeList.getChild("7")
+ x9Entry = xTreeList.getChild("8")
+
+ self.assertEqual(get_state_as_dict(x1Entry)["Text"], "(empty)")
+ self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0")
+ self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1")
+ self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2")
+ self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3")
+ self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5")
+ self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8")
+ self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9")
+ self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
+
+ xCancel = xFloatWindow.getChild("cancel")
+ xCancel.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf101165.py b/sc/qa/uitest/autofilter/tdf101165.py
index 1eda0193b69c..e71820e53e0a 100644
--- a/sc/qa/uitest/autofilter/tdf101165.py
+++ b/sc/qa/uitest/autofilter/tdf101165.py
@@ -13,17 +13,16 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf101165(UITestCase):
def test_tdf101165_autofilter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf101165.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf101165.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xAll = xFloatWindow.getChild("toggle_all")
- xAll.executeAction("CLICK", tuple())
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xAll = xFloatWindow.getChild("toggle_all")
+ xAll.executeAction("CLICK", tuple())
- self.assertEqual(get_cell_by_position(document, 1, 0, 1).getValue(), 6494)
+ self.assertEqual(get_cell_by_position(document, 1, 0, 1).getValue(), 6494)
- self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf117276.py b/sc/qa/uitest/autofilter/tdf117276.py
index 9f2fa71ee69a..fdd5e91b7f83 100644
--- a/sc/qa/uitest/autofilter/tdf117276.py
+++ b/sc/qa/uitest/autofilter/tdf117276.py
@@ -13,85 +13,84 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf117276(UITestCase):
def test_tdf117276_autofilter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf117276.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- # 1. open attached file
- # 2. open filter of column B (Fabrikat) and deselect (Citroen, Fiat, Ford, Opel, Peugeot, Renault, Tesla)
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
-
- xCitroenEntry = xTreeList.getChild("2")
- xCitroenEntry.executeAction("CLICK", tuple()) #Citroen
- xFiatEntry = xTreeList.getChild("3")
- xFiatEntry.executeAction("CLICK", tuple()) #Fiat
- xFordEntry = xTreeList.getChild("4")
- xFordEntry.executeAction("CLICK", tuple()) #Ford
- xOpelEntry = xTreeList.getChild("6")
- xOpelEntry.executeAction("CLICK", tuple()) #Opel
- xPeugeotEntry = xTreeList.getChild("7")
- xPeugeotEntry.executeAction("CLICK", tuple()) #Peugeot
- xRenaultEntry = xTreeList.getChild("9")
- xRenaultEntry.executeAction("CLICK", tuple()) #Renault
- xTeslaEntry = xTreeList.getChild("10")
- xTeslaEntry.executeAction("CLICK", tuple()) #Tesla
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 3))
-
- # 3. open filter of column I (Wert) and deselect 8000 (Values 7000 and 9000 are not shown)
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
-
- xCitroenEntry = xTreeList.getChild("0")
- xCitroenEntry.executeAction("CLICK", tuple())
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 9))
-
- # 4. open filter of column B and select Tesla
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
- xTeslaEntry = xTreeList.getChild("4")
- xTeslaEntry.executeAction("CLICK", tuple()) #Tesla
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertFalse(is_row_hidden(calc_doc, 21))
-
- # 5. open filter of column I and select 7000 --> 8000 because:new strategy of the filter is implemented
- #(which strings to show and which to hide, when multiple filters are in used).
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_list_box")
-
- x8000Entry = xTreeList.getChild("1") # check "8000"
- x8000Entry.executeAction("CLICK", tuple())
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertFalse(is_row_hidden(calc_doc, 7))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf117276.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ # 1. open attached file
+ # 2. open filter of column B (Fabrikat) and deselect (Citroen, Fiat, Ford, Opel, Peugeot, Renault, Tesla)
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ xCitroenEntry = xTreeList.getChild("2")
+ xCitroenEntry.executeAction("CLICK", tuple()) #Citroen
+ xFiatEntry = xTreeList.getChild("3")
+ xFiatEntry.executeAction("CLICK", tuple()) #Fiat
+ xFordEntry = xTreeList.getChild("4")
+ xFordEntry.executeAction("CLICK", tuple()) #Ford
+ xOpelEntry = xTreeList.getChild("6")
+ xOpelEntry.executeAction("CLICK", tuple()) #Opel
+ xPeugeotEntry = xTreeList.getChild("7")
+ xPeugeotEntry.executeAction("CLICK", tuple()) #Peugeot
+ xRenaultEntry = xTreeList.getChild("9")
+ xRenaultEntry.executeAction("CLICK", tuple()) #Renault
+ xTeslaEntry = xTreeList.getChild("10")
+ xTeslaEntry.executeAction("CLICK", tuple()) #Tesla
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 3))
+
+ # 3. open filter of column I (Wert) and deselect 8000 (Values 7000 and 9000 are not shown)
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ xCitroenEntry = xTreeList.getChild("0")
+ xCitroenEntry.executeAction("CLICK", tuple())
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 9))
+
+ # 4. open filter of column B and select Tesla
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ xTeslaEntry = xTreeList.getChild("4")
+ xTeslaEntry.executeAction("CLICK", tuple()) #Tesla
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertFalse(is_row_hidden(calc_doc, 21))
+
+ # 5. open filter of column I and select 7000 --> 8000 because:new strategy of the filter is implemented
+ #(which strings to show and which to hide, when multiple filters are in used).
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ x8000Entry = xTreeList.getChild("1") # check "8000"
+ x8000Entry.executeAction("CLICK", tuple())
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertFalse(is_row_hidden(calc_doc, 7))
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf122260.py b/sc/qa/uitest/autofilter/tdf122260.py
index 00c141e3195f..fb2c905e3844 100644
--- a/sc/qa/uitest/autofilter/tdf122260.py
+++ b/sc/qa/uitest/autofilter/tdf122260.py
@@ -59,29 +59,27 @@ class tdf122260(UITestCase):
return valuesCount
def test_tdf122260_autofilter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122260.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- self.assertIsNotNone(gridwin)
-
- # filter out b1
- self.check_value_in_AutoFilter(gridwin, "1", "0")
- # filter out a2 (as a1 is filtered out a2 is the first item)
- self.check_value_in_AutoFilter(gridwin, "0", "0")
- # return back a2 (as a1 is filtered out a2 is the first item)
- self.check_value_in_AutoFilter(gridwin, "0", "0")
-
- # check rows visibility
- # row-0 is row with headers
- self.assertTrue(is_row_hidden(calc_doc, 1))
- self.assertFalse(is_row_hidden(calc_doc, 2))
- self.assertFalse(is_row_hidden(calc_doc, 3))
- self.assertFalse(is_row_hidden(calc_doc, 4))
-
- # check if "b1" is accessible in filter of the column-b
- # (so all values of the column B are available)
- self.assertEqual(4, self.get_values_count_in_AutoFilter(gridwin, "1"))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122260.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ self.assertIsNotNone(gridwin)
+
+ # filter out b1
+ self.check_value_in_AutoFilter(gridwin, "1", "0")
+ # filter out a2 (as a1 is filtered out a2 is the first item)
+ self.check_value_in_AutoFilter(gridwin, "0", "0")
+ # return back a2 (as a1 is filtered out a2 is the first item)
+ self.check_value_in_AutoFilter(gridwin, "0", "0")
+
+ # check rows visibility
+ # row-0 is row with headers
+ self.assertTrue(is_row_hidden(calc_doc, 1))
+ self.assertFalse(is_row_hidden(calc_doc, 2))
+ self.assertFalse(is_row_hidden(calc_doc, 3))
+ self.assertFalse(is_row_hidden(calc_doc, 4))
+
+ # check if "b1" is accessible in filter of the column-b
+ # (so all values of the column B are available)
+ self.assertEqual(4, self.get_values_count_in_AutoFilter(gridwin, "1"))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf130070.py b/sc/qa/uitest/autofilter/tdf130070.py
index 227355626a75..1ea4b8fbaf9c 100644
--- a/sc/qa/uitest/autofilter/tdf130070.py
+++ b/sc/qa/uitest/autofilter/tdf130070.py
@@ -13,43 +13,42 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf130770(UITestCase):
def test_tdf130770_autofilter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130770.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- # 1. open attached file and check initial state
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 2))
- self.assertFalse(is_row_hidden(calc_doc, 3))
- self.assertFalse(is_row_hidden(calc_doc, 4))
-
- # 2. open filter of column A and cancel
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
-
- xOkBtn = xFloatWindow.getChild("cancel")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 2))
- self.assertFalse(is_row_hidden(calc_doc, 3))
- self.assertFalse(is_row_hidden(calc_doc, 4))
-
- # 3. open filter of column A and just click OK
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertFalse(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 2))
- self.assertFalse(is_row_hidden(calc_doc, 3))
- self.assertTrue(is_row_hidden(calc_doc, 4)) # filtered out
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf130770.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ # 1. open attached file and check initial state
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 2))
+ self.assertFalse(is_row_hidden(calc_doc, 3))
+ self.assertFalse(is_row_hidden(calc_doc, 4))
+
+ # 2. open filter of column A and cancel
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+
+ xOkBtn = xFloatWindow.getChild("cancel")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 2))
+ self.assertFalse(is_row_hidden(calc_doc, 3))
+ self.assertFalse(is_row_hidden(calc_doc, 4))
+
+ # 3. open filter of column A and just click OK
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertFalse(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 2))
+ self.assertFalse(is_row_hidden(calc_doc, 3))
+ self.assertTrue(is_row_hidden(calc_doc, 4)) # filtered out
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf140754.py b/sc/qa/uitest/autofilter/tdf140754.py
index 4d413ac0d85f..186637e303b9 100644
--- a/sc/qa/uitest/autofilter/tdf140754.py
+++ b/sc/qa/uitest/autofilter/tdf140754.py
@@ -13,72 +13,70 @@ class tdf140754(UITestCase):
def test_tdf140754(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf140754.ods"))
-
- #Make sure 'multi-threaded calculation' is enabled
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xCalcEntry = xPages.getChild('3')
- xCalcEntry.executeAction("EXPAND", tuple())
- xCalcCalculateEntry = xCalcEntry.getChild('3')
- xCalcCalculateEntry.executeAction("SELECT", tuple())
-
- self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"])
-
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- document = self.ui_test.get_component()
-
- self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
- self.assertEqual(0, get_cell_by_position(document, 0, 0, 82).getValue())
- self.assertEqual(1, get_cell_by_position(document, 0, 0, 238).getValue())
- self.assertEqual(28, get_cell_by_position(document, 0, 0, 265).getValue())
- self.assertEqual(28, get_cell_by_position(document, 0, 0, 1370).getValue())
-
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xAll = xFloatWindow.getChild("toggle_all")
- xAll.executeAction("CLICK", tuple())
-
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(25, len(xList.getChildren()))
-
- # Without the fix in place, this test would have crashed here
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
- self.assertEqual(1, get_cell_by_position(document, 0, 0, 82).getValue())
- self.assertEqual(39, get_cell_by_position(document, 0, 0, 238).getValue())
- self.assertEqual(66, get_cell_by_position(document, 0, 0, 265).getValue())
- self.assertEqual(282, get_cell_by_position(document, 0, 0, 1370).getValue())
-
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xAll = xFloatWindow.getChild("toggle_all")
- xAll.executeAction("CLICK", tuple())
-
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xList = xCheckListMenu.getChild("check_list_box")
- self.assertEqual(10, len(xList.getChildren()))
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.assertEqual(1, get_cell_by_position(document, 0, 0, 30).getValue())
- self.assertEqual(11, get_cell_by_position(document, 0, 0, 82).getValue())
- self.assertEqual(69, get_cell_by_position(document, 0, 0, 238).getValue())
- self.assertEqual(96, get_cell_by_position(document, 0, 0, 265).getValue())
- self.assertEqual(411, get_cell_by_position(document, 0, 0, 1370).getValue())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf140754.ods")) as calc_doc:
+
+ #Make sure 'multi-threaded calculation' is enabled
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xCalcEntry = xPages.getChild('3')
+ xCalcEntry.executeAction("EXPAND", tuple())
+ xCalcCalculateEntry = xCalcEntry.getChild('3')
+ xCalcCalculateEntry.executeAction("SELECT", tuple())
+
+ self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"])
+
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ document = self.ui_test.get_component()
+
+ self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+ self.assertEqual(0, get_cell_by_position(document, 0, 0, 82).getValue())
+ self.assertEqual(1, get_cell_by_position(document, 0, 0, 238).getValue())
+ self.assertEqual(28, get_cell_by_position(document, 0, 0, 265).getValue())
+ self.assertEqual(28, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xAll = xFloatWindow.getChild("toggle_all")
+ xAll.executeAction("CLICK", tuple())
+
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(25, len(xList.getChildren()))
+
+ # Without the fix in place, this test would have crashed here
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(0, get_cell_by_position(document, 0, 0, 30).getValue())
+ self.assertEqual(1, get_cell_by_position(document, 0, 0, 82).getValue())
+ self.assertEqual(39, get_cell_by_position(document, 0, 0, 238).getValue())
+ self.assertEqual(66, get_cell_by_position(document, 0, 0, 265).getValue())
+ self.assertEqual(282, get_cell_by_position(document, 0, 0, 1370).getValue())
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xAll = xFloatWindow.getChild("toggle_all")
+ xAll.executeAction("CLICK", tuple())
+
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(10, len(xList.getChildren()))
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(1, get_cell_by_position(document, 0, 0, 30).getValue())
+ self.assertEqual(11, get_cell_by_position(document, 0, 0, 82).getValue())
+ self.assertEqual(69, get_cell_by_position(document, 0, 0, 238).getValue())
+ self.assertEqual(96, get_cell_by_position(document, 0, 0, 265).getValue())
+ self.assertEqual(411, get_cell_by_position(document, 0, 0, 1370).getValue())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf92767.py b/sc/qa/uitest/autofilter/tdf92767.py
index e846e0bcfb40..a016d2337f86 100644
--- a/sc/qa/uitest/autofilter/tdf92767.py
+++ b/sc/qa/uitest/autofilter/tdf92767.py
@@ -12,42 +12,40 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf92767(UITestCase):
def test_tdf92767(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf92767.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- for i in range(0,25):
- self.assertFalse(is_row_hidden(calc_doc, i))
-
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
- xTreeList = xFloatWindow.getChild("check_tree_box")
- xFirstEntry = xTreeList.getChild("0")
- self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"])
- self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"])
-
- # Deselect all the options but the last one
- for i in range(6):
- xChild = xFirstEntry.getChild(str(i))
- xChild.executeAction("CLICK", tuple())
- self.assertEqual('false', get_state_as_dict(xChild)['IsChecked'])
-
- xLastChild = xFirstEntry.getChild('6')
- self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked'])
- self.assertEqual('July', get_state_as_dict(xLastChild)['Text'])
-
- xOkBtn = xFloatWindow.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- for i in range(1,22):
- self.assertTrue(is_row_hidden(calc_doc, i))
-
- # Without the fix in place, this test would have failed here
- self.assertFalse(is_row_hidden(calc_doc, 23))
- self.assertFalse(is_row_hidden(calc_doc, 24))
- self.assertFalse(is_row_hidden(calc_doc, 25))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf92767.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ for i in range(0,25):
+ self.assertFalse(is_row_hidden(calc_doc, i))
+
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xTreeList = xFloatWindow.getChild("check_tree_box")
+ xFirstEntry = xTreeList.getChild("0")
+ self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"])
+ self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"])
+
+ # Deselect all the options but the last one
+ for i in range(6):
+ xChild = xFirstEntry.getChild(str(i))
+ xChild.executeAction("CLICK", tuple())
+ self.assertEqual('false', get_state_as_dict(xChild)['IsChecked'])
+
+ xLastChild = xFirstEntry.getChild('6')
+ self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked'])
+ self.assertEqual('July', get_state_as_dict(xLastChild)['Text'])
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ for i in range(1,22):
+ self.assertTrue(is_row_hidden(calc_doc, i))
+
+ # Without the fix in place, this test would have failed here
+ self.assertFalse(is_row_hidden(calc_doc, 23))
+ self.assertFalse(is_row_hidden(calc_doc, 24))
+ self.assertFalse(is_row_hidden(calc_doc, 25))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/autofilter/tdf97340.py b/sc/qa/uitest/autofilter/tdf97340.py
index 7ef59bf6b641..f4b58ce5a7d4 100644
--- a/sc/qa/uitest/autofilter/tdf97340.py
+++ b/sc/qa/uitest/autofilter/tdf97340.py
@@ -12,30 +12,29 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf97340(UITestCase):
def test_tdf97340_autofilter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
- xFloatWindow = self.xUITest.getFloatWindow()
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
- xCheckListMenu = xFloatWindow.getChild("check_list_menu")
- xTreeList = xCheckListMenu.getChild("check_tree_box")
- self.assertEqual(2, len(xTreeList.getChildren()))
- self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
- self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_tree_box")
+ self.assertEqual(2, len(xTreeList.getChildren()))
+ self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+ self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
- xsearchEdit = xFloatWindow.getChild("search_edit")
- xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
- self.assertEqual(0, len(xTreeList.getChildren()))
+ xsearchEdit = xFloatWindow.getChild("search_edit")
+ xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
+ self.assertEqual(0, len(xTreeList.getChildren()))
- xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- #tdf#133785, without the fix in place, it would have been 0
- self.assertEqual(2, len(xTreeList.getChildren()))
- self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
- self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+ #tdf#133785, without the fix in place, it would have been 0
+ self.assertEqual(2, len(xTreeList.getChildren()))
+ self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+ self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py
index 23f8bd9bac26..57691ef5c499 100644
--- a/sc/qa/uitest/calc_tests/autofill.py
+++ b/sc/qa/uitest/calc_tests/autofill.py
@@ -14,115 +14,113 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class CalcAutofill(UITestCase):
def test_autofill(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autofill.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 19.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 20.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 21.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 22.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 23.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 24.34)
- #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xup = xDialog.getChild("up")
- xincrement = xDialog.getChild("increment")
- xup.executeAction("CLICK", tuple())
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 12.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 13.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 14.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 15.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 16.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 17.34)
- self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
+ with self.ui_test.load_file(get_url_for_data_file("autofill.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 19.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 20.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 21.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 22.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 23.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 24.34)
+ #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xup = xDialog.getChild("up")
+ xincrement = xDialog.getChild("increment")
+ xup.executeAction("CLICK", tuple())
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 12.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 13.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 14.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 15.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 16.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 17.34)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34)
- #Continue with the next cells with grey background
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
- self.assertEqual(get_cell_by_position(document, 0, 12, 12).getString(), "12abc41")
- self.assertEqual(get_cell_by_position(document, 0, 12, 13).getString(), "12abc42")
- self.assertEqual(get_cell_by_position(document, 0, 12, 14).getString(), "12abc43")
- self.assertEqual(get_cell_by_position(document, 0, 12, 15).getString(), "12abc44")
- self.assertEqual(get_cell_by_position(document, 0, 12, 16).getString(), "12abc45")
- self.assertEqual(get_cell_by_position(document, 0, 12, 17).getString(), "12abc46")
+ #Continue with the next cells with grey background
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 12).getString(), "12abc41")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 13).getString(), "12abc42")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 14).getString(), "12abc43")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 15).getString(), "12abc44")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 16).getString(), "12abc45")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 17).getString(), "12abc46")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xup = xDialog.getChild("up")
- xincrement = xDialog.getChild("increment")
- xup.executeAction("CLICK", tuple())
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 12, 5).getString(), "12abc34")
- self.assertEqual(get_cell_by_position(document, 0, 12, 6).getString(), "12abc35")
- self.assertEqual(get_cell_by_position(document, 0, 12, 7).getString(), "12abc36")
- self.assertEqual(get_cell_by_position(document, 0, 12, 8).getString(), "12abc37")
- self.assertEqual(get_cell_by_position(document, 0, 12, 9).getString(), "12abc38")
- self.assertEqual(get_cell_by_position(document, 0, 12, 10).getString(), "12abc39")
- self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
- self.assertEqual(get_cell_by_position(document, 0, 15, 12).getString(), "10.64.127.8")
- self.assertEqual(get_cell_by_position(document, 0, 15, 13).getString(), "10.64.127.9")
- self.assertEqual(get_cell_by_position(document, 0, 15, 14).getString(), "10.64.127.10")
- self.assertEqual(get_cell_by_position(document, 0, 15, 15).getString(), "10.64.127.11")
- self.assertEqual(get_cell_by_position(document, 0, 15, 16).getString(), "10.64.127.12")
- self.assertEqual(get_cell_by_position(document, 0, 15, 17).getString(), "10.64.127.13")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xup = xDialog.getChild("up")
+ xincrement = xDialog.getChild("increment")
+ xup.executeAction("CLICK", tuple())
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 12, 5).getString(), "12abc34")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 6).getString(), "12abc35")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 7).getString(), "12abc36")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 8).getString(), "12abc37")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 9).getString(), "12abc38")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 10).getString(), "12abc39")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xup = xDialog.getChild("up")
- xincrement = xDialog.getChild("increment")
- xup.executeAction("CLICK", tuple())
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #Compare with the content in the right next column
- self.assertEqual(get_cell_by_position(document, 0, 15, 5).getString(), "10.64.127.1")
- self.assertEqual(get_cell_by_position(document, 0, 15, 6).getString(), "10.64.127.2")
- self.assertEqual(get_cell_by_position(document, 0, 15, 7).getString(), "10.64.127.3")
- self.assertEqual(get_cell_by_position(document, 0, 15, 8).getString(), "10.64.127.4")
- self.assertEqual(get_cell_by_position(document, 0, 15, 9).getString(), "10.64.127.5")
- self.assertEqual(get_cell_by_position(document, 0, 15, 10).getString(), "10.64.127.6")
- self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 12).getString(), "10.64.127.8")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 13).getString(), "10.64.127.9")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 14).getString(), "10.64.127.10")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 15).getString(), "10.64.127.11")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 16).getString(), "10.64.127.12")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 17).getString(), "10.64.127.13")
- self.ui_test.close_doc()
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xup = xDialog.getChild("up")
+ xincrement = xDialog.getChild("increment")
+ xup.executeAction("CLICK", tuple())
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"}))
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #Compare with the content in the right next column
+ self.assertEqual(get_cell_by_position(document, 0, 15, 5).getString(), "10.64.127.1")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 6).getString(), "10.64.127.2")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 7).getString(), "10.64.127.3")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 8).getString(), "10.64.127.4")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 9).getString(), "10.64.127.5")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 10).getString(), "10.64.127.6")
+ self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7")
def test_autofill_with_suffix(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
diff --git a/sc/qa/uitest/calc_tests/autosum.py b/sc/qa/uitest/calc_tests/autosum.py
index f7c41388c17e..bc493d1977b0 100644
--- a/sc/qa/uitest/calc_tests/autosum.py
+++ b/sc/qa/uitest/calc_tests/autosum.py
@@ -15,269 +15,247 @@ class calcAutosum(UITestCase):
def test_autosum_test1(self):
#Sum on range and Sum on Sum's
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Place the cell cursor on the gray cells located under Point 1.
- #(Multiselection is not possible at this place) and press the Sum Icon in the formula bar.
- #Now hit the enter key and the result should be shown. Do so for each gray cell in this part of the document.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B13"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B14"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 9).getFormula(), "=SUM(B8:B9)")
- self.assertEqual(get_cell_by_position(document, 0, 1, 12).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 12).getFormula(), "=SUM(B11:B12)")
- self.assertEqual(get_cell_by_position(document, 0, 1, 13).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 1, 13).getFormula(), "=SUM(B13:B13;B10:B10)")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "F8:F14"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 5, 13).getFormula(), "=SUM(F13:F13;F10:F10)")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Place the cell cursor on the gray cells located under Point 1.
+ #(Multiselection is not possible at this place) and press the Sum Icon in the formula bar.
+ #Now hit the enter key and the result should be shown. Do so for each gray cell in this part of the document.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B13"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B14"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 9).getFormula(), "=SUM(B8:B9)")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 12).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 12).getFormula(), "=SUM(B11:B12)")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 13).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 13).getFormula(), "=SUM(B13:B13;B10:B10)")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "F8:F14"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getFormula(), "=SUM(F13:F13;F10:F10)")
def test_autosum_test2(self):
#Sum on Row and Column
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E25"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E26"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E27"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E28"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E29"}))
- self.xUITest.executeCommand(".uno:AutoSum")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E30"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 4, 24).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 4, 24).getFormula(), "=SUM(E22:E24)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 25).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 4, 25).getFormula(), "=SUM(B26:D26)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 26).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 4, 26).getFormula(), "=SUM(B27:D27)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 27).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 4, 27).getFormula(), "=SUM(B28:D28)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 28).getValue(), 9)
- self.assertEqual(get_cell_by_position(document, 0, 4, 28).getFormula(), "=SUM(E26:E28)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 29).getValue(), 12)
- self.assertEqual(get_cell_by_position(document, 0, 4, 29).getFormula(), "=SUM(E29:E29;E25:E25)")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E25"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E26"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E27"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E28"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E29"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E30"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 4, 24).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 24).getFormula(), "=SUM(E22:E24)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 25).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 25).getFormula(), "=SUM(B26:D26)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 26).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 26).getFormula(), "=SUM(B27:D27)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 27).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 27).getFormula(), "=SUM(B28:D28)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 28).getValue(), 9)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 28).getFormula(), "=SUM(E26:E28)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 29).getValue(), 12)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 29).getFormula(), "=SUM(E29:E29;E25:E25)")
def test_autosum_test3(self):
#Subtotals on Autosum
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C49"}))
- self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C49"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
- self.assertEqual(get_cell_by_position(document, 0, 2, 48).getValue(), 20)
- self.assertEqual(get_cell_by_position(document, 0, 2, 48).getFormula(), "=SUBTOTAL(9;C38:C48)")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 2, 48).getValue(), 20)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 48).getFormula(), "=SUBTOTAL(9;C38:C48)")
def test_autosum_test4(self):
#Autosum on column with selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B59:B64"}))
- self.xUITest.executeCommand(".uno:AutoSum")
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.assertEqual(get_cell_by_position(document, 0, 1, 63).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 1, 63).getFormula(), "=SUM(B59:B63)")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B59:B64"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 1, 63).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 63).getFormula(), "=SUM(B59:B63)")
def test_autosum_test5(self):
#5.Autosum on rows with selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B76:E80"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 4, 75).getValue(), 30)
- self.assertEqual(get_cell_by_position(document, 0, 4, 75).getFormula(), "=SUM(B76:D76)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 76).getValue(), 60)
- self.assertEqual(get_cell_by_position(document, 0, 4, 76).getFormula(), "=SUM(B77:D77)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 77).getValue(), 90)
- self.assertEqual(get_cell_by_position(document, 0, 4, 77).getFormula(), "=SUM(B78:D78)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 78).getValue(), 120)
- self.assertEqual(get_cell_by_position(document, 0, 4, 78).getFormula(), "=SUM(B79:D79)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 79).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 4, 79).getFormula(), "=SUM(B80:D80)")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B76:E80"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 4, 75).getValue(), 30)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 75).getFormula(), "=SUM(B76:D76)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 76).getValue(), 60)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 76).getFormula(), "=SUM(B77:D77)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 77).getValue(), 90)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 77).getFormula(), "=SUM(B78:D78)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 78).getValue(), 120)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 78).getFormula(), "=SUM(B79:D79)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 79).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 79).getFormula(), "=SUM(B80:D80)")
def test_autosum_test6(self):
#6.Subtotal on column with selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C92:C101"}))
- self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C92:C101"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
- self.assertEqual(get_cell_by_position(document, 0, 2, 100).getValue(), 19)
- self.assertEqual(get_cell_by_position(document, 0, 2, 100).getFormula(), "=SUBTOTAL(9;C92:C100)")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 2, 100).getValue(), 19)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 100).getFormula(), "=SUBTOTAL(9;C92:C100)")
def test_autosum_test7(self):
#7.Autosum on column without selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B109:B113"}))
- self.xUITest.executeCommand(".uno:AutoSum")
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.assertEqual(get_cell_by_position(document, 0, 1, 113).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 1, 113).getFormula(), "=SUM(B109:B113)")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B109:B113"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 1, 113).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 113).getFormula(), "=SUM(B109:B113)")
def test_autosum_test8(self):
#8.Autosum on rows without selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B126:D126"}))
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B128:D128", "EXTEND":"1"}))
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B130:D130", "EXTEND":"1"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 4, 125).getValue(), 30)
- self.assertEqual(get_cell_by_position(document, 0, 4, 125).getFormula(), "=SUM(B126:D126)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 127).getValue(), 90)
- self.assertEqual(get_cell_by_position(document, 0, 4, 127).getFormula(), "=SUM(B128:D128)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 129).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 4, 129).getFormula(), "=SUM(B130:D130)")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B126:D126"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B128:D128", "EXTEND":"1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B130:D130", "EXTEND":"1"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 4, 125).getValue(), 30)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 125).getFormula(), "=SUM(B126:D126)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 127).getValue(), 90)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 127).getFormula(), "=SUM(B128:D128)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 129).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 129).getFormula(), "=SUM(B130:D130)")
def test_autosum_test9(self):
#9.Subtotal on column without selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C142:C149"}))
- self.xUITest.executeCommand(".uno:AutoSum")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C142:C149"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
- self.assertEqual(get_cell_by_position(document, 0, 2, 150).getValue(), 19)
- self.assertEqual(get_cell_by_position(document, 0, 2, 150).getFormula(), "=SUBTOTAL(9;C142:C149)")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 2, 150).getValue(), 19)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 150).getFormula(), "=SUBTOTAL(9;C142:C149)")
def test_autosum_test10(self):
#10.Autosum on multiselected columns without selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B160:D164"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 1, 164).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 1, 164).getFormula(), "=SUM(B160:B164)")
- self.assertEqual(get_cell_by_position(document, 0, 2, 164).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 2, 164).getFormula(), "=SUM(C160:C164)")
- self.assertEqual(get_cell_by_position(document, 0, 3, 164).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 3, 164).getFormula(), "=SUM(D160:D164)")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B160:D164"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 164).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 164).getFormula(), "=SUM(B160:B164)")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 164).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 164).getFormula(), "=SUM(C160:C164)")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 164).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 164).getFormula(), "=SUM(D160:D164)")
def test_autosum_test11(self):
#11.Autosum on columns with formula results without selected empty cell for result
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B173:D177"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(round(get_cell_by_position(document, 0, 1, 177).getValue(),2), 2.55)
- self.assertEqual(get_cell_by_position(document, 0, 1, 177).getFormula(), "=SUM(B173:B177)")
- self.assertEqual(round(get_cell_by_position(document, 0, 2, 177).getValue(),2), -4.91)
- self.assertEqual(get_cell_by_position(document, 0, 2, 177).getFormula(), "=SUM(C173:C177)")
- self.assertEqual(get_cell_by_position(document, 0, 3, 177).getValue(), 5500)
- self.assertEqual(get_cell_by_position(document, 0, 3, 177).getFormula(), "=SUM(D173:D177)")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B173:D177"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 177).getValue(),2), 2.55)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 177).getFormula(), "=SUM(B173:B177)")
+ self.assertEqual(round(get_cell_by_position(document, 0, 2, 177).getValue(),2), -4.91)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 177).getFormula(), "=SUM(C173:C177)")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 177).getValue(), 5500)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 177).getFormula(), "=SUM(D173:D177)")
def test_autosum_test12(self):
#12.Autosum on column with filled cell under selected area
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B186:D190"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 1, 191).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 1, 191).getFormula(), "=SUM(B186:B190)")
- self.assertEqual(get_cell_by_position(document, 0, 2, 191).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 2, 191).getFormula(), "=SUM(C186:C190)")
- self.assertEqual(get_cell_by_position(document, 0, 3, 191).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 3, 191).getFormula(), "=SUM(D186:D190)")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B186:D190"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 191).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 191).getFormula(), "=SUM(B186:B190)")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 191).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 191).getFormula(), "=SUM(C186:C190)")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 191).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 191).getFormula(), "=SUM(D186:D190)")
def test_autosum_test13(self):
#13.Autosum on column and rows with empty cells selected for row and column
- calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B203:E208"}))
- self.xUITest.executeCommand(".uno:AutoSum")
-
- self.assertEqual(get_cell_by_position(document, 0, 1, 207).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 1, 207).getFormula(), "=SUM(B203:B207)")
- self.assertEqual(get_cell_by_position(document, 0, 2, 207).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 2, 207).getFormula(), "=SUM(C203:C207)")
- self.assertEqual(get_cell_by_position(document, 0, 3, 207).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 3, 207).getFormula(), "=SUM(D203:D207)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 207).getValue(), 450)
- self.assertEqual(get_cell_by_position(document, 0, 4, 207).getFormula(), "=SUM(B208:D208)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 202).getValue(), 30)
- self.assertEqual(get_cell_by_position(document, 0, 4, 202).getFormula(), "=SUM(B203:D203)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 203).getValue(), 60)
- self.assertEqual(get_cell_by_position(document, 0, 4, 203).getFormula(), "=SUM(B204:D204)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 204).getValue(), 90)
- self.assertEqual(get_cell_by_position(document, 0, 4, 204).getFormula(), "=SUM(B205:D205)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 205).getValue(), 120)
- self.assertEqual(get_cell_by_position(document, 0, 4, 205).getFormula(), "=SUM(B206:D206)")
- self.assertEqual(get_cell_by_position(document, 0, 4, 206).getValue(), 150)
- self.assertEqual(get_cell_by_position(document, 0, 4, 206).getFormula(), "=SUM(B207:D207)")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B203:E208"}))
+ self.xUITest.executeCommand(".uno:AutoSum")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 207).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 207).getFormula(), "=SUM(B203:B207)")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 207).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 207).getFormula(), "=SUM(C203:C207)")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 207).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 207).getFormula(), "=SUM(D203:D207)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 207).getValue(), 450)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 207).getFormula(), "=SUM(B208:D208)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 202).getValue(), 30)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 202).getFormula(), "=SUM(B203:D203)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 203).getValue(), 60)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 203).getFormula(), "=SUM(B204:D204)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 204).getValue(), 90)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 204).getFormula(), "=SUM(B205:D205)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 205).getValue(), 120)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 205).getFormula(), "=SUM(B206:D206)")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 206).getValue(), 150)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 206).getFormula(), "=SUM(B207:D207)")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests/mergedRowsColumns.py b/sc/qa/uitest/calc_tests/mergedRowsColumns.py
index 3247f0bc63bd..2bc225d1f84d 100644
--- a/sc/qa/uitest/calc_tests/mergedRowsColumns.py
+++ b/sc/qa/uitest/calc_tests/mergedRowsColumns.py
@@ -13,180 +13,171 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class mergedRowsColumns(UITestCase):
def test_merged_row_delete_tdf105412(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods"))
- xTopWindow = self.xUITest.getTopFocusWindow()
- gridwin = xTopWindow.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc:
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A20"}))
- self.xUITest.executeCommand(".uno:SelectRow")
- self.xUITest.executeCommand(".uno:DeleteRows")
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A20"}))
+ self.xUITest.executeCommand(".uno:SelectRow")
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
def test_merged_columns_delete(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods"))
- xTopWindow = self.xUITest.getTopFocusWindow()
- gridwin = xTopWindow.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc:
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
- self.xUITest.executeCommand(".uno:SelectColumn")
- self.xUITest.executeCommand(".uno:DeleteColumns")
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Redo")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+ self.xUITest.executeCommand(".uno:DeleteColumns")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
def test_undo_not_available_merged_cells_tdf37901(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods"))
- xTopWindow = self.xUITest.getTopFocusWindow()
- gridwin = xTopWindow.getChild("grid_window")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"}))
- self.xUITest.executeCommand(".uno:MergeCells")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
- self.xUITest.executeCommand(".uno:ToggleMergeCells")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:B2"}))
- self.xUITest.executeCommand(".uno:MergeCells")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
- self.xUITest.executeCommand(".uno:ToggleMergeCells")
- self.xUITest.executeCommand(".uno:Undo")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc:
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"}))
+ self.xUITest.executeCommand(".uno:MergeCells")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
+ self.xUITest.executeCommand(".uno:ToggleMergeCells")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:B2"}))
+ self.xUITest.executeCommand(".uno:MergeCells")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#")
+ self.xUITest.executeCommand(".uno:ToggleMergeCells")
+ self.xUITest.executeCommand(".uno:Undo")
def test_calculations_in_merged_cells_tdf51368(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf51368.ods"))
- xTopWindow = self.xUITest.getTopFocusWindow()
- gridwin = xTopWindow.getChild("grid_window")
-
- #move the content of the hidden cells into the first cell
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("move-cells-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
-
- #keep the contents of the hidden cells
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("keep-content-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "3")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
-
- #Empty the contents of the hidden cells
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("move-cells-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
-
- #A21-A22
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A21:A22"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("keep-content-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 21).getString(), "3")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2")
-
- #A30-A32
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A30:A32"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("keep-content-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 30).getString(), "is")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad")
-
- #J12-K12
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J12:K12"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("keep-content-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3")
-
- #J22-K22
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J22:K22"}))
- self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xMoveCells = xDialog.getChild("keep-content-radio")
- xMoveCells.executeAction("CLICK", tuple())
- self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
- self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2")
-
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf51368.ods")) as calc_doc:
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
+
+ #move the content of the hidden cells into the first cell
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("move-cells-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
+
+ #keep the contents of the hidden cells
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("keep-content-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "3")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
+
+ #Empty the contents of the hidden cells
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("move-cells-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3")
+
+ #A21-A22
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A21:A22"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("keep-content-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 21).getString(), "3")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2")
+
+ #A30-A32
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A30:A32"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("keep-content-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 30).getString(), "is")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad")
+
+ #J12-K12
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J12:K12"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("keep-content-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3")
+
+ #J22-K22
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J22:K22"}))
+ self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xMoveCells = xDialog.getChild("keep-content-radio")
+ xMoveCells.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xDialog.getChild("ok"))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2")
def test_merge_merged_cells_tdf63766(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods"))
- xTopWindow = self.xUITest.getTopFocusWindow()
- gridwin = xTopWindow.getChild("grid_window")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C19:F22"}))
- self.xUITest.executeCommand(".uno:ToggleMergeCells")
- self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
- self.xUITest.executeCommand(".uno:Undo")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc:
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C19:F22"}))
+ self.xUITest.executeCommand(".uno:ToggleMergeCells")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6")
+ self.xUITest.executeCommand(".uno:Undo")
def test_move_merged_cells(self):
self.ui_test.create_doc_in_start_center("calc")
diff --git a/sc/qa/uitest/calc_tests/tdf133855.py b/sc/qa/uitest/calc_tests/tdf133855.py
index 8f347e87c080..cd2144c3a134 100644
--- a/sc/qa/uitest/calc_tests/tdf133855.py
+++ b/sc/qa/uitest/calc_tests/tdf133855.py
@@ -13,38 +13,36 @@ class tdf133855(UITestCase):
def test_tdf133855(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf133855.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf133855.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
- results = ['A', 'B', 'C', 'D', 'E', 'F']
+ results = ['A', 'B', 'C', 'D', 'E', 'F']
- # Conditional formatted dropdown list
- for i in range(len(results)):
- gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "5"}))
+ # Conditional formatted dropdown list
+ for i in range(len(results)):
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "5"}))
- #Select the TreeList UI Object
- xWin = self.xUITest.getTopFocusWindow()
- xlist = xWin.getChild("list")
+ #Select the TreeList UI Object
+ xWin = self.xUITest.getTopFocusWindow()
+ xlist = xWin.getChild("list")
- xListItem = xlist.getChild( str(i) )
- xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
- self.assertEqual(get_cell_by_position(document, 0, 6, 5).getString(), results[i])
+ xListItem = xlist.getChild( str(i) )
+ xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
+ self.assertEqual(get_cell_by_position(document, 0, 6, 5).getString(), results[i])
- # normal dropdown list
- for i in range(len(results)):
- gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "6"}))
+ # normal dropdown list
+ for i in range(len(results)):
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "6"}))
- #Select the TreeList UI Object
- xWin = self.xUITest.getTopFocusWindow()
- xlist = xWin.getChild("list")
+ #Select the TreeList UI Object
+ xWin = self.xUITest.getTopFocusWindow()
+ xlist = xWin.getChild("list")
- xListItem = xlist.getChild( str(i) )
- xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
- self.assertEqual(get_cell_by_position(document, 0, 6, 6).getString(), results[i])
-
- self.ui_test.close_doc()
+ xListItem = xlist.getChild( str(i) )
+ xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
+ self.assertEqual(get_cell_by_position(document, 0, 6, 6).getString(), results[i])
# 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 8b47fb6f6d5d..95ddcf3df592 100644
--- a/sc/qa/uitest/calc_tests2/consolidate.py
+++ b/sc/qa/uitest/calc_tests2/consolidate.py
@@ -12,106 +12,104 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class consolidate(UITestCase):
def test_consolidate(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("consolidate.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("consolidate.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- 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")
+ 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")
- 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"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 300)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 303)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 306)
- self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 309)
+ 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(document, 0, 1, 2).getValue(), 300)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 303)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 306)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 309)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 303)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 306)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 309)
- self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 312)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 303)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 306)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 309)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 312)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 306)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 309)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 312)
- self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 315)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 306)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 309)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 312)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 315)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 309)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 312)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 315)
- self.assertEqual(get_cell_by_position(document, 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)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 309)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 312)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 315)
+ self.assertEqual(get_cell_by_position(document, 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)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 200)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 202)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 204)
- self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 206)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 200)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 202)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 204)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 206)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 202)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 204)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 206)
- self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 208)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 202)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 204)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 206)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 208)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 204)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 206)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 208)
- self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 210)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 204)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 206)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 208)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 210)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 206)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 208)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 210)
- self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 212)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 206)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 208)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 210)
+ self.assertEqual(get_cell_by_position(document, 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)
-
- self.ui_test.close_doc()
+ # 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)
# 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 cc719db86c4e..25b6373c7e42 100644
--- a/sc/qa/uitest/calc_tests2/standardFilter.py
+++ b/sc/qa/uitest/calc_tests2/standardFilter.py
@@ -15,128 +15,125 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class standardFilter(UITestCase):
def test_standard_filter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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)
- #3x down - should be on row 9
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- gridWinState = get_state_as_dict(gridwin)
- self.assertEqual(gridWinState["CurrentRow"], "8")
- #reopen filter and verify
- 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)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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)
+ #3x down - should be on row 9
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["CurrentRow"], "8")
+ #reopen filter and verify
+ 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)
def test_standard_filter_copy_result(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "b")
- self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "c")
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 4)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "a")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "b")
+ self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "c")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 4)
def test_standard_filter_copy_result_next_sheet(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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)
- #verify
- self.assertEqual(get_cell_by_position(document, 1, 5, 0).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 1, 6, 0).getString(), "b")
- self.assertEqual(get_cell_by_position(document, 1, 7, 0).getString(), "c")
- self.assertEqual(get_cell_by_position(document, 1, 5, 1).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 1, 6, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 1, 7, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 1, 5, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 1, 6, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 1, 7, 2).getValue(), 4)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 1, 5, 0).getString(), "a")
+ self.assertEqual(get_cell_by_position(document, 1, 6, 0).getString(), "b")
+ self.assertEqual(get_cell_by_position(document, 1, 7, 0).getString(), "c")
+ self.assertEqual(get_cell_by_position(document, 1, 5, 1).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 1, 6, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 1, 7, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 1, 5, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 1, 6, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 1, 7, 2).getValue(), 4)
def test_standard_filter_case_sensitive(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
diff --git a/sc/qa/uitest/calc_tests2/tdf114992.py b/sc/qa/uitest/calc_tests2/tdf114992.py
index 38c5568171f6..eedf7dcba100 100644
--- a/sc/qa/uitest/calc_tests2/tdf114992.py
+++ b/sc/qa/uitest/calc_tests2/tdf114992.py
@@ -11,20 +11,18 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf114992(UITestCase):
def test_tdf114992_delete_sheet_crash(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf114992.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf114992.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet
- xDialog = self.xUITest.getTopFocusWindow()
- xOKButton = xDialog.getChild("yes")
- xOKButton.executeAction("CLICK", tuple())
+ self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOKButton = xDialog.getChild("yes")
+ xOKButton.executeAction("CLICK", tuple())
- self.assertEqual(document.Sheets.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.Sheets.getCount(), 2)
+ self.assertEqual(document.Sheets.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Sheets.getCount(), 2)
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests2/tdf37623.py b/sc/qa/uitest/calc_tests2/tdf37623.py
index fd81c77c7ef0..fcf4d278448a 100644
--- a/sc/qa/uitest/calc_tests2/tdf37623.py
+++ b/sc/qa/uitest/calc_tests2/tdf37623.py
@@ -12,23 +12,22 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf37623(UITestCase):
def test_tdf37623_autofill_rows_hidden(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf37623.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A6"}))
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xautofill = xDialog.getChild("autofill")
- xautofill.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ with self.ui_test.load_file(get_url_for_data_file("tdf37623.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A6"}))
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xautofill = xDialog.getChild("autofill")
+ xautofill.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 3)
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 3)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf57274.py b/sc/qa/uitest/calc_tests3/tdf57274.py
index be5b0abcb760..32b92bc14bcc 100644
--- a/sc/qa/uitest/calc_tests3/tdf57274.py
+++ b/sc/qa/uitest/calc_tests3/tdf57274.py
@@ -14,29 +14,28 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf57274(UITestCase):
def test_tdf57274_tdf116385_row_only(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57274.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf57274.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #* Source Cells, range B6..E6
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"}))
- self.xUITest.executeCommand(".uno:Copy")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
- #We paste here using Paste Special with 'Link' Checkbox activated
- xLink = xDialog.getChild("link")
- xLink.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- # self.ui_test.close_dialog_through_button(xOkBtn)
+ #* Source Cells, range B6..E6
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #We paste here using Paste Special with 'Link' Checkbox activated
+ xLink = xDialog.getChild("link")
+ xLink.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ # self.ui_test.close_dialog_through_button(xOkBtn)
- 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
- #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank.
- self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6")
- self.ui_test.close_doc()
+ #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank.
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf62267.py b/sc/qa/uitest/calc_tests3/tdf62267.py
index 930c0c262f25..c4c36b150125 100644
--- a/sc/qa/uitest/calc_tests3/tdf62267.py
+++ b/sc/qa/uitest/calc_tests3/tdf62267.py
@@ -15,37 +15,35 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf62267(UITestCase):
def test_tdf62267(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62267.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- #* Copy A1, then paste special to C1;
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:Copy")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
- #it's the default - text, numbers and dates
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- #--> Cell formatting should stay as before
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
-
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check that we have exactly 1 conditional format
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '1')
-
- xTreeEntry = xList.getChild('0')
- self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value = 1")
-
- xCancelBtn = xCondFormatMgr.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf62267.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #* Copy A1, then paste special to C1;
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #it's the default - text, numbers and dates
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ #--> Cell formatting should stay as before
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly 1 conditional format
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ xTreeEntry = xList.getChild('0')
+ self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value = 1")
+
+ xCancelBtn = xCondFormatMgr.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf63805.py b/sc/qa/uitest/calc_tests3/tdf63805.py
index e7b1277d5a7b..8c9332cb4200 100644
--- a/sc/qa/uitest/calc_tests3/tdf63805.py
+++ b/sc/qa/uitest/calc_tests3/tdf63805.py
@@ -15,45 +15,44 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf63805(UITestCase):
def test_tdf63805_autofill_Date_Months(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf63805.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf63805.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #1 - A1: 2012-10-31
- enter_text_to_cell(gridwin, "A1", "2012-10-31")
- #2 - Select A1:A20
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"}))
- #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok>
- self.ui_test.execute_dialog_through_command(".uno:FillSeries")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #5 -Expected: All Cells show last day of month / Actual: some months skipped
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41243)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41274)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41305)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41333)
- self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 41364)
- self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 41394)
- self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 41425)
- self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 41455)
- self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 41486)
- self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 41517)
- self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 41547)
- self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 41578)
- self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 41608)
- self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 41639)
- self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 41670)
- self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 41698)
- self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 41729)
- self.assertEqual(get_cell_by_position(document, 0, 0, 18).getValue(), 41759)
- self.assertEqual(get_cell_by_position(document, 0, 0, 19).getValue(), 41790)
- #4 - undo.
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0)
- self.ui_test.close_doc()
+ #1 - A1: 2012-10-31
+ enter_text_to_cell(gridwin, "A1", "2012-10-31")
+ #2 - Select A1:A20
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"}))
+ #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok>
+ self.ui_test.execute_dialog_through_command(".uno:FillSeries")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #5 -Expected: All Cells show last day of month / Actual: some months skipped
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41243)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41274)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41305)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41333)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 41364)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 41394)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 41425)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 41455)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 41486)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 41517)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 41547)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 41578)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 41608)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 41639)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 41670)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 41698)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 41729)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 18).getValue(), 41759)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 19).getValue(), 41790)
+ #4 - undo.
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf65856.py b/sc/qa/uitest/calc_tests3/tdf65856.py
index 60a95302b6c5..3211d3117b34 100644
--- a/sc/qa/uitest/calc_tests3/tdf65856.py
+++ b/sc/qa/uitest/calc_tests3/tdf65856.py
@@ -12,85 +12,83 @@ from libreoffice.calc.document import get_cell_by_position
class tdf65856(UITestCase):
def test_tdf65856_paste_special_shift_right(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf65856.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #- mark D1:E14; copy
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"}))
- self.xUITest.executeCommand(".uno:Copy")
- #mark cell D1
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ #- mark D1:E14; copy
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ #mark cell D1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- xmove_right = xDialog.getChild("move_right")
- xmove_right.executeAction("CLICK", tuple())
+ xmove_right = xDialog.getChild("move_right")
+ xmove_right.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- #check
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1")
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1")
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1")
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1")
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1")
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1")
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1")
- self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14")
- self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14")
- self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14")
- self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14")
- self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14")
- self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14")
- self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14")
- self.ui_test.close_doc()
+ #check
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14")
def test_tdf65856_paste_special_shift_right_2(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #- select range C2:D4; copy
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"}))
- self.xUITest.executeCommand(".uno:Copy")
- #mark cell B2
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ #- select range C2:D4; copy
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ #mark cell B2
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- xmove_right = xDialog.getChild("move_right")
- xmove_right.executeAction("CLICK", tuple())
+ xmove_right = xDialog.getChild("move_right")
+ xmove_right.executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- #check
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2")
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2")
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3")
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3")
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4")
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4")
- self.ui_test.close_doc()
+ #check
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf69981.py b/sc/qa/uitest/calc_tests3/tdf69981.py
index cf4c7eed0c2d..c32476acc056 100644
--- a/sc/qa/uitest/calc_tests3/tdf69981.py
+++ b/sc/qa/uitest/calc_tests3/tdf69981.py
@@ -13,66 +13,64 @@ class tdf69981(UITestCase):
def test_tdf69981_text_to_columns(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf69981.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf69981.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #Select A2:A7
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"}))
- #Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- xtab = xDialog.getChild("tab")
- xcomma = xDialog.getChild("comma")
- xtab.executeAction("CLICK", tuple())
- xcomma.executeAction("CLICK", tuple())
- #Click Ok
- #overwrite warning come up
- #press Ok.
- xOK = xDialog.getChild("ok")
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
+ #Select A2:A7
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"}))
+ #Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xtab.executeAction("CLICK", tuple())
+ xcomma.executeAction("CLICK", tuple())
+ #Click Ok
+ #overwrite warning come up
+ #press Ok.
+ xOK = xDialog.getChild("ok")
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Original")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "a")
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Original")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "a")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "a")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "a")
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Copy")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "b")
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "b")
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "b")
- self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Copy")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "b")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "b")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "b")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "c")
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "c")
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "c")
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "c")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "c")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "c")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "c")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "c")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests3/tdf77509.py b/sc/qa/uitest/calc_tests3/tdf77509.py
index 4d2571c554dc..79e228c180da 100644
--- a/sc/qa/uitest/calc_tests3/tdf77509.py
+++ b/sc/qa/uitest/calc_tests3/tdf77509.py
@@ -13,65 +13,63 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf77509(UITestCase):
def test_tdf77509_consolidate(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77509.xls"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1. Open attachment: Consolidate-test.xls
- #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.load_file(get_url_for_data_file("tdf77509.xls")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. Open attachment: Consolidate-test.xls
+ #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()
- 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())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual("A 1", get_cell_by_position(document, 0, 3, 0).getString())
- self.assertEqual("AB 1", get_cell_by_position(document, 0, 3, 1).getString())
- self.assertEqual("AB 12", get_cell_by_position(document, 0, 3, 2).getString())
- self.assertEqual("AB 123", get_cell_by_position(document, 0, 3, 3).getString())
- self.assertEqual("ABC 1", get_cell_by_position(document, 0, 3, 4).getString())
+ #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(document, 0, 3, 0).getString())
+ self.assertEqual("AB 1", get_cell_by_position(document, 0, 3, 1).getString())
+ self.assertEqual("AB 12", get_cell_by_position(document, 0, 3, 2).getString())
+ self.assertEqual("AB 123", get_cell_by_position(document, 0, 3, 3).getString())
+ self.assertEqual("ABC 1", get_cell_by_position(document, 0, 3, 4).getString())
- self.assertEqual(1, get_cell_by_position(document, 0, 4, 0).getValue())
- self.assertEqual(2, get_cell_by_position(document, 0, 4, 1).getValue())
- self.assertEqual(2, get_cell_by_position(document, 0, 4, 2).getValue())
- self.assertEqual(1, get_cell_by_position(document, 0, 4, 3).getValue())
- self.assertEqual(1, get_cell_by_position(document, 0, 4, 4).getValue())
+ self.assertEqual(1, get_cell_by_position(document, 0, 4, 0).getValue())
+ self.assertEqual(2, get_cell_by_position(document, 0, 4, 1).getValue())
+ self.assertEqual(2, get_cell_by_position(document, 0, 4, 2).getValue())
+ self.assertEqual(1, get_cell_by_position(document, 0, 4, 3).getValue())
+ self.assertEqual(1, get_cell_by_position(document, 0, 4, 4).getValue())
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual("", get_cell_by_position(document, 0, 3, 0).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 3, 1).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 3, 2).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 3, 3).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 3, 4).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 3, 0).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 3, 1).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 3, 2).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 3, 3).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 3, 4).getString())
- self.assertEqual(0, get_cell_by_position(document, 0, 4, 0).getValue())
- self.assertEqual(0, get_cell_by_position(document, 0, 4, 1).getValue())
- self.assertEqual(0, get_cell_by_position(document, 0, 4, 2).getValue())
- self.assertEqual(0, get_cell_by_position(document, 0, 4, 3).getValue())
- self.assertEqual(0, get_cell_by_position(document, 0, 4, 4).getValue())
-
- self.ui_test.close_doc()
+ self.assertEqual(0, get_cell_by_position(document, 0, 4, 0).getValue())
+ self.assertEqual(0, get_cell_by_position(document, 0, 4, 1).getValue())
+ self.assertEqual(0, get_cell_by_position(document, 0, 4, 2).getValue())
+ self.assertEqual(0, get_cell_by_position(document, 0, 4, 3).getValue())
+ self.assertEqual(0, get_cell_by_position(document, 0, 4, 4).getValue())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf131170.py b/sc/qa/uitest/calc_tests4/tdf131170.py
index 87805af1a167..8f558f78fef6 100644
--- a/sc/qa/uitest/calc_tests4/tdf131170.py
+++ b/sc/qa/uitest/calc_tests4/tdf131170.py
@@ -9,42 +9,40 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf131170(UITestCase):
def test_DefineLabelRange(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131170.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf131170.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- self.ui_test.execute_dialog_through_command(".uno:DefineLabelRange")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:DefineLabelRange")
+ xDialog = self.xUITest.getTopFocusWindow()
- xRange = xDialog.getChild("range")
- self.assertEqual(4, len(xRange.getChildren()))
- self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
- self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "$Sheet1.$I$6:$K$6 [AA, BB, CC]")
- self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "--- Row ---")
- self.assertEqual(get_state_as_dict(xRange.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
+ xRange = xDialog.getChild("range")
+ self.assertEqual(4, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "$Sheet1.$I$6:$K$6 [AA, BB, CC]")
+ self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "--- Row ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
- xDeleteBtn = xDialog.getChild("delete")
+ xDeleteBtn = xDialog.getChild("delete")
- xRange.getChild('1').executeAction("SELECT", tuple())
- with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
+ xRange.getChild('1').executeAction("SELECT", tuple())
+ with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- self.assertEqual(3, len(xRange.getChildren()))
- self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
- self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
- self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
+ self.assertEqual(3, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
- xRange.getChild('2').executeAction("SELECT", tuple())
- with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
+ xRange.getChild('2').executeAction("SELECT", tuple())
+ with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
- self.assertEqual(2, len(xRange.getChildren()))
- self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
- self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
+ self.assertEqual(2, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ 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/calc_tests4/tdf138089.py b/sc/qa/uitest/calc_tests4/tdf138089.py
index 54e3015b3175..c59838df86db 100644
--- a/sc/qa/uitest/calc_tests4/tdf138089.py
+++ b/sc/qa/uitest/calc_tests4/tdf138089.py
@@ -13,36 +13,34 @@ class tdf138089(UITestCase):
def test_tdf138089(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf138089.xlsx"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- self.assertTrue(is_row_hidden(calc_doc, 1))
- self.assertTrue(is_row_hidden(calc_doc, 2))
- self.assertTrue(is_row_hidden(calc_doc, 3))
- self.assertFalse(is_row_hidden(calc_doc, 4))
- self.assertFalse(is_row_hidden(calc_doc, 5))
- 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"])
-
- 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))
- self.assertTrue(is_row_hidden(calc_doc, 2))
- self.assertTrue(is_row_hidden(calc_doc, 3))
- self.assertFalse(is_row_hidden(calc_doc, 4))
- self.assertFalse(is_row_hidden(calc_doc, 5))
- self.assertTrue(is_row_hidden(calc_doc, 6))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138089.xlsx")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ self.assertTrue(is_row_hidden(calc_doc, 1))
+ self.assertTrue(is_row_hidden(calc_doc, 2))
+ self.assertTrue(is_row_hidden(calc_doc, 3))
+ self.assertFalse(is_row_hidden(calc_doc, 4))
+ self.assertFalse(is_row_hidden(calc_doc, 5))
+ 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"])
+
+ 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))
+ self.assertTrue(is_row_hidden(calc_doc, 2))
+ self.assertTrue(is_row_hidden(calc_doc, 3))
+ self.assertFalse(is_row_hidden(calc_doc, 4))
+ self.assertFalse(is_row_hidden(calc_doc, 5))
+ self.assertTrue(is_row_hidden(calc_doc, 6))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf141547.py b/sc/qa/uitest/calc_tests4/tdf141547.py
index 066507aa9db8..cfe8e1d33cb0 100644
--- a/sc/qa/uitest/calc_tests4/tdf141547.py
+++ b/sc/qa/uitest/calc_tests4/tdf141547.py
@@ -13,30 +13,28 @@ class tdf141547(UITestCase):
def test_tdf141547(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf141547.xlsx"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- for i in range(1, 7):
- 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)
-
- self.assertFalse(is_row_hidden(calc_doc, 0))
- for i in range(1, 7):
- self.assertTrue(is_row_hidden(calc_doc, i))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf141547.xlsx")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ for i in range(1, 7):
+ 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)
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ for i in range(1, 7):
+ self.assertTrue(is_row_hidden(calc_doc, i))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf85403.py b/sc/qa/uitest/calc_tests4/tdf85403.py
index 2e411ada8394..0a2acbd7ce9f 100644
--- a/sc/qa/uitest/calc_tests4/tdf85403.py
+++ b/sc/qa/uitest/calc_tests4/tdf85403.py
@@ -13,25 +13,23 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf85403(UITestCase):
def test_tdf85403_text_to_columns(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf85403.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf85403.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #'123 in A1, SUM(A1) in B1, result is 0 as expected,
- #now select A1 and use data->text to columns->ok and B1 is not updated,
- #putting a new SUM(A1) in C1 will show 123
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- # Click Ok
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ #'123 in A1, SUM(A1) in B1, result is 0 as expected,
+ #now select A1 and use data->text to columns->ok and B1 is not updated,
+ #putting a new SUM(A1) in C1 will show 123
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 123)
-
- self.ui_test.close_doc()
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 123)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf85979.py b/sc/qa/uitest/calc_tests4/tdf85979.py
index 3a2e9a6a81cd..8482bdb917d0 100644
--- a/sc/qa/uitest/calc_tests4/tdf85979.py
+++ b/sc/qa/uitest/calc_tests4/tdf85979.py
@@ -13,41 +13,39 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf85979(UITestCase):
def test_td85979_text_to_columns(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf85979.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf85979.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #(I selected C1 to C5, then Text to Columns, unselected "Tab" and selected "Space")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- xspace = xDialog.getChild("space")
- if (get_state_as_dict(xspace)["Selected"]) == "false":
- xspace.executeAction("CLICK", tuple())
- # Click Ok
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
+ #(I selected C1 to C5, then Text to Columns, unselected "Tab" and selected "Space")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xspace = xDialog.getChild("space")
+ if (get_state_as_dict(xspace)["Selected"]) == "false":
+ xspace.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 99)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 9)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 9)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 260)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 10)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 23)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 23)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 149)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 14)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 14)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 16)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 35)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 35)
-
- self.ui_test.close_doc()
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 99)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 9)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 9)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 260)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 10)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 23)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 23)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 149)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 14)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 14)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 16)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 35)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 35)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf86253.py b/sc/qa/uitest/calc_tests4/tdf86253.py
index a2e004caf3a4..f3047f8fd4f2 100644
--- a/sc/qa/uitest/calc_tests4/tdf86253.py
+++ b/sc/qa/uitest/calc_tests4/tdf86253.py
@@ -11,48 +11,46 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf86253(UITestCase):
def test_tdf86253(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf86253.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- #* Copy A1, then paste special only "formatting" to C1:C17;
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:Copy")
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C17"}))
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xtext = xDialog.getChild("text")
- xnumbers = xDialog.getChild("numbers")
- xdatetime = xDialog.getChild("datetime")
- xformats = xDialog.getChild("formats")
-
- xtext.executeAction("CLICK", tuple())
- xnumbers.executeAction("CLICK", tuple())
- xdatetime.executeAction("CLICK", tuple())
- xformats.executeAction("CLICK", tuple())
-
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- #--> Cell formatting for C1:C17 is changed. But, if you go to "Format - Conditional Formatting - Manage",
- #you will see that a new formatting condition is created with the range "C1:C6", rather than "C1:C17". This is wrong behavior.
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
-
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check that we have exactly 1 conditional format and range is C1:C17
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '1')
-
- xTreeEntry = xList.getChild('0')
- self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1:A6,C1:C17\tCell value >= 0")
-
- xCancelBtn = xCondFormatMgr.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf86253.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #* Copy A1, then paste special only "formatting" to C1:C17;
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C17"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xtext = xDialog.getChild("text")
+ xnumbers = xDialog.getChild("numbers")
+ xdatetime = xDialog.getChild("datetime")
+ xformats = xDialog.getChild("formats")
+
+ xtext.executeAction("CLICK", tuple())
+ xnumbers.executeAction("CLICK", tuple())
+ xdatetime.executeAction("CLICK", tuple())
+ xformats.executeAction("CLICK", tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ #--> Cell formatting for C1:C17 is changed. But, if you go to "Format - Conditional Formatting - Manage",
+ #you will see that a new formatting condition is created with the range "C1:C6", rather than "C1:C17". This is wrong behavior.
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly 1 conditional format and range is C1:C17
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ xTreeEntry = xList.getChild('0')
+ self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1:A6,C1:C17\tCell value >= 0")
+
+ xCancelBtn = xCondFormatMgr.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf89958.py b/sc/qa/uitest/calc_tests4/tdf89958.py
index 0ec1b7dd8284..8935bae5934a 100644
--- a/sc/qa/uitest/calc_tests4/tdf89958.py
+++ b/sc/qa/uitest/calc_tests4/tdf89958.py
@@ -13,50 +13,48 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf89958(UITestCase):
def test_td89958_standard_filter(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf89958.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #select A1-> Column .uno:SelectColumn
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:SelectColumn")
+ with self.ui_test.load_file(get_url_for_data_file("tdf89958.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select A1-> Column .uno:SelectColumn
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
- #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")
+ #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")
- 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"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- gridWinState = get_state_as_dict(gridwin)
- self.assertEqual(gridWinState["CurrentRow"], "1")
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- gridWinState = get_state_as_dict(gridwin)
- self.assertEqual(gridWinState["CurrentRow"], "3")
-# #reopen filter and verify - doesn't works
-# 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"], "Column A")
-# self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
-# self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
-# xCancelBtn = xDialog.getChild("cancel")
-# self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["CurrentRow"], "1")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["CurrentRow"], "3")
+ # #reopen filter and verify - doesn't works
+ # 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"], "Column A")
+ # self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
+ # self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
+ # xCancelBtn = xDialog.getChild("cancel")
+ # self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf99386.py b/sc/qa/uitest/calc_tests4/tdf99386.py
index 088af0eee505..4df99fb733b8 100644
--- a/sc/qa/uitest/calc_tests4/tdf99386.py
+++ b/sc/qa/uitest/calc_tests4/tdf99386.py
@@ -14,18 +14,16 @@ class tdf99386(UITestCase):
def test_td99386_undo_merged_cell_needs_hard_recalculate(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99386.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf99386.ods")) as calc_doc:
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWindow = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) #select cells
- self.xUITest.executeCommand(".uno:ToggleMergeCells") # merge cells
- self.xUITest.executeCommand(".uno:Undo")
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) #select cells
+ self.xUITest.executeCommand(".uno:ToggleMergeCells") # merge cells
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "This")
-
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "This")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/textToColumns.py b/sc/qa/uitest/calc_tests4/textToColumns.py
index 5c4bbf6c59af..5231c40dabcb 100644
--- a/sc/qa/uitest/calc_tests4/textToColumns.py
+++ b/sc/qa/uitest/calc_tests4/textToColumns.py
@@ -15,488 +15,481 @@ class CalcTextToColumns(UITestCase):
def test_text_to_columns_dot(self):
#_Dot_as_Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_dot.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- print(get_state_as_dict(xreplwarncb)["Selected"])
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- print(get_state_as_dict(xreplwarncb)["Selected"])
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Select A1:A5 on Sheet 'Dot_as_Separator'
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- #Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
- xtab = xDialog.getChild("tab")
- xcomma = xDialog.getChild("comma")
- xsemicolon = xDialog.getChild("semicolon")
- xspace = xDialog.getChild("space")
- xother = xDialog.getChild("other")
- xinputother = xDialog.getChild("inputother")
-
- if (get_state_as_dict(xother)["Selected"]) == "false":
- xother.executeAction("CLICK", tuple())
- xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
- #Click Ok
- #Does an overwrite warning come up? If not file an Issue.
- #Tag the 'Do not show warning again' checkbox and press Ok.
- xOK = xDialog.getChild("ok")
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes") as dialog:
- xask = dialog.getChild("ask")
- xask.executeAction("CLICK", tuple())
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
- #verify setting in options
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- self.assertEqual(get_state_as_dict(xreplwarncb)["Selected"], "false")
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_dot.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Select A1:A5 on Sheet 'Dot_as_Separator'
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ #Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
+ #Click Ok
+ #Does an overwrite warning come up? If not file an Issue.
+ #Tag the 'Do not show warning again' checkbox and press Ok.
+ xOK = xDialog.getChild("ok")
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes") as dialog:
+ xask = dialog.getChild("ask")
+ xask.executeAction("CLICK", tuple())
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ #verify setting in options
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ self.assertEqual(get_state_as_dict(xreplwarncb)["Selected"], "false")
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
def test_text_to_columns_comma(self):
#Comma as Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_comma.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- print(get_state_as_dict(xreplwarncb)["Selected"])
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- print(get_state_as_dict(xreplwarncb)["Selected"])
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Select A1:A5
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- # Untag Tab as separator and tag comma.
- xComma = xDialog.getChild("comma")
- if (get_state_as_dict(xComma)["Selected"]) == "false":
- xComma.executeAction("CLICK", tuple())
- # Click Ok
- xOK = xDialog.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_comma.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag Tab as separator and tag comma.
+ xComma = xDialog.getChild("comma")
+ if (get_state_as_dict(xComma)["Selected"]) == "false":
+ xComma.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+
def test_text_to_columns_semicolon(self):
#Semicolon as Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_semicolon.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Select A1:A5 on Sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- # Untag comma as separator and tag Semicolon
- xSemicolon = xDialog.getChild("semicolon")
- if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
- xSemicolon.executeAction("CLICK", tuple())
- # Click Ok
- xOK = xDialog.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_semicolon.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xSemicolon = xDialog.getChild("semicolon")
+ if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
+ xSemicolon.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
def test_text_to_columns_space(self):
#Space as Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_space.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Select A1:A5 on Sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- # Untag comma as separator and tag Semicolon
- xSpace = xDialog.getChild("space")
- if (get_state_as_dict(xSpace)["Selected"]) == "false":
- xSpace.executeAction("CLICK", tuple())
- # xspace.executeAction("CLICK", tuple())
- # Click Ok
- xOK = xDialog.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_space.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xSpace = xDialog.getChild("space")
+ if (get_state_as_dict(xSpace)["Selected"]) == "false":
+ xSpace.executeAction("CLICK", tuple())
+ # xspace.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
def test_text_to_columns_pipe(self):
#Space as Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Select A1:A5 on Sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- # Untag comma as separator and tag Semicolon
- xtab = xDialog.getChild("tab")
- xcomma = xDialog.getChild("comma")
- xsemicolon = xDialog.getChild("semicolon")
- xspace = xDialog.getChild("space")
- xother = xDialog.getChild("other")
- xinputother = xDialog.getChild("inputother")
- xSpace = xDialog.getChild("space")
- if (get_state_as_dict(xother)["Selected"]) == "false":
- xother.executeAction("CLICK", tuple())
- xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
- # Click Ok
- xOK = xDialog.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+ xSpace = xDialog.getChild("space")
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
def test_text_to_columns_pipespace(self):
#Space as Separator
- calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialogOpt = self.xUITest.getTopFocusWindow()
-
- xPages = xDialogOpt.getChild("pages")
- xWriterEntry = xPages.getChild('3') # Calc
- xWriterEntry.executeAction("EXPAND", tuple())
- xWriterGeneralEntry = xWriterEntry.getChild('0')
- xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
- xreplwarncb = xDialogOpt.getChild("replwarncb")
- if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
- xreplwarncb.executeAction("CLICK", tuple())
- xOKBtn = xDialogOpt.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Select A1:A5 on Sheet
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
- # Data - Text to Columns
- self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
- xDialog = self.xUITest.getTopFocusWindow()
- #
- xtab = xDialog.getChild("tab")
- xcomma = xDialog.getChild("comma")
- xsemicolon = xDialog.getChild("semicolon")
- xspace = xDialog.getChild("space")
- xother = xDialog.getChild("other")
- xinputother = xDialog.getChild("inputother")
- if (get_state_as_dict(xspace)["Selected"]) == "false":
- xspace.executeAction("CLICK", tuple())
- if (get_state_as_dict(xother)["Selected"]) == "false":
- xother.executeAction("CLICK", tuple())
- xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
- # Click Ok
- xOK = xDialog.getChild("ok")
-
- with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
- pass
-
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
- self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
- self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
- self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+ if (get_state_as_dict(xspace)["Selected"]) == "false":
+ xspace.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py
index 4203ef728fcb..e9e54206faa7 100644
--- a/sc/qa/uitest/calc_tests4/trackedChanges.py
+++ b/sc/qa/uitest/calc_tests4/trackedChanges.py
@@ -15,31 +15,29 @@ import datetime
class CalcTrackedChanges(UITestCase):
def test_tdf131907(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131907.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
-
- xChangesList = xTrackDlg.getChild("calcchanges")
- self.assertEqual(1, len(xChangesList.getChildren()))
+ 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()
- 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))
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(1, len(xChangesList.getChildren()))
- #it would crash here
- xRejBtn = xTrackDlg.getChild("reject")
- xRejBtn.executeAction("CLICK", tuple())
+ 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))
- 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")
+ #it would crash here
+ xRejBtn = xTrackDlg.getChild("reject")
+ xRejBtn.executeAction("CLICK", tuple())
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.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.ui_test.close_doc()
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
def test_tdf66263_Protect_Records(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
@@ -296,31 +294,29 @@ class CalcTrackedChanges(UITestCase):
def test_tdf136062(self):
- self.ui_test.load_file(get_url_for_data_file("tdf136062.ods"))
-
- self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf136062.ods")):
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- xChangesList = xTrackDlg.getChild("calcchanges")
- self.assertEqual(1, len(xChangesList.getChildren()))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
- xRejectAllBtn = xTrackDlg.getChild("rejectall")
- xRejectBtn = xTrackDlg.getChild("reject")
- xAcceptAllBtn = xTrackDlg.getChild("acceptall")
- xAcceptBtn = xTrackDlg.getChild("accept")
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(1, len(xChangesList.getChildren()))
- # 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'])
+ xRejectAllBtn = xTrackDlg.getChild("rejectall")
+ xRejectBtn = xTrackDlg.getChild("reject")
+ xAcceptAllBtn = xTrackDlg.getChild("acceptall")
+ xAcceptBtn = xTrackDlg.getChild("accept")
- xCancBtn = xTrackDlg.getChild("close")
- xCancBtn.executeAction("CLICK", tuple())
+ # 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'])
- self.ui_test.close_doc()
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py
index e8dd2857a252..8416cb62e2ae 100644
--- a/sc/qa/uitest/calc_tests6/tdf107267.py
+++ b/sc/qa/uitest/calc_tests6/tdf107267.py
@@ -17,62 +17,60 @@ class Subtotals(UITestCase):
def test_tdf107267(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf107267.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
- # 1. Open the test file
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F123"}))
- # 2. Data->Subtotals
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- # = 1st group = 3. Group by "Person Number", select "shipping time" and use the Max function.
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Person Number")
- # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
-# xCheckListMenu = xDialog.getChild("grid1")
-# xTreeList = xCheckListMenu.getChild("columns")
-# x6Entry = xTreeList.getChild("5")
-# xFirstEntry.executeAction("CLICK", tuple())
- #use the Max function
+ with self.ui_test.load_file(get_url_for_data_file("tdf107267.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # 1. Open the test file
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F123"}))
+ # 2. Data->Subtotals
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ # = 1st group = 3. Group by "Person Number", select "shipping time" and use the Max function.
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Person Number")
+ # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
+ # xCheckListMenu = xDialog.getChild("grid1")
+ # xTreeList = xCheckListMenu.getChild("columns")
+ # x6Entry = xTreeList.getChild("5")
+ # xFirstEntry.executeAction("CLICK", tuple())
+ #use the Max function
- #= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function.
- select_pos(xTabs, "1")
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Person Number")
- # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
-# xCheckListMenu = xDialog.getChild("grid1")
-# xTreeList = xCheckListMenu.getChild("columns")
-# x6Entry = xTreeList.getChild("5")
-# xFirstEntry.executeAction("CLICK", tuple())
- #use the Min function
+ #= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function.
+ select_pos(xTabs, "1")
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Person Number")
+ # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
+ # xCheckListMenu = xDialog.getChild("grid1")
+ # xTreeList = xCheckListMenu.getChild("columns")
+ # x6Entry = xTreeList.getChild("5")
+ # xFirstEntry.executeAction("CLICK", tuple())
+ #use the Min function
- #= 3rd group = Group by "Person Number", select "shipping time" and use the Average function.
- select_pos(xTabs, "2")
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Person Number")
- # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
-# xCheckListMenu = xDialog.getChild("grid1")
-# xTreeList = xCheckListMenu.getChild("columns")
-# x6Entry = xTreeList.getChild("5")
-# xFirstEntry.executeAction("CLICK", tuple())
- #use the Average function
+ #= 3rd group = Group by "Person Number", select "shipping time" and use the Average function.
+ select_pos(xTabs, "2")
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Person Number")
+ # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected
+ # xCheckListMenu = xDialog.getChild("grid1")
+ # xTreeList = xCheckListMenu.getChild("columns")
+ # x6Entry = xTreeList.getChild("5")
+ # xFirstEntry.executeAction("CLICK", tuple())
+ #use the Average function
- # 5. Click OK
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # 5. Click OK
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 141).getString(), "Grand Average")
- self.assertEqual(get_cell_by_position(document, 0, 0, 142).getString(), "Grand Min")
- self.assertEqual(get_cell_by_position(document, 0, 0, 143).getString(), "Grand Max")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 141).getString(), "Grand Average")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 142).getString(), "Grand Min")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 143).getString(), "Grand Max")
- self.assertEqual(round(get_cell_by_position(document, 0, 5, 141).getValue(), 13), 3.3852459016393)
- self.assertEqual(get_cell_by_position(document, 0, 5, 142).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 5, 143).getValue(), 26)
-
- self.ui_test.close_doc()
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 141).getValue(), 13), 3.3852459016393)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 142).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 143).getValue(), 26)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf107869.py b/sc/qa/uitest/calc_tests6/tdf107869.py
index f07b53e68432..2d4127b0f64c 100644
--- a/sc/qa/uitest/calc_tests6/tdf107869.py
+++ b/sc/qa/uitest/calc_tests6/tdf107869.py
@@ -11,75 +11,73 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf107869(UITestCase):
def test_tdf107869_undo_redo_delete_row_with_comment(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("comments.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #- Delete the row with comment.
- #select row 1
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:SelectRow")
- #delete row 1
- self.xUITest.executeCommand(".uno:DeleteRows")
- #A1 should be "B"
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- #- Undo-redo deletion a few times.
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ with self.ui_test.load_file(get_url_for_data_file("comments.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #- Delete the row with comment.
+ #select row 1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectRow")
+ #delete row 1
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ #A1 should be "B"
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ #- Undo-redo deletion a few times.
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- #select row 1 and 2
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
- self.xUITest.executeCommand(".uno:SelectRow")
- #delete row 1
- self.xUITest.executeCommand(".uno:DeleteRows")
- #A1 should be ""
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
- #- Undo-redo deletion a few times.
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
-
- self.ui_test.close_doc()
+ #select row 1 and 2
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+ self.xUITest.executeCommand(".uno:SelectRow")
+ #delete row 1
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ #A1 should be ""
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ #- Undo-redo deletion a few times.
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py
index cc5c97f34a30..bd1151f569f9 100644
--- a/sc/qa/uitest/calc_tests6/tdf118638.py
+++ b/sc/qa/uitest/calc_tests6/tdf118638.py
@@ -16,43 +16,41 @@ class Subtotals(UITestCase):
def test_tdf118638_subtotal_format(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118638.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
- # Open the test file
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B15"}))
- #Data->Subtotals
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Store Name")
- xCheckListMenu = xDialog.getChild("grid1")
- xTreeList = xCheckListMenu.getChild("columns")
- xEntry = xTreeList.getChild("1")
- xEntry.executeAction("CLICK", tuple())
-
- #use the SUM function
-# xfunctions = xDialog.getChild("functions")
-# propsF = {"TEXT": "Sum"}
-# actionPropsF = mkPropertyValues(propsF)
-# xfunctions.executeAction("SELECT", actionPropsF)
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 15).getString(), "5408 Sum")
- self.assertEqual(get_cell_by_position(document, 0, 0, 16).getString(), "Grand Sum")
-
- self.assertEqual(round(get_cell_by_position(document, 0, 1, 15).getValue(),12), 238.89)
- self.assertEqual(round(get_cell_by_position(document, 0, 1, 16).getValue(),12), 238.89)
-
- self.assertEqual(get_cell_by_position(document, 0, 1, 15).getString(), "$238.89")
- self.assertEqual(get_cell_by_position(document, 0, 1, 16).getString(), "$238.89")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf118638.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # Open the test file
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B15"}))
+ #Data->Subtotals
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Store Name")
+ xCheckListMenu = xDialog.getChild("grid1")
+ xTreeList = xCheckListMenu.getChild("columns")
+ xEntry = xTreeList.getChild("1")
+ xEntry.executeAction("CLICK", tuple())
+
+ #use the SUM function
+ # xfunctions = xDialog.getChild("functions")
+ # propsF = {"TEXT": "Sum"}
+ # actionPropsF = mkPropertyValues(propsF)
+ # xfunctions.executeAction("SELECT", actionPropsF)
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 15).getString(), "5408 Sum")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 16).getString(), "Grand Sum")
+
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 15).getValue(),12), 238.89)
+ self.assertEqual(round(get_cell_by_position(document, 0, 1, 16).getValue(),12), 238.89)
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 15).getString(), "$238.89")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 16).getString(), "$238.89")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf122509.py b/sc/qa/uitest/calc_tests7/tdf122509.py
index e1abea4347a1..5dbb61518ace 100644
--- a/sc/qa/uitest/calc_tests7/tdf122509.py
+++ b/sc/qa/uitest/calc_tests7/tdf122509.py
@@ -15,38 +15,37 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf122509(UITestCase):
def test_tdf122509_format_cell_negative_numbers(self):
#numberingformatpage.ui
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122509.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #select cell A1
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- #format - cell
- self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0") #tab Numbers
- xliststore1 = xDialog.getChild("categorylb") #1st list / Category
- xliststore2 = xDialog.getChild("formatlb") #2nd list / Format
- xdecimalsed = xDialog.getChild("decimalsed")
- xleadzerosed = xDialog.getChild("leadzerosed")
- xnegnumred = xDialog.getChild("negnumred")
- xthousands = xDialog.getChild("thousands")
- xlanguagelb = xDialog.getChild("languagelb")
- xformatted = xDialog.getChild("formatted")
+ with self.ui_test.load_file(get_url_for_data_file("tdf122509.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select cell A1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #format - cell
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab Numbers
+ xliststore1 = xDialog.getChild("categorylb") #1st list / Category
+ xliststore2 = xDialog.getChild("formatlb") #2nd list / Format
+ xdecimalsed = xDialog.getChild("decimalsed")
+ xleadzerosed = xDialog.getChild("leadzerosed")
+ xnegnumred = xDialog.getChild("negnumred")
+ xthousands = xDialog.getChild("thousands")
+ xlanguagelb = xDialog.getChild("languagelb")
+ xformatted = xDialog.getChild("formatted")
- self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]")
- #click negative
- xnegnumred.executeAction("CLICK", tuple())
- #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7
- self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]")
- # click negative
- xnegnumred.executeAction("CLICK", tuple())
- #OK
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
- #verify; no crashes
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2)
+ self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]")
+ #click negative
+ xnegnumred.executeAction("CLICK", tuple())
+ #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7
+ self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]")
+ # click negative
+ xnegnumred.executeAction("CLICK", tuple())
+ #OK
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #verify; no crashes
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf124818.py b/sc/qa/uitest/calc_tests7/tdf124818.py
index 5101be90a91a..f73bb543d312 100644
--- a/sc/qa/uitest/calc_tests7/tdf124818.py
+++ b/sc/qa/uitest/calc_tests7/tdf124818.py
@@ -11,18 +11,17 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf124818(UITestCase):
def test_tdf124818_crash_select_all_and_switch_spreadsheet(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124818.xls"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf124818.xls")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #Select all ( Ctrl + A );Go to sheet Graph2;Select all;Crash
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:JumpToPrevTable")
- self.xUITest.executeCommand(".uno:SelectAll")
+ #Select all ( Ctrl + A );Go to sheet Graph2;Select all;Crash
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:JumpToPrevTable")
+ self.xUITest.executeCommand(".uno:SelectAll")
- #verify; no crashes
- self.assertEqual(document.Sheets.getCount(), 3)
+ #verify; no crashes
+ self.assertEqual(document.Sheets.getCount(), 3)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf124896.py b/sc/qa/uitest/calc_tests7/tdf124896.py
index 128f4d270223..5605253f6979 100644
--- a/sc/qa/uitest/calc_tests7/tdf124896.py
+++ b/sc/qa/uitest/calc_tests7/tdf124896.py
@@ -11,18 +11,17 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf124896(UITestCase):
def test_tdf124896_crash_delete_sheet(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124896.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf124896.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- # Remove X Bar R Chart (2) sheet
- self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet
- xDialog = self.xUITest.getTopFocusWindow()
- xOKButton = xDialog.getChild("yes")
- xOKButton.executeAction("CLICK", tuple())
- #verify; no crashes
- self.assertEqual(document.Sheets.getCount(), 2)
+ # Remove X Bar R Chart (2) sheet
+ self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOKButton = xDialog.getChild("yes")
+ xOKButton.executeAction("CLICK", tuple())
+ #verify; no crashes
+ self.assertEqual(document.Sheets.getCount(), 2)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf137397.py b/sc/qa/uitest/calc_tests7/tdf137397.py
index ae67f9837bfc..c9e1b2d3525c 100644
--- a/sc/qa/uitest/calc_tests7/tdf137397.py
+++ b/sc/qa/uitest/calc_tests7/tdf137397.py
@@ -13,29 +13,27 @@ class tdf137397(UITestCase):
def test_tdf137397(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf137397.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf137397.ods")) as calc_doc:
- change_measurement_unit(self, 'Centimeter')
+ change_measurement_unit(self, 'Centimeter')
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWin = xCalcDoc.getChild("grid_window")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
- xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"}))
+ xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"}))
- self.xUITest.executeCommand(".uno:Sidebar")
- xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
- xChild = self.ui_test.wait_until_child_is_available('selectwidth')
- self.assertEqual(get_state_as_dict(xChild)['Text'], '6.00 cm')
+ xChild = self.ui_test.wait_until_child_is_available('selectwidth')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '6.00 cm')
- # Without the fix in place, this test would have failed with
- # AssertionError: '-14,585,309.84 cm' != '2.00 cm'
- xChild = self.ui_test.wait_until_child_is_available('selectheight')
- self.assertEqual(get_state_as_dict(xChild)['Text'], '2.00 cm')
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '-14,585,309.84 cm' != '2.00 cm'
+ xChild = self.ui_test.wait_until_child_is_available('selectheight')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '2.00 cm')
- self.xUITest.executeCommand(".uno:Sidebar")
-
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf31805.py b/sc/qa/uitest/calc_tests7/tdf31805.py
index 8c7fc1227912..5c2f363c3d9e 100644
--- a/sc/qa/uitest/calc_tests7/tdf31805.py
+++ b/sc/qa/uitest/calc_tests7/tdf31805.py
@@ -13,29 +13,28 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf31805(UITestCase):
def test_tdf31805_delete_column_merged(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1. open "sample.ods"
- #2. click 'G1'
- #3. Menu 'edit -> Delete Cell - Delete entire Column'
- #expected: Column with cell containing "g" will be deleted,
- # a merged cell range will remain left row 1
+ with self.ui_test.load_file(get_url_for_data_file("tdf31805.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. open "sample.ods"
+ #2. click 'G1'
+ #3. Menu 'edit -> Delete Cell - Delete entire Column'
+ #expected: Column with cell containing "g" will be deleted,
+ # a merged cell range will remain left row 1
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)
- self.xUITest.executeCommand(".uno:DeleteColumns")
- #verify. C5:F11 should be merged
- #isMerged returns true if this cell is merged with another cell.
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
- self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False) #G5
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
- self.xUITest.executeCommand(".uno:DeleteRows")
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
- self.xUITest.executeCommand(".uno:DeleteColumns")
- self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
- self.ui_test.close_doc()
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)
+ self.xUITest.executeCommand(".uno:DeleteColumns")
+ #verify. C5:F11 should be merged
+ #isMerged returns true if this cell is merged with another cell.
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False) #G5
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.xUITest.executeCommand(".uno:DeleteColumns")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests7/tdf91425.py b/sc/qa/uitest/calc_tests7/tdf91425.py
index 36f8966adf48..19948fb70810 100644
--- a/sc/qa/uitest/calc_tests7/tdf91425.py
+++ b/sc/qa/uitest/calc_tests7/tdf91425.py
@@ -13,23 +13,22 @@ from libreoffice.calc.document import get_cell_by_position
class tdf91425(UITestCase):
def test_tdf91425_insert_columns_left(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91425.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1) Open test file provided in report
- #2) Move mouse pointer over Column A header, the right mouse button click
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- #3) Insert columns left
- self.xUITest.executeCommand(".uno:InsertColumnsBefore")
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "C")
- #redo
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")
+ with self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1) Open test file provided in report
+ #2) Move mouse pointer over Column A header, the right mouse button click
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #3) Insert columns left
+ self.xUITest.executeCommand(".uno:InsertColumnsBefore")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "C")
+ #redo
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py
index 46ce7d9673cf..d92226771eb5 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -10,109 +10,107 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class navigator(UITestCase):
def test_rename_sheet(self):
- self.ui_test.load_file(get_url_for_data_file("navigator.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWin = xCalcDoc.getChild("grid_window")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
-
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xContentBox = xNavigatorPanel.getChild('contentbox')
- xSheets = xContentBox.getChild("0")
- self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
- self.assertEqual(len(xSheets.getChildren()), 2)
- self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
- self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
- xRangeNames = xContentBox.getChild("1")
- self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
- self.assertEqual(len(xRangeNames.getChildren()), 2)
- self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
- self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
-
- #The document has one comment too
- xComments = xContentBox.getChild("6")
- self.assertEqual(get_state_as_dict(xComments)['Text'], 'Comments')
- self.assertEqual(len(xComments.getChildren()), 1)
- self.assertEqual(get_state_as_dict(xComments.getChild('0'))['Text'], 'Test Comment')
-
- self.ui_test.execute_dialog_through_command(".uno:RenameTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xname_entry = xDialog.getChild("name_entry")
- xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xContentBox = xNavigatorPanel.getChild('contentbox')
- xSheets = xContentBox.getChild("0")
- self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
- self.assertEqual(len(xSheets.getChildren()), 2)
- self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'S1')
- self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
- xRangeNames = xContentBox.getChild("1")
- self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
- self.assertEqual(len(xRangeNames.getChildren()), 2)
- self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (S1)')
- self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (S1)')
-
- self.xUITest.executeCommand(".uno:Undo")
-
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xContentBox = xNavigatorPanel.getChild('contentbox')
- xSheets = xContentBox.getChild("0")
- self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
- self.assertEqual(len(xSheets.getChildren()), 2)
- self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
- self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
- xRangeNames = xContentBox.getChild("1")
- self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
- self.assertEqual(len(xRangeNames.getChildren()), 2)
- #FIXME: tdf#133082
- #self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
- #self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
-
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("navigator.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
+
+ #The document has one comment too
+ xComments = xContentBox.getChild("6")
+ self.assertEqual(get_state_as_dict(xComments)['Text'], 'Comments')
+ self.assertEqual(len(xComments.getChildren()), 1)
+ self.assertEqual(get_state_as_dict(xComments.getChild('0'))['Text'], 'Test Comment')
+
+ self.ui_test.execute_dialog_through_command(".uno:RenameTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xname_entry = xDialog.getChild("name_entry")
+ xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'S1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (S1)')
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (S1)')
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ #FIXME: tdf#133082
+ #self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
+ #self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
+
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_tdf98493(self):
- self.ui_test.load_file(get_url_for_data_file("tdf98493.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf98493.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
- self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], "2")
+ self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], "2")
- self.xUITest.executeCommand(".uno:Sidebar")
- xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xToolBar = xNavigatorPanel.getChild("toolbox2")
- xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xToolBar = xNavigatorPanel.getChild("toolbox2")
+ xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button
- xContentBox = xNavigatorPanel.getChild('contentbox')
+ xContentBox = xNavigatorPanel.getChild('contentbox')
- # tdf#133079, without the fix in place, it would be 8
- self.assertEqual(len(xContentBox.getChildren()), 1)
+ # tdf#133079, without the fix in place, it would be 8
+ self.assertEqual(len(xContentBox.getChildren()), 1)
- xSheets = xContentBox.getChild('0')
- self.assertEqual(len(xSheets.getChildren()), 12)
+ xSheets = xContentBox.getChild('0')
+ self.assertEqual(len(xSheets.getChildren()), 12)
- #key=item position, value=sheet ( there are hidden sheets )
- results = { '1': '0', '5': '4', '6': '4', '11': '10'}
+ #key=item position, value=sheet ( there are hidden sheets )
+ results = { '1': '0', '5': '4', '6': '4', '11': '10'}
- for k, v in results.items():
- xChild = xSheets.getChild(k)
- xChild.executeAction("DOUBLECLICK", tuple())
+ for k, v in results.items():
+ xChild = xSheets.getChild(k)
+ xChild.executeAction("DOUBLECLICK", tuple())
- self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], v)
+ self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], v)
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_tdf134390(self):
@@ -152,23 +150,22 @@ class navigator(UITestCase):
self.ui_test.close_doc()
def test_tdf141973(self):
- self.ui_test.load_file(get_url_for_data_file("tdf141973.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xGridWin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf141973.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- # Without the fix in place, this test would have crashed here
- xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+ # Without the fix in place, this test would have crashed here
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
- xContentBox = xNavigatorPanel.getChild('contentbox')
- xDrawings = xContentBox.getChild("7")
- self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text'])
- self.assertEqual(len(xDrawings.getChildren()), 1)
- self.assertEqual('withname', get_state_as_dict(xDrawings.getChild('0'))['Text'])
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xDrawings = xContentBox.getChild("7")
+ self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text'])
+ self.assertEqual(len(xDrawings.getChildren()), 1)
+ self.assertEqual('withname', get_state_as_dict(xDrawings.getChild('0'))['Text'])
- self.xUITest.executeCommand(".uno:Sidebar")
+ self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
diff --git a/sc/qa/uitest/calc_tests8/tdf114710.py b/sc/qa/uitest/calc_tests8/tdf114710.py
index 94f3849f58ac..a4989a72de58 100644
--- a/sc/qa/uitest/calc_tests8/tdf114710.py
+++ b/sc/qa/uitest/calc_tests8/tdf114710.py
@@ -11,42 +11,40 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf114710(UITestCase):
def test_tdf114710(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf114710.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf114710.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"}))
- self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"}))
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.create_doc_in_start_center("writer")
- self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
- xList = xDialog.getChild('list')
+ xList = xDialog.getChild('list')
- for childName in xList.getChildren():
- xChild = xList.getChild(childName)
- if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)":
- break
+ for childName in xList.getChildren():
+ xChild = xList.getChild(childName)
+ if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)":
+ break
- xChild.executeAction("SELECT", tuple())
- self.assertEqual(
- get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)")
+ xChild.executeAction("SELECT", tuple())
+ self.assertEqual(
+ get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)")
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- # Without the fix in place, this test would have crashed here
- document = self.ui_test.get_component()
- self.assertEqual(1, document.GraphicObjects.getCount())
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have crashed here
+ document = self.ui_test.get_component()
+ self.assertEqual(1, document.GraphicObjects.getCount())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf119343.py b/sc/qa/uitest/calc_tests8/tdf119343.py
index a5128c488429..1393c50ad1c9 100644
--- a/sc/qa/uitest/calc_tests8/tdf119343.py
+++ b/sc/qa/uitest/calc_tests8/tdf119343.py
@@ -18,19 +18,18 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf119343(UITestCase):
def test_tdf119343_copy_paste_formula(self):
#numberingformatpage.ui
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119343.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf119343.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "M295"}))
- self.xUITest.executeCommand(".uno:Copy")
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- self.xUITest.executeCommand(".uno:Paste")
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 12, 295).getString(), "Q11005355")
- self.assertEqual(get_cell_by_position(document, 0, 12, 294).getString(), "Q1099565")
- self.assertEqual(get_cell_by_position(document, 0, 12, 293).getString(), "Q108420")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "M295"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ self.xUITest.executeCommand(".uno:Paste")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 12, 295).getString(), "Q11005355")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 294).getString(), "Q1099565")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 293).getString(), "Q108420")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf124829.py b/sc/qa/uitest/calc_tests8/tdf124829.py
index e41ee01eb093..45cf00b459a6 100644
--- a/sc/qa/uitest/calc_tests8/tdf124829.py
+++ b/sc/qa/uitest/calc_tests8/tdf124829.py
@@ -18,18 +18,17 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf124829(UITestCase):
def test_tdf124829_Crash_cutting_undo_sheet_external_links(self):
#numberingformatpage.ui
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124829.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf124829.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Cut")
- for i in range(40):
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Cut")
+ for i in range(40):
+ self.xUITest.executeCommand(".uno:Undo")
- #verify; no crashes
- self.assertEqual(document.Sheets.getCount(), 6)
+ #verify; no crashes
+ self.assertEqual(document.Sheets.getCount(), 6)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/forms.py b/sc/qa/uitest/calc_tests9/forms.py
index b682cf69c9ea..aceb5a8b589d 100644
--- a/sc/qa/uitest/calc_tests9/forms.py
+++ b/sc/qa/uitest/calc_tests9/forms.py
@@ -12,19 +12,17 @@ class Forms(UITestCase):
def test_tdf131000(self):
- self.ui_test.load_file(get_url_for_data_file("tdf131000.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf131000.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "form"}))
+ 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")
+ # Without the fix in place, this test would have hung here
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- 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.ui_test.close_doc()
+ self.assertEqual("A1:A7000", get_state_as_dict(xCellRange)['Text'])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/pivotTable.py b/sc/qa/uitest/calc_tests9/pivotTable.py
index 6fd0ff0517cc..c5879f8ce143 100644
--- a/sc/qa/uitest/calc_tests9/pivotTable.py
+++ b/sc/qa/uitest/calc_tests9/pivotTable.py
@@ -15,54 +15,52 @@ class pivotTable(UITestCase):
# This is basically a test for cf93998eb5abc193d95ae5433bf4dfd11a9d62d8
# Without the fix in place, this test would have crashed
- self.ui_test.load_file(get_url_for_data_file("basicPivotTable.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("basicPivotTable.ods")):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "1"}))
- self.xUITest.executeCommand(".uno:GoUp")
+ self.xUITest.executeCommand(".uno:GoUp")
- self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun")
+ self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- xFields = xDialog.getChild("listbox-fields")
- self.assertEqual(2, len(xFields.getChildren()))
- self.assertEqual("qtX", get_state_as_dict(xFields.getChild('0'))['Text'])
- self.assertEqual("qtY", get_state_as_dict(xFields.getChild('1'))['Text'])
+ xFields = xDialog.getChild("listbox-fields")
+ self.assertEqual(2, len(xFields.getChildren()))
+ self.assertEqual("qtX", get_state_as_dict(xFields.getChild('0'))['Text'])
+ self.assertEqual("qtY", get_state_as_dict(xFields.getChild('1'))['Text'])
- xColumns = xDialog.getChild("listbox-column")
- self.assertEqual(1, len(xColumns.getChildren()))
- self.assertEqual("Data", get_state_as_dict(xColumns.getChild('0'))['Text'])
+ xColumns = xDialog.getChild("listbox-column")
+ self.assertEqual(1, len(xColumns.getChildren()))
+ self.assertEqual("Data", get_state_as_dict(xColumns.getChild('0'))['Text'])
- xPage = xDialog.getChild("listbox-page")
- self.assertEqual(1, len(xPage.getChildren()))
- xPageChild = xPage.getChild('0')
- self.assertEqual("qtX", get_state_as_dict(xPageChild)['Text'])
+ xPage = xDialog.getChild("listbox-page")
+ self.assertEqual(1, len(xPage.getChildren()))
+ xPageChild = xPage.getChild('0')
+ self.assertEqual("qtX", get_state_as_dict(xPageChild)['Text'])
- with self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ())) as dialog:
- optionBtn = dialog.getChild("options")
+ with self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ())) as dialog:
+ optionBtn = dialog.getChild("options")
- with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
- xEmptyLine = dialog2.getChild("emptyline")
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
+ xEmptyLine = dialog2.getChild("emptyline")
- xEmptyLine.executeAction("CLICK", tuple())
- self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
+ xEmptyLine.executeAction("CLICK", tuple())
+ self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
- with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog2:
- xEmptyLine = dialog2.getChild("emptyline")
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog2:
+ xEmptyLine = dialog2.getChild("emptyline")
- xEmptyLine.executeAction("CLICK", tuple())
- self.assertEqual('false', get_state_as_dict(xEmptyLine)['Selected'])
+ xEmptyLine.executeAction("CLICK", tuple())
+ self.assertEqual('false', get_state_as_dict(xEmptyLine)['Selected'])
- with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
- xEmptyLine = dialog2.getChild("emptyline")
+ with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2:
+ xEmptyLine = dialog2.getChild("emptyline")
- self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
-
- self.ui_test.close_doc()
+ self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected'])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf113571.py b/sc/qa/uitest/calc_tests9/tdf113571.py
index 89e0b2afd3a4..48657e37e60d 100644
--- a/sc/qa/uitest/calc_tests9/tdf113571.py
+++ b/sc/qa/uitest/calc_tests9/tdf113571.py
@@ -11,28 +11,27 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class Tdf113571(UITestCase):
def test_tdf113571(self):
- self.ui_test.load_file(get_url_for_data_file("tdf113571.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf113571.ods")):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- # Close the document
- self.xUITest.executeCommand(".uno:CloseDoc")
+ # Close the document
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.create_doc_in_start_center("writer")
- self.xUITest.executeCommand(".uno:PasteUnformatted")
+ self.xUITest.executeCommand(".uno:PasteUnformatted")
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- # Without the fix in place, this test would have failed with
- # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' !=
- # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"'
- self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>',
- document.Text.String)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' !=
+ # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"'
+ self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>',
+ document.Text.String)
- self.ui_test.close_doc()
diff --git a/sc/qa/uitest/calc_tests9/tdf124318.py b/sc/qa/uitest/calc_tests9/tdf124318.py
index 69a8a8a181ef..8aad127c608e 100644
--- a/sc/qa/uitest/calc_tests9/tdf124318.py
+++ b/sc/qa/uitest/calc_tests9/tdf124318.py
@@ -12,24 +12,22 @@ class tdf124318(UITestCase):
def test_tdf124318(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124318.xls"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf124318.xls")) as calc_doc:
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"}))
- self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+k"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+k"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- # Without the fix in place, this test would have failed with
- # AssertionError: 'mobile/identification/authentification' !=
- # 'mobile/identification/authentification%00塹\uf481ᴻ䡿ⲯ嶂藄挧%00%00ꮥ%00'
- self.assertEqual("mobile/identification/authentification",
- get_state_as_dict(xDialog.getChild("target"))['Text'].split(".fr/")[1])
- self.assertEqual("mobile/identification/authentification",
- get_state_as_dict(xDialog.getChild("indication"))['Text'].split(".fr/")[1])
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'mobile/identification/authentification' !=
+ # 'mobile/identification/authentification%00塹\uf481ᴻ䡿ⲯ嶂藄挧%00%00ꮥ%00'
+ self.assertEqual("mobile/identification/authentification",
+ get_state_as_dict(xDialog.getChild("target"))['Text'].split(".fr/")[1])
+ self.assertEqual("mobile/identification/authentification",
+ get_state_as_dict(xDialog.getChild("indication"))['Text'].split(".fr/")[1])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf125440.py b/sc/qa/uitest/calc_tests9/tdf125440.py
index 12e113a1c17c..82accfb11942 100644
--- a/sc/qa/uitest/calc_tests9/tdf125440.py
+++ b/sc/qa/uitest/calc_tests9/tdf125440.py
@@ -14,29 +14,28 @@ class Tdf1254400(UITestCase):
def test_tdf125440(self):
# In order to simulate copy&paste from external source,
# import the text in Writer, copy it and paste it in Calc
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf125440.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf125440.odt")) as writer_doc:
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
- # Close the document
- self.xUITest.executeCommand(".uno:CloseDoc")
+ # Close the document
+ self.xUITest.executeCommand(".uno:CloseDoc")
- calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:PasteUnformatted")
+ self.xUITest.executeCommand(".uno:PasteUnformatted")
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Row' != '"Row"'
- self.assertEqual("Row", get_cell_by_position(document, 0, 0, 0).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 1, 0).getString())
- self.assertEqual("", get_cell_by_position(document, 0, 2, 0).getString())
- self.assertEqual("50", get_cell_by_position(document, 0, 3, 0).getString())
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Row' != '"Row"'
+ self.assertEqual("Row", get_cell_by_position(document, 0, 0, 0).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 1, 0).getString())
+ self.assertEqual("", get_cell_by_position(document, 0, 2, 0).getString())
+ self.assertEqual("50", get_cell_by_position(document, 0, 3, 0).getString())
- self.ui_test.close_doc()
diff --git a/sc/qa/uitest/calc_tests9/tdf126673.py b/sc/qa/uitest/calc_tests9/tdf126673.py
index f01844bddd3a..30c81696f836 100644
--- a/sc/qa/uitest/calc_tests9/tdf126673.py
+++ b/sc/qa/uitest/calc_tests9/tdf126673.py
@@ -16,34 +16,32 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf126673(UITestCase):
def test_tdf126673_auto_fit_row_height(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf126673.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf126673.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- #select A2
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
- #optimal row height
- self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
- xDialog = self.xUITest.getTopFocusWindow()
- # Click Ok
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #select A2
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
- #row height
- self.ui_test.execute_dialog_through_command(".uno:RowHeight")
- xDialog = self.xUITest.getTopFocusWindow()
- xvalue = xDialog.getChild("value")
- heightStrOrig = get_state_as_dict(xvalue)["Text"]
- heightVal = heightStrOrig[:4] #default 0.45 cm,
- self.assertEqual(heightVal > '0.45', True) #new value is bigger then default
- # Click Ok
- xcancel = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xcancel)
-
- self.ui_test.close_doc()
+ #select A2
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+ #optimal row height
+ self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #select A2
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+ #row height
+ self.ui_test.execute_dialog_through_command(".uno:RowHeight")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xvalue = xDialog.getChild("value")
+ heightStrOrig = get_state_as_dict(xvalue)["Text"]
+ heightVal = heightStrOrig[:4] #default 0.45 cm,
+ self.assertEqual(heightVal > '0.45', True) #new value is bigger then default
+ # Click Ok
+ xcancel = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancel)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf130371.py b/sc/qa/uitest/calc_tests9/tdf130371.py
index e2930e855b9a..9533e0719393 100644
--- a/sc/qa/uitest/calc_tests9/tdf130371.py
+++ b/sc/qa/uitest/calc_tests9/tdf130371.py
@@ -12,56 +12,54 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class namedRanges(UITestCase):
def test_tdf130371(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130371.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- text1 = "value\t$Sheet2.$B$2\tSheet2"
- text2 = "value\t$Sheet3.$B$2\tSheet3"
- text3 = "value\t$Sheet4.$B$2\tSheet4"
-
- self.ui_test.execute_dialog_through_command(".uno:DefineName")
- xDialog = self.xUITest.getTopFocusWindow()
- namesList = xDialog.getChild('names')
- self.assertEqual(2, len(namesList.getChildren()))
- self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
- self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
- self.xUITest.executeCommand(".uno:Copy")
-
- self.xUITest.executeCommand(".uno:JumpToNextTable")
- self.xUITest.executeCommand(".uno:JumpToNextTable")
-
- self.xUITest.executeCommand(".uno:Paste")
-
- self.ui_test.execute_dialog_through_command(".uno:DefineName")
- xDialog = self.xUITest.getTopFocusWindow()
- namesList = xDialog.getChild('names')
- self.assertEqual(3, len(namesList.getChildren()))
- self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
- self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
- self.assertEqual(get_state_as_dict(namesList.getChild('2'))["Text"], text3)
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.xUITest.executeCommand(".uno:Undo")
-
- self.ui_test.execute_dialog_through_command(".uno:DefineName")
- xDialog = self.xUITest.getTopFocusWindow()
- namesList = xDialog.getChild('names')
- self.assertEqual(2, len(namesList.getChildren()))
- self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
- self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
-
- xCancelBtn = xDialog.getChild("cancel")
- xCancelBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf130371.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ text1 = "value\t$Sheet2.$B$2\tSheet2"
+ text2 = "value\t$Sheet3.$B$2\tSheet3"
+ text3 = "value\t$Sheet4.$B$2\tSheet4"
+
+ self.ui_test.execute_dialog_through_command(".uno:DefineName")
+ xDialog = self.xUITest.getTopFocusWindow()
+ namesList = xDialog.getChild('names')
+ self.assertEqual(2, len(namesList.getChildren()))
+ self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
+ self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
+
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
+ self.xUITest.executeCommand(".uno:Copy")
+
+ self.xUITest.executeCommand(".uno:JumpToNextTable")
+ self.xUITest.executeCommand(".uno:JumpToNextTable")
+
+ self.xUITest.executeCommand(".uno:Paste")
+
+ self.ui_test.execute_dialog_through_command(".uno:DefineName")
+ xDialog = self.xUITest.getTopFocusWindow()
+ namesList = xDialog.getChild('names')
+ self.assertEqual(3, len(namesList.getChildren()))
+ self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
+ self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
+ self.assertEqual(get_state_as_dict(namesList.getChild('2'))["Text"], text3)
+
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.ui_test.execute_dialog_through_command(".uno:DefineName")
+ xDialog = self.xUITest.getTopFocusWindow()
+ namesList = xDialog.getChild('names')
+ self.assertEqual(2, len(namesList.getChildren()))
+ self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1)
+ self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2)
+
+ xCancelBtn = xDialog.getChild("cancel")
+ xCancelBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf137446.py b/sc/qa/uitest/calc_tests9/tdf137446.py
index 06a716121c28..efdfb0213fb2 100644
--- a/sc/qa/uitest/calc_tests9/tdf137446.py
+++ b/sc/qa/uitest/calc_tests9/tdf137446.py
@@ -13,45 +13,43 @@ class tdf137446(UITestCase):
def test_tdf137446(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf137446.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf137446.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"}))
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual('10', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
- self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
- self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+ self.assertEqual('10', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
- xDialog.getChild('MTR_FLD_WIDTH').executeAction("UP", tuple())
+ xDialog.getChild('MTR_FLD_WIDTH').executeAction("UP", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual('10.1', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
- self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
- self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('10.1', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
- # Without the fix in place, this test would have failed with AssertionError: '0' != '180'
- self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+ # Without the fix in place, this test would have failed with AssertionError: '0' != '180'
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf91217.py b/sc/qa/uitest/calc_tests9/tdf91217.py
index 765271c8a8e2..397d43ec06fc 100644
--- a/sc/qa/uitest/calc_tests9/tdf91217.py
+++ b/sc/qa/uitest/calc_tests9/tdf91217.py
@@ -17,24 +17,22 @@ class tdf91217(UITestCase):
def test_tdf91217_crash_deleting_rows(self):
# FIXME disable this will it's clear what existing problem did this test uncover.
return
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91217.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Select rows 76-1125 in sheet 3 (Daily), right click, Delete Rows. Instant crash.
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A76:A1125"}))
- self.xUITest.executeCommand(".uno:SelectRow")
- #delete rows
- self.xUITest.executeCommand(".uno:DeleteRows")
- #A1 should be "Dist"
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
- #- Undo-redo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
+ with self.ui_test.load_file(get_url_for_data_file("tdf91217.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Select rows 76-1125 in sheet 3 (Daily), right click, Delete Rows. Instant crash.
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A76:A1125"}))
+ self.xUITest.executeCommand(".uno:SelectRow")
+ #delete rows
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ #A1 should be "Dist"
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
+ #- Undo-redo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
- self.xUITest.executeCommand(".uno:Redo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
-
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py
index 2e5b99b92ea5..d7a744749188 100644
--- a/sc/qa/uitest/chart/chartArea.py
+++ b/sc/qa/uitest/chart/chartArea.py
@@ -16,154 +16,153 @@ from uitest.uihelper.common import get_state_as_dict, type_text, get_url_for_dat
class chartArea(UITestCase):
def test_chart_area_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("chartArea.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- xArea = document.Sheets[0].Charts[0].getEmbeddedObject().Area
- self.assertEqual(xArea.LineWidth, 0)
- self.assertEqual(xArea.LineTransparence, 0)
- self.assertEqual(hex(xArea.FillColor), '0xffffff')
- self.assertEqual(xArea.FillTransparence, 0)
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Borders".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xArea.LineWidth, 100)
- self.assertEqual(xArea.LineTransparence, 5)
- self.assertEqual(hex(xArea.FillColor), '0xffffff')
- self.assertEqual(xArea.FillTransparence, 0)
-
- #reopen and verify tab "Borders".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- #Click on tab "Area"
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
-
- rCustom = xDialog.getChild("R_custom")
- gCustom = xDialog.getChild("G_custom")
- bCustom = xDialog.getChild("B_custom")
-
- rCustom.executeAction("CLEAR", tuple())
- rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
- rCustom.executeAction("UP", tuple())
- rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
- gCustom.executeAction("CLEAR", tuple())
- gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
- gCustom.executeAction("UP", tuple())
- gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- bCustom.executeAction("CLEAR", tuple())
- bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
- bCustom.executeAction("UP", tuple())
- bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xArea.LineWidth, 100)
- self.assertEqual(xArea.LineTransparence, 5)
- self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
- self.assertEqual(xArea.FillTransparence, 0)
-
- #reopen and verify tab "Area".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- rCustom = xDialog.getChild("R_custom")
- gCustom = xDialog.getChild("G_custom")
- bCustom = xDialog.getChild("B_custom")
-
- self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
- self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
- self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
-
- #change tab "Transparency"
- select_pos(tabcontrol, "2")
- transparency = xDialog.getChild("RBT_TRANS_LINEAR")
- transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
-
- transparency.executeAction("CLICK", tuple())
- transparencyPercent.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xArea.LineWidth, 100)
- self.assertEqual(xArea.LineTransparence, 5)
- self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
- self.assertEqual(xArea.FillTransparence, 51)
-
- #reopen and verify tab "Transparency"
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
-
- transparency = xDialog.getChild("RBT_TRANS_LINEAR")
- transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
-
- self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
- self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xArea.LineWidth, 100)
- self.assertEqual(xArea.LineTransparence, 5)
- self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
- self.assertEqual(xArea.FillTransparence, 51)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ xArea = document.Sheets[0].Charts[0].getEmbeddedObject().Area
+ self.assertEqual(xArea.LineWidth, 0)
+ self.assertEqual(xArea.LineTransparence, 0)
+ self.assertEqual(hex(xArea.FillColor), '0xffffff')
+ self.assertEqual(xArea.FillTransparence, 0)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Borders".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xArea.LineWidth, 100)
+ self.assertEqual(xArea.LineTransparence, 5)
+ self.assertEqual(hex(xArea.FillColor), '0xffffff')
+ self.assertEqual(xArea.FillTransparence, 0)
+
+ #reopen and verify tab "Borders".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ #Click on tab "Area"
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+
+ rCustom = xDialog.getChild("R_custom")
+ gCustom = xDialog.getChild("G_custom")
+ bCustom = xDialog.getChild("B_custom")
+
+ rCustom.executeAction("CLEAR", tuple())
+ rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
+ rCustom.executeAction("UP", tuple())
+ rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
+ gCustom.executeAction("CLEAR", tuple())
+ gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
+ gCustom.executeAction("UP", tuple())
+ gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ bCustom.executeAction("CLEAR", tuple())
+ bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
+ bCustom.executeAction("UP", tuple())
+ bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xArea.LineWidth, 100)
+ self.assertEqual(xArea.LineTransparence, 5)
+ self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
+ self.assertEqual(xArea.FillTransparence, 0)
+
+ #reopen and verify tab "Area".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ rCustom = xDialog.getChild("R_custom")
+ gCustom = xDialog.getChild("G_custom")
+ bCustom = xDialog.getChild("B_custom")
+
+ self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
+ self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
+ self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
+
+ #change tab "Transparency"
+ select_pos(tabcontrol, "2")
+ transparency = xDialog.getChild("RBT_TRANS_LINEAR")
+ transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
+
+ transparency.executeAction("CLICK", tuple())
+ transparencyPercent.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xArea.LineWidth, 100)
+ self.assertEqual(xArea.LineTransparence, 5)
+ self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
+ self.assertEqual(xArea.FillTransparence, 51)
+
+ #reopen and verify tab "Transparency"
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ transparency = xDialog.getChild("RBT_TRANS_LINEAR")
+ transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
+
+ self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xArea.LineWidth, 100)
+ self.assertEqual(xArea.LineTransparence, 5)
+ self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
+ self.assertEqual(xArea.FillTransparence, 51)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartAxes.py b/sc/qa/uitest/chart/chartAxes.py
index b0ceb6df5fc6..9b8db33aa4e7 100644
--- a/sc/qa/uitest/chart/chartAxes.py
+++ b/sc/qa/uitest/chart/chartAxes.py
@@ -15,53 +15,52 @@ from uitest.uihelper.common import get_state_as_dict, type_text, get_url_for_dat
class chartAxes(UITestCase):
def test_chart_enable_grids_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- primaryX = xDialog.getChild("primaryX")
- primaryY = xDialog.getChild("primaryY")
- secondaryX = xDialog.getChild("secondaryX")
- secondaryY = xDialog.getChild("secondaryY")
+ primaryX = xDialog.getChild("primaryX")
+ primaryY = xDialog.getChild("primaryY")
+ secondaryX = xDialog.getChild("secondaryX")
+ secondaryY = xDialog.getChild("secondaryY")
- primaryX.executeAction("CLICK", tuple())
- primaryY.executeAction("CLICK", tuple())
- secondaryX.executeAction("CLICK", tuple())
- secondaryY.executeAction("CLICK", tuple())
+ primaryX.executeAction("CLICK", tuple())
+ primaryY.executeAction("CLICK", tuple())
+ secondaryX.executeAction("CLICK", tuple())
+ secondaryY.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and verify Grids dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ #reopen and verify Grids dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- primaryX = xDialog.getChild("primaryX")
- primaryY = xDialog.getChild("primaryY")
- secondaryX = xDialog.getChild("secondaryX")
- secondaryY = xDialog.getChild("secondaryY")
+ primaryX = xDialog.getChild("primaryX")
+ primaryY = xDialog.getChild("primaryY")
+ secondaryX = xDialog.getChild("secondaryX")
+ secondaryY = xDialog.getChild("secondaryY")
- self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false")
- self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false")
- self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true")
- self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py
index d634aab839fb..0d5bae2f0333 100644
--- a/sc/qa/uitest/chart/chartDataLabels.py
+++ b/sc/qa/uitest/chart/chartDataLabels.py
@@ -19,323 +19,316 @@ from com.sun.star.lang import Locale
class chartDataLabels(UITestCase):
def test_chart_data_labels_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
-
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertFalse(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowCategoryName)
- self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol)
- self.assertEqual(xDataSeries[0].LabelSeparator, " ")
-
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowCategoryName)
- self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol)
- self.assertEqual(xDataSeries[0].LabelSeparator, " ")
-
- valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
- category = xDialog.getChild("CB_CATEGORY")
- legend = xDialog.getChild("CB_SYMBOL")
- wrapText = xDialog.getChild("CB_WRAP_TEXT")
- separator = xDialog.getChild("LB_TEXT_SEPARATOR")
- placement = xDialog.getChild("LB_LABEL_PLACEMENT")
- degrees = xDialog.getChild("NF_LABEL_DEGREES")
- textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
-
- #valueAsNumber.executeAction("CLICK", tuple())
- category.executeAction("CLICK", tuple())
- legend.executeAction("CLICK", tuple())
- wrapText.executeAction("CLICK", tuple())
- select_by_text(separator, "Comma")
-
- select_by_text(placement, "Below")
- degrees.executeAction("UP", tuple())
- select_by_text(textDirection, "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
- self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
- self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
-
- #reopen and verify InsertMenuDataLabels dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
- self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
- self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
-
- valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
- category = xDialog.getChild("CB_CATEGORY")
- legend = xDialog.getChild("CB_SYMBOL")
- wrapText = xDialog.getChild("CB_WRAP_TEXT")
- separator = xDialog.getChild("LB_TEXT_SEPARATOR")
- placement = xDialog.getChild("LB_LABEL_PLACEMENT")
- degrees = xDialog.getChild("NF_LABEL_DEGREES")
- textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
-
- self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "true")
- self.assertEqual(get_state_as_dict(category)["Selected"], "true")
- self.assertEqual(get_state_as_dict(legend)["Selected"], "true")
- self.assertEqual(get_state_as_dict(wrapText)["Selected"], "true")
- self.assertEqual(get_state_as_dict(separator)["SelectEntryText"], "Comma")
- self.assertEqual(get_state_as_dict(placement)["SelectEntryText"], "Below")
- self.assertEqual(get_state_as_dict(degrees)["Text"], "1°")
- self.assertEqual(get_state_as_dict(textDirection)["SelectEntryText"], "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
- self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
- self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertFalse(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowCategoryName)
+ self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol)
+ self.assertEqual(xDataSeries[0].LabelSeparator, " ")
+
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowCategoryName)
+ self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol)
+ self.assertEqual(xDataSeries[0].LabelSeparator, " ")
+
+ valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
+ category = xDialog.getChild("CB_CATEGORY")
+ legend = xDialog.getChild("CB_SYMBOL")
+ wrapText = xDialog.getChild("CB_WRAP_TEXT")
+ separator = xDialog.getChild("LB_TEXT_SEPARATOR")
+ placement = xDialog.getChild("LB_LABEL_PLACEMENT")
+ degrees = xDialog.getChild("NF_LABEL_DEGREES")
+ textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
+
+ #valueAsNumber.executeAction("CLICK", tuple())
+ category.executeAction("CLICK", tuple())
+ legend.executeAction("CLICK", tuple())
+ wrapText.executeAction("CLICK", tuple())
+ select_by_text(separator, "Comma")
+
+ select_by_text(placement, "Below")
+ degrees.executeAction("UP", tuple())
+ select_by_text(textDirection, "Right-to-left")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
+ self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
+ self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
+
+ #reopen and verify InsertMenuDataLabels dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
+ self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
+ self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
+
+ valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
+ category = xDialog.getChild("CB_CATEGORY")
+ legend = xDialog.getChild("CB_SYMBOL")
+ wrapText = xDialog.getChild("CB_WRAP_TEXT")
+ separator = xDialog.getChild("LB_TEXT_SEPARATOR")
+ placement = xDialog.getChild("LB_LABEL_PLACEMENT")
+ degrees = xDialog.getChild("NF_LABEL_DEGREES")
+ textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
+
+ self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(category)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(legend)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(wrapText)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(separator)["SelectEntryText"], "Comma")
+ self.assertEqual(get_state_as_dict(placement)["SelectEntryText"], "Below")
+ self.assertEqual(get_state_as_dict(degrees)["Text"], "1°")
+ self.assertEqual(get_state_as_dict(textDirection)["SelectEntryText"], "Right-to-left")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowCategoryName)
+ self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol)
+ self.assertEqual(xDataSeries[0].LabelSeparator, ", ")
def test_chart_data_labels_percentage_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("dataLabels.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
-
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertIsNone(xDataSeries[0].PercentageNumberFormat)
-
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertIsNone(xDataSeries[0].PercentageNumberFormat)
-
- valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
- valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE")
- category = xDialog.getChild("CB_CATEGORY")
- legend = xDialog.getChild("CB_SYMBOL")
- wrapText = xDialog.getChild("CB_WRAP_TEXT")
- separator = xDialog.getChild("LB_TEXT_SEPARATOR")
- placement = xDialog.getChild("LB_LABEL_PLACEMENT")
- degrees = xDialog.getChild("NF_LABEL_DEGREES")
- textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
- buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT")
-
- valueAsNumber.executeAction("CLICK", tuple())
- valueAsPercentage.executeAction("CLICK", tuple())
- #button Percentage format
-
- with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as dialog:
- sourceformat = dialog.getChild("sourceformat")
- decimalsed = dialog.getChild("decimalsed")
- leadzerosed = dialog.getChild("leadzerosed")
- negnumred = dialog.getChild("negnumred")
- thousands = dialog.getChild("thousands")
- formatted = dialog.getChild("formatted")
-
- sourceformat.executeAction("CLICK", tuple())
- decimalsed.executeAction("UP", tuple())
- leadzerosed.executeAction("UP", tuple())
- negnumred.executeAction("CLICK", tuple())
- thousands.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%")
-
- self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false")
- self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats()
- xLocale = Locale('en', 'US', '')
- xFormat = xNumberFormats.queryKey("#,#00.0%;[RED]-#,#00.0%", xLocale, True)
-
- self.assertFalse(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
-
- #reopen and verify Percentage dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
-
- self.assertFalse(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
-
- valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
- valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE")
- category = xDialog.getChild("CB_CATEGORY")
- legend = xDialog.getChild("CB_SYMBOL")
- wrapText = xDialog.getChild("CB_WRAP_TEXT")
- separator = xDialog.getChild("LB_TEXT_SEPARATOR")
- placement = xDialog.getChild("LB_LABEL_PLACEMENT")
- degrees = xDialog.getChild("NF_LABEL_DEGREES")
- textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
- buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT")
-
- self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false")
- self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertFalse(xDataSeries[0].Label.ShowNumber)
- self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertIsNone(xDataSeries[0].PercentageNumberFormat)
+
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertIsNone(xDataSeries[0].PercentageNumberFormat)
+
+ valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
+ valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE")
+ category = xDialog.getChild("CB_CATEGORY")
+ legend = xDialog.getChild("CB_SYMBOL")
+ wrapText = xDialog.getChild("CB_WRAP_TEXT")
+ separator = xDialog.getChild("LB_TEXT_SEPARATOR")
+ placement = xDialog.getChild("LB_LABEL_PLACEMENT")
+ degrees = xDialog.getChild("NF_LABEL_DEGREES")
+ textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
+ buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT")
+
+ valueAsNumber.executeAction("CLICK", tuple())
+ valueAsPercentage.executeAction("CLICK", tuple())
+ #button Percentage format
+
+ with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as dialog:
+ sourceformat = dialog.getChild("sourceformat")
+ decimalsed = dialog.getChild("decimalsed")
+ leadzerosed = dialog.getChild("leadzerosed")
+ negnumred = dialog.getChild("negnumred")
+ thousands = dialog.getChild("thousands")
+ formatted = dialog.getChild("formatted")
+
+ sourceformat.executeAction("CLICK", tuple())
+ decimalsed.executeAction("UP", tuple())
+ leadzerosed.executeAction("UP", tuple())
+ negnumred.executeAction("CLICK", tuple())
+ thousands.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%")
+
+ self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats()
+ xLocale = Locale('en', 'US', '')
+ xFormat = xNumberFormats.queryKey("#,#00.0%;[RED]-#,#00.0%", xLocale, True)
+
+ self.assertFalse(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
+
+ #reopen and verify Percentage dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ self.assertFalse(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
+
+ valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER")
+ valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE")
+ category = xDialog.getChild("CB_CATEGORY")
+ legend = xDialog.getChild("CB_SYMBOL")
+ wrapText = xDialog.getChild("CB_WRAP_TEXT")
+ separator = xDialog.getChild("LB_TEXT_SEPARATOR")
+ placement = xDialog.getChild("LB_LABEL_PLACEMENT")
+ degrees = xDialog.getChild("NF_LABEL_DEGREES")
+ textDirection = xDialog.getChild("LB_LABEL_TEXTDIR")
+ buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT")
+
+ self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertFalse(xDataSeries[0].Label.ShowNumber)
+ self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat)
def test_tdf131291(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131291.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf131291.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT")
+ xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT")
- with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as dialog:
- categoryformat = dialog.getChild("categorylb")
- formatted = dialog.getChild("formatted")
- sourceformat = dialog.getChild("sourceformat")
+ with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as dialog:
+ categoryformat = dialog.getChild("categorylb")
+ formatted = dialog.getChild("formatted")
+ sourceformat = dialog.getChild("sourceformat")
- # Select currency
- sourceformat.executeAction("CLICK", tuple());
- categoryformat.getChild("4").executeAction("SELECT", tuple());
+ # Select currency
+ sourceformat.executeAction("CLICK", tuple());
+ categoryformat.getChild("4").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency")
+ self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency")
- self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00")
+ self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats()
- xLocale = Locale()
- xFormat = xNumberFormats.queryKey("[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00", xLocale, True)
+ xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats()
+ xLocale = Locale()
+ xFormat = xNumberFormats.queryKey("[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00", xLocale, True)
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
- #reopen and verify the previous changes
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ #reopen and verify the previous changes
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- # tdf#131291: it would fail here: AssertionError: 0 != 104
- self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ # tdf#131291: it would fail here: AssertionError: 0 != 104
+ self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertTrue(xDataSeries[0].Label.ShowNumber)
- self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
- self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
- self.ui_test.close_doc()
+ self.assertTrue(xDataSeries[0].Label.ShowNumber)
+ self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent)
+ self.assertEqual(xDataSeries[0].NumberFormat, xFormat)
def test_tdf136573(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("dataLabels.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- # Select the first label
- xDataLabel = xChartMain.getChild("CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0")
- xDataLabel.executeAction("SELECT", tuple())
+ # Select the first label
+ xDataLabel = xChartMain.getChild("CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0")
+ xDataLabel.executeAction("SELECT", tuple())
- self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+ self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("0.5", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
- self.assertEqual("2.89", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual("0.5", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+ self.assertEqual("2.89", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
- # Use OK button in order to test tdf#137165
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ # Use OK button in order to test tdf#137165
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+ self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
- # Check the position has changed after moving the label using the arrows keys
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("0.4", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
- self.assertEqual("2.79", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+ # Check the position has changed after moving the label using the arrows keys
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual("0.4", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+ self.assertEqual("2.79", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartGrid.py b/sc/qa/uitest/chart/chartGrid.py
index cb6a681a73fc..7b9814194e51 100644
--- a/sc/qa/uitest/chart/chartGrid.py
+++ b/sc/qa/uitest/chart/chartGrid.py
@@ -17,217 +17,216 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class chartGrid(UITestCase):
def test_tdf98390_chart_grid_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- #X Axis Major Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #tab "Line".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify X Axis Major Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Y Axis Major Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Y Axis Major Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Y Axis Minor Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Y Axis Minor Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #X Axis Minor Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify X Axis Minor Grid
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #All Grids
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify X Axis Minor Grid (changed in All Grids)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "10%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ #X Axis Major Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #tab "Line".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify X Axis Major Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Y Axis Major Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Y Axis Major Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Y Axis Minor Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Y Axis Minor Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #X Axis Minor Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify X Axis Minor Grid
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #All Grids
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify X Axis Minor Grid (changed in All Grids)
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "10%")
+
+ 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/chart/chartGrids.py b/sc/qa/uitest/chart/chartGrids.py
index 0fed3e9e9571..b1ffd01b0c49 100644
--- a/sc/qa/uitest/chart/chartGrids.py
+++ b/sc/qa/uitest/chart/chartGrids.py
@@ -15,80 +15,79 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class chartGrids(UITestCase):
def test_chart_enable_grids_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- primaryX = xDialog.getChild("primaryX")
- primaryY = xDialog.getChild("primaryY")
- secondaryX = xDialog.getChild("secondaryX")
- secondaryY = xDialog.getChild("secondaryY")
-
- primaryX.executeAction("CLICK", tuple())
- primaryY.executeAction("CLICK", tuple())
- secondaryX.executeAction("CLICK", tuple())
- secondaryY.executeAction("CLICK", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Grids dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- primaryX = xDialog.getChild("primaryX")
- primaryY = xDialog.getChild("primaryY")
- secondaryX = xDialog.getChild("secondaryX")
- secondaryY = xDialog.getChild("secondaryY")
-
- self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false")
- self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false")
- self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "false")
- self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "false")
-
- primaryX.executeAction("CLICK", tuple())
- primaryY.executeAction("CLICK", tuple())
- secondaryX.executeAction("CLICK", tuple())
- secondaryY.executeAction("CLICK", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Grids dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- primaryX = xDialog.getChild("primaryX")
- primaryY = xDialog.getChild("primaryY")
- secondaryX = xDialog.getChild("secondaryX")
- secondaryY = xDialog.getChild("secondaryY")
-
- self.assertEqual(get_state_as_dict(primaryX)["Selected"], "true")
- self.assertEqual(get_state_as_dict(primaryY)["Selected"], "true")
- self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true")
- self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ primaryX = xDialog.getChild("primaryX")
+ primaryY = xDialog.getChild("primaryY")
+ secondaryX = xDialog.getChild("secondaryX")
+ secondaryY = xDialog.getChild("secondaryY")
+
+ primaryX.executeAction("CLICK", tuple())
+ primaryY.executeAction("CLICK", tuple())
+ secondaryX.executeAction("CLICK", tuple())
+ secondaryY.executeAction("CLICK", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Grids dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ primaryX = xDialog.getChild("primaryX")
+ primaryY = xDialog.getChild("primaryY")
+ secondaryX = xDialog.getChild("secondaryX")
+ secondaryY = xDialog.getChild("secondaryY")
+
+ self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "false")
+
+ primaryX.executeAction("CLICK", tuple())
+ primaryY.executeAction("CLICK", tuple())
+ secondaryX.executeAction("CLICK", tuple())
+ secondaryY.executeAction("CLICK", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Grids dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ primaryX = xDialog.getChild("primaryX")
+ primaryY = xDialog.getChild("primaryY")
+ secondaryX = xDialog.getChild("secondaryX")
+ secondaryY = xDialog.getChild("secondaryY")
+
+ self.assertEqual(get_state_as_dict(primaryX)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(primaryY)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true")
+
+ 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/chart/chartLegend.py b/sc/qa/uitest/chart/chartLegend.py
index 0e7727b6b854..54929c5c6c30 100644
--- a/sc/qa/uitest/chart/chartLegend.py
+++ b/sc/qa/uitest/chart/chartLegend.py
@@ -17,7 +17,7 @@ from uitest.uihelper import guarded
class chartLegend(UITestCase):
def test_chart_display_legend_dialog(self):
- with guarded.load_file(self, get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
document = self.ui_test.get_component()
@@ -77,7 +77,7 @@ class chartLegend(UITestCase):
def test_legends_move_with_arrows_keys(self):
- with guarded.load_file(self, get_url_for_data_file("dataLabels.ods")) as calc_doc:
+ with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) as calc_doc:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild("grid_window")
diff --git a/sc/qa/uitest/chart/chartTitles.py b/sc/qa/uitest/chart/chartTitles.py
index 35765ba6b05a..84f0878a22e8 100644
--- a/sc/qa/uitest/chart/chartTitles.py
+++ b/sc/qa/uitest/chart/chartTitles.py
@@ -16,118 +16,115 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class chartTitles(UITestCase):
def test_chart_display_titles_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- xCS = document.Sheets[0].Charts[0].getEmbeddedObject().FirstDiagram.CoordinateSystems[0]
-
- self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
- self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
- self.assertIsNone(xCS.getAxisByDimension(0, 0).TitleObject)
- self.assertIsNone(xCS.getAxisByDimension(1, 0).TitleObject)
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- maintitle = xDialog.getChild("maintitle")
- subtitle = xDialog.getChild("subtitle")
- primaryXaxis = xDialog.getChild("primaryXaxis")
- primaryYaxis = xDialog.getChild("primaryYaxis")
- secondaryXaxis = xDialog.getChild("secondaryXaxis")
- secondaryYaxis = xDialog.getChild("secondaryYaxis")
-
- maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
- subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
- primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"}))
- primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"}))
- secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"}))
- secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"}))
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
- self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
- self.assertEqual("A", document.Sheets[0].Charts[0].getEmbeddedObject().Title.String)
- self.assertEqual("B", document.Sheets[0].Charts[0].getEmbeddedObject().SubTitle.String)
- self.assertEqual("C", xCS.getAxisByDimension(0, 0).TitleObject.Text[0].String)
- self.assertEqual("D", xCS.getAxisByDimension(1, 0).TitleObject.Text[0].String)
- self.assertEqual("E", xCS.getAxisByDimension(0, 1).TitleObject.Text[0].String)
- self.assertEqual("F", xCS.getAxisByDimension(1, 1).TitleObject.Text[0].String)
-
- #reopen and verify InsertMenuTitles dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- maintitle = xDialog.getChild("maintitle")
- subtitle = xDialog.getChild("subtitle")
- primaryXaxis = xDialog.getChild("primaryXaxis")
- primaryYaxis = xDialog.getChild("primaryYaxis")
- secondaryXaxis = xDialog.getChild("secondaryXaxis")
- secondaryYaxis = xDialog.getChild("secondaryYaxis")
-
- self.assertEqual(get_state_as_dict(maintitle)["Text"], "A")
- self.assertEqual(get_state_as_dict(subtitle)["Text"], "B")
- self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C")
- self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D")
- self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E")
- self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ xCS = document.Sheets[0].Charts[0].getEmbeddedObject().FirstDiagram.CoordinateSystems[0]
+
+ self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
+ self.assertFalse(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
+ self.assertIsNone(xCS.getAxisByDimension(0, 0).TitleObject)
+ self.assertIsNone(xCS.getAxisByDimension(1, 0).TitleObject)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ maintitle = xDialog.getChild("maintitle")
+ subtitle = xDialog.getChild("subtitle")
+ primaryXaxis = xDialog.getChild("primaryXaxis")
+ primaryYaxis = xDialog.getChild("primaryYaxis")
+ secondaryXaxis = xDialog.getChild("secondaryXaxis")
+ secondaryYaxis = xDialog.getChild("secondaryYaxis")
+
+ maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
+ primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"}))
+ primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"}))
+ secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"}))
+ secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"}))
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle)
+ self.assertTrue(document.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle)
+ self.assertEqual("A", document.Sheets[0].Charts[0].getEmbeddedObject().Title.String)
+ self.assertEqual("B", document.Sheets[0].Charts[0].getEmbeddedObject().SubTitle.String)
+ self.assertEqual("C", xCS.getAxisByDimension(0, 0).TitleObject.Text[0].String)
+ self.assertEqual("D", xCS.getAxisByDimension(1, 0).TitleObject.Text[0].String)
+ self.assertEqual("E", xCS.getAxisByDimension(0, 1).TitleObject.Text[0].String)
+ self.assertEqual("F", xCS.getAxisByDimension(1, 1).TitleObject.Text[0].String)
+
+ #reopen and verify InsertMenuTitles dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ maintitle = xDialog.getChild("maintitle")
+ subtitle = xDialog.getChild("subtitle")
+ primaryXaxis = xDialog.getChild("primaryXaxis")
+ primaryYaxis = xDialog.getChild("primaryYaxis")
+ secondaryXaxis = xDialog.getChild("secondaryXaxis")
+ secondaryYaxis = xDialog.getChild("secondaryYaxis")
+
+ self.assertEqual(get_state_as_dict(maintitle)["Text"], "A")
+ self.assertEqual(get_state_as_dict(subtitle)["Text"], "B")
+ self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C")
+ self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D")
+ self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E")
+ self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
def test_title_move_with_arrows_keys(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("chartArea.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- # Select the title
- xTitle = xChartMain.getChild("CID/Title=")
- xTitle.executeAction("SELECT", tuple())
+ # Select the title
+ xTitle = xChartMain.getChild("CID/Title=")
+ xTitle.executeAction("SELECT", tuple())
- self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+ self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("3.52", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
- self.assertEqual("0.3", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual("3.52", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+ self.assertEqual("0.3", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+ self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
- # Check the position has changed after moving the title using the arrows keys
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("3.42", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
- self.assertEqual("0.2", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+ # Check the position has changed after moving the title using the arrows keys
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual("3.42", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+ self.assertEqual("0.2", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartWall.py b/sc/qa/uitest/chart/chartWall.py
index 3c48db27d16e..485ce8d2090f 100644
--- a/sc/qa/uitest/chart/chartWall.py
+++ b/sc/qa/uitest/chart/chartWall.py
@@ -16,169 +16,168 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class chartWall(UITestCase):
def test_chart_wall_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- xWall = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Wall
- self.assertEqual(xWall.LineWidth, 0)
- self.assertEqual(xWall.LineTransparence, 0)
- self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
- self.assertEqual(xWall.FillTransparence, 0)
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Borders".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
- self.assertEqual(xWall.FillTransparence, 0)
-
- #reopen and verify tab "Borders".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
- self.assertEqual(xWall.FillTransparence, 0)
-
- #Click on tab "Area"
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
-
- rCustom = xDialog.getChild("R_custom")
- gCustom = xDialog.getChild("G_custom")
- bCustom = xDialog.getChild("B_custom")
-
- rCustom.executeAction("CLEAR", tuple())
- rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
- rCustom.executeAction("UP", tuple())
- rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
- gCustom.executeAction("CLEAR", tuple())
- gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
- gCustom.executeAction("UP", tuple())
- gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- bCustom.executeAction("CLEAR", tuple())
- bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
- bCustom.executeAction("UP", tuple())
- bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
- self.assertEqual(xWall.FillTransparence, 0)
-
- #reopen and verify tab "Area".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- rCustom = xDialog.getChild("R_custom")
- gCustom = xDialog.getChild("G_custom")
- bCustom = xDialog.getChild("B_custom")
-
- self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
- self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
- self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
- self.assertEqual(xWall.FillTransparence, 0)
-
- #change tab "Transparency"
- select_pos(tabcontrol, "2")
- transparency = xDialog.getChild("RBT_TRANS_LINEAR")
- transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
-
- transparency.executeAction("CLICK", tuple())
- transparencyPercent.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
- self.assertEqual(xWall.FillTransparence, 51)
-
- #reopen and verify tab "Transparency"
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
-
- transparency = xDialog.getChild("RBT_TRANS_LINEAR")
- transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
-
- self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
- self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
- self.assertEqual(xWall.FillTransparence, 51)
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(xWall.LineWidth, 100)
- self.assertEqual(xWall.LineTransparence, 5)
- self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
- self.assertEqual(xWall.FillTransparence, 51)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ xWall = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Wall
+ self.assertEqual(xWall.LineWidth, 0)
+ self.assertEqual(xWall.LineTransparence, 0)
+ self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
+ self.assertEqual(xWall.FillTransparence, 0)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Borders".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
+ self.assertEqual(xWall.FillTransparence, 0)
+
+ #reopen and verify tab "Borders".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
+ self.assertEqual(xWall.FillTransparence, 0)
+
+ #Click on tab "Area"
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+
+ rCustom = xDialog.getChild("R_custom")
+ gCustom = xDialog.getChild("G_custom")
+ bCustom = xDialog.getChild("B_custom")
+
+ rCustom.executeAction("CLEAR", tuple())
+ rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
+ rCustom.executeAction("UP", tuple())
+ rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
+ gCustom.executeAction("CLEAR", tuple())
+ gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
+ gCustom.executeAction("UP", tuple())
+ gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ bCustom.executeAction("CLEAR", tuple())
+ bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
+ bCustom.executeAction("UP", tuple())
+ bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
+ self.assertEqual(xWall.FillTransparence, 0)
+
+ #reopen and verify tab "Area".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ rCustom = xDialog.getChild("R_custom")
+ gCustom = xDialog.getChild("G_custom")
+ bCustom = xDialog.getChild("B_custom")
+
+ self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
+ self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
+ self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
+ self.assertEqual(xWall.FillTransparence, 0)
+
+ #change tab "Transparency"
+ select_pos(tabcontrol, "2")
+ transparency = xDialog.getChild("RBT_TRANS_LINEAR")
+ transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
+
+ transparency.executeAction("CLICK", tuple())
+ transparencyPercent.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
+ self.assertEqual(xWall.FillTransparence, 51)
+
+ #reopen and verify tab "Transparency"
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ transparency = xDialog.getChild("RBT_TRANS_LINEAR")
+ transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
+
+ self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
+ self.assertEqual(xWall.FillTransparence, 51)
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(xWall.LineWidth, 100)
+ self.assertEqual(xWall.LineTransparence, 5)
+ self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
+ self.assertEqual(xWall.FillTransparence, 51)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/chartXAxis.py b/sc/qa/uitest/chart/chartXAxis.py
index d169fa5d683e..15adb54b64b0 100644
--- a/sc/qa/uitest/chart/chartXAxis.py
+++ b/sc/qa/uitest/chart/chartXAxis.py
@@ -17,246 +17,245 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class chartXAxis(UITestCase):
def test_chart_x_axis_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- reverseDirection = xDialog.getChild("CBX_REVERSE")
- logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
-
- reverseDirection.executeAction("CLICK", tuple())
- logarithmicScale.executeAction("CLICK", tuple())
- autoMinimum.executeAction("CLICK", tuple())
- autoMaximum.executeAction("CLICK", tuple())
- majorInterval.executeAction("CLICK", tuple())
- minorInterval.executeAction("CLICK", tuple())
-
- minimum.executeAction("DOWN", tuple()) #10.12.2017
- maximum.executeAction("DOWN", tuple()) #29.04.2018
- major.executeAction("DOWN", tuple()) #19
- minor.executeAction("UP", tuple()) #3
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- reverseDirection = xDialog.getChild("CBX_REVERSE")
- logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
-
- self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true")
- self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true")
- self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017")
- self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018")
- self.assertEqual(get_state_as_dict(major)["Text"], "19")
- self.assertEqual(get_state_as_dict(minor)["Text"], "3")
-
- #Click on tab "positioning".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- select_by_text(crossAxis, "Start")
- select_by_text(placeLabels, "Outside end")
- innerMajorTick.executeAction("CLICK", tuple())
- outerMajorTick.executeAction("CLICK", tuple())
- innerMinorTick.executeAction("CLICK", tuple())
- outerMinorTick.executeAction("CLICK", tuple())
- select_by_text(placeMarks, "At axis")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start")
- self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
- self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
- self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
- #change tab "positioning".
- select_by_text(crossAxis, "Value")
- crossAxisValue.executeAction("UP", tuple()) #1
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
- self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "1")
- self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
- self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
- self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
- #change tab "Line".
- select_pos(tabcontrol, "2")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "Line".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- #change tab "Label"
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- tile = xDialog.getChild("tile")
- overlapCB = xDialog.getChild("overlapCB")
- breakCB = xDialog.getChild("breakCB")
- stackedCB = xDialog.getChild("stackedCB")
- textdirLB = xDialog.getChild("textdirLB")
-
- tile.executeAction("CLICK", tuple())
- overlapCB.executeAction("CLICK", tuple())
- breakCB.executeAction("CLICK", tuple())
- stackedCB.executeAction("CLICK", tuple())
- select_by_text(textdirLB, "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "Label".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- tile = xDialog.getChild("tile")
- overlapCB = xDialog.getChild("overlapCB")
- breakCB = xDialog.getChild("breakCB")
- stackedCB = xDialog.getChild("stackedCB")
- textdirLB = xDialog.getChild("textdirLB")
-
- self.assertEqual(get_state_as_dict(tile)["Checked"], "true")
- self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ reverseDirection = xDialog.getChild("CBX_REVERSE")
+ logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
+
+ reverseDirection.executeAction("CLICK", tuple())
+ logarithmicScale.executeAction("CLICK", tuple())
+ autoMinimum.executeAction("CLICK", tuple())
+ autoMaximum.executeAction("CLICK", tuple())
+ majorInterval.executeAction("CLICK", tuple())
+ minorInterval.executeAction("CLICK", tuple())
+
+ minimum.executeAction("DOWN", tuple()) #10.12.2017
+ maximum.executeAction("DOWN", tuple()) #29.04.2018
+ major.executeAction("DOWN", tuple()) #19
+ minor.executeAction("UP", tuple()) #3
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ reverseDirection = xDialog.getChild("CBX_REVERSE")
+ logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
+
+ self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017")
+ self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018")
+ self.assertEqual(get_state_as_dict(major)["Text"], "19")
+ self.assertEqual(get_state_as_dict(minor)["Text"], "3")
+
+ #Click on tab "positioning".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ select_by_text(crossAxis, "Start")
+ select_by_text(placeLabels, "Outside end")
+ innerMajorTick.executeAction("CLICK", tuple())
+ outerMajorTick.executeAction("CLICK", tuple())
+ innerMinorTick.executeAction("CLICK", tuple())
+ outerMinorTick.executeAction("CLICK", tuple())
+ select_by_text(placeMarks, "At axis")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start")
+ self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
+ self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
+ #change tab "positioning".
+ select_by_text(crossAxis, "Value")
+ crossAxisValue.executeAction("UP", tuple()) #1
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
+ self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "1")
+ self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
+ self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
+ #change tab "Line".
+ select_pos(tabcontrol, "2")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "Line".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ #change tab "Label"
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ tile = xDialog.getChild("tile")
+ overlapCB = xDialog.getChild("overlapCB")
+ breakCB = xDialog.getChild("breakCB")
+ stackedCB = xDialog.getChild("stackedCB")
+ textdirLB = xDialog.getChild("textdirLB")
+
+ tile.executeAction("CLICK", tuple())
+ overlapCB.executeAction("CLICK", tuple())
+ breakCB.executeAction("CLICK", tuple())
+ stackedCB.executeAction("CLICK", tuple())
+ select_by_text(textdirLB, "Right-to-left")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "Label".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ tile = xDialog.getChild("tile")
+ overlapCB = xDialog.getChild("overlapCB")
+ breakCB = xDialog.getChild("breakCB")
+ stackedCB = xDialog.getChild("stackedCB")
+ textdirLB = xDialog.getChild("textdirLB")
+
+ self.assertEqual(get_state_as_dict(tile)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left")
+
+ 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/chart/chartYAxis.py b/sc/qa/uitest/chart/chartYAxis.py
index 22c3b79329d5..22e7fe67b8fb 100644
--- a/sc/qa/uitest/chart/chartYAxis.py
+++ b/sc/qa/uitest/chart/chartYAxis.py
@@ -17,248 +17,247 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class chartYAxis(UITestCase):
def test_chart_y_axis_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # X Axis...
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
-
- reverseDirection = xDialog.getChild("CBX_REVERSE")
- logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
-
- reverseDirection.executeAction("CLICK", tuple())
- logarithmicScale.executeAction("CLICK", tuple())
- autoMinimum.executeAction("CLICK", tuple())
- autoMaximum.executeAction("CLICK", tuple())
- majorInterval.executeAction("CLICK", tuple())
- minorInterval.executeAction("CLICK", tuple())
-
- minimum.executeAction("UP", tuple()) #1
- maximum.executeAction("DOWN", tuple()) #17
- major.executeAction("DOWN", tuple()) #1
- minor.executeAction("UP", tuple()) #3
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- reverseDirection = xDialog.getChild("CBX_REVERSE")
- logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
-
- self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true")
- self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true")
- self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minimum)["Text"], "1")
- self.assertEqual(get_state_as_dict(maximum)["Text"], "17")
- self.assertEqual(get_state_as_dict(major)["Text"], "1")
- self.assertEqual(get_state_as_dict(minor)["Text"], "3")
-
- #Click on tab "positioning".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- select_by_text(crossAxis, "Start")
- select_by_text(placeLabels, "Outside end")
- innerMajorTick.executeAction("CLICK", tuple())
- outerMajorTick.executeAction("CLICK", tuple())
- innerMinorTick.executeAction("CLICK", tuple())
- outerMinorTick.executeAction("CLICK", tuple())
- select_by_text(placeMarks, "At axis")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start")
- self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
- self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
- self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
- #change tab "positioning".
- select_by_text(crossAxis, "Value")
- crossAxisValue.executeAction("CLEAR", tuple())
- crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
-
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
- #self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "19.01.2018") #bug 123520
- self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
- self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
- self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
- self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
- #change tab "Line".
- select_pos(tabcontrol, "2")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- transparency.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "Line".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
-
- #change tab "Label"
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- tile = xDialog.getChild("tile")
- overlapCB = xDialog.getChild("overlapCB")
- breakCB = xDialog.getChild("breakCB")
- stackedCB = xDialog.getChild("stackedCB")
- textdirLB = xDialog.getChild("textdirLB")
-
- tile.executeAction("CLICK", tuple())
- overlapCB.executeAction("CLICK", tuple())
- breakCB.executeAction("CLICK", tuple())
- stackedCB.executeAction("CLICK", tuple())
- select_by_text(textdirLB, "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify tab "Label".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
-
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- tile = xDialog.getChild("tile")
- overlapCB = xDialog.getChild("overlapCB")
- breakCB = xDialog.getChild("breakCB")
- stackedCB = xDialog.getChild("stackedCB")
- textdirLB = xDialog.getChild("textdirLB")
-
- self.assertEqual(get_state_as_dict(tile)["Checked"], "true")
- self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true")
- self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # X Axis...
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+
+ reverseDirection = xDialog.getChild("CBX_REVERSE")
+ logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
+
+ reverseDirection.executeAction("CLICK", tuple())
+ logarithmicScale.executeAction("CLICK", tuple())
+ autoMinimum.executeAction("CLICK", tuple())
+ autoMaximum.executeAction("CLICK", tuple())
+ majorInterval.executeAction("CLICK", tuple())
+ minorInterval.executeAction("CLICK", tuple())
+
+ minimum.executeAction("UP", tuple()) #1
+ maximum.executeAction("DOWN", tuple()) #17
+ major.executeAction("DOWN", tuple()) #1
+ minor.executeAction("UP", tuple()) #3
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ reverseDirection = xDialog.getChild("CBX_REVERSE")
+ logarithmicScale = xDialog.getChild("CBX_LOGARITHM")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
+
+ self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minimum)["Text"], "1")
+ self.assertEqual(get_state_as_dict(maximum)["Text"], "17")
+ self.assertEqual(get_state_as_dict(major)["Text"], "1")
+ self.assertEqual(get_state_as_dict(minor)["Text"], "3")
+
+ #Click on tab "positioning".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ select_by_text(crossAxis, "Start")
+ select_by_text(placeLabels, "Outside end")
+ innerMajorTick.executeAction("CLICK", tuple())
+ outerMajorTick.executeAction("CLICK", tuple())
+ innerMinorTick.executeAction("CLICK", tuple())
+ outerMinorTick.executeAction("CLICK", tuple())
+ select_by_text(placeMarks, "At axis")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start")
+ self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
+ self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
+ #change tab "positioning".
+ select_by_text(crossAxis, "Value")
+ crossAxisValue.executeAction("CLEAR", tuple())
+ crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
+ #self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "19.01.2018") #bug 123520
+ self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end")
+ self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis")
+ #change tab "Line".
+ select_pos(tabcontrol, "2")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "Line".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ #change tab "Label"
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ tile = xDialog.getChild("tile")
+ overlapCB = xDialog.getChild("overlapCB")
+ breakCB = xDialog.getChild("breakCB")
+ stackedCB = xDialog.getChild("stackedCB")
+ textdirLB = xDialog.getChild("textdirLB")
+
+ tile.executeAction("CLICK", tuple())
+ overlapCB.executeAction("CLICK", tuple())
+ breakCB.executeAction("CLICK", tuple())
+ stackedCB.executeAction("CLICK", tuple())
+ select_by_text(textdirLB, "Right-to-left")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify tab "Label".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ tile = xDialog.getChild("tile")
+ overlapCB = xDialog.getChild("overlapCB")
+ breakCB = xDialog.getChild("breakCB")
+ stackedCB = xDialog.getChild("stackedCB")
+ textdirLB = xDialog.getChild("textdirLB")
+
+ self.assertEqual(get_state_as_dict(tile)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left")
+
+ 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/chart/copyPaste.py b/sc/qa/uitest/chart/copyPaste.py
index 078dc1938973..5294022bfdac 100644
--- a/sc/qa/uitest/chart/copyPaste.py
+++ b/sc/qa/uitest/chart/copyPaste.py
@@ -16,64 +16,62 @@ class CopyPaste(UITestCase):
@unittest.skipIf(platform.system() == "Windows", "Fails on Windows: tdf#142635")
def test_copy_paste_chart_with_dot_in_sheet_name(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("chartWithDotInSheetName.ods"))
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("chartWithDotInSheetName.ods")) as calc_doc:
+ document = self.ui_test.get_component()
- xChart = document.Sheets[0].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ xChart = document.Sheets[0].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(4, len(xDataSeries))
+ self.assertEqual(4, len(xDataSeries))
- xOldSheetRanges = []
- for i in range(4):
- xRow = []
- xDS = xDataSeries[i].DataSequences
+ xOldSheetRanges = []
+ for i in range(4):
+ xRow = []
+ xDS = xDataSeries[i].DataSequences
- self.assertEqual(1, len(xDS))
- xRow.append(xDS[0].Values.SourceRangeRepresentation)
- xOldSheetRanges.append(xRow)
+ self.assertEqual(1, len(xDS))
+ xRow.append(xDS[0].Values.SourceRangeRepresentation)
+ xOldSheetRanges.append(xRow)
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("calc")
- document = self.ui_test.get_component()
+ self.ui_test.create_doc_in_start_center("calc")
+ document = self.ui_test.get_component()
- # Rename the sheet to match the same name as the first document
- self.ui_test.execute_dialog_through_command(".uno:RenameTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xname_entry = xDialog.getChild("name_entry")
+ # Rename the sheet to match the same name as the first document
+ self.ui_test.execute_dialog_through_command(".uno:RenameTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xname_entry = xDialog.getChild("name_entry")
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"Sheet.1"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"Sheet.1"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xChart = document.Sheets[0].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ xChart = document.Sheets[0].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(4, len(xDataSeries))
+ self.assertEqual(4, len(xDataSeries))
- xNewSheetRanges = []
- for i in range(4):
- xRow = []
- xDS = xDataSeries[i].DataSequences
+ xNewSheetRanges = []
+ for i in range(4):
+ xRow = []
+ xDS = xDataSeries[i].DataSequences
- self.assertEqual(1, len(xDS))
- xRow.append(xDS[0].Values.SourceRangeRepresentation)
- xNewSheetRanges.append(xRow)
+ self.assertEqual(1, len(xDS))
+ xRow.append(xDS[0].Values.SourceRangeRepresentation)
+ xNewSheetRanges.append(xRow)
- # Without the fix in place, this test would have failed with
- # ["$'Sheet.1'.$B$12:$B$18"]
- # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"]
- self.assertEqual(xOldSheetRanges, xNewSheetRanges)
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # ["$'Sheet.1'.$B$12:$B$18"]
+ # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"]
+ self.assertEqual(xOldSheetRanges, xNewSheetRanges)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/formatDataSeries.py b/sc/qa/uitest/chart/formatDataSeries.py
index 4aeaebe66ce8..660a29de0507 100644
--- a/sc/qa/uitest/chart/formatDataSeries.py
+++ b/sc/qa/uitest/chart/formatDataSeries.py
@@ -16,95 +16,94 @@ from uitest.uihelper.common import get_state_as_dict, type_text, get_url_for_dat
class chartFormatDataSeries(UITestCase):
def test_chart_format_data_series_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Options".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1")
- secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2")
- leaveGap = xDialog.getChild("RB_DONT_PAINT")
- assumeZero = xDialog.getChild("RB_ASSUME_ZERO")
- continueLine = xDialog.getChild("RB_CONTINUE_LINE")
- includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS")
- hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN")
-
- secondaryYAxis.executeAction("CLICK", tuple())
- leaveGap.executeAction("CLICK", tuple())
- includeHiddenCells.executeAction("CLICK", tuple())
- hideLegend.executeAction("CLICK", tuple())
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
-
- xWidth = xDialog.getChild("MF_SYMBOL_WIDTH")
- xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT")
- xKeep = xDialog.getChild("CB_SYMBOL_RATIO")
-
- xKeep.executeAction("CLICK", tuple())
- xWidth.executeAction("UP", tuple())
- xWidth.executeAction("UP", tuple())
- xHeight.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Options".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1")
- secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2")
- leaveGap = xDialog.getChild("RB_DONT_PAINT")
- assumeZero = xDialog.getChild("RB_ASSUME_ZERO")
- continueLine = xDialog.getChild("RB_CONTINUE_LINE")
- includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS")
- hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN")
-
- self.assertEqual(get_state_as_dict(secondaryYAxis)["Checked"], "true")
- self.assertEqual(get_state_as_dict(leaveGap)["Checked"], "true")
- self.assertEqual(get_state_as_dict(includeHiddenCells)["Selected"], "true")
- self.assertEqual(get_state_as_dict(hideLegend)["Selected"], "true")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
-
- xWidth = xDialog.getChild("MF_SYMBOL_WIDTH")
- xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT")
- xKeep = xDialog.getChild("CB_SYMBOL_RATIO")
-
- self.assertEqual(get_state_as_dict(xKeep)["Selected"], "true") #checked as default even after reopen
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.35 cm")
- self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.30 cm")
- #click up, should up both values, because Keep ratio is checked
- xWidth.executeAction("UP", tuple())
- xHeight.executeAction("UP", tuple())
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.41 cm")
- self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.35 cm")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Options".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1")
+ secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2")
+ leaveGap = xDialog.getChild("RB_DONT_PAINT")
+ assumeZero = xDialog.getChild("RB_ASSUME_ZERO")
+ continueLine = xDialog.getChild("RB_CONTINUE_LINE")
+ includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS")
+ hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN")
+
+ secondaryYAxis.executeAction("CLICK", tuple())
+ leaveGap.executeAction("CLICK", tuple())
+ includeHiddenCells.executeAction("CLICK", tuple())
+ hideLegend.executeAction("CLICK", tuple())
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild("MF_SYMBOL_WIDTH")
+ xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT")
+ xKeep = xDialog.getChild("CB_SYMBOL_RATIO")
+
+ xKeep.executeAction("CLICK", tuple())
+ xWidth.executeAction("UP", tuple())
+ xWidth.executeAction("UP", tuple())
+ xHeight.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Options".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1")
+ secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2")
+ leaveGap = xDialog.getChild("RB_DONT_PAINT")
+ assumeZero = xDialog.getChild("RB_ASSUME_ZERO")
+ continueLine = xDialog.getChild("RB_CONTINUE_LINE")
+ includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS")
+ hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN")
+
+ self.assertEqual(get_state_as_dict(secondaryYAxis)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(leaveGap)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(includeHiddenCells)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(hideLegend)["Selected"], "true")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild("MF_SYMBOL_WIDTH")
+ xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT")
+ xKeep = xDialog.getChild("CB_SYMBOL_RATIO")
+
+ self.assertEqual(get_state_as_dict(xKeep)["Selected"], "true") #checked as default even after reopen
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.35 cm")
+ self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.30 cm")
+ #click up, should up both values, because Keep ratio is checked
+ xWidth.executeAction("UP", tuple())
+ xHeight.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.41 cm")
+ self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.35 cm")
+
+ 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/chart/tdf101894.py b/sc/qa/uitest/chart/tdf101894.py
index 11399f0fe83d..db5f9cb93ea9 100644
--- a/sc/qa/uitest/chart/tdf101894.py
+++ b/sc/qa/uitest/chart/tdf101894.py
@@ -13,66 +13,64 @@ from uitest.uihelper.common import get_state_as_dict
class tdf101894(UITestCase):
def test_tdf101894(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf101894.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
-
- document = self.ui_test.get_component()
-
- xChart = document.Sheets[0].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
-
- self.assertEqual(4, len(xDataSeries))
-
- xOldSheetRanges = []
- for i in range(4):
- xRow = []
- xDS = xDataSeries[i].DataSequences
-
- self.assertEqual(2, len(xDS))
- xRow.append(xDS[0].Values.SourceRangeRepresentation)
- xRow.append(xDS[1].Values.SourceRangeRepresentation)
- xOldSheetRanges.append(xRow)
-
- # Rename the sheet first
- self.ui_test.execute_dialog_through_command(".uno:RenameTable")
- xDialog = self.xUITest.getTopFocusWindow()
- xname_entry = xDialog.getChild("name_entry")
-
- oldName = get_state_as_dict(xname_entry)['Text']
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Copy sheet and use the old name
- self.ui_test.execute_dialog_through_command(".uno:Move")
- xDialog = self.xUITest.getTopFocusWindow()
- newName = xDialog.getChild("newName")
- newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- newName.executeAction("TYPE", mkPropertyValues({"TEXT": oldName}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- xChart = document.Sheets[0].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
-
- self.assertEqual(4, len(xDataSeries))
-
- xNewSheetRanges = []
- for i in range(4):
- xRow = []
- xDS = xDataSeries[i].DataSequences
-
- self.assertEqual(2, len(xDS))
- xRow.append(xDS[0].Values.SourceRangeRepresentation)
- xRow.append(xDS[1].Values.SourceRangeRepresentation)
- xNewSheetRanges.append(xRow)
-
- self.assertEqual(xOldSheetRanges, xNewSheetRanges)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf101894.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ document = self.ui_test.get_component()
+
+ xChart = document.Sheets[0].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+
+ self.assertEqual(4, len(xDataSeries))
+
+ xOldSheetRanges = []
+ for i in range(4):
+ xRow = []
+ xDS = xDataSeries[i].DataSequences
+
+ self.assertEqual(2, len(xDS))
+ xRow.append(xDS[0].Values.SourceRangeRepresentation)
+ xRow.append(xDS[1].Values.SourceRangeRepresentation)
+ xOldSheetRanges.append(xRow)
+
+ # Rename the sheet first
+ self.ui_test.execute_dialog_through_command(".uno:RenameTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xname_entry = xDialog.getChild("name_entry")
+
+ oldName = get_state_as_dict(xname_entry)['Text']
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Copy sheet and use the old name
+ self.ui_test.execute_dialog_through_command(".uno:Move")
+ xDialog = self.xUITest.getTopFocusWindow()
+ newName = xDialog.getChild("newName")
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newName.executeAction("TYPE", mkPropertyValues({"TEXT": oldName}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ xChart = document.Sheets[0].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+
+ self.assertEqual(4, len(xDataSeries))
+
+ xNewSheetRanges = []
+ for i in range(4):
+ xRow = []
+ xDS = xDataSeries[i].DataSequences
+
+ self.assertEqual(2, len(xDS))
+ xRow.append(xDS[0].Values.SourceRangeRepresentation)
+ xRow.append(xDS[1].Values.SourceRangeRepresentation)
+ xNewSheetRanges.append(xRow)
+
+ self.assertEqual(xOldSheetRanges, xNewSheetRanges)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf107097.py b/sc/qa/uitest/chart/tdf107097.py
index 50ecccaff309..09db67f197cc 100644
--- a/sc/qa/uitest/chart/tdf107097.py
+++ b/sc/qa/uitest/chart/tdf107097.py
@@ -14,52 +14,50 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf107097(UITestCase):
def test_tdf107097(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf107097.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf107097.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- xFirstMatrix = []
- for row in range(6, 18):
- xRow = []
- for column in range(3, 7):
- xRow.append(get_cell_by_position(document, 1, column, row).getValue())
- xFirstMatrix.append(xRow)
+ xFirstMatrix = []
+ for row in range(6, 18):
+ xRow = []
+ for column in range(3, 7):
+ xRow.append(get_cell_by_position(document, 1, column, row).getValue())
+ xFirstMatrix.append(xRow)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
- xSecondMatrix = []
- for row in xData.Data:
- xRow = []
- for value in row:
- xRow.append(value)
- xSecondMatrix.append(xRow)
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(value)
+ xSecondMatrix.append(xRow)
- self.assertEqual(xFirstMatrix, xSecondMatrix)
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
- aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
- 'Sum - Sales T3', 'Sum - Sales T4')
- aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B', 'DE Munich A',
- 'DE Munich B', 'EN Glasgow A', 'EN Liverpool B', 'EN London A',
- 'EN London B', 'FR Nantes A', 'FR Nantes B', 'FR Paris A', 'FR Paris B')
+ aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
+ 'Sum - Sales T3', 'Sum - Sales T4')
+ aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B', 'DE Munich A',
+ 'DE Munich B', 'EN Glasgow A', 'EN Liverpool B', 'EN London A',
+ 'EN London B', 'FR Nantes A', 'FR Nantes B', 'FR Paris A', 'FR Paris B')
- self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
- self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
-
- self.ui_test.close_doc()
+ self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
+ self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf120348.py b/sc/qa/uitest/chart/tdf120348.py
index b8ccb6c9b2c0..0685ab7c0f63 100644
--- a/sc/qa/uitest/chart/tdf120348.py
+++ b/sc/qa/uitest/chart/tdf120348.py
@@ -14,49 +14,48 @@ class tdf120348(UITestCase):
def test_tdf120348(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120348.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf120348.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- xFirstMatrix = []
- for row in range(1, 159):
- xRow = []
- for column in range(5, 9):
- xRow.append(round(get_cell_by_position(document, 0, column, row).getValue(), 5))
- xFirstMatrix.append(xRow)
+ xFirstMatrix = []
+ for row in range(1, 159):
+ xRow = []
+ for column in range(5, 9):
+ xRow.append(round(get_cell_by_position(document, 0, column, row).getValue(), 5))
+ xFirstMatrix.append(xRow)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 2"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 2"}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
- columnNames = ('Finland', 'Sweden', 'Poland', '')
- self.assertEqual(columnNames, xData.ColumnDescriptions)
+ columnNames = ('Finland', 'Sweden', 'Poland', '')
+ self.assertEqual(columnNames, xData.ColumnDescriptions)
- xSecondMatrix = []
- for row in xData.Data:
- xRow = []
- for value in row:
- xRow.append(round(value, 5))
- xSecondMatrix.append(xRow)
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(round(value, 5))
+ xSecondMatrix.append(xRow)
- # Without the fix in place, this test would have failed with
- # First differing element 51:
- # [3.31618, 3.65089, 3.33626, 0.0]
- # [3.31618, 3.65089, 0.0, 0.0]
+ # Without the fix in place, this test would have failed with
+ # First differing element 51:
+ # [3.31618, 3.65089, 3.33626, 0.0]
+ # [3.31618, 3.65089, 0.0, 0.0]
- self.assertEqual(xFirstMatrix, xSecondMatrix)
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf122398.py b/sc/qa/uitest/chart/tdf122398.py
index 279d46ccce4c..c6093f61677c 100644
--- a/sc/qa/uitest/chart/tdf122398.py
+++ b/sc/qa/uitest/chart/tdf122398.py
@@ -15,80 +15,79 @@ from uitest.uihelper.common import get_state_as_dict, type_text, get_url_for_dat
class tdf122398(UITestCase):
def test_tdf122398_chart_min_max_x_axis(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #Open attached file. Set chart into edit mode. Select x-axis and then Format Selection.
- #Disable the Automatic for min and max. You cannot change the values at all, neither with direct
- #input nor with up-down arrow buttons.
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
+ #Open attached file. Set chart into edit mode. Select x-axis and then Format Selection.
+ #Disable the Automatic for min and max. You cannot change the values at all, neither with direct
+ #input nor with up-down arrow buttons.
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
- autoMinimum.executeAction("CLICK", tuple())
- autoMaximum.executeAction("CLICK", tuple())
- majorInterval.executeAction("CLICK", tuple())
- minorInterval.executeAction("CLICK", tuple())
- #In a chart that contains an axis with a date datatype, the UI does not allow specifying
- #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900)
- minimum.executeAction("CLEAR", tuple())
- minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"}))
- maximum.executeAction("DOWN", tuple()) #29.04.2018
- major.executeAction("UP", tuple()) #21
- minor.executeAction("DOWN", tuple()) #1
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ autoMinimum.executeAction("CLICK", tuple())
+ autoMaximum.executeAction("CLICK", tuple())
+ majorInterval.executeAction("CLICK", tuple())
+ minorInterval.executeAction("CLICK", tuple())
+ #In a chart that contains an axis with a date datatype, the UI does not allow specifying
+ #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900)
+ minimum.executeAction("CLEAR", tuple())
+ minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"}))
+ maximum.executeAction("DOWN", tuple()) #29.04.2018
+ major.executeAction("UP", tuple()) #21
+ minor.executeAction("DOWN", tuple()) #1
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and verify
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Scale".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
+ #reopen and verify
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Scale".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
- autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
- autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
- majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
- minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
- minimum = xDialog.getChild("EDT_MIN")
- maximum = xDialog.getChild("EDT_MAX")
- major = xDialog.getChild("EDT_STEP_MAIN")
- minor = xDialog.getChild("MT_STEPHELP")
+ autoMinimum = xDialog.getChild("CBX_AUTO_MIN")
+ autoMaximum = xDialog.getChild("CBX_AUTO_MAX")
+ majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN")
+ minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP")
+ minimum = xDialog.getChild("EDT_MIN")
+ maximum = xDialog.getChild("EDT_MAX")
+ major = xDialog.getChild("EDT_STEP_MAIN")
+ minor = xDialog.getChild("MT_STEPHELP")
- self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
- self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
- self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018")
- self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018")
- self.assertEqual(get_state_as_dict(major)["Text"], "21")
- self.assertEqual(get_state_as_dict(minor)["Text"], "1")
+ self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018")
+ self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018")
+ self.assertEqual(get_state_as_dict(major)["Text"], "21")
+ self.assertEqual(get_state_as_dict(minor)["Text"], "1")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf123013.py b/sc/qa/uitest/chart/tdf123013.py
index 72fca5bce520..23a667f86317 100644
--- a/sc/qa/uitest/chart/tdf123013.py
+++ b/sc/qa/uitest/chart/tdf123013.py
@@ -15,45 +15,44 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf123013(UITestCase):
def test_tdf96432_chart_trendline_name(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123013.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- #add name
- xentryname = xDialog.getChild("entry_name")
- xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ with self.ui_test.load_file(get_url_for_data_file("tdf123013.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ #add name
+ xentryname = xDialog.getChild("entry_name")
+ xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and try again
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ #reopen and try again
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- #Right-click on the chart; from the pop-up menu select "Format Y bars
- # The program presents dialog "Format Y bars", tab "Line".
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- #add name
- xentryname = xDialog.getChild("entry_name")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #Right-click on the chart; from the pop-up menu select "Format Y bars
+ # The program presents dialog "Format Y bars", tab "Line".
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ #add name
+ xentryname = xDialog.getChild("entry_name")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf123231.py b/sc/qa/uitest/chart/tdf123231.py
index db596266579c..a9d3546fb0eb 100644
--- a/sc/qa/uitest/chart/tdf123231.py
+++ b/sc/qa/uitest/chart/tdf123231.py
@@ -15,69 +15,68 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf123231(UITestCase):
def test_tdf123231_chart_trendline_dialog_power(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #Change regression Type to Power
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
+ #Change regression Type to Power
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
- power.executeAction("CLICK", tuple()) #set power
+ power.executeAction("CLICK", tuple()) #set power
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen dialog and close dialog
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- self.assertEqual(get_state_as_dict(power)["Checked"], "true")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #reopen dialog and close dialog
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ self.assertEqual(get_state_as_dict(power)["Checked"], "true")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and verify Power
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
+ #reopen and verify Power
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
- self.assertEqual(get_state_as_dict(power)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(power)["Checked"], "true")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf123520.py b/sc/qa/uitest/chart/tdf123520.py
index 150467bb5990..2fa43e9e110a 100644
--- a/sc/qa/uitest/chart/tdf123520.py
+++ b/sc/qa/uitest/chart/tdf123520.py
@@ -16,66 +16,65 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf123520(UITestCase):
def test_tdf123520_chart_y_cross_other_axis(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123520.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf123520.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # Y Axis
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "positioning".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # Y Axis
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "positioning".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
- crossAxisValue.executeAction("CLEAR", tuple())
- crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"}))
- #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"}))
- #TAB doesn't works- add "a" at the end of textbox
- #workaround - edit another ui item, it should trigger leave of textbox
- select_by_text(placeLabels, "Outside start")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+ crossAxisValue.executeAction("CLEAR", tuple())
+ crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"}))
+ #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"}))
+ #TAB doesn't works- add "a" at the end of textbox
+ #workaround - edit another ui item, it should trigger leave of textbox
+ select_by_text(placeLabels, "Outside start")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
- self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018")
- self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start")
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
+ self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018")
+ self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf124111.py b/sc/qa/uitest/chart/tdf124111.py
index b7b5f954ecf2..056deff2f103 100644
--- a/sc/qa/uitest/chart/tdf124111.py
+++ b/sc/qa/uitest/chart/tdf124111.py
@@ -15,60 +15,59 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf124111(UITestCase):
def test_tdf124111_chart_x_negative_cross(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124111.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf124111.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "positioning".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis...
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "positioning".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
- crossAxisValue.executeAction("DOWN", tuple()) #-1
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+ crossAxisValue.executeAction("DOWN", tuple()) #-1
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #reopen and verify tab "positioning".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ #reopen and verify tab "positioning".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
- crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
- placeLabels = xDialog.getChild("LB_PLACE_LABELS")
- innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
- outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
- innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
- outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
- placeMarks = xDialog.getChild("LB_PLACE_TICKS")
+ crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
+ crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
+ placeLabels = xDialog.getChild("LB_PLACE_LABELS")
+ innerMajorTick = xDialog.getChild("CB_TICKS_INNER")
+ outerMajorTick = xDialog.getChild("CB_TICKS_OUTER")
+ innerMinorTick = xDialog.getChild("CB_MINOR_INNER")
+ outerMinorTick = xDialog.getChild("CB_MINOR_OUTER")
+ placeMarks = xDialog.getChild("LB_PLACE_TICKS")
- self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
- self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1")
+ self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
+ self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
+ 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/chart/tdf129587.py b/sc/qa/uitest/chart/tdf129587.py
index 24b319806763..020b866274b7 100644
--- a/sc/qa/uitest/chart/tdf129587.py
+++ b/sc/qa/uitest/chart/tdf129587.py
@@ -12,48 +12,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf129587(UITestCase):
def test_tdf129587(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf129587.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf129587.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual("$Tabelle1.$F$2:$G$11", xDataSeries[0].ErrorBarY.ErrorBarRangeNegative)
+ document = self.ui_test.get_component()
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual("$Tabelle1.$F$2:$G$11", xDataSeries[0].ErrorBarY.ErrorBarRangeNegative)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/MultiClick/D=0:CS=0:CT=0:Series=0:ErrorsY=")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
- xDialog = self.xUITest.getTopFocusWindow()
+ xSeriesObj = xChartMain.getChild("CID/MultiClick/D=0:CS=0:CT=0:Series=0:ErrorsY=")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
- xPerBtn = xDialog.getChild("RB_PERCENT")
- xPerBtn.executeAction("CLICK", tuple())
+ xPerBtn = xDialog.getChild("RB_PERCENT")
+ xPerBtn.executeAction("CLICK", tuple())
- xPosField = xDialog.getChild("MF_POSITIVE")
- xNegField = xDialog.getChild("MF_NEGATIVE")
+ xPosField = xDialog.getChild("MF_POSITIVE")
+ xNegField = xDialog.getChild("MF_NEGATIVE")
- self.assertEqual("0%", get_state_as_dict(xPosField)['Text'])
- self.assertEqual("0%", get_state_as_dict(xNegField)['Text'])
+ self.assertEqual("0%", get_state_as_dict(xPosField)['Text'])
+ self.assertEqual("0%", get_state_as_dict(xNegField)['Text'])
- #Increase value by one
- xPosField.executeAction("UP", tuple())
+ #Increase value by one
+ xPosField.executeAction("UP", tuple())
- #Both fields are updated because 'Same value for both' is enabled
- self.assertEqual("1%", get_state_as_dict(xPosField)['Text'])
- self.assertEqual("1%", get_state_as_dict(xNegField)['Text'])
+ #Both fields are updated because 'Same value for both' is enabled
+ self.assertEqual("1%", get_state_as_dict(xPosField)['Text'])
+ self.assertEqual("1%", get_state_as_dict(xNegField)['Text'])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #Without the fix in place, it would have crashed here
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(1.0, xDataSeries[0].ErrorBarY.PercentageError)
+ #Without the fix in place, it would have crashed here
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual(1.0, xDataSeries[0].ErrorBarY.PercentageError)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf133630.py b/sc/qa/uitest/chart/tdf133630.py
index 1f3ced1cd9ad..2b0ee28e3913 100644
--- a/sc/qa/uitest/chart/tdf133630.py
+++ b/sc/qa/uitest/chart/tdf133630.py
@@ -13,55 +13,54 @@ class tdf133630(UITestCase):
def test_tdf133630(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("chartArea.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- xCS = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0]
- self.assertEqual(0, xCS.getAxisByDimension(0, 0).LineWidth)
- self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)
+ xCS = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0]
+ self.assertEqual(0, xCS.getAxisByDimension(0, 0).LineWidth)
+ self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)
- # First change the line width of one element
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:Axis=0,0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
+ # First change the line width of one element
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:Axis=0,0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xWidth.executeAction("UP", tuple())
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xWidth.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
- self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)
+ self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
+ self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth)
- # Now change the line width of another element
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
+ # Now change the line width of another element
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xWidth.executeAction("UP", tuple())
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xWidth.executeAction("UP", tuple())
- # Without the fix in place, this test would have crashed here
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # Without the fix in place, this test would have crashed here
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
- self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth)
+ self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth)
+ self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf134059.py b/sc/qa/uitest/chart/tdf134059.py
index 1869256e0c7b..76f364a7c58d 100644
--- a/sc/qa/uitest/chart/tdf134059.py
+++ b/sc/qa/uitest/chart/tdf134059.py
@@ -39,30 +39,28 @@ class Tdf134059(UITestCase):
gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": "Object 1"}))
def test_tdf134059(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf134059.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf134059.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.assertSeriesNames(gridwin)
+ self.assertSeriesNames(gridwin)
- # Hide row 10
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A10"}))
- self.ui_test._xUITest.executeCommand(".uno:HideRow")
+ # Hide row 10
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A10"}))
+ self.ui_test._xUITest.executeCommand(".uno:HideRow")
- row = get_row(calc_doc, 9)
- self.assertFalse(row.getPropertyValue("IsVisible"))
+ row = get_row(calc_doc, 9)
+ self.assertFalse(row.getPropertyValue("IsVisible"))
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Col. 1' != 'Column C'
- self.assertSeriesNames(gridwin)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Col. 1' != 'Column C'
+ self.assertSeriesNames(gridwin)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertTrue(row.getPropertyValue("IsVisible"))
+ self.assertTrue(row.getPropertyValue("IsVisible"))
- self.assertSeriesNames(gridwin)
-
- self.ui_test.close_doc()
+ self.assertSeriesNames(gridwin)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf136011.py b/sc/qa/uitest/chart/tdf136011.py
index e4bcbd5f975e..a523b8ecaa0e 100644
--- a/sc/qa/uitest/chart/tdf136011.py
+++ b/sc/qa/uitest/chart/tdf136011.py
@@ -22,36 +22,35 @@ class tdf136011(UITestCase):
# Test both charts
for i, name in enumerate(xObjectNames):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf136011.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf136011.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- xExpectedResults = []
- for category in xCategories:
- for subCategory in xSubCategories[i]:
- xExpectedResults.append(category + ' ' + subCategory)
+ xExpectedResults = []
+ for category in xCategories:
+ for subCategory in xSubCategories[i]:
+ xExpectedResults.append(category + ' ' + subCategory)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": name}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": name}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
- self.assertEqual(xColumnNames, list(xData.ColumnDescriptions))
+ self.assertEqual(xColumnNames, list(xData.ColumnDescriptions))
- # Without the fix in place, the numbers in the categories in chart
- # 'Object 2' wouldn't have been pasted to the new document
- self.assertEqual(xExpectedResults, list(xData.RowDescriptions))
+ # Without the fix in place, the numbers in the categories in chart
+ # 'Object 2' wouldn't have been pasted to the new document
+ self.assertEqual(xExpectedResults, list(xData.RowDescriptions))
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf43175.py b/sc/qa/uitest/chart/tdf43175.py
index fe837197e6a5..1bfb26aa43d3 100644
--- a/sc/qa/uitest/chart/tdf43175.py
+++ b/sc/qa/uitest/chart/tdf43175.py
@@ -11,38 +11,36 @@ from uitest.uihelper.common import get_url_for_data_file
class Tdf43175(UITestCase):
def test_tdf43175(self):
- self.ui_test.load_file(get_url_for_data_file("tdf43175.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf43175.ods")):
- self.xUITest.executeCommand(".uno:TableSelectAll")
+ self.xUITest.executeCommand(".uno:TableSelectAll")
- self.ui_test.execute_dialog_through_command(".uno:Move")
- xDialog = self.xUITest.getTopFocusWindow()
- insertBefore = xDialog.getChild("insertBefore")
+ self.ui_test.execute_dialog_through_command(".uno:Move")
+ xDialog = self.xUITest.getTopFocusWindow()
+ insertBefore = xDialog.getChild("insertBefore")
- # Select - move to end position -
- xTreeEntry = insertBefore.getChild('2')
- xTreeEntry.executeAction("SELECT", tuple())
+ # Select - move to end position -
+ xTreeEntry = insertBefore.getChild('2')
+ xTreeEntry.executeAction("SELECT", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- aSheetNames = ['Blad1', 'Blad2', 'Blad1_2', 'Blad2_2']
+ aSheetNames = ['Blad1', 'Blad2', 'Blad1_2', 'Blad2_2']
- self.assertEqual(4, document.Sheets.getCount())
- for i in range(4):
- self.assertEqual(aSheetNames[i], document.Sheets[i].Name)
+ self.assertEqual(4, document.Sheets.getCount())
+ for i in range(4):
+ self.assertEqual(aSheetNames[i], document.Sheets[i].Name)
- xChart = document.Sheets[i].Charts[0]
- xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(1, len(xDataSeries))
+ xChart = document.Sheets[i].Charts[0]
+ xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual(1, len(xDataSeries))
- # Without the fix in place, this test would have failed with
- # AssertionError: '$Blad1_2.$A$1:$A$5' != '$Blad1.$A$1:$A$5'
- aExpectedRangeName = '$' + aSheetNames[i] + '.$A$1:$A$5'
- self.assertEqual(aExpectedRangeName, xDataSeries[0].DataSequences[0].Values.SourceRangeRepresentation)
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '$Blad1_2.$A$1:$A$5' != '$Blad1.$A$1:$A$5'
+ aExpectedRangeName = '$' + aSheetNames[i] + '.$A$1:$A$5'
+ self.assertEqual(aExpectedRangeName, xDataSeries[0].DataSequences[0].Values.SourceRangeRepresentation)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf62057.py b/sc/qa/uitest/chart/tdf62057.py
index dc67dd8db5a5..6cb1ef8cdd21 100644
--- a/sc/qa/uitest/chart/tdf62057.py
+++ b/sc/qa/uitest/chart/tdf62057.py
@@ -12,48 +12,46 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf62057(UITestCase):
def test_tdf62057(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62057.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf62057.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- xDataMatrix = []
- for column in range(1, 3):
- xColumn = []
- for row in range(0, 6):
- xColumn.append(round(get_cell_by_position(document, 0, column, row).getValue(), 5))
- xDataMatrix.append(xColumn)
-
- xRowDescriptions = []
- for row in range(0, 6):
- xRowDescriptions.append(get_cell_by_position(document, 0, 0, row).getString())
+ xDataMatrix = []
+ for column in range(1, 3):
+ xColumn = []
+ for row in range(0, 6):
+ xColumn.append(round(get_cell_by_position(document, 0, column, row).getValue(), 5))
+ xDataMatrix.append(xColumn)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ xRowDescriptions = []
+ for row in range(0, 6):
+ xRowDescriptions.append(get_cell_by_position(document, 0, 0, row).getString())
- self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:Copy")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.xUITest.executeCommand(".uno:Paste")
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ self.xUITest.executeCommand(".uno:Paste")
- xNewDataMatrix = []
- xNewDataMatrix.append([round(item[0], 5) for item in xData.Data])
- xNewDataMatrix.append([round(item[1], 5) for item in xData.Data])
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
- # Without the fix in place, this test would have failed with
- # AssertionError: Lists differ: ['10m', '11v', '12m', '13m', '14m', '15v'] != ['55.3796', '35.0989']
- self.assertEqual(xRowDescriptions, list(xData.RowDescriptions))
+ xNewDataMatrix = []
+ xNewDataMatrix.append([round(item[0], 5) for item in xData.Data])
+ xNewDataMatrix.append([round(item[1], 5) for item in xData.Data])
- self.assertEqual(xDataMatrix, xNewDataMatrix)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: Lists differ: ['10m', '11v', '12m', '13m', '14m', '15v'] != ['55.3796', '35.0989']
+ self.assertEqual(xRowDescriptions, list(xData.RowDescriptions))
- self.ui_test.close_doc()
+ self.assertEqual(xDataMatrix, xNewDataMatrix)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf62349.py b/sc/qa/uitest/chart/tdf62349.py
index 6c3e97760a8e..2c9d0d44fef1 100644
--- a/sc/qa/uitest/chart/tdf62349.py
+++ b/sc/qa/uitest/chart/tdf62349.py
@@ -15,29 +15,27 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf62349(UITestCase):
def test_tdf62349_crash_copy_chart_clipboard(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62349.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #3: select all data cells C5:H9
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C5:H9"}))
- # 4: create a chart with insert/chart menu
- self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
- xChartDlg = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf62349.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #3: select all data cells C5:H9
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C5:H9"}))
+ # 4: create a chart with insert/chart menu
+ self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
+ xChartDlg = self.xUITest.getTopFocusWindow()
- xOkBtn = xChartDlg.getChild("finish")
- self.ui_test.close_dialog_through_button(xOkBtn)
+ xOkBtn = xChartDlg.getChild("finish")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- # 5: (single) click to an empty cell to finalize the chart
- gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
- # 6: (single) click back inside the chart to select it
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- # 7: press CTRL-C
- self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:Paste")
- #check we didn't crash
- self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "group1")
-
- self.ui_test.close_doc()
+ # 5: (single) click to an empty cell to finalize the chart
+ gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
+ # 6: (single) click back inside the chart to select it
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ # 7: press CTRL-C
+ self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Paste")
+ #check we didn't crash
+ self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "group1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf93506_trendline.py b/sc/qa/uitest/chart/tdf93506_trendline.py
index 8efd880ccbb5..f528238bdd90 100644
--- a/sc/qa/uitest/chart/tdf93506_trendline.py
+++ b/sc/qa/uitest/chart/tdf93506_trendline.py
@@ -18,449 +18,448 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf93506(UITestCase):
def test_tdf93506_chart_trendline_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- change_measurement_unit(self, "Centimeter")
-
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- logarithmic.executeAction("CLICK", tuple())
- xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"}))
- extrapolateForward.executeAction("UP", tuple())
- extrapolateBackward.executeAction("UP", tuple())
- showEquation.executeAction("CLICK", tuple())
- showCorrelationCoefficient.executeAction("CLICK", tuple())
- xVarname.executeAction("CLEAR", tuple())
- xVarname.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
- yVarName.executeAction("CLEAR", tuple())
- yVarName.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"}))
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
-
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- xWidth.executeAction("UP", tuple())
- xTransparent.executeAction("UP", tuple())
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- self.assertEqual(get_state_as_dict(logarithmic)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
- self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
- self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
- self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
- self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
- self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Now change regression Type to Exponential
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- exponential.executeAction("CLICK", tuple()) #set exponential
- #set Force intercept
- setIntercept.executeAction("CLICK", tuple())
- interceptValue.executeAction("UP", tuple())
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Exponential
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- self.assertEqual(get_state_as_dict(exponential)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
- self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
- self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
- self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
- self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
- self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
- self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
- self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Now change regression Type to Power
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- power.executeAction("CLICK", tuple()) #set power
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Power
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- self.assertEqual(get_state_as_dict(power)["Checked"], "true")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
- self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
- self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
- self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
- # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
- # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
- self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
- self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Now change regression Type to Polynomial
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- polynomial = xDialog.getChild("polynomial") #type regression polynomial
- degree = xDialog.getChild("degree")
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- polynomial.executeAction("CLICK", tuple()) #set polynomial
- degree.executeAction("UP", tuple())
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Polynomial
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- polynomial = xDialog.getChild("polynomial") #type regression polynomial
- degree = xDialog.getChild("degree")
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- self.assertEqual(get_state_as_dict(polynomial)["Checked"], "true")
- self.assertEqual(get_state_as_dict(degree)["Text"], "3")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
- self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
- self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
- self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
- self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
- self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
- self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
- self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
- self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #Now change regression Type to Moving average
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- movingAverage = xDialog.getChild("movingAverage") #type regression Moving average
- movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type
- period = xDialog.getChild("period")
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- movingAverage.executeAction("CLICK", tuple()) #set polynomial
- select_by_text(movingAverageType, "Averaged Abscissa")
- period.executeAction("UP", tuple())
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #reopen and verify Moving average
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Type".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
- exponential = xDialog.getChild("exponential") #type regression exponential
- power = xDialog.getChild("exponential") #type regression power
- polynomial = xDialog.getChild("polynomial") #type regression polynomial
- movingAverage = xDialog.getChild("movingAverage") #type regression Moving average
- movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type
- degree = xDialog.getChild("degree")
- period = xDialog.getChild("period")
- xentryname = xDialog.getChild("entry_name") #add name
- extrapolateForward = xDialog.getChild("extrapolateForward")
- extrapolateBackward = xDialog.getChild("extrapolateBackward")
- setIntercept = xDialog.getChild("setIntercept")
- interceptValue = xDialog.getChild("interceptValue")
- showEquation = xDialog.getChild("showEquation")
- showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
- xVarname = xDialog.getChild("entry_Xname")
- yVarName = xDialog.getChild("entry_Yname")
-
- self.assertEqual(get_state_as_dict(movingAverage)["Checked"], "true")
- self.assertEqual(get_state_as_dict(movingAverageType)["SelectEntryText"], "Averaged Abscissa")
- self.assertEqual(get_state_as_dict(period)["Text"], "3")
- self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
-
- #Click on tab "Line".
- select_pos(tabcontrol, "1")
- xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
- xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
-
- self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
- self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ change_measurement_unit(self, "Centimeter")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ logarithmic.executeAction("CLICK", tuple())
+ xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"}))
+ extrapolateForward.executeAction("UP", tuple())
+ extrapolateBackward.executeAction("UP", tuple())
+ showEquation.executeAction("CLICK", tuple())
+ showCorrelationCoefficient.executeAction("CLICK", tuple())
+ xVarname.executeAction("CLEAR", tuple())
+ xVarname.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ yVarName.executeAction("CLEAR", tuple())
+ yVarName.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"}))
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ xTransparent.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ self.assertEqual(get_state_as_dict(logarithmic)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
+ self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
+ self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Now change regression Type to Exponential
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ exponential.executeAction("CLICK", tuple()) #set exponential
+ #set Force intercept
+ setIntercept.executeAction("CLICK", tuple())
+ interceptValue.executeAction("UP", tuple())
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Exponential
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ self.assertEqual(get_state_as_dict(exponential)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
+ self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
+ self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Now change regression Type to Power
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ power.executeAction("CLICK", tuple()) #set power
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Power
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ self.assertEqual(get_state_as_dict(power)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
+ self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
+ # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
+ # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
+ self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Now change regression Type to Polynomial
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ polynomial = xDialog.getChild("polynomial") #type regression polynomial
+ degree = xDialog.getChild("degree")
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ polynomial.executeAction("CLICK", tuple()) #set polynomial
+ degree.executeAction("UP", tuple())
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Polynomial
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ polynomial = xDialog.getChild("polynomial") #type regression polynomial
+ degree = xDialog.getChild("degree")
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ self.assertEqual(get_state_as_dict(polynomial)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(degree)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
+ self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1")
+ self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xVarname)["Text"], "a")
+ self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Now change regression Type to Moving average
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ movingAverage = xDialog.getChild("movingAverage") #type regression Moving average
+ movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type
+ period = xDialog.getChild("period")
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ movingAverage.executeAction("CLICK", tuple()) #set polynomial
+ select_by_text(movingAverageType, "Averaged Abscissa")
+ period.executeAction("UP", tuple())
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #reopen and verify Moving average
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Type".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic
+ exponential = xDialog.getChild("exponential") #type regression exponential
+ power = xDialog.getChild("exponential") #type regression power
+ polynomial = xDialog.getChild("polynomial") #type regression polynomial
+ movingAverage = xDialog.getChild("movingAverage") #type regression Moving average
+ movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type
+ degree = xDialog.getChild("degree")
+ period = xDialog.getChild("period")
+ xentryname = xDialog.getChild("entry_name") #add name
+ extrapolateForward = xDialog.getChild("extrapolateForward")
+ extrapolateBackward = xDialog.getChild("extrapolateBackward")
+ setIntercept = xDialog.getChild("setIntercept")
+ interceptValue = xDialog.getChild("interceptValue")
+ showEquation = xDialog.getChild("showEquation")
+ showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient")
+ xVarname = xDialog.getChild("entry_Xname")
+ yVarName = xDialog.getChild("entry_Yname")
+
+ self.assertEqual(get_state_as_dict(movingAverage)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(movingAverageType)["SelectEntryText"], "Averaged Abscissa")
+ self.assertEqual(get_state_as_dict(period)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name")
+
+ #Click on tab "Line".
+ select_pos(tabcontrol, "1")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%")
+
+ 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/chart/tdf96432.py b/sc/qa/uitest/chart/tdf96432.py
index 28b3015f37ab..6d8a5e4c2f91 100644
--- a/sc/qa/uitest/chart/tdf96432.py
+++ b/sc/qa/uitest/chart/tdf96432.py
@@ -13,65 +13,64 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf96432(UITestCase):
def test_tdf96432_chart_crash_transparency_error_bar_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96432.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf96432.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(0, xDataSeries[0].ErrorBarY.LineTransparence)
+ document = self.ui_test.get_component()
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual(0, xDataSeries[0].ErrorBarY.LineTransparence)
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- #Right-click on the chart; from the pop-up menu select "Format Y bars
- # The program presents dialog "Format Y bars", tab "Line".
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Line".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one
- xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
- xTransparency.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #Right-click on the chart; from the pop-up menu select "Format Y bars
+ # The program presents dialog "Format Y bars", tab "Line".
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Line".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one
+ xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+ xTransparency.executeAction("UP", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #verify - we didn't crash
- gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
+ #verify - we didn't crash
+ gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(5, xDataSeries[0].ErrorBarY.LineTransparence)
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual(5, xDataSeries[0].ErrorBarY.LineTransparence)
- #reopen and try again
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
+ #reopen and try again
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- #Right-click on the chart; from the pop-up menu select "Format Y bars
- # The program presents dialog "Format Y bars", tab "Line".
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
- xDialog = self.xUITest.getTopFocusWindow()
- #Click on tab "Line".
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
- #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one
- xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
- self.assertEqual(get_state_as_dict(xTransparency)["Text"][0], "5")
- xTransparency.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #Right-click on the chart; from the pop-up menu select "Format Y bars
+ # The program presents dialog "Format Y bars", tab "Line".
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"}))
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Click on tab "Line".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one
+ xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+ self.assertEqual(get_state_as_dict(xTransparency)["Text"][0], "5")
+ xTransparency.executeAction("UP", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #verify - we didn't crash
- gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
+ #verify - we didn't crash
+ gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
- xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
- self.assertEqual(10, xDataSeries[0].ErrorBarY.LineTransparence)
+ xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries
+ self.assertEqual(10, xDataSeries[0].ErrorBarY.LineTransparence)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf98690.py b/sc/qa/uitest/chart/tdf98690.py
index 4ea448c1d0d9..f99009206bb4 100644
--- a/sc/qa/uitest/chart/tdf98690.py
+++ b/sc/qa/uitest/chart/tdf98690.py
@@ -11,35 +11,33 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf98690(UITestCase):
def test_tdf98690(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98690.xlsx"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ with self.ui_test.load_file(get_url_for_data_file("tdf98690.xlsx")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Chart 2"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Chart 2"}))
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- self.xUITest.executeCommand(".uno:CloseDoc")
+ self.xUITest.executeCommand(".uno:CloseDoc")
- self.ui_test.create_doc_in_start_center("calc")
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
- aExpectedRowDescriptions = tuple(str(i) for i in range(1, 14))
- aExpectedColumnDescriptions = ('Column D Column D', 'cc_girder2', 'Column S Column S',
- 'Column S Column S', 'Column D Column D', 'clexrfdon', 'Column S Column S',
- 'Column S Column S', 'Column D', 'clexrfdoff', 'Column S Column S', 'Column S Column S')
+ aExpectedRowDescriptions = tuple(str(i) for i in range(1, 14))
+ aExpectedColumnDescriptions = ('Column D Column D', 'cc_girder2', 'Column S Column S',
+ 'Column S Column S', 'Column D Column D', 'clexrfdon', 'Column S Column S',
+ 'Column S Column S', 'Column D', 'clexrfdoff', 'Column S Column S', 'Column S Column S')
- # Without the fix in place, this test would have failed here,
- # since the pasted chart wouldn't have had any data
- self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
- self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed here,
+ # since the pasted chart wouldn't have had any data
+ self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
+ self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/chart/tdf99069.py b/sc/qa/uitest/chart/tdf99069.py
index bca0d532ffa6..e8d805d82355 100644
--- a/sc/qa/uitest/chart/tdf99069.py
+++ b/sc/qa/uitest/chart/tdf99069.py
@@ -15,56 +15,55 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf99069(UITestCase):
def test_tdf99069_chart_cancel_data_ranges_dialog(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99069.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #(1) Download and open example.ods attached to tdf#97266 with cell B1 active.
- #(2) In tool bar, click the chart icon. Program presents Chart Wizard.
- self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
- xDialog = self.xUITest.getTopFocusWindow()
- #(3) In Chart Wizard, click <Finish>. The program closes the wizard;
- # the chart shows a border with handles on each side and at each corner.
- xFinishBtn = xDialog.getChild("finish")
- self.ui_test.close_dialog_through_button(xFinishBtn)
- for _ in range(0,5):
- #(4) Click outside the chart, for example in cell C23. The borders
- #disappear from the chart and the program restores the menubar to
- #the window. (Yes, this step is necessary to the crash.)
- gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C23"}))
- #(5) Double-click on the chart. The program shows a border around the
- # chart. (It may be necessary to do this a second time before the
- # pop-up menu will offer "Data Ranges...".
- gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
- gridwin.executeAction("ACTIVATE", tuple())
- xChartMainTop = self.xUITest.getTopFocusWindow()
- xChartMain = xChartMainTop.getChild("chart_window")
-
- #(6) Right-click on the chart; from the pop-up menu select "Data
- # Ranges...". The program presents dialog "Data Ranges", tab "Data Range".
- xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
- self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"}))
+ with self.ui_test.load_file(get_url_for_data_file("tdf99069.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #(1) Download and open example.ods attached to tdf#97266 with cell B1 active.
+ #(2) In tool bar, click the chart icon. Program presents Chart Wizard.
+ self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart")
xDialog = self.xUITest.getTopFocusWindow()
+ #(3) In Chart Wizard, click <Finish>. The program closes the wizard;
+ # the chart shows a border with handles on each side and at each corner.
+ xFinishBtn = xDialog.getChild("finish")
+ self.ui_test.close_dialog_through_button(xFinishBtn)
+ for _ in range(0,5):
+ #(4) Click outside the chart, for example in cell C23. The borders
+ #disappear from the chart and the program restores the menubar to
+ #the window. (Yes, this step is necessary to the crash.)
+ gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C23"}))
+ #(5) Double-click on the chart. The program shows a border around the
+ # chart. (It may be necessary to do this a second time before the
+ # pop-up menu will offer "Data Ranges...".
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+ gridwin.executeAction("ACTIVATE", tuple())
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
- #(7) Click on tab "Data Series". (Actually, tab "Data Range" crashes,
- # too. This step is just a remnant of what I was doing when I
- # stumbled over the bug.)
- notebook = xDialog.getChild("tabcontrol")
- select_pos(notebook, "0")
- select_pos(notebook, "1")
+ #(6) Right-click on the chart; from the pop-up menu select "Data
+ # Ranges...". The program presents dialog "Data Ranges", tab "Data Range".
+ xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
+ self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"}))
+ xDialog = self.xUITest.getTopFocusWindow()
- #(8) Click <Cancel>. In the versions that I deemed bad while
- # bibisecting, the program crashed here five times out of seven.
- # The other two attempts, both on daily bibisect version 2016-02-18,
- # crashed after I closed the Data Ranges dialog an additional three
- # times, one of those times using by typing <Esc>.
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ #(7) Click on tab "Data Series". (Actually, tab "Data Range" crashes,
+ # too. This step is just a remnant of what I was doing when I
+ # stumbled over the bug.)
+ notebook = xDialog.getChild("tabcontrol")
+ select_pos(notebook, "0")
+ select_pos(notebook, "1")
- #verify - we didn't crash
- gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 0.529084)
+ #(8) Click <Cancel>. In the versions that I deemed bad while
+ # bibisecting, the program crashed here five times out of seven.
+ # The other two attempts, both on daily bibisect version 2016-02-18,
+ # crashed after I closed the Data Ranges dialog an additional three
+ # times, one of those times using by typing <Esc>.
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ #verify - we didn't crash
+ gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 0.529084)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py
index 36b243008deb..516090076ec8 100644
--- a/sc/qa/uitest/conditional_format/tdf100793.py
+++ b/sc/qa/uitest/conditional_format/tdf100793.py
@@ -15,83 +15,81 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf100793(UITestCase):
def test_tdf100793(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf100793.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- sheet = get_sheet_from_doc(calc_doc, 2)
- conditional_format_list = get_conditional_format_from_sheet(sheet)
- self.assertEqual(conditional_format_list.getLength(), 1)
- #2) Go to sheet "plan"
- gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"}))
- #3) Open the conditional formatting management dialog-> The indicated range should be G18:K29,F18,F20:F29
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
-
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check that we have exactly one conditional formats in the beginning
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '1')
-
- #3) Click Edit & try to change to intended one, F18:K33
- xEditBtn = xCondFormatMgr.getChild("edit")
- self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
- xCondFormatDlg = self.xUITest.getTopFocusWindow()
-
- #modify textbox
- xedassign = xCondFormatDlg.getChild("edassign")
- #go at the beginning
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
- # 11x right
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
- #now I'm at F18 - write :K33
- xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"}))
-
- xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
-
- # we need to get a pointer again as the old window has been deleted
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check again that we still have 1 entry in the list
- # and still only 1 conditional format in the document
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '1')
-
- self.assertEqual(conditional_format_list.getLength(), 1)
-
- # close the conditional format manager
- xOKBtn = xCondFormatMgr.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #verify - reopen, check range
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
- xEditBtn = xCondFormatMgr.getChild("edit")
- self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
- xCondFormatDlg = self.xUITest.getTopFocusWindow()
- xedassign = xCondFormatDlg.getChild("edassign")
- self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29")
- xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
- xCancelBtn = xCondFormatMgr.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf100793.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ sheet = get_sheet_from_doc(calc_doc, 2)
+ conditional_format_list = get_conditional_format_from_sheet(sheet)
+ self.assertEqual(conditional_format_list.getLength(), 1)
+ #2) Go to sheet "plan"
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"}))
+ #3) Open the conditional formatting management dialog-> The indicated range should be G18:K29,F18,F20:F29
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly one conditional formats in the beginning
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ #3) Click Edit & try to change to intended one, F18:K33
+ xEditBtn = xCondFormatMgr.getChild("edit")
+ self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
+ xCondFormatDlg = self.xUITest.getTopFocusWindow()
+
+ #modify textbox
+ xedassign = xCondFormatDlg.getChild("edassign")
+ #go at the beginning
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
+ # 11x right
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ #now I'm at F18 - write :K33
+ xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"}))
+
+ xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
+
+ # we need to get a pointer again as the old window has been deleted
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check again that we still have 1 entry in the list
+ # and still only 1 conditional format in the document
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ self.assertEqual(conditional_format_list.getLength(), 1)
+
+ # close the conditional format manager
+ xOKBtn = xCondFormatMgr.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #verify - reopen, check range
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+ xEditBtn = xCondFormatMgr.getChild("edit")
+ self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
+ xCondFormatDlg = self.xUITest.getTopFocusWindow()
+ xedassign = xCondFormatDlg.getChild("edassign")
+ self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29")
+ xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xCondFormatMgr.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf104026.py b/sc/qa/uitest/conditional_format/tdf104026.py
index 5aa6a1ff8b6f..45c2b9dea665 100644
--- a/sc/qa/uitest/conditional_format/tdf104026.py
+++ b/sc/qa/uitest/conditional_format/tdf104026.py
@@ -29,20 +29,18 @@ class Tdf104026(UITestCase):
self.ui_test.close_dialog_through_button(xOKBtn)
def test_tdf104026(self):
- self.ui_test.load_file(get_url_for_data_file("tdf104026.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf104026.ods")):
- self.execute_conditional_format_manager_dialog(6)
+ self.execute_conditional_format_manager_dialog(6)
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
- self.xUITest.executeCommand(".uno:DeleteRows")
+ self.xUITest.executeCommand(".uno:DeleteRows")
- # Without the fix in place, this test would have failed with
- # AssertionError: 'A2\tCell value != $Sheet1.$B2' != 'A2\tCell value != $Sheet1.$B#REF!'
- self.execute_conditional_format_manager_dialog(5)
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'A2\tCell value != $Sheet1.$B2' != 'A2\tCell value != $Sheet1.$B#REF!'
+ self.execute_conditional_format_manager_dialog(5)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf105544.py b/sc/qa/uitest/conditional_format/tdf105544.py
index b15f094004a4..0099ed682ac7 100644
--- a/sc/qa/uitest/conditional_format/tdf105544.py
+++ b/sc/qa/uitest/conditional_format/tdf105544.py
@@ -15,41 +15,39 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf105544(UITestCase):
def test_tdf105544_Manage_Conditional_Formatting_edit_condition(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105544.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #2. select B3. Format> conditional formatting> manage
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check that we have exactly four conditional formats in the beginning
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '4')
-
- #select B3:B37 range and click edit, then click yes
- xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list
- xEditBtn = xCondFormatMgr.getChild("edit")
- self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
- xCondFormatDlg = self.xUITest.getTopFocusWindow()
-
- xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
-
- # we need to get a pointer again as the old window has been deleted
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
-
- # check again that we still have 4 entry in the list
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '4')
-
- # close the conditional format manager
- xOKBtn = xCondFormatMgr.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf105544.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #2. select B3. Format> conditional formatting> manage
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly four conditional formats in the beginning
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '4')
+
+ #select B3:B37 range and click edit, then click yes
+ xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list
+ xEditBtn = xCondFormatMgr.getChild("edit")
+ self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible")
+ xCondFormatDlg = self.xUITest.getTopFocusWindow()
+
+ xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
+
+ # we need to get a pointer again as the old window has been deleted
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check again that we still have 4 entry in the list
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '4')
+
+ # close the conditional format manager
+ xOKBtn = xCondFormatMgr.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/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py
index 67146bcdf20a..bec007993e6c 100644
--- a/sc/qa/uitest/conditional_format/tdf117899.py
+++ b/sc/qa/uitest/conditional_format/tdf117899.py
@@ -28,50 +28,47 @@ class Tdf117899(UITestCase):
self.ui_test.close_dialog_through_button(xOKBtn)
def test_tdf117899(self):
- self.ui_test.load_file(get_url_for_data_file("tdf117899.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf117899.ods")):
- self.execute_conditional_format_manager_dialog()
+ self.execute_conditional_format_manager_dialog()
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
+ self.xUITest.executeCommand(".uno:Copy")
- # Close the Calc document
- self.xUITest.executeCommand(".uno:CloseDoc")
+ # Close the Calc document
+ self.xUITest.executeCommand(".uno:CloseDoc")
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, "tdf117899-temp.ods")
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf117899-temp.ods")
- self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.create_doc_in_start_center("writer")
- # Paste as an OLE spreadsheet
- formatProperty = mkPropertyValues({"SelectedFormat": 85})
- self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+ # Paste as an OLE spreadsheet
+ formatProperty = mkPropertyValues({"SelectedFormat": 85})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
- # Save Copy as
- self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8")
- xDialog = self.xUITest.getTopFocusWindow()
+ # Save Copy as
+ self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8")
+ xDialog = self.xUITest.getTopFocusWindow()
- xFileName = xDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ xFileName = xDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
- xOpenBtn = xDialog.getChild("open")
- self.ui_test.close_dialog_through_button(xOpenBtn)
+ xOpenBtn = xDialog.getChild("open")
+ self.ui_test.close_dialog_through_button(xOpenBtn)
- # Close the Writer document
- self.ui_test.close_doc()
+ # Close the Writer document
+ self.ui_test.close_doc()
- self.ui_test.load_file(systemPathToFileUrl(xFilePath))
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
- # Without the fix in place, this test would have failed here
- self.execute_conditional_format_manager_dialog()
-
- # Close the Calc document
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed here
+ self.execute_conditional_format_manager_dialog()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf118206.py b/sc/qa/uitest/conditional_format/tdf118206.py
index 70e51a6c880c..679e76dcb879 100644
--- a/sc/qa/uitest/conditional_format/tdf118206.py
+++ b/sc/qa/uitest/conditional_format/tdf118206.py
@@ -14,30 +14,29 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
#Bug 118206 - [GTK3] Calc hangs copying/cutting a conditional format column
class tdf118206(UITestCase):
def test_tdf118206(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- self.xUITest.executeCommand(".uno:SelectColumn")
- self.xUITest.executeCommand(".uno:Copy")
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
- self.xUITest.executeCommand(".uno:SelectColumn")
- self.xUITest.executeCommand(".uno:Paste")
+ with self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+ self.xUITest.executeCommand(".uno:Paste")
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "On Back Order")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "On Back Order")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1)
- #Undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "On Back Order")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "")
- self.assertEqual(get_cell_by_position(document, 0, 1, 7).getString(), "")
- self.ui_test.close_doc()
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "On Back Order")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 7).getString(), "")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf81696.py b/sc/qa/uitest/conditional_format/tdf81696.py
index 92717c57db60..a57d91a70479 100644
--- a/sc/qa/uitest/conditional_format/tdf81696.py
+++ b/sc/qa/uitest/conditional_format/tdf81696.py
@@ -18,28 +18,27 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf81696(UITestCase):
def test_tdf81696_sort_cell_conditional_formatting(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81696.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf81696.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"}))
- #Open sort dialog by DATA - SORT,Just sort it by Column A, ascending. (it's default)
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- xleftright = xDialog.getChild("leftright")
- select_pos(xTabs, "0")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"}))
+ #Open sort dialog by DATA - SORT,Just sort it by Column A, ascending. (it's default)
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ xleftright = xDialog.getChild("leftright")
+ select_pos(xTabs, "0")
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1)
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1)
- self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py
index 44ef9243a792..c20cf15c2393 100644
--- a/sc/qa/uitest/conditional_format/tdf96453.py
+++ b/sc/qa/uitest/conditional_format/tdf96453.py
@@ -14,55 +14,53 @@ class ConditionalFormatDlgTest(UITestCase):
def test_tdf96453(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) as calc_doc:
- sheet = get_sheet_from_doc(calc_doc, 0)
- conditional_format_list = get_conditional_format_from_sheet(sheet)
- self.assertEqual(conditional_format_list.getLength(), 2)
+ sheet = get_sheet_from_doc(calc_doc, 0)
+ conditional_format_list = get_conditional_format_from_sheet(sheet)
+ self.assertEqual(conditional_format_list.getLength(), 2)
- self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
- # check that we have exactly two conditional formats in the beginning
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '2')
+ # check that we have exactly two conditional formats in the beginning
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '2')
- # remove one conditional format
- xRemoveBtn = xCondFormatMgr.getChild("remove")
- xRemoveBtn.executeAction("CLICK", tuple())
+ # remove one conditional format
+ xRemoveBtn = xCondFormatMgr.getChild("remove")
+ xRemoveBtn.executeAction("CLICK", tuple())
- # check that the table only shows one
- # but the document still contains two
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '1')
+ # check that the table only shows one
+ # but the document still contains two
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
- self.assertEqual(conditional_format_list.getLength(), 2)
+ self.assertEqual(conditional_format_list.getLength(), 2)
- # add a new conditional format through the add button
- xAddBtn = xCondFormatMgr.getChild("add")
- self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible")
+ # add a new conditional format through the add button
+ xAddBtn = xCondFormatMgr.getChild("add")
+ self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible")
- xCondFormatDlg = self.xUITest.getTopFocusWindow()
- xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
+ xCondFormatDlg = self.xUITest.getTopFocusWindow()
+ xCondFormatOkBtn = xCondFormatDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xCondFormatOkBtn)
- # we need to get a pointer again as the old window has been deleted
- xCondFormatMgr = self.xUITest.getTopFocusWindow()
+ # we need to get a pointer again as the old window has been deleted
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
- # check again that we now have 2 and not 3 entries in the list
- # and still only 2 conditional formats in the document
- xList = xCondFormatMgr.getChild("CONTAINER")
- list_state = get_state_as_dict(xList)
- self.assertEqual(list_state['Children'], '2')
+ # check again that we now have 2 and not 3 entries in the list
+ # and still only 2 conditional formats in the document
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '2')
- self.assertEqual(conditional_format_list.getLength(), 2)
+ self.assertEqual(conditional_format_list.getLength(), 2)
- # close the conditional format manager
- xCancelBtn = xCondFormatMgr.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ # close the conditional format manager
+ xCancelBtn = xCondFormatMgr.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 0ef068a90a2b..478db9cc1fdd 100644
--- a/sc/qa/uitest/function_wizard/tdf123479.py
+++ b/sc/qa/uitest/function_wizard/tdf123479.py
@@ -19,28 +19,27 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf123479(UITestCase):
def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self):
#numberingformatpage.ui
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123479.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #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.load_file(get_url_for_data_file("tdf123479.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #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")
- #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(document, 0, 1, 0).getString(), "Pass/Fail")
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #verify; no crashes
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Pass/Fail")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/goalSeek/goalSeek.py b/sc/qa/uitest/goalSeek/goalSeek.py
index f17377c5b505..7bbb35a78b0e 100644
--- a/sc/qa/uitest/goalSeek/goalSeek.py
+++ b/sc/qa/uitest/goalSeek/goalSeek.py
@@ -13,26 +13,25 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class goalSeek(UITestCase):
def test_goalSeek(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("goalSeek.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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.load_file(get_url_for_data_file("goalSeek.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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_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(document, 0, 1, 0).getValue(), 200000)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 15000)
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 200000)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 15000)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/goalSeek/tdf37341.py b/sc/qa/uitest/goalSeek/tdf37341.py
index 117949fb44b1..7248e6b39218 100644
--- a/sc/qa/uitest/goalSeek/tdf37341.py
+++ b/sc/qa/uitest/goalSeek/tdf37341.py
@@ -15,25 +15,24 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf37341(UITestCase):
def test_tdf37341_goalSeek(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf37341.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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.load_file(get_url_for_data_file("tdf37341.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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_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(document, 0, 4, 6).getValue() > 0, True)
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue() > 0, True)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py
index 07e4ece7ab1a..43bce6da86bd 100644
--- a/sc/qa/uitest/goalSeek/tdf43693.py
+++ b/sc/qa/uitest/goalSeek/tdf43693.py
@@ -15,25 +15,24 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf43693(UITestCase):
def test_tdf43693_goalSeek(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf43693.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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.load_file(get_url_for_data_file("tdf43693.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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_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(document, 0, 7, 4).getValue(), 0.04)
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0.04)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/key_f4/tdf102525.py b/sc/qa/uitest/key_f4/tdf102525.py
index 7976827a44ae..9681d2be87ab 100644
--- a/sc/qa/uitest/key_f4/tdf102525.py
+++ b/sc/qa/uitest/key_f4/tdf102525.py
@@ -13,27 +13,25 @@ from libreoffice.calc.document import get_cell_by_position
class tdf102525(UITestCase):
def test_tdf102525_F4_key_array_formula(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf102525.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf102525.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #select B1:B4
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"}))
- #F4
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"}))
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF($A$1:$A$4>2;1;2)}")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1)
- #Undo
- self.xUITest.executeCommand(".uno:Undo")
- #verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF(A1:A4>2;1;2)}")
-
- self.ui_test.close_doc()
+ #select B1:B4
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"}))
+ #F4
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"}))
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF($A$1:$A$4>2;1;2)}")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1)
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF(A1:A4>2;1;2)}")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/manual_tests/calc.py b/sc/qa/uitest/manual_tests/calc.py
index 88cc750ca834..247f7028e2ae 100644
--- a/sc/qa/uitest/manual_tests/calc.py
+++ b/sc/qa/uitest/manual_tests/calc.py
@@ -168,22 +168,20 @@ class ManualCalcTests(UITestCase):
# http://manual-test.libreoffice.org/manage/case/151/
def test_cell_recalc(self):
- doc = self.ui_test.load_file(get_url_for_data_file("cell_recalc.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("cell_recalc.ods")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:D9"}))
- self.xUITest.executeCommand(".uno:Cut")
-
- self.assertEqual(get_cell_by_position(doc, 0, 3, 15).getValue(), 0)
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:D9"}))
+ self.xUITest.executeCommand(".uno:Cut")
- self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(doc, 0, 3, 15).getValue(), 0)
- for i in range(1, 9):
- self.assertTrue(get_cell_by_position(doc, 0, 3, i).getValue() != 0)
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(doc, 0, 3, 15).getValue(), 195)
+ for i in range(1, 9):
+ self.assertTrue(get_cell_by_position(doc, 0, 3, i).getValue() != 0)
- self.ui_test.close_doc()
+ self.assertEqual(get_cell_by_position(doc, 0, 3, 15).getValue(), 195)
# http://manual-test.libreoffice.org/manage/case/143/
def test_random_numbers(self):
diff --git a/sc/qa/uitest/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py
index 61d53fd4187b..df3fae824162 100644
--- a/sc/qa/uitest/pageFormat/tdf123508.py
+++ b/sc/qa/uitest/pageFormat/tdf123508.py
@@ -16,42 +16,41 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf123508(UITestCase):
def test_tdf123508_format_page_scale(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123508.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #open "Format > Page - Sheet > Scale
- self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "6") #tab Scale
- scalingMode = xDialog.getChild("comboLB_SCALEMODE")
- spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
- spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
- #select "Fit print range(s) to width/height" from the scale mode drop-down list
- select_by_text(scalingMode, "Fit print range(s) to width/height")
- #define a value for the page, e.g.: width 2; height 2
- spinEDSCALEPAGEWIDTH.executeAction("UP", tuple())
- spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple())
+ with self.ui_test.load_file(get_url_for_data_file("tdf123508.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #open "Format > Page - Sheet > Scale
+ self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6") #tab Scale
+ scalingMode = xDialog.getChild("comboLB_SCALEMODE")
+ spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
+ spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
+ #select "Fit print range(s) to width/height" from the scale mode drop-down list
+ select_by_text(scalingMode, "Fit print range(s) to width/height")
+ #define a value for the page, e.g.: width 2; height 2
+ spinEDSCALEPAGEWIDTH.executeAction("UP", tuple())
+ spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "6") #tab Scale
- scalingMode = xDialog.getChild("comboLB_SCALEMODE")
- spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
- spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
+ #verify
+ self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6") #tab Scale
+ scalingMode = xDialog.getChild("comboLB_SCALEMODE")
+ spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH")
+ spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT")
- self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height")
- self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2")
- self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2")
+ self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height")
+ self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2")
+ self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2")
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py
index 0adc2a3cb6bc..99495123fe14 100644
--- a/sc/qa/uitest/range_name/tdf119954.py
+++ b/sc/qa/uitest/range_name/tdf119954.py
@@ -16,66 +16,65 @@ from uitest.uihelper.keyboard import select_all
class tdf119954(UITestCase):
def test_tdf119954_second_db_range(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119954.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #* new document
- #* in A1 enter 1
- #* in C3 enter 2
- #* on A1 define a database range 'aaa' with $Sheet1.$A$1
- #* on C3 define a database range 'bbb' with $Sheet2.$C$3
- #* in any cell enter formula =bbb
- # => result is 1 instead of 2
- #* place cell cursor on that formula cell again
- # => see that the formula is =aaa instead of =bbb
+ with self.ui_test.load_file(get_url_for_data_file("tdf119954.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #* new document
+ #* in A1 enter 1
+ #* in C3 enter 2
+ #* on A1 define a database range 'aaa' with $Sheet1.$A$1
+ #* on C3 define a database range 'bbb' with $Sheet2.$C$3
+ #* in any cell enter formula =bbb
+ # => result is 1 instead of 2
+ #* place cell cursor on that formula cell again
+ # => 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()
+ 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)
+ 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)
- 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())
+ 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)
+ xOkBtn = xDefineNameDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
- enter_text_to_cell(gridwin, "B2", "=bbb")
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ enter_text_to_cell(gridwin, "B2", "=bbb")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- enter_text_to_cell(gridwin, "C2", "=aaa")
- gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 1)
+ enter_text_to_cell(gridwin, "C2", "=aaa")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 1)
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0)
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getFormula(), "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "")
+ self.assertEqual(get_cell_by_position(document, 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)
+ # 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)
- self.ui_test.close_doc()
# 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 867482fbeaea..2a6d2a3cd424 100644
--- a/sc/qa/uitest/search_replace/replace.py
+++ b/sc/qa/uitest/search_replace/replace.py
@@ -12,48 +12,47 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class ReplaceTest(UITestCase):
def test_tdf106194(self):
- doc = self.ui_test.load_file(get_url_for_data_file("tdf106194.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")) as doc:
- xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xSearchDlg = self.xUITest.getTopFocusWindow()
+ 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")
+ xCloseBtn = xSearchDlg.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ self.ui_test.close_dialog_through_button(xCloseBtn)
- self.ui_test.close_doc()
diff --git a/sc/qa/uitest/search_replace/tdf132783.py b/sc/qa/uitest/search_replace/tdf132783.py
index 372b3ddb0f5f..5795a5afcf2c 100644
--- a/sc/qa/uitest/search_replace/tdf132783.py
+++ b/sc/qa/uitest/search_replace/tdf132783.py
@@ -11,25 +11,23 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf132783(UITestCase):
def test_tdf132783(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf132783.ods"))
+ 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")
+ for i in range(5):
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ 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)
+ 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")
- self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], str( 96 + i))
-
- self.ui_test.close_doc()
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1")
+ self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], str( 96 + i))
# 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 994bcd21a89d..335d985eadcb 100644
--- a/sc/qa/uitest/search_replace/tdf35020.py
+++ b/sc/qa/uitest/search_replace/tdf35020.py
@@ -16,34 +16,33 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf35020(UITestCase):
def test_tdf39959_find_replace_all_sheets(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35020.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf35020.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- 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)
+ 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)
- #verify Sheet1.A13 A14 = 2
- self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 2)
- #Undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 1)
- self.ui_test.close_doc()
+ #verify Sheet1.A13 A14 = 2
+ self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 2)
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf39959.py b/sc/qa/uitest/search_replace/tdf39959.py
index b743c4a90f0f..3c05533bc540 100644
--- a/sc/qa/uitest/search_replace/tdf39959.py
+++ b/sc/qa/uitest/search_replace/tdf39959.py
@@ -15,38 +15,37 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf39959(UITestCase):
def test_tdf39959_find_replace_all_sheets(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf39959.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf39959.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- # 1. Open a new document
- # 2. Enter "asdf" in A1
- # 3. Activate Sheet2
- # 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
+ # 1. Open a new document
+ # 2. Enter "asdf" in A1
+ # 3. Activate Sheet2
+ # 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)
+ 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)
- #verify Sheet2.A1 = "bbb"
- self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "bbb ")
- self.assertEqual(get_cell_by_position(document, 1, 0, 2).getString(), "abc")
- #Undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "asdf ")
- self.ui_test.close_doc()
+ #verify Sheet2.A1 = "bbb"
+ self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "bbb ")
+ self.assertEqual(get_cell_by_position(document, 1, 0, 2).getString(), "abc")
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "asdf ")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/search_replace/tdf44861.py b/sc/qa/uitest/search_replace/tdf44861.py
index 1df8e8e6b012..37947ff9d3de 100644
--- a/sc/qa/uitest/search_replace/tdf44861.py
+++ b/sc/qa/uitest/search_replace/tdf44861.py
@@ -15,39 +15,37 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class tdf44861(UITestCase):
def test_tdf44861_find_replaceAll_regexp(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf44861.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- # 2. ctrl-h, in dialog
- # Search: ([0-9]{2})([0-9]{2})
- # Replace: $1.$2
- # check option "Enable regular expressions"
- # Press "Replace all"
+ with self.ui_test.load_file(get_url_for_data_file("tdf44861.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ # 2. ctrl-h, in dialog
+ # Search: ([0-9]{2})([0-9]{2})
+ # Replace: $1.$2
+ # 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)
+ 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)
- #Expected: instead of 1345-1430 appears 13.45-14.30
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "13.45-14.30")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "13.45-14.30")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "14.50-15.30")
- self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "12.55-13.35")
- self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "12.30-13.40")
-
- self.ui_test.close_doc()
+ #Expected: instead of 1345-1430 appears 13.45-14.30
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "13.45-14.30")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "13.45-14.30")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "14.50-15.30")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "12.55-13.35")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "12.30-13.40")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py
index e8d62ae789fb..762773e8635f 100644
--- a/sc/qa/uitest/solver/solver.py
+++ b/sc/qa/uitest/solver/solver.py
@@ -14,39 +14,38 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class solver(UITestCase):
def test_solver(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("solver.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- 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.load_file(get_url_for_data_file("solver.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ 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")
- 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(document, 0, 1, 1).getValue(), 400)
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 400)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/sorting.py b/sc/qa/uitest/sort/sorting.py
index 4b56ceea7c5b..59c00c7b258a 100644
--- a/sc/qa/uitest/sort/sorting.py
+++ b/sc/qa/uitest/sort/sorting.py
@@ -300,4 +300,4 @@ class CalcSorting(UITestCase):
self.ui_test.close_dialog_through_button(xCanc)
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/stableSorting.py b/sc/qa/uitest/sort/stableSorting.py
index 269bd5252f2b..8b68af659538 100644
--- a/sc/qa/uitest/sort/stableSorting.py
+++ b/sc/qa/uitest/sort/stableSorting.py
@@ -19,49 +19,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class CalcStableSorting(UITestCase):
def test_Must_keep_sort_order_previous_sorting_toolbar_button_Ascending(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("stableSorting.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Select cell E1 ("Sales") and press toolbar button for ascending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
- self.xUITest.executeCommand(".uno:SortAscending")
- #Select cell D1 ("Product") and press toolbar button for ascending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
- self.xUITest.executeCommand(".uno:SortAscending")
- #Select cell C1 ("Salesman") and press toolbar button for ascending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
- self.xUITest.executeCommand(".uno:SortAscending")
- # Select cell B1 ("Region") and press toolbar button for ascending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
- self.xUITest.executeCommand(".uno:SortAscending")
- #Verify that the numbers in column "CheckOrder" are ascending
- for i in range(1, 501):
- self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), i)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Select cell E1 ("Sales") and press toolbar button for ascending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
+ self.xUITest.executeCommand(".uno:SortAscending")
+ #Select cell D1 ("Product") and press toolbar button for ascending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.xUITest.executeCommand(".uno:SortAscending")
+ #Select cell C1 ("Salesman") and press toolbar button for ascending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
+ self.xUITest.executeCommand(".uno:SortAscending")
+ # Select cell B1 ("Region") and press toolbar button for ascending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ self.xUITest.executeCommand(".uno:SortAscending")
+ #Verify that the numbers in column "CheckOrder" are ascending
+ for i in range(1, 501):
+ self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), i)
def test_Must_keep_sort_order_previous_sorting_toolbar_button_Descending(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("stableSorting.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #Select cell E1 ("Sales") and press toolbar button for descending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
- self.xUITest.executeCommand(".uno:SortDescending")
- #Select cell D1 ("Product") and press toolbar button for descending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
- self.xUITest.executeCommand(".uno:SortDescending")
- #Select cell C1 ("Salesman") and press toolbar button for descending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
- self.xUITest.executeCommand(".uno:SortDescending")
- # Select cell B1 ("Region") and press toolbar button for descending sorting.
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
- self.xUITest.executeCommand(".uno:SortDescending")
- #Verify that the numbers in column "CheckOrder" are ascending
- for i in range(1, 501):
- j = 501 - i
- self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), j)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Select cell E1 ("Sales") and press toolbar button for descending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"}))
+ self.xUITest.executeCommand(".uno:SortDescending")
+ #Select cell D1 ("Product") and press toolbar button for descending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.xUITest.executeCommand(".uno:SortDescending")
+ #Select cell C1 ("Salesman") and press toolbar button for descending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"}))
+ self.xUITest.executeCommand(".uno:SortDescending")
+ # Select cell B1 ("Region") and press toolbar button for descending sorting.
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ self.xUITest.executeCommand(".uno:SortDescending")
+ #Verify that the numbers in column "CheckOrder" are ascending
+ for i in range(1, 501):
+ j = 501 - i
+ self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), j)
# def test_Must_keep_sort_order_previous_sorting_using_sort_dialog(self):
# cannot test for now - criteria names are identical - Markus https://gerrit.libreoffice.org/#/c/52534/
diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py
index b17dbb73cbf4..1445a1d87dc2 100644
--- a/sc/qa/uitest/sort/subtotals.py
+++ b/sc/qa/uitest/sort/subtotals.py
@@ -49,128 +49,124 @@ class Subtotals(UITestCase):
self.ui_test.close_doc()
def test_tdf88792(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf88792.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
-
- # go to cell A1
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- # Select from the menu bar Data
- # Select option subtotal
- # Subtotal dialog displays
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- # Select group by: Category
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Category")
- # Select calculate subtotals for the months - selected by default
- # Select tab options
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "3")
- # select option include formats
- xformats = xDialog.getChild("formats")
- xformats.executeAction("CLICK", tuple())
- # apply with OK
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 28000)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf88792.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+
+ # go to cell A1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ # Select from the menu bar Data
+ # Select option subtotal
+ # Subtotal dialog displays
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Select group by: Category
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Category")
+ # Select calculate subtotals for the months - selected by default
+ # Select tab options
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ # select option include formats
+ xformats = xDialog.getChild("formats")
+ xformats.executeAction("CLICK", tuple())
+ # apply with OK
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 28000)
def test_tdf88735(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf88735.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
- # 1 select all cells
- self.xUITest.executeCommand(".uno:SelectAll")#use uno command Menu Edit->Select All
- # 2 invoke sub-total menu and select none
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "- none -")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- # 2 invoke sort menu and... crash
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "z")
- self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 8)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf88735.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # 1 select all cells
+ self.xUITest.executeCommand(".uno:SelectAll")#use uno command Menu Edit->Select All
+ # 2 invoke sub-total menu and select none
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "- none -")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ # 2 invoke sort menu and... crash
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "z")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 8)
def test_tdf56958(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf56958.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
- # 1. Open the test file
- # 2. Data->Subtotals
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- # 3. Group by->Trans date
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "Trans Date")
- # 4. Tick 'Calculate subtotals for' -> Amount (grid1)
- xCheckListMenu = xDialog.getChild("grid1")
- xTreeList = xCheckListMenu.getChild("columns")
- xFirstEntry = xTreeList.getChild("2")
- xFirstEntry.executeAction("CLICK", tuple())
- # 5. Click OK
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- # 6. Data->Subtotals
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- # 7. Group by->-none-
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "- none -")
- # 8. Untick 'Calculate subtotals for' -> Amount
- xCheckListMenu = xDialog.getChild("grid1")
- xTreeList = xCheckListMenu.getChild("columns")
- xFirstEntry = xTreeList.getChild("2")
- xFirstEntry.executeAction("CLICK", tuple())
- # 9. Click OK
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- # 10. Data->Sort
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- # 11. Sort key 1->Post Date.
- sortkey1 = xDialog.getChild("sortlb")
- select_by_text(sortkey1, "Post Date")
- # 12. Sort key 2->-undefined-
- sortkey2 = xDialog.getChild("sortuserlb")
- select_by_text(sortkey2, "- undefined -")
- # 13. Click OK
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), -0.25)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf56958.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # 1. Open the test file
+ # 2. Data->Subtotals
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # 3. Group by->Trans date
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "Trans Date")
+ # 4. Tick 'Calculate subtotals for' -> Amount (grid1)
+ xCheckListMenu = xDialog.getChild("grid1")
+ xTreeList = xCheckListMenu.getChild("columns")
+ xFirstEntry = xTreeList.getChild("2")
+ xFirstEntry.executeAction("CLICK", tuple())
+ # 5. Click OK
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ # 6. Data->Subtotals
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # 7. Group by->-none-
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "- none -")
+ # 8. Untick 'Calculate subtotals for' -> Amount
+ xCheckListMenu = xDialog.getChild("grid1")
+ xTreeList = xCheckListMenu.getChild("columns")
+ xFirstEntry = xTreeList.getChild("2")
+ xFirstEntry.executeAction("CLICK", tuple())
+ # 9. Click OK
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ # 10. Data->Sort
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # 11. Sort key 1->Post Date.
+ sortkey1 = xDialog.getChild("sortlb")
+ select_by_text(sortkey1, "Post Date")
+ # 12. Sort key 2->-undefined-
+ sortkey2 = xDialog.getChild("sortuserlb")
+ select_by_text(sortkey2, "- undefined -")
+ # 13. Click OK
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), -0.25)
def test_tdf55734(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55734.ods"))
- XcalcDoc = self.xUITest.getTopFocusWindow()
- document = self.ui_test.get_component()
- gridwin = XcalcDoc.getChild("grid_window")
- # 1. Open attached document
- # 2. Place cursor in cell outside of subtotals range (e.g. B7)
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
- # 3. Data → Subtotals
- self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
- xDialog = self.xUITest.getTopFocusWindow()
- # 4. Group by: "- none -"
- xGroupBy = xDialog.getChild("group_by")
- select_by_text(xGroupBy, "- none -")
- # 5. Press "OK" and watch LibreOffice crash.
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf55734.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # 1. Open attached document
+ # 2. Place cursor in cell outside of subtotals range (e.g. B7)
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
+ # 3. Data → Subtotals
+ self.ui_test.execute_dialog_through_command(".uno:DataSubTotals")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # 4. Group by: "- none -"
+ xGroupBy = xDialog.getChild("group_by")
+ select_by_text(xGroupBy, "- none -")
+ # 5. Press "OK" and watch LibreOffice crash.
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf105301.py b/sc/qa/uitest/sort/tdf105301.py
index 48cb62ec9252..2a93df6b57b9 100644
--- a/sc/qa/uitest/sort/tdf105301.py
+++ b/sc/qa/uitest/sort/tdf105301.py
@@ -12,33 +12,31 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf105301(UITestCase):
def test_tdf105301(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105301.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
-
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:R9"}))
-
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- self.assertEqual("Column B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
- self.assertEqual("Column C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText'])
- self.assertEqual("Column D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText'])
-
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Column E' != '- undefined -'
- self.assertEqual("Column E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText'])
- self.assertEqual("Column F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText'])
- self.assertEqual("Column G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText'])
-
- # tdf#51828: Without the fix in place, this test would have failed here
- self.assertEqual("- undefined -", get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText'])
-
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf105301.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:R9"}))
+
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ self.assertEqual("Column B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
+ self.assertEqual("Column C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText'])
+ self.assertEqual("Column D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText'])
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Column E' != '- undefined -'
+ self.assertEqual("Column E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText'])
+ self.assertEqual("Column F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText'])
+ self.assertEqual("Column G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText'])
+
+ # tdf#51828: Without the fix in place, this test would have failed here
+ self.assertEqual("- undefined -", get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText'])
+
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf49531.py b/sc/qa/uitest/sort/tdf49531.py
index 1d66f6a36c5a..fc1a5a05afd4 100644
--- a/sc/qa/uitest/sort/tdf49531.py
+++ b/sc/qa/uitest/sort/tdf49531.py
@@ -17,46 +17,45 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf49531(UITestCase):
def test_td49531_sort_undo_crash(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf49531.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #select A3:C147
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:C147"}))
+ with self.ui_test.load_file(get_url_for_data_file("tdf49531.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select A3:C147
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:C147"}))
- #Menu 'Data -> Sort -> Top to bottom - all otheroptions unchecked
- #Column B - Ascending' <ok>
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xNatural = xDialog.getChild("naturalsort")
- xtopdown = xDialog.getChild("topdown")
- xHeader = xDialog.getChild("header")
- if (get_state_as_dict(xNatural)["Selected"]) == "true":
- xNatural.executeAction("CLICK", tuple())
- if (get_state_as_dict(xHeader)["Selected"]) == "true":
- xHeader.executeAction("CLICK", tuple())
- xtopdown.executeAction("CLICK", tuple())
- select_pos(xTabs, "0")
- xSortKey1 = xDialog.getChild("sortlb")
- xAsc = xDialog.getChild("up")
- select_by_text(xSortKey1, "Column B")
- xAsc.executeAction("CLICK", tuple())
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "x")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0")
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 111)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 48)
- # UNDO Bug 49520 - EDITING: CRASH when undo sort with chart
- self.xUITest.executeCommand(".uno:Undo")
- # Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "x")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0")
- self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 2)
- self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
- self.ui_test.close_doc()
+ #Menu 'Data -> Sort -> Top to bottom - all otheroptions unchecked
+ #Column B - Ascending' <ok>
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xtopdown = xDialog.getChild("topdown")
+ xHeader = xDialog.getChild("header")
+ if (get_state_as_dict(xNatural)["Selected"]) == "true":
+ xNatural.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xHeader)["Selected"]) == "true":
+ xHeader.executeAction("CLICK", tuple())
+ xtopdown.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xSortKey1 = xDialog.getChild("sortlb")
+ xAsc = xDialog.getChild("up")
+ select_by_text(xSortKey1, "Column B")
+ xAsc.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "x")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 111)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 48)
+ # UNDO Bug 49520 - EDITING: CRASH when undo sort with chart
+ self.xUITest.executeCommand(".uno:Undo")
+ # Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "x")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf53482.py b/sc/qa/uitest/sort/tdf53482.py
index 1e6fa01b404a..2058f1888f93 100644
--- a/sc/qa/uitest/sort/tdf53482.py
+++ b/sc/qa/uitest/sort/tdf53482.py
@@ -17,37 +17,35 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf53482(UITestCase):
def test_tdf53482_Range_contains_column_headings_file(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf53482.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1. Highlight cells to be sorted A8:J124
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:J124"}))
- #2. Click Data menu, Sort
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- #3. On Options tab, tick 'Range contains column labels'
- xHeader = xDialog.getChild("header")
- xHeader.executeAction("CLICK", tuple())
- if (get_state_as_dict(xHeader)["Selected"]) == "false":
+ with self.ui_test.load_file(get_url_for_data_file("tdf53482.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. Highlight cells to be sorted A8:J124
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:J124"}))
+ #2. Click Data menu, Sort
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ #3. On Options tab, tick 'Range contains column labels'
+ xHeader = xDialog.getChild("header")
xHeader.executeAction("CLICK", tuple())
- #4. On Sort Criteria tab, set appropriate criteria
- select_pos(xTabs, "0")
- xDown = xDialog.getChild("down")
- xDown.executeAction("CLICK", tuple())
- xSortKey1 = xDialog.getChild("sortlb")
- select_by_text(xSortKey1, "Occupation")
- #5. Click Ok
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #6. Expected behavior: Ignore column labels when sorting
- self.assertEqual(get_cell_by_position(document, 0, 6, 7).getString(), "Occupation")
- self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "Travel Industry")
- self.assertEqual(get_cell_by_position(document, 0, 6, 123).getString(), "13")
-
- self.ui_test.close_doc()
+ if (get_state_as_dict(xHeader)["Selected"]) == "false":
+ xHeader.executeAction("CLICK", tuple())
+ #4. On Sort Criteria tab, set appropriate criteria
+ select_pos(xTabs, "0")
+ xDown = xDialog.getChild("down")
+ xDown.executeAction("CLICK", tuple())
+ xSortKey1 = xDialog.getChild("sortlb")
+ select_by_text(xSortKey1, "Occupation")
+ #5. Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #6. Expected behavior: Ignore column labels when sorting
+ self.assertEqual(get_cell_by_position(document, 0, 6, 7).getString(), "Occupation")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "Travel Industry")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 123).getString(), "13")
def test_tdf53482_Range_contains_column_headings(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
diff --git a/sc/qa/uitest/sort/tdf54018.py b/sc/qa/uitest/sort/tdf54018.py
index db5085e9266c..ece3a7fa2cc0 100644
--- a/sc/qa/uitest/sort/tdf54018.py
+++ b/sc/qa/uitest/sort/tdf54018.py
@@ -16,34 +16,32 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf54018(UITestCase):
def test_td54018_sort_with_comments(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf54018.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf54018.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- #click top left columns / rows heading field to select all cells
- self.xUITest.executeCommand(".uno:SelectAll")
- #Menu 'Data -> Sort -> Column D -> Descending' <ok>
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xSortKey1 = xDialog.getChild("sortlb")
- xdown = xDialog.getChild("down")
- select_by_text(xSortKey1, "Column B")
- xdown.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #Bug: When progress bar reaches 40% LibO Stops responding
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "7")
- self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "6")
- self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "5")
- self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "4")
- self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "3")
- self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "2")
- self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "1")
-
- self.ui_test.close_doc()
+ #click top left columns / rows heading field to select all cells
+ self.xUITest.executeCommand(".uno:SelectAll")
+ #Menu 'Data -> Sort -> Column D -> Descending' <ok>
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xSortKey1 = xDialog.getChild("sortlb")
+ xdown = xDialog.getChild("down")
+ select_by_text(xSortKey1, "Column B")
+ xdown.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Bug: When progress bar reaches 40% LibO Stops responding
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "7")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "6")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "5")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "4")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf57465.py b/sc/qa/uitest/sort/tdf57465.py
index 9f03d09fa798..26cdd6bdbf52 100644
--- a/sc/qa/uitest/sort/tdf57465.py
+++ b/sc/qa/uitest/sort/tdf57465.py
@@ -13,42 +13,40 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf57465(UITestCase):
def test_tdf57465(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57465.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf57465.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:G4"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:G4"}))
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
- xHeader = xDialog.getChild("header")
- if (get_state_as_dict(xHeader)["Selected"]) == 'true':
- xHeader.executeAction("CLICK", tuple())
+ xHeader = xDialog.getChild("header")
+ if (get_state_as_dict(xHeader)["Selected"]) == 'true':
+ xHeader.executeAction("CLICK", tuple())
- xLeftRight = xDialog.getChild("leftright")
- xLeftRight.executeAction("CLICK", tuple())
+ xLeftRight = xDialog.getChild("leftright")
+ xLeftRight.executeAction("CLICK", tuple())
- select_pos(xTabs, "0")
+ select_pos(xTabs, "0")
- self.assertEqual("Row 1", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
+ self.assertEqual("Row 1", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText'])
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
- self.assertEqual("a", get_cell_by_position(document, 0, 1, 1).getString())
+ self.assertEqual("a", get_cell_by_position(document, 0, 1, 1).getString())
- # Without the fix in place, this test would have failed with
- # AssertionError: 'b' != ''
- self.assertEqual("b", get_cell_by_position(document, 0, 2, 2).getString())
- self.assertEqual("c", get_cell_by_position(document, 0, 3, 3).getString())
- self.assertEqual("d", get_cell_by_position(document, 0, 4, 1).getString())
- self.assertEqual("e", get_cell_by_position(document, 0, 5, 2).getString())
- self.assertEqual("f", get_cell_by_position(document, 0, 6, 3).getString())
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'b' != ''
+ self.assertEqual("b", get_cell_by_position(document, 0, 2, 2).getString())
+ self.assertEqual("c", get_cell_by_position(document, 0, 3, 3).getString())
+ self.assertEqual("d", get_cell_by_position(document, 0, 4, 1).getString())
+ self.assertEqual("e", get_cell_by_position(document, 0, 5, 2).getString())
+ self.assertEqual("f", get_cell_by_position(document, 0, 6, 3).getString())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf91305.py b/sc/qa/uitest/sort/tdf91305.py
index eae7e8c4555e..340efdb3a531 100644
--- a/sc/qa/uitest/sort/tdf91305.py
+++ b/sc/qa/uitest/sort/tdf91305.py
@@ -137,4 +137,4 @@ class tdf91305(UITestCase):
self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff")
self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf95192.py b/sc/qa/uitest/sort/tdf95192.py
index be310f6a4eb1..b3d7b1d069e6 100644
--- a/sc/qa/uitest/sort/tdf95192.py
+++ b/sc/qa/uitest/sort/tdf95192.py
@@ -14,34 +14,32 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf95192(UITestCase):
def test_td99627_natural_sort(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf95192.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf95192.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- #Open sort dialog by DATA - SORT
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xNatural = xDialog.getChild("naturalsort")
- xNatural.executeAction("CLICK", tuple())
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Capra 1/17")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Sal. Capra 1/20")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Sal. Oregina 1/2")
- self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
- #UNDO
- self.xUITest.executeCommand(".uno:Undo")
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Oregina 1/2")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Via A. Centurione 11/7")
- self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xNatural.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Capra 1/17")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Sal. Capra 1/20")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Sal. Oregina 1/2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
+ #UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Oregina 1/2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Via A. Centurione 11/7")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf99208.py b/sc/qa/uitest/sort/tdf99208.py
index 1b9680a19cb7..dd037792dda1 100644
--- a/sc/qa/uitest/sort/tdf99208.py
+++ b/sc/qa/uitest/sort/tdf99208.py
@@ -16,49 +16,47 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf99208(UITestCase):
def test_td99627_natural_sort(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99208.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #select A3:C245
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C245"}))
+ with self.ui_test.load_file(get_url_for_data_file("tdf99208.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select A3:C245
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C245"}))
- #Menu 'Data -> Sort
- #Column A - Ascending' <ok>
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xNatural = xDialog.getChild("naturalsort")
- xtopdown = xDialog.getChild("topdown")
- xHeader = xDialog.getChild("header")
- xFormats = xDialog.getChild("formats")
- if (get_state_as_dict(xNatural)["Selected"]) == "false":
- xNatural.executeAction("CLICK", tuple())
- if (get_state_as_dict(xHeader)["Selected"]) == "false":
- xHeader.executeAction("CLICK", tuple())
- if (get_state_as_dict(xFormats)["Selected"]) == "false":
- xFormats.executeAction("CLICK", tuple())
- xtopdown.executeAction("CLICK", tuple())
- select_pos(xTabs, "0")
- xSortKey1 = xDialog.getChild("sortlb")
- xAsc = xDialog.getChild("up")
- select_by_text(xSortKey1, "FODMAP")
- xAsc.executeAction("CLICK", tuple())
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
- #Verify Expected: Values column B sorted ascending, column "control" unsorted
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "agave")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "almond milk")
- self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "zucchini")
- # UNDO
- self.xUITest.executeCommand(".uno:Undo")
- # Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "beef (grass fed, no breadcrumbs)")
- self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "salsa")
-
- self.ui_test.close_doc()
+ #Menu 'Data -> Sort
+ #Column A - Ascending' <ok>
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xtopdown = xDialog.getChild("topdown")
+ xHeader = xDialog.getChild("header")
+ xFormats = xDialog.getChild("formats")
+ if (get_state_as_dict(xNatural)["Selected"]) == "false":
+ xNatural.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xHeader)["Selected"]) == "false":
+ xHeader.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xFormats)["Selected"]) == "false":
+ xFormats.executeAction("CLICK", tuple())
+ xtopdown.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xSortKey1 = xDialog.getChild("sortlb")
+ xAsc = xDialog.getChild("up")
+ select_by_text(xSortKey1, "FODMAP")
+ xAsc.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify Expected: Values column B sorted ascending, column "control" unsorted
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "agave")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "almond milk")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "zucchini")
+ # UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ # Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "beef (grass fed, no breadcrumbs)")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "salsa")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/sort/tdf99627.py b/sc/qa/uitest/sort/tdf99627.py
index d5071adeae79..0be80c388586 100644
--- a/sc/qa/uitest/sort/tdf99627.py
+++ b/sc/qa/uitest/sort/tdf99627.py
@@ -15,34 +15,32 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf99627(UITestCase):
def test_td99627_natural_sort(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99627.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf99627.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- #Open sort dialog by DATA - SORT
- self.ui_test.execute_dialog_through_command(".uno:DataSort")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xNatural = xDialog.getChild("naturalsort")
- xdown = xDialog.getChild("down")
- xNatural.executeAction("CLICK", tuple())
- select_pos(xTabs, "0")
- xdown.executeAction("CLICK", tuple())
- xOk = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOk)
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2998")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "1")
- #UNDO
- self.xUITest.executeCommand(".uno:Undo")
- #Verify
- self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "1")
- self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "2998")
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xdown = xDialog.getChild("down")
+ xNatural.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xdown.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2998")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "1")
+ #UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "2998")
- self.ui_test.close_doc()
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py
index 588b1bea77fc..0102df1f8f92 100644
--- a/sc/qa/uitest/statistics/regression.py
+++ b/sc/qa/uitest/statistics/regression.py
@@ -20,22 +20,21 @@ class regression(UITestCase):
self._regression_check(data_groupedby_column = True)
def _regression_check(self, data_groupedby_column = True):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("regression.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("regression.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
- # Initially the final check status is "FALSE" (failed).
- self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "FALSE",
- "Check status must be FALSE before the test")
- self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = True)
- self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = False)
- self._do_regression(regression_type = "LOG", data_groupedby_column = data_groupedby_column)
- self._do_regression(regression_type = "POWER", data_groupedby_column = data_groupedby_column)
- self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "TRUE",
- "One of more of the checks failed for data_groupedby_column = {}, manually try with the document".
- format(data_groupedby_column))
- self.ui_test.close_doc()
+ # Initially the final check status is "FALSE" (failed).
+ self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "FALSE",
+ "Check status must be FALSE before the test")
+ self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = True)
+ self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = False)
+ self._do_regression(regression_type = "LOG", data_groupedby_column = data_groupedby_column)
+ self._do_regression(regression_type = "POWER", data_groupedby_column = data_groupedby_column)
+ self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "TRUE",
+ "One of more of the checks failed for data_groupedby_column = {}, manually try with the document".
+ format(data_groupedby_column))
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")
diff --git a/sc/qa/uitest/statistics/tdf76731.py b/sc/qa/uitest/statistics/tdf76731.py
index 48db1ff350d2..12cecdab1832 100644
--- a/sc/qa/uitest/statistics/tdf76731.py
+++ b/sc/qa/uitest/statistics/tdf76731.py
@@ -17,52 +17,51 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class anova(UITestCase):
def test_tdf76731_anova(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf76731.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1. Open the attached sample document in Calc.
- #2. Select the data range, i.e. A1:C5.
- 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.load_file(get_url_for_data_file("tdf76731.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. Open the attached sample document in Calc.
+ #2. Select the data range, i.e. A1:C5.
+ 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")
- 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)
- #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value.
- 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")
- self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups")
- self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1")
- self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2")
- self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3")
- self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation")
- self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups")
- self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups")
- self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total")
+ 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)
+ #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value.
+ 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")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total")
- self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical")
- self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),9), 3.885293835)
+ self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical")
+ self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),9), 3.885293835)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "")
- self.ui_test.close_doc()
-# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/textCase/textCase.py b/sc/qa/uitest/textCase/textCase.py
index 711bfa548301..d3823f1dacc6 100644
--- a/sc/qa/uitest/textCase/textCase.py
+++ b/sc/qa/uitest/textCase/textCase.py
@@ -127,35 +127,32 @@ class textCase(UITestCase):
def test_tdf119155_Capitalize_Every_Word(self):
#Bug 119155 - Freeze after command format->text->Capitalize Every Word
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119155.xlsx"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1. Open attached file
- #2. Select cells from C2 to C14
- gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:C14"}))
- #3. Go to menu: Format->Text->Capitalize Every Word
- self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
- #Actual Results:Freezes LibreOffice
- self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "Collagene Expert Targeted Wrinkle Corrector Unboxed 10 Ml")
- self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "Vitamina Suractivee Hand Cream 400 Ml")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf119155.xlsx")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1. Open attached file
+ #2. Select cells from C2 to C14
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:C14"}))
+ #3. Go to menu: Format->Text->Capitalize Every Word
+ self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase")
+ #Actual Results:Freezes LibreOffice
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "Collagene Expert Targeted Wrinkle Corrector Unboxed 10 Ml")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "Vitamina Suractivee Hand Cream 400 Ml")
def test_tdf119162_Cycle_Case(self):
#Bug 119162 - Format > Text > Cycle Case on attached example file hangs Calc reproducibly
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119162.xls"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- #1.Open the attached .xls file
- #2. Select column A
- gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
- #3. Select [Format] > [Text] > [Cycle Case]
- self.xUITest.executeCommand(".uno:ChangeCaseRotateCase")
- self.xUITest.executeCommand(".uno:ChangeCaseToLower")
- #Actual Results:Freezes LibreOffice
- self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "test\n")
+ with self.ui_test.load_file(get_url_for_data_file("tdf119162.xls")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #1.Open the attached .xls file
+ #2. Select column A
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #3. Select [Format] > [Text] > [Cycle Case]
+ self.xUITest.executeCommand(".uno:ChangeCaseRotateCase")
+ self.xUITest.executeCommand(".uno:ChangeCaseToLower")
+ #Actual Results:Freezes LibreOffice
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "test\n")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/validity/tdf137945.py b/sc/qa/uitest/validity/tdf137945.py
index 65f433de5931..4885ab3d5f42 100644
--- a/sc/qa/uitest/validity/tdf137945.py
+++ b/sc/qa/uitest/validity/tdf137945.py
@@ -11,23 +11,21 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class Tdf137945(UITestCase):
def test_tdf137945(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf137945.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf137945.ods")) as calc_doc:
- self.ui_test.execute_dialog_through_command(".uno:Validation")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xInput = xDialog.getChild("inputhelp")
- xTitle = xDialog.getChild("title")
+ self.ui_test.execute_dialog_through_command(".uno:Validation")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xInput = xDialog.getChild("inputhelp")
+ xTitle = xDialog.getChild("title")
- self.assertEqual("test", get_state_as_dict(xTitle)['Text'])
- # Without the fix in place, this test would have failed with
- # '1 2 3 4 5 10 end' != '1 2 3 4 5 10 end'
- self.assertEqual("1 2 3 4 5 10 end", get_state_as_dict(xInput)['Text'])
+ self.assertEqual("test", get_state_as_dict(xTitle)['Text'])
+ # Without the fix in place, this test would have failed with
+ # '1 2 3 4 5 10 end' != '1 2 3 4 5 10 end'
+ self.assertEqual("1 2 3 4 5 10 end", get_state_as_dict(xInput)['Text'])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/qa/uitest/findReplace/findReplace.py b/sd/qa/uitest/findReplace/findReplace.py
index 2d300e249517..b0f26723b1dc 100644
--- a/sd/qa/uitest/findReplace/findReplace.py
+++ b/sd/qa/uitest/findReplace/findReplace.py
@@ -13,113 +13,111 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class findReplace(UITestCase):
def test_find_impress(self):
- impress_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odp"))
- document = self.ui_test.get_component()
- # print(dir(document))
- # xPages= document.CurrentController.getCurrentPage().Number
- # print(xPages)
-
- # check current slide is 1
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
-
- # search for string "second"
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd slide
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
-
- # verify we moved to slide 2
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
-
- # search for string "third"
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
- xsearch.executeAction("CLICK", tuple())
-
- #verify we moved to slide 3
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 3) #3rd slide
-
- # close the dialog
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- # now open dialog and verify find="third" (remember last value);
- # replace value with "First" (click match case) with word "Replace"
- # click twice the Replace button, check "Replace first first"
-
- # open the dialog again
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- # verify search string is still "third" from previous search
- searchterm = xDialog.getChild("searchterm")
- self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
-
- # replace it with "First"
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"}))
-
- # click "match case"
- matchcase = xDialog.getChild("matchcase")
- matchcase.executeAction("CLICK", tuple()) #click match case
-
- # set the replace string to "Replace"
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox
-
- # hit replace button 2 times
- replace = xDialog.getChild("replace")
- replace.executeAction("CLICK", tuple())
- replace.executeAction("CLICK", tuple()) #click twice Replace button (one selects, second replaces)
-
- # close and reopen the dialog, because of bug 122788
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- # now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
- matchcase = xDialog.getChild("matchcase")
- matchcase.executeAction("CLICK", tuple()) # uncheck match case
-
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"}))
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple()) # click on replace all button
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn) #close the dialog
-
- # go to second page
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd slide
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
- #now check if text "Replace aaa aaa" is on first slide
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- backsearch = xDialog.getChild("backsearch")
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace aaa aaa"}))
- backsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) #1st slide
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("findReplace.odp")) as impress_doc:
+ document = self.ui_test.get_component()
+ # print(dir(document))
+ # xPages= document.CurrentController.getCurrentPage().Number
+ # print(xPages)
+
+ # check current slide is 1
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
+
+ # search for string "second"
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd slide
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+
+ # verify we moved to slide 2
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
+
+ # search for string "third"
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
+ xsearch.executeAction("CLICK", tuple())
+
+ #verify we moved to slide 3
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 3) #3rd slide
+
+ # close the dialog
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+
+ # now open dialog and verify find="third" (remember last value);
+ # replace value with "First" (click match case) with word "Replace"
+ # click twice the Replace button, check "Replace first first"
+
+ # open the dialog again
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ # verify search string is still "third" from previous search
+ searchterm = xDialog.getChild("searchterm")
+ self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
+
+ # replace it with "First"
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"}))
+
+ # click "match case"
+ matchcase = xDialog.getChild("matchcase")
+ matchcase.executeAction("CLICK", tuple()) #click match case
+
+ # set the replace string to "Replace"
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox
+
+ # hit replace button 2 times
+ replace = xDialog.getChild("replace")
+ replace.executeAction("CLICK", tuple())
+ replace.executeAction("CLICK", tuple()) #click twice Replace button (one selects, second replaces)
+
+ # close and reopen the dialog, because of bug 122788
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ # now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
+ matchcase = xDialog.getChild("matchcase")
+ matchcase.executeAction("CLICK", tuple()) # uncheck match case
+
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"}))
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple()) # click on replace all button
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn) #close the dialog
+
+ # go to second page
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd slide
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
+ #now check if text "Replace aaa aaa" is on first slide
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ backsearch = xDialog.getChild("backsearch")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace aaa aaa"}))
+ backsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) #1st slide
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/qa/uitest/impress_tests/embedded.py b/sd/qa/uitest/impress_tests/embedded.py
index 3cec962dd1b4..1e3c23014a4f 100644
--- a/sd/qa/uitest/impress_tests/embedded.py
+++ b/sd/qa/uitest/impress_tests/embedded.py
@@ -12,26 +12,24 @@ from libreoffice.calc.document import get_cell_by_position
class EmbeddedDocument(UITestCase):
def test_open_embedded_document(self):
- self.ui_test.load_file(get_url_for_data_file("embedded.pptx"))
+ with self.ui_test.load_file(get_url_for_data_file("embedded.pptx")):
- xImpressDoc = self.xUITest.getTopFocusWindow()
- xEditWin = xImpressDoc.getChild("impress_win")
+ xImpressDoc = self.xUITest.getTopFocusWindow()
+ xEditWin = xImpressDoc.getChild("impress_win")
- xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object 2"}))
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object 2"}))
- xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- document = self.ui_test.get_component()
- self.assertEqual("Name", get_cell_by_position(document, 0, 0, 0).getString())
- self.assertEqual("NWell", get_cell_by_position(document, 0, 0, 1).getString())
- self.assertEqual("PWell", get_cell_by_position(document, 0, 0, 2).getString())
- self.assertEqual("Active", get_cell_by_position(document, 0, 0, 3).getString())
- self.assertEqual("NoPoly", get_cell_by_position(document, 0, 0, 4).getString())
- self.assertEqual("Poly", get_cell_by_position(document, 0, 0, 5).getString())
- self.assertEqual("Sized", get_cell_by_position(document, 0, 0, 6).getString())
+ document = self.ui_test.get_component()
+ self.assertEqual("Name", get_cell_by_position(document, 0, 0, 0).getString())
+ self.assertEqual("NWell", get_cell_by_position(document, 0, 0, 1).getString())
+ self.assertEqual("PWell", get_cell_by_position(document, 0, 0, 2).getString())
+ self.assertEqual("Active", get_cell_by_position(document, 0, 0, 3).getString())
+ self.assertEqual("NoPoly", get_cell_by_position(document, 0, 0, 4).getString())
+ self.assertEqual("Poly", get_cell_by_position(document, 0, 0, 5).getString())
+ self.assertEqual("Sized", get_cell_by_position(document, 0, 0, 6).getString())
- self.xUITest.executeCommand(".uno:CloseDoc")
-
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:CloseDoc")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sd/qa/uitest/impress_tests/tdf141297.py b/sd/qa/uitest/impress_tests/tdf141297.py
index 76aab4d4594f..cf6991414715 100644
--- a/sd/qa/uitest/impress_tests/tdf141297.py
+++ b/sd/qa/uitest/impress_tests/tdf141297.py
@@ -81,18 +81,16 @@ class tdf141297(UITestCase):
# Close the Writer document
self.ui_test.close_doc()
- self.ui_test.load_file(systemPathToFileUrl(xFilePath))
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- self.xUITest.executeCommand(".uno:ManageLinks")
+ self.xUITest.executeCommand(".uno:ManageLinks")
- # Since the image is no longer linked, the link dialog is not open.
- # Without the fix in place, this dialog would have been opened
- xMainWin = self.xUITest.getTopFocusWindow()
- self.assertTrue(sLinks not in xMainWin.getChildren())
- self.assertTrue(sFileName not in xMainWin.getChildren())
- self.assertTrue(sBreakLink not in xMainWin.getChildren())
- self.assertTrue("impress_win" in xMainWin.getChildren())
-
- self.ui_test.close_doc()
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("impress_win" in xMainWin.getChildren())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sfx2/qa/uitest/doc/objserv.py b/sfx2/qa/uitest/doc/objserv.py
index 369c2a4393fd..7c658be8dfd8 100644
--- a/sfx2/qa/uitest/doc/objserv.py
+++ b/sfx2/qa/uitest/doc/objserv.py
@@ -13,17 +13,15 @@ class Test(UITestCase):
def testPdfSigning(self):
# Start Impress.
- impress_doc = self.ui_test.load_file(get_url_for_data_file("pdf-sign.pdf"))
- doc = self.xUITest.getTopFocusWindow()
-
- # Now use File -> Digital signatures -> Digital signatures.
- self.ui_test.execute_dialog_through_command(".uno:Signature")
- xDialog = self.xUITest.getTopFocusWindow()
- # Without the accompanying fix in place, this test would have failed with:
- # uno.com.sun.star.uno.RuntimeException: Could not find child with id: close vcl/source/uitest/uiobject.cxx:452
- self.ui_test.close_dialog_through_button(xDialog.getChild("close"))
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("pdf-sign.pdf")) as impress_doc:
+ doc = self.xUITest.getTopFocusWindow()
+
+ # Now use File -> Digital signatures -> Digital signatures.
+ self.ui_test.execute_dialog_through_command(".uno:Signature")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Without the accompanying fix in place, this test would have failed with:
+ # uno.com.sun.star.uno.RuntimeException: Could not find child with id: close vcl/source/uitest/uiobject.cxx:452
+ self.ui_test.close_dialog_through_button(xDialog.getChild("close"))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/chapterNumbering/tdf123547.py b/sw/qa/uitest/chapterNumbering/tdf123547.py
index 4b2cdf0a5f06..135db13fe927 100644
--- a/sw/qa/uitest/chapterNumbering/tdf123547.py
+++ b/sw/qa/uitest/chapterNumbering/tdf123547.py
@@ -12,18 +12,17 @@ from uitest.uihelper.common import select_pos
class tdf123547(UITestCase):
def test_tdf123547_numbering_dialog_crash(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf123547.docx"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf123547.docx")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "1")
- xokbtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xokbtn)
- #verify we didn't crash
- self.assertEqual(document.CurrentController.PageCount, 1)
+ self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xokbtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xokbtn)
+ #verify we didn't crash
+ self.assertEqual(document.CurrentController.PageCount, 1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findReplace/findReplace.py b/sw/qa/uitest/findReplace/findReplace.py
index 30e0c0e63006..0ef4f22ac1d9 100644
--- a/sw/qa/uitest/findReplace/findReplace.py
+++ b/sw/qa/uitest/findReplace/findReplace.py
@@ -11,89 +11,87 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, typ
class findReplace(UITestCase):
def test_find_writer(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd page
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
-
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
- xsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") #3rd page
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first"
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"}))
- matchcase = xDialog.getChild("matchcase")
- matchcase.executeAction("CLICK", tuple()) #click match case
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox
- replace = xDialog.getChild("replace")
- replace.executeAction("CLICK", tuple())
- replace.executeAction("CLICK", tuple()) #click twice Replace button
- #verify
- self.assertEqual(document.Text.String[0:19], "Replace first first")
-
- #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"}))
- matchcase.executeAction("CLICK", tuple()) #uncheck match case
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.Text.String[0:15], "Replace aaa aaa")
-
- #now delete strings in textbox Find and textbox Replace, click button Format, select Size=16 pt, Close OK, Find Next; verify Page=2;
- #click No format button; close dialog
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-
- format = xDialog.getChild("format")
- with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
- xTabs = dialog.getChild("tabcontrol")
- select_pos(xTabs, "0")
- xSizeFont = dialog.getChild("westsizelb-cjk")
- xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16
-
- # Verify these didn't get set again through SvxSearchController::StateChanged, timer-
- # triggered from SfxBindings::NextJob while executing the Format dialog above:
- self.assertEqual(get_state_as_dict(searchterm)["Text"], "")
- self.assertEqual(get_state_as_dict(replaceterm)["Text"], "")
-
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- noformat = xDialog.getChild("noformat")
- noformat.executeAction("CLICK", tuple()) #click No format button
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"second"})) #2nd page
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
+ xsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") #3rd page
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+
+ #now open dialog and verify find="third" (remember last value); replace value with "First" ( click match case) with word "Replace" - click twice Replace button, check "Replace first first"
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ self.assertEqual(get_state_as_dict(searchterm)["Text"], "third")
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"First"}))
+ matchcase = xDialog.getChild("matchcase")
+ matchcase.executeAction("CLICK", tuple()) #click match case
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Replace"})) #replace textbox
+ replace = xDialog.getChild("replace")
+ replace.executeAction("CLICK", tuple())
+ replace.executeAction("CLICK", tuple()) #click twice Replace button
+ #verify
+ self.assertEqual(document.Text.String[0:19], "Replace first first")
+
+ #now replace first (uncheck match case) with word "aaa" - click once Replace All button, check "Replace aaa aaa"
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aaa"}))
+ matchcase.executeAction("CLICK", tuple()) #uncheck match case
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.Text.String[0:15], "Replace aaa aaa")
+
+ #now delete strings in textbox Find and textbox Replace, click button Format, select Size=16 pt, Close OK, Find Next; verify Page=2;
+ #click No format button; close dialog
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ replaceterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+
+ format = xDialog.getChild("format")
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())) as dialog:
+ xTabs = dialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xSizeFont = dialog.getChild("westsizelb-cjk")
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"16"})) #set font size 16
+
+ # Verify these didn't get set again through SvxSearchController::StateChanged, timer-
+ # triggered from SfxBindings::NextJob while executing the Format dialog above:
+ self.assertEqual(get_state_as_dict(searchterm)["Text"], "")
+ self.assertEqual(get_state_as_dict(replaceterm)["Text"], "")
+
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ noformat = xDialog.getChild("noformat")
+ noformat.executeAction("CLICK", tuple()) #click No format button
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
#Bug 39022 - find-replace->$1, not pattern
def test_tdf39022_replace_regexp(self):
@@ -124,56 +122,52 @@ class findReplace(UITestCase):
#tdf116242 ţ ț
def test_tdf116242_replace_t_with_cedilla(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf116242.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ţ"})) #find
- replaceterm = xDialog.getChild("replaceterm")
- replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ț"})) #replace
- includediacritics = xDialog.getChild("includediacritics")
- if (get_state_as_dict(includediacritics)["Selected"]) == "false":
- includediacritics.executeAction("CLICK", tuple())
- replaceall = xDialog.getChild("replaceall")
- replaceall.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(document.Text.String[0:13], "țoootdf116242")
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf116242.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ţ"})) #find
+ replaceterm = xDialog.getChild("replaceterm")
+ replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"ț"})) #replace
+ includediacritics = xDialog.getChild("includediacritics")
+ if (get_state_as_dict(includediacritics)["Selected"]) == "false":
+ includediacritics.executeAction("CLICK", tuple())
+ replaceall = xDialog.getChild("replaceall")
+ replaceall.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(document.Text.String[0:13], "țoootdf116242")
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
#Bug 98417 - FIND & REPLACE: Add 'Find Previous' button
def test_tdf98417_find_previous_writer(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
- xsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") #page 4
- backsearch = xDialog.getChild("backsearch")
- backsearch.executeAction("CLICK", tuple())
- #verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
-
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"third"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+ xsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4") #page 4
+ backsearch = xDialog.getChild("backsearch")
+ backsearch.executeAction("CLICK", tuple())
+ #verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
def test_tdf136577(self):
self.ui_test.create_doc_in_start_center("writer")
diff --git a/sw/qa/uitest/findReplace/tdf118208.py b/sw/qa/uitest/findReplace/tdf118208.py
index 17cd71fc9923..79c38315898f 100644
--- a/sw/qa/uitest/findReplace/tdf118208.py
+++ b/sw/qa/uitest/findReplace/tdf118208.py
@@ -14,64 +14,62 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf118208(UITestCase):
def test_tdf118208_search_dialog_format_crash(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118208.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- # 1. Open the attached file.
- # 2. Press ctrl-H to show the search and replace dialog.
- # 3. Press the "Format..." button.
- #Libreoffice immediately crashed.
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf118208.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ # 1. Open the attached file.
+ # 2. Press ctrl-H to show the search and replace dialog.
+ # 3. Press the "Format..." button.
+ #Libreoffice immediately crashed.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
- xPages = xDialog.getChild("pages")
- xLanguageEntry = xPages.getChild('2') # Language Settings
- xLanguageEntry.executeAction("EXPAND", tuple())
- xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
- xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
+ xPages = xDialog.getChild("pages")
+ xLanguageEntry = xPages.getChild('2') # Language Settings
+ xLanguageEntry.executeAction("EXPAND", tuple())
+ xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+ xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
- asianlanguage = xDialog.getChild("asiansupport")
- complexlanguage = xDialog.getChild("ctlsupport")
- if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
- asianlanguage.executeAction("CLICK", tuple())
- if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
- complexlanguage.executeAction("CLICK", tuple())
+ asianlanguage = xDialog.getChild("asiansupport")
+ complexlanguage = xDialog.getChild("ctlsupport")
+ if (get_state_as_dict(asianlanguage)["Selected"]) == "true":
+ asianlanguage.executeAction("CLICK", tuple())
+ if (get_state_as_dict(complexlanguage)["Selected"]) == "true":
+ complexlanguage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- format = xDialog.getChild("format")
+ format = xDialog.getChild("format")
- with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())):
- pass
+ with self.ui_test.execute_blocking_action(format.executeAction, args=('CLICK', ())):
+ pass
- #verify
- self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
+ #verify
+ self.assertEqual(document.Text.String[0:14], "Aaaaaaaaaaaaaa")
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
- #enable lang support again
- self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
+ #enable lang support again
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
- xPages = xDialog.getChild("pages")
- xLanguageEntry = xPages.getChild('2') # Language Settings
- xLanguageEntry.executeAction("EXPAND", tuple())
- xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
- xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
+ xPages = xDialog.getChild("pages")
+ xLanguageEntry = xPages.getChild('2') # Language Settings
+ xLanguageEntry.executeAction("EXPAND", tuple())
+ xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+ xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) #Language
- asianlanguage = xDialog.getChild("asiansupport")
- complexlanguage = xDialog.getChild("ctlsupport")
- if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
- asianlanguage.executeAction("CLICK", tuple())
- if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
- complexlanguage.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ asianlanguage = xDialog.getChild("asiansupport")
+ complexlanguage = xDialog.getChild("ctlsupport")
+ if (get_state_as_dict(asianlanguage)["Selected"]) == "false":
+ asianlanguage.executeAction("CLICK", tuple())
+ if (get_state_as_dict(complexlanguage)["Selected"]) == "false":
+ complexlanguage.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/findSimilarity/findSimilarity.py b/sw/qa/uitest/findSimilarity/findSimilarity.py
index 8328dedbe191..da5066e8ec91 100644
--- a/sw/qa/uitest/findSimilarity/findSimilarity.py
+++ b/sw/qa/uitest/findSimilarity/findSimilarity.py
@@ -12,60 +12,58 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class findSimilarities(UITestCase):
def test_find_similarities(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("findReplace.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #verify: we are on page 1
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- # search and replace dialog
- #find = seco
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"seco"})) #seco
- # check similarities, button similarities, set values = 1; close dialog with OK
- similarity = xDialog.getChild("similarity")
- similaritybtn = xDialog.getChild("similaritybtn")
- similarity.executeAction("CLICK", tuple())
- with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ())) as dialog:
- otherfld = dialog.getChild("otherfld")
- longerfld = dialog.getChild("longerfld")
- shorterfld = dialog.getChild("shorterfld")
- otherfld.executeAction("DOWN", tuple())
- longerfld.executeAction("DOWN", tuple())
- shorterfld.executeAction("DOWN", tuple())
+ with self.ui_test.load_file(get_url_for_data_file("findReplace.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #verify: we are on page 1
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+ # search and replace dialog
+ #find = seco
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"seco"})) #seco
+ # check similarities, button similarities, set values = 1; close dialog with OK
+ similarity = xDialog.getChild("similarity")
+ similaritybtn = xDialog.getChild("similaritybtn")
+ similarity.executeAction("CLICK", tuple())
+ with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ())) as dialog:
+ otherfld = dialog.getChild("otherfld")
+ longerfld = dialog.getChild("longerfld")
+ shorterfld = dialog.getChild("shorterfld")
+ otherfld.executeAction("DOWN", tuple())
+ longerfld.executeAction("DOWN", tuple())
+ shorterfld.executeAction("DOWN", tuple())
- #open dialog again, verify values = 1; close dialog with cancel
- with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog:
- otherfld = dialog.getChild("otherfld")
- longerfld = dialog.getChild("longerfld")
- shorterfld = dialog.getChild("shorterfld")
- self.assertEqual(get_state_as_dict(otherfld)["Text"], "1")
- self.assertEqual(get_state_as_dict(longerfld)["Text"], "1")
- self.assertEqual(get_state_as_dict(shorterfld)["Text"], "1")
+ #open dialog again, verify values = 1; close dialog with cancel
+ with self.ui_test.execute_blocking_action(similaritybtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog:
+ otherfld = dialog.getChild("otherfld")
+ longerfld = dialog.getChild("longerfld")
+ shorterfld = dialog.getChild("shorterfld")
+ self.assertEqual(get_state_as_dict(otherfld)["Text"], "1")
+ self.assertEqual(get_state_as_dict(longerfld)["Text"], "1")
+ self.assertEqual(get_state_as_dict(shorterfld)["Text"], "1")
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- # Find next - not found
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- #find = secon
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"secon"}))
- # Find next - verify: we are on page 2
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) #word "second" is selected
- #find = irst
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"irst"}))
- # Find next - verify: we are on page 1
- xsearch.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
-
- self.ui_test.close_doc()
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ # Find next - not found
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+ #find = secon
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"secon"}))
+ # Find next - verify: we are on page 2
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) #word "second" is selected
+ #find = irst
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"irst"}))
+ # Find next - verify: we are on page 1
+ xsearch.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py
index fc220f530202..ebb354bf37b2 100644
--- a/sw/qa/uitest/navigator/tdf114724.py
+++ b/sw/qa/uitest/navigator/tdf114724.py
@@ -13,39 +13,38 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf114724(UITestCase):
def test_track_headings_outline(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf114724.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
- xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
- xToolBar = xNavigatorPanel.getChild("content5")
- xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBar = xNavigatorPanel.getChild("content5")
+ xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button
- xWriterEdit.executeAction("FOCUS", tuple())
+ xWriterEdit.executeAction("FOCUS", tuple())
- xContentTree = xNavigatorPanel.getChild("contenttree")
+ xContentTree = xNavigatorPanel.getChild("contenttree")
- self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
- for _ in range(0,3):
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+ for _ in range(0,3):
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
- self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+ self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
- for _ in range(0,3):
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ for _ in range(0,3):
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
- self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
- self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+ self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1")
+ self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/navigator/tdf140661.py b/sw/qa/uitest/navigator/tdf140661.py
index 3991105ee78b..75b496b027f9 100644
--- a/sw/qa/uitest/navigator/tdf140661.py
+++ b/sw/qa/uitest/navigator/tdf140661.py
@@ -41,21 +41,19 @@ class tdf140661(UITestCase):
def test_tdf140661(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf140661.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")) as writer_doc:
- self.launch_navigator(True)
+ self.launch_navigator(True)
- # Select the shape and ungroup it
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ # Select the shape and ungroup it
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.wait_until_child_is_available('metricfield')
+ self.ui_test.wait_until_child_is_available('metricfield')
- self.xUITest.executeCommand(".uno:FormatUngroup")
+ self.xUITest.executeCommand(".uno:FormatUngroup")
- # Without the fix in place, this test would have failed with
- # AssertionError: 12 != 0
- self.launch_navigator(False)
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 12 != 0
+ self.launch_navigator(False)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py
index 9b125ff941ec..a3aa1dfa8d10 100644
--- a/sw/qa/uitest/navigator/tdf40427.py
+++ b/sw/qa/uitest/navigator/tdf40427.py
@@ -14,68 +14,67 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf40427(UITestCase):
def test_tdf40427(self):
- self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt"))
- xMainWindow = self.xUITest.getTopFocusWindow()
- xWriterEdit = xMainWindow.getChild("writer_edit")
+ with self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")):
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xMainWindow.getChild("writer_edit")
- self.assertEqual(2, self.ui_test.get_component().CurrentController.PageCount)
+ self.assertEqual(2, self.ui_test.get_component().CurrentController.PageCount)
- # Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom
- self.ui_test.execute_dialog_through_command(".uno:Zoom")
- xDialog = self.xUITest.getTopFocusWindow()
+ # Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom
+ self.ui_test.execute_dialog_through_command(".uno:Zoom")
+ xDialog = self.xUITest.getTopFocusWindow()
- columnssb = xDialog.getChild("columnssb")
- columns = xDialog.getChild("columns")
- bookmode = xDialog.getChild("bookmode")
- self.assertEqual("true", get_state_as_dict(columns)["Checked"])
- self.assertEqual("2", get_state_as_dict(columnssb)["Text"])
- self.assertEqual("false", get_state_as_dict(bookmode)["Selected"])
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ bookmode = xDialog.getChild("bookmode")
+ self.assertEqual("true", get_state_as_dict(columns)["Checked"])
+ self.assertEqual("2", get_state_as_dict(columnssb)["Text"])
+ self.assertEqual("false", get_state_as_dict(bookmode)["Selected"])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # In this view, the sections "SectionB" and "SectionC" on second page are positioned on screen
- # higher than "SectionY" and "SectionA" respectively; there are nested and anchored sections.
- # Make sure that order in Navigator follows their relative position in document, not vertical
- # position on screen, nor sorted alphabetically. Sections in flying frames are sorted by their
- # anchor position in the document.
+ # In this view, the sections "SectionB" and "SectionC" on second page are positioned on screen
+ # higher than "SectionY" and "SectionA" respectively; there are nested and anchored sections.
+ # Make sure that order in Navigator follows their relative position in document, not vertical
+ # position on screen, nor sorted alphabetically. Sections in flying frames are sorted by their
+ # anchor position in the document.
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
- # wait until the navigator panel is available
- xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
+ # wait until the navigator panel is available
+ xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
- xContentTree = xNavigatorPanel.getChild("contenttree")
- xSections = xContentTree.getChild('6')
- self.assertEqual('Sections', get_state_as_dict(xSections)['Text'])
- xSections.executeAction("EXPAND", ())
+ xContentTree = xNavigatorPanel.getChild("contenttree")
+ xSections = xContentTree.getChild('6')
+ self.assertEqual('Sections', get_state_as_dict(xSections)['Text'])
+ xSections.executeAction("EXPAND", ())
- refSectionNames = [
- 'SectionZ',
- 'SectionY', # SectionB should not get before this, despite its Y position on screen is higher
- 'SectionT3', # Sections in tables go in rows, then across rows
- 'SectionT1',
- 'SectionT2',
- 'SectionT0',
- 'SectionF2', # Goes before SectionF1, because their fly anchors go in that order
- 'SectionF3', # Same as SectionF1, but anchor section is in fly itself
- 'SectionFinF3', # Check order of nested sections inside fly
- 'SectionA',
- 'SectionF1', # Section in fly anchored in a section goes immediately after its anchor section
- 'SectionB', # High on screen, but late in list because it's on second page
- 'SectionC',
- ]
- self.assertEqual(len(refSectionNames), len(xSections.getChildren()))
+ refSectionNames = [
+ 'SectionZ',
+ 'SectionY', # SectionB should not get before this, despite its Y position on screen is higher
+ 'SectionT3', # Sections in tables go in rows, then across rows
+ 'SectionT1',
+ 'SectionT2',
+ 'SectionT0',
+ 'SectionF2', # Goes before SectionF1, because their fly anchors go in that order
+ 'SectionF3', # Same as SectionF1, but anchor section is in fly itself
+ 'SectionFinF3', # Check order of nested sections inside fly
+ 'SectionA',
+ 'SectionF1', # Section in fly anchored in a section goes immediately after its anchor section
+ 'SectionB', # High on screen, but late in list because it's on second page
+ 'SectionC',
+ ]
+ self.assertEqual(len(refSectionNames), len(xSections.getChildren()))
- actSectionNames = []
- for i in range(len(refSectionNames)):
- actSectionNames.append(get_state_as_dict(xSections.getChild(str(i)))['Text'])
- # Without the fix in place, this would fail with
- # AssertionError: Lists differ: ['SectionZ', 'SectionY', 'SectionT3', 'SectionT1', 'SectionT2'[100 chars]onC'] != ['SectionZ', 'SectionB', 'SectionF3', 'SectionFinF3', 'Section[100 chars]onA']
- self.assertEqual(refSectionNames, actSectionNames)
+ actSectionNames = []
+ for i in range(len(refSectionNames)):
+ actSectionNames.append(get_state_as_dict(xSections.getChild(str(i)))['Text'])
+ # Without the fix in place, this would fail with
+ # AssertionError: Lists differ: ['SectionZ', 'SectionY', 'SectionT3', 'SectionT1', 'SectionT2'[100 chars]onC'] != ['SectionZ', 'SectionB', 'SectionF3', 'SectionFinF3', 'Section[100 chars]onA']
+ self.assertEqual(refSectionNames, actSectionNames)
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf99711.py b/sw/qa/uitest/sidebar/tdf99711.py
index 1cc899f42cc1..7ffea85ab157 100644
--- a/sw/qa/uitest/sidebar/tdf99711.py
+++ b/sw/qa/uitest/sidebar/tdf99711.py
@@ -12,29 +12,27 @@ from uitest.uihelper.common import change_measurement_unit
class tdf99711(UITestCase):
def test_tdf99711(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc:
- #set measurement to millimeters
- change_measurement_unit(self, "Millimeter")
+ #set measurement to millimeters
+ change_measurement_unit(self, "Millimeter")
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
- #wait until the sidebar is available
- xChild = self.ui_test.wait_until_child_is_available('selectwidth')
- self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
+ #wait until the sidebar is available
+ xChild = self.ui_test.wait_until_child_is_available('selectwidth')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
- xChild = self.ui_test.wait_until_child_is_available('selectheight')
- self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
+ xChild = self.ui_test.wait_until_child_is_available('selectheight')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
- self.xUITest.executeCommand(".uno:Sidebar")
-
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:Sidebar")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/styleInspector/styleInspector.py b/sw/qa/uitest/styleInspector/styleInspector.py
index 9c4abaf7191f..b734cb624970 100644
--- a/sw/qa/uitest/styleInspector/styleInspector.py
+++ b/sw/qa/uitest/styleInspector/styleInspector.py
@@ -12,344 +12,340 @@ from com.sun.star.rdf.URIs import RDF_TYPE, RDFS_COMMENT, RDFS_LABEL, ODF_PREFIX
class styleNavigator(UITestCase):
def test_listbox_is_updated(self):
- self.ui_test.load_file(get_url_for_data_file("styles.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
-
- xListBox = xWriterEdit.getChild('listbox_fonts')
-
- # The cursor is on text without formatting and default style
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with direct formatting
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
-
- xDirFormatting = xListBox.getChild('3')
- self.assertEqual(5, len(xDirFormatting.getChildren()))
- self.assertEqual("Char Back Color\t0xffff00", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Char Back Transparent\tFalse", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
- self.assertEqual("Char Color\t0xc9211e", get_state_as_dict(xDirFormatting.getChild('2'))['Text'])
- self.assertEqual("Char Shading Value\t0", get_state_as_dict(xDirFormatting.getChild('3'))['Text'])
- self.assertEqual("Char Transparence\t0", get_state_as_dict(xDirFormatting.getChild('4'))['Text'])
-
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with paragraph direct formatting
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
-
- xParDirFormatting = xListBox.getChild('1')
- self.assertEqual(7, len(xParDirFormatting.getChildren()))
- self.assertEqual("Fill Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Para Back Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
- self.assertEqual("Para Back Transparent\tFalse", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
- self.assertEqual("Para First Line Indent\t0", get_state_as_dict(xParDirFormatting.getChild('3'))['Text'])
- self.assertEqual("Para is Auto First Line Indent\tFalse", get_state_as_dict(xParDirFormatting.getChild('4'))['Text'])
- self.assertEqual("Para Left Margin\t1482", get_state_as_dict(xParDirFormatting.getChild('5'))['Text'])
- self.assertEqual("Para Right Margin\t0", get_state_as_dict(xParDirFormatting.getChild('6'))['Text'])
-
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with 'Title' style
- xParStyle = xListBox.getChild('0')
- self.assertEqual(3, len(xParStyle.getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text'])
- self.assertEqual(136, len(xParStyle.getChild('0').getChildren()))
- self.assertEqual("Heading\t", get_state_as_dict(xParStyle.getChild('1'))['Text'])
- self.assertEqual(28, len(xParStyle.getChild('1').getChildren()))
-
- xTitleStyle = xParStyle.getChild('2')
- self.assertEqual("Title\t", get_state_as_dict(xTitleStyle)['Text'])
- self.assertEqual(16, len(xTitleStyle.getChildren()))
- self.assertEqual("Char Difference Height\t0", get_state_as_dict(xTitleStyle.getChild('0'))['Text'])
- self.assertEqual("Char Difference Height Asian\t0", get_state_as_dict(xTitleStyle.getChild('1'))['Text'])
- self.assertEqual("Char Difference Height Complex\t0", get_state_as_dict(xTitleStyle.getChild('2'))['Text'])
- self.assertEqual("Char Height\t28", get_state_as_dict(xTitleStyle.getChild('3'))['Text'])
- self.assertEqual("Char Height Asian\t28", get_state_as_dict(xTitleStyle.getChild('4'))['Text'])
- self.assertEqual("Char Height Complex\t28", get_state_as_dict(xTitleStyle.getChild('5'))['Text'])
- self.assertEqual("Char Property Height\t100", get_state_as_dict(xTitleStyle.getChild('6'))['Text'])
- self.assertEqual("Char Property Height Asian\t100", get_state_as_dict(xTitleStyle.getChild('7'))['Text'])
- self.assertEqual("Char Property Height Complex\t100", get_state_as_dict(xTitleStyle.getChild('8'))['Text'])
- self.assertEqual("Char Weight\tBold", get_state_as_dict(xTitleStyle.getChild('9'))['Text'])
- self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xTitleStyle.getChild('10'))['Text'])
- self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xTitleStyle.getChild('11'))['Text'])
- self.assertEqual("Follow Style\tText body", get_state_as_dict(xTitleStyle.getChild('12'))['Text'])
- self.assertEqual("Para Adjust\t3", get_state_as_dict(xTitleStyle.getChild('13'))['Text'])
- self.assertEqual("Para Expand Single Word\tFalse", get_state_as_dict(xTitleStyle.getChild('14'))['Text'])
- self.assertEqual("Para Last Line Adjust\t0", get_state_as_dict(xTitleStyle.getChild('15'))['Text'])
-
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with custom style
- xParStyle = xListBox.getChild('0')
- self.assertEqual(3, len(xParStyle.getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text'])
- self.assertEqual(136, len(xParStyle.getChild('0').getChildren()))
- self.assertEqual("Text Body\t", get_state_as_dict(xParStyle.getChild('1'))['Text'])
- self.assertEqual(6, len(xParStyle.getChild('1').getChildren()))
-
- xCustomStyle = xParStyle.getChild('2')
- self.assertEqual("Custom_Style\t", get_state_as_dict(xCustomStyle)['Text'])
- self.assertEqual(7, len(xCustomStyle.getChildren()))
- self.assertEqual("Char Color\t0xff5429", get_state_as_dict(xCustomStyle.getChild('0'))['Text'])
- self.assertEqual("Char Difference Height\t0", get_state_as_dict(xCustomStyle.getChild('1'))['Text'])
- self.assertEqual("Char Height\t20", get_state_as_dict(xCustomStyle.getChild('2'))['Text'])
- self.assertEqual("Char Property Height\t100", get_state_as_dict(xCustomStyle.getChild('3'))['Text'])
- self.assertEqual("Char Transparence\t0", get_state_as_dict(xCustomStyle.getChild('4'))['Text'])
- self.assertEqual("Char Weight\tBold", get_state_as_dict(xCustomStyle.getChild('5'))['Text'])
- self.assertEqual("Follow Style\tCustom_Style", get_state_as_dict(xCustomStyle.getChild('6'))['Text'])
-
- self.assertEqual(7, len(xListBox.getChild('0').getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("styles.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ xListBox = xWriterEdit.getChild('listbox_fonts')
+
+ # The cursor is on text without formatting and default style
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with direct formatting
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+
+ xDirFormatting = xListBox.getChild('3')
+ self.assertEqual(5, len(xDirFormatting.getChildren()))
+ self.assertEqual("Char Back Color\t0xffff00", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Char Back Transparent\tFalse", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
+ self.assertEqual("Char Color\t0xc9211e", get_state_as_dict(xDirFormatting.getChild('2'))['Text'])
+ self.assertEqual("Char Shading Value\t0", get_state_as_dict(xDirFormatting.getChild('3'))['Text'])
+ self.assertEqual("Char Transparence\t0", get_state_as_dict(xDirFormatting.getChild('4'))['Text'])
+
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with paragraph direct formatting
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+
+ xParDirFormatting = xListBox.getChild('1')
+ self.assertEqual(7, len(xParDirFormatting.getChildren()))
+ self.assertEqual("Fill Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Para Back Color\t0xff0000", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
+ self.assertEqual("Para Back Transparent\tFalse", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
+ self.assertEqual("Para First Line Indent\t0", get_state_as_dict(xParDirFormatting.getChild('3'))['Text'])
+ self.assertEqual("Para is Auto First Line Indent\tFalse", get_state_as_dict(xParDirFormatting.getChild('4'))['Text'])
+ self.assertEqual("Para Left Margin\t1482", get_state_as_dict(xParDirFormatting.getChild('5'))['Text'])
+ self.assertEqual("Para Right Margin\t0", get_state_as_dict(xParDirFormatting.getChild('6'))['Text'])
+
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with 'Title' style
+ xParStyle = xListBox.getChild('0')
+ self.assertEqual(3, len(xParStyle.getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text'])
+ self.assertEqual(136, len(xParStyle.getChild('0').getChildren()))
+ self.assertEqual("Heading\t", get_state_as_dict(xParStyle.getChild('1'))['Text'])
+ self.assertEqual(28, len(xParStyle.getChild('1').getChildren()))
+
+ xTitleStyle = xParStyle.getChild('2')
+ self.assertEqual("Title\t", get_state_as_dict(xTitleStyle)['Text'])
+ self.assertEqual(16, len(xTitleStyle.getChildren()))
+ self.assertEqual("Char Difference Height\t0", get_state_as_dict(xTitleStyle.getChild('0'))['Text'])
+ self.assertEqual("Char Difference Height Asian\t0", get_state_as_dict(xTitleStyle.getChild('1'))['Text'])
+ self.assertEqual("Char Difference Height Complex\t0", get_state_as_dict(xTitleStyle.getChild('2'))['Text'])
+ self.assertEqual("Char Height\t28", get_state_as_dict(xTitleStyle.getChild('3'))['Text'])
+ self.assertEqual("Char Height Asian\t28", get_state_as_dict(xTitleStyle.getChild('4'))['Text'])
+ self.assertEqual("Char Height Complex\t28", get_state_as_dict(xTitleStyle.getChild('5'))['Text'])
+ self.assertEqual("Char Property Height\t100", get_state_as_dict(xTitleStyle.getChild('6'))['Text'])
+ self.assertEqual("Char Property Height Asian\t100", get_state_as_dict(xTitleStyle.getChild('7'))['Text'])
+ self.assertEqual("Char Property Height Complex\t100", get_state_as_dict(xTitleStyle.getChild('8'))['Text'])
+ self.assertEqual("Char Weight\tBold", get_state_as_dict(xTitleStyle.getChild('9'))['Text'])
+ self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xTitleStyle.getChild('10'))['Text'])
+ self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xTitleStyle.getChild('11'))['Text'])
+ self.assertEqual("Follow Style\tText body", get_state_as_dict(xTitleStyle.getChild('12'))['Text'])
+ self.assertEqual("Para Adjust\t3", get_state_as_dict(xTitleStyle.getChild('13'))['Text'])
+ self.assertEqual("Para Expand Single Word\tFalse", get_state_as_dict(xTitleStyle.getChild('14'))['Text'])
+ self.assertEqual("Para Last Line Adjust\t0", get_state_as_dict(xTitleStyle.getChild('15'))['Text'])
+
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with custom style
+ xParStyle = xListBox.getChild('0')
+ self.assertEqual(3, len(xParStyle.getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xParStyle.getChild('0'))['Text'])
+ self.assertEqual(136, len(xParStyle.getChild('0').getChildren()))
+ self.assertEqual("Text Body\t", get_state_as_dict(xParStyle.getChild('1'))['Text'])
+ self.assertEqual(6, len(xParStyle.getChild('1').getChildren()))
+
+ xCustomStyle = xParStyle.getChild('2')
+ self.assertEqual("Custom_Style\t", get_state_as_dict(xCustomStyle)['Text'])
+ self.assertEqual(7, len(xCustomStyle.getChildren()))
+ self.assertEqual("Char Color\t0xff5429", get_state_as_dict(xCustomStyle.getChild('0'))['Text'])
+ self.assertEqual("Char Difference Height\t0", get_state_as_dict(xCustomStyle.getChild('1'))['Text'])
+ self.assertEqual("Char Height\t20", get_state_as_dict(xCustomStyle.getChild('2'))['Text'])
+ self.assertEqual("Char Property Height\t100", get_state_as_dict(xCustomStyle.getChild('3'))['Text'])
+ self.assertEqual("Char Transparence\t0", get_state_as_dict(xCustomStyle.getChild('4'))['Text'])
+ self.assertEqual("Char Weight\tBold", get_state_as_dict(xCustomStyle.getChild('5'))['Text'])
+ self.assertEqual("Follow Style\tCustom_Style", get_state_as_dict(xCustomStyle.getChild('6'))['Text'])
+
+ self.assertEqual(7, len(xListBox.getChild('0').getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_metadata(self):
- self.ui_test.load_file(get_url_for_data_file("metadata.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
-
- xListBox = xWriterEdit.getChild('listbox_fonts')
-
- # The cursor is on text without metadata
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with paragraph metadata showed under direct paragraph formatting
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
-
- xParDirFormatting = xListBox.getChild('1')
- self.assertEqual(1, len(xParDirFormatting.getChildren()))
- self.assertEqual("Metadata Reference\t", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
-
- xMetadata = xParDirFormatting.getChild('0')
- self.assertEqual(4, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tpara1", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tParagraph", get_state_as_dict(xMetadata.getChild('1'))['Text'])
- self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tAbout this paragraph...", get_state_as_dict(xMetadata.getChild('2'))['Text'])
- self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph", get_state_as_dict(xMetadata.getChild('3'))['Text'])
-
- self.xUITest.executeCommand(".uno:GoDown")
- # FIXME jump over the control character (not visible in getString(), but it affects
- # cursor position and availability of NestedTextContent)
- self.xUITest.executeCommand(".uno:GoRight")
-
- # The cursor is on text with annotated text range
- xDirFormatting = xListBox.getChild('3')
- self.assertEqual(2, len(xDirFormatting.getChildren()))
- self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Nested Text Content\tAnnotated text range", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
-
- xMetadata = xDirFormatting.getChild('0')
- self.assertEqual(4, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tid2758386667", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tText span", get_state_as_dict(xMetadata.getChild('1'))['Text'])
- self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tComment...", get_state_as_dict(xMetadata.getChild('2'))['Text'])
- self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph portion", get_state_as_dict(xMetadata.getChild('3'))['Text'])
-
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
-
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("metadata.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ xListBox = xWriterEdit.getChild('listbox_fonts')
+
+ # The cursor is on text without metadata
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with paragraph metadata showed under direct paragraph formatting
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+
+ xParDirFormatting = xListBox.getChild('1')
+ self.assertEqual(1, len(xParDirFormatting.getChildren()))
+ self.assertEqual("Metadata Reference\t", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
+
+ xMetadata = xParDirFormatting.getChild('0')
+ self.assertEqual(4, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tpara1", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tParagraph", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+ self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tAbout this paragraph...", get_state_as_dict(xMetadata.getChild('2'))['Text'])
+ self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph", get_state_as_dict(xMetadata.getChild('3'))['Text'])
+
+ self.xUITest.executeCommand(".uno:GoDown")
+ # FIXME jump over the control character (not visible in getString(), but it affects
+ # cursor position and availability of NestedTextContent)
+ self.xUITest.executeCommand(".uno:GoRight")
+
+ # The cursor is on text with annotated text range
+ xDirFormatting = xListBox.getChild('3')
+ self.assertEqual(2, len(xDirFormatting.getChildren()))
+ self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Nested Text Content\tAnnotated text range", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
+
+ xMetadata = xDirFormatting.getChild('0')
+ self.assertEqual(4, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tid2758386667", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tText span", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+ self.assertEqual("http://www.w3.org/2000/01/rdf-schema#comment\tComment...", get_state_as_dict(xMetadata.getChild('2'))['Text'])
+ self.assertEqual("http://www.w3.org/2000/01/rdf-schema#label\tAnnotated paragraph portion", get_state_as_dict(xMetadata.getChild('3'))['Text'])
+
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_bookmark_metadata(self):
- self.ui_test.load_file(get_url_for_data_file("bookmark-metadata.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
-
- xListBox = xWriterEdit.getChild('listbox_fonts')
-
- # The cursor is on text without metadata
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # The cursor is on text with paragraph metadata showed under direct paragraph formatting
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
-
- # Outer bookmark
- xBookmarkFormatting = xListBox.getChild('4')
- self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
- self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
-
- self.xUITest.executeCommand(".uno:GoDown")
-
- # Inner bookmark
- xBookmarkFormatting = xListBox.getChild('4')
- self.assertEqual(2, len(xBookmarkFormatting.getChildren()))
-
- self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
- xMetadata = xBookmarkFormatting.getChild('0').getChild('0')
- self.assertEqual(2, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tID-566430c5-9857-4ff2-be6d-57d127368d88", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
-
- self.assertEqual("Bookmark 2\t", get_state_as_dict(xBookmarkFormatting.getChild('1'))['Text'])
- xMetadata = xBookmarkFormatting.getChild('1').getChild('0')
- self.assertEqual(2, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tID-941142c3-924d-4884-a521-cb6a2dd26f04", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
-
- # Only in outer bookmark again
- self.xUITest.executeCommand(".uno:GoDown")
- xBookmarkFormatting = xListBox.getChild('4')
- self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
- self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
-
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("bookmark-metadata.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ xListBox = xWriterEdit.getChild('listbox_fonts')
+
+ # The cursor is on text without metadata
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # The cursor is on text with paragraph metadata showed under direct paragraph formatting
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+
+ # Outer bookmark
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
+ self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+
+ self.xUITest.executeCommand(".uno:GoDown")
+
+ # Inner bookmark
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(2, len(xBookmarkFormatting.getChildren()))
+
+ self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+ xMetadata = xBookmarkFormatting.getChild('0').getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-566430c5-9857-4ff2-be6d-57d127368d88", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ self.assertEqual("Bookmark 2\t", get_state_as_dict(xBookmarkFormatting.getChild('1'))['Text'])
+ xMetadata = xBookmarkFormatting.getChild('1').getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-941142c3-924d-4884-a521-cb6a2dd26f04", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ self.assertEqual("http://www.w3.org/1999/02/22-rdf-syntax-ns#type\tBookmark", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ # Only in outer bookmark again
+ self.xUITest.executeCommand(".uno:GoDown")
+ xBookmarkFormatting = xListBox.getChild('4')
+ self.assertEqual(1, len(xBookmarkFormatting.getChildren()))
+ self.assertEqual("Bookmark 1\t", get_state_as_dict(xBookmarkFormatting.getChild('0'))['Text'])
+
+ self.xUITest.executeCommand(".uno:Sidebar")
def test_metadata_shading_color(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("metacolor.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- self.xUITest.executeCommand(".uno:Sidebar")
- xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
-
- xListBox = xWriterEdit.getChild('listbox_fonts')
-
- # The cursor is on text without metadata
- self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
- self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
- self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
-
- # go to next word with RDF annotation
- self.xUITest.executeCommand(".uno:GoToNextWord")
- self.xUITest.executeCommand(".uno:GoRight")
-
- # FIXME jump over the control character (not visible in getString(), but it affects
- # cursor position and availability of NestedTextContent)
- self.xUITest.executeCommand(".uno:GoRight")
-
- # The cursor is on text with annotated text range
- xDirFormatting = xListBox.getChild('3')
- self.assertEqual(2, len(xDirFormatting.getChildren()))
- self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Nested Text Content\tipsum", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
-
- xMetadata = xDirFormatting.getChild('0')
- self.assertEqual(2, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tID-f1a8a096-7a43-4bda-a462-d73c2800dd9a", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- # RGB code of the custom shading color of the annotated text range is FFB7E9
- self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tFFB7E9", get_state_as_dict(xMetadata.getChild('1'))['Text'])
-
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
-
- # go to next word with RDF annotation
- self.xUITest.executeCommand(".uno:GoToNextWord")
- self.xUITest.executeCommand(".uno:GoToNextWord")
- self.xUITest.executeCommand(".uno:GoToNextWord")
- self.xUITest.executeCommand(".uno:GoRight")
-
- # The cursor is on text with annotated text range
- xDirFormatting = xListBox.getChild('3')
- self.assertEqual(2, len(xDirFormatting.getChildren()))
- self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
- self.assertEqual("Nested Text Content\tames", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
-
- xMetadata = xDirFormatting.getChild('0')
- print(get_state_as_dict(xMetadata))
- self.assertEqual(2, len(xMetadata.getChildren()))
- self.assertEqual("xml:id\tID-24478193-9630-4d03-8976-9e097c843a0b", get_state_as_dict(xMetadata.getChild('0'))['Text'])
- # RGB code of the custom shading color of the annotated text range is 97E1E9 (the code can be lower case, see STRtoRGB)
- self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\t97e1e9", get_state_as_dict(xMetadata.getChild('1'))['Text'])
-
- self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
- self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
-
- # add a new annotated text range and check it in the Style Inspector
- self.xUITest.executeCommand(".uno:GoToStartOfDoc")
-
- # create annotated text range on "Lorem"
- viewCursor = writer_doc.CurrentController.getViewCursor()
- viewCursor.goRight(5, True)
- rdf = writer_doc.createInstance("com.sun.star.text.InContentMetadata")
- writer_doc.Text.insertTextContent(viewCursor, rdf, True)
-
- # set its custom shading color using the new URI const LO_EXT_SHADING
- repository = writer_doc.getRDFRepository()
- # get metadata graph of file "custom.rdf" stored in the test document
- xCustomGraph = [repository.getGraph(i) for i in repository.getGraphNames() if i.LocalName == "custom.rdf"]
- self.assertEqual(1, len(xCustomGraph))
-
- smgr = self.xContext.ServiceManager
- xShadingURI = smgr.createInstance('com.sun.star.rdf.URI')
- xShadingURI.initialize((LO_EXT_SHADING,))
- xShadingColor = smgr.createInstance('com.sun.star.rdf.Literal')
- xShadingColor.initialize(('BBFF88',))
- xCustomGraph[0].addStatement(rdf, xShadingURI, xShadingColor)
-
- # remove the selection
- self.xUITest.executeCommand(".uno:GoLeft")
-
- # FIXME: neither LO_EXT_SHADING, nor odf:prefix/odf:suffix changes update the View,
- # so add a temporary bookmark to the text range to trigger the color change immediately
- self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
- xBookDlg = self.xUITest.getTopFocusWindow()
- xInsertBtn = xBookDlg.getChild("insert")
- xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
- self.xUITest.executeCommand(".uno:Undo")
-
- xDirFormatting = xListBox.getChild('3')
- xMetadata = xDirFormatting.getChild('0')
- self.assertEqual(2, len(xMetadata.getChildren()))
- # RGB code of the custom shading color of the annotated text range is BBFF88
- self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tBBFF88", get_state_as_dict(xMetadata.getChild('1'))['Text'])
-
- self.xUITest.executeCommand(".uno:Sidebar")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("metacolor.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
+
+ xListBox = xWriterEdit.getChild('listbox_fonts')
+
+ # The cursor is on text without metadata
+ self.assertEqual(1, len(xListBox.getChild('0').getChildren()))
+ self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
+ self.assertEqual(136, len(xListBox.getChild('0').getChild('0').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+
+ # go to next word with RDF annotation
+ self.xUITest.executeCommand(".uno:GoToNextWord")
+ self.xUITest.executeCommand(".uno:GoRight")
+
+ # FIXME jump over the control character (not visible in getString(), but it affects
+ # cursor position and availability of NestedTextContent)
+ self.xUITest.executeCommand(".uno:GoRight")
+
+ # The cursor is on text with annotated text range
+ xDirFormatting = xListBox.getChild('3')
+ self.assertEqual(2, len(xDirFormatting.getChildren()))
+ self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Nested Text Content\tipsum", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
+
+ xMetadata = xDirFormatting.getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-f1a8a096-7a43-4bda-a462-d73c2800dd9a", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ # RGB code of the custom shading color of the annotated text range is FFB7E9
+ self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tFFB7E9", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+
+ # go to next word with RDF annotation
+ self.xUITest.executeCommand(".uno:GoToNextWord")
+ self.xUITest.executeCommand(".uno:GoToNextWord")
+ self.xUITest.executeCommand(".uno:GoToNextWord")
+ self.xUITest.executeCommand(".uno:GoRight")
+
+ # The cursor is on text with annotated text range
+ xDirFormatting = xListBox.getChild('3')
+ self.assertEqual(2, len(xDirFormatting.getChildren()))
+ self.assertEqual("Metadata Reference\t", get_state_as_dict(xDirFormatting.getChild('0'))['Text'])
+ self.assertEqual("Nested Text Content\tames", get_state_as_dict(xDirFormatting.getChild('1'))['Text'])
+
+ xMetadata = xDirFormatting.getChild('0')
+ print(get_state_as_dict(xMetadata))
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ self.assertEqual("xml:id\tID-24478193-9630-4d03-8976-9e097c843a0b", get_state_as_dict(xMetadata.getChild('0'))['Text'])
+ # RGB code of the custom shading color of the annotated text range is 97E1E9 (the code can be lower case, see STRtoRGB)
+ self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\t97e1e9", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ self.assertEqual(0, len(xListBox.getChild('1').getChildren()))
+ self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
+
+ # add a new annotated text range and check it in the Style Inspector
+ self.xUITest.executeCommand(".uno:GoToStartOfDoc")
+
+ # create annotated text range on "Lorem"
+ viewCursor = writer_doc.CurrentController.getViewCursor()
+ viewCursor.goRight(5, True)
+ rdf = writer_doc.createInstance("com.sun.star.text.InContentMetadata")
+ writer_doc.Text.insertTextContent(viewCursor, rdf, True)
+
+ # set its custom shading color using the new URI const LO_EXT_SHADING
+ repository = writer_doc.getRDFRepository()
+ # get metadata graph of file "custom.rdf" stored in the test document
+ xCustomGraph = [repository.getGraph(i) for i in repository.getGraphNames() if i.LocalName == "custom.rdf"]
+ self.assertEqual(1, len(xCustomGraph))
+
+ smgr = self.xContext.ServiceManager
+ xShadingURI = smgr.createInstance('com.sun.star.rdf.URI')
+ xShadingURI.initialize((LO_EXT_SHADING,))
+ xShadingColor = smgr.createInstance('com.sun.star.rdf.Literal')
+ xShadingColor.initialize(('BBFF88',))
+ xCustomGraph[0].addStatement(rdf, xShadingURI, xShadingColor)
+
+ # remove the selection
+ self.xUITest.executeCommand(".uno:GoLeft")
+
+ # FIXME: neither LO_EXT_SHADING, nor odf:prefix/odf:suffix changes update the View,
+ # so add a temporary bookmark to the text range to trigger the color change immediately
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+ self.xUITest.executeCommand(".uno:Undo")
+
+ xDirFormatting = xListBox.getChild('3')
+ xMetadata = xDirFormatting.getChild('0')
+ self.assertEqual(2, len(xMetadata.getChildren()))
+ # RGB code of the custom shading color of the annotated text range is BBFF88
+ self.assertEqual("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0odf#shading\tBBFF88", get_state_as_dict(xMetadata.getChild('1'))['Text'])
+
+ self.xUITest.executeCommand(".uno:Sidebar")
diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py
index 7beff37c6c8d..4f48eeb644db 100644
--- a/sw/qa/uitest/table/sheetToTable.py
+++ b/sw/qa/uitest/table/sheetToTable.py
@@ -13,58 +13,52 @@ from uitest.uihelper.calc import enter_text_to_cell
class sheetToTable(UITestCase):
def test_sheet_to_table_without_hidden_rows(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- self.ui_test.close_doc()
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:Paste")
- #verify (don't copy hidden cells)
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
- # This was 3 (copied hidden row)
- self.assertEqual(len(table.getRows()), 2)
- self.assertEqual(table.getCellByName("A1").getString(), "1")
- # This was "2 (hidden)" (copied hidden row)
- self.assertEqual(table.getCellByName("A2").getString(), "3")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.xUITest.executeCommand(".uno:Paste")
+ #verify (don't copy hidden cells)
+ self.assertEqual(document.TextTables.getCount(), 1)
+ table = document.getTextTables()[0]
+ # This was 3 (copied hidden row)
+ self.assertEqual(len(table.getRows()), 2)
+ self.assertEqual(table.getCellByName("A1").getString(), "1")
+ # This was "2 (hidden)" (copied hidden row)
+ self.assertEqual(table.getCellByName("A2").getString(), "3")
def test_tdf138688(self):
- calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods"))
- xCalcDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:SelectAll")
- self.xUITest.executeCommand(".uno:Copy")
- gridwin = xCalcDoc.getChild("grid_window")
- document = self.ui_test.get_component()
- self.ui_test.close_doc()
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # set numbering in the paragraph after the table
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:DefaultNumbering")
- self.xUITest.executeCommand(".uno:GoUp")
- self.xUITest.executeCommand(".uno:GoUp")
-
- #verify (this was a freezing/crash)
- self.xUITest.executeCommand(".uno:Paste")
-
- #verify also tdf#124646 (don't copy hidden cells)
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
- # This was 3 (copied hidden row)
- self.assertEqual(len(table.getRows()), 2)
- self.assertEqual(table.getCellByName("A1").getString(), "1")
- # This was "2 (hidden)" (copied hidden row)
- self.assertEqual(table.getCellByName("A2").getString(), "3")
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # set numbering in the paragraph after the table
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:DefaultNumbering")
+ self.xUITest.executeCommand(".uno:GoUp")
+ self.xUITest.executeCommand(".uno:GoUp")
+
+ #verify (this was a freezing/crash)
+ self.xUITest.executeCommand(".uno:Paste")
+
+ #verify also tdf#124646 (don't copy hidden cells)
+ self.assertEqual(document.TextTables.getCount(), 1)
+ table = document.getTextTables()[0]
+ # This was 3 (copied hidden row)
+ self.assertEqual(len(table.getRows()), 2)
+ self.assertEqual(table.getCellByName("A1").getString(), "1")
+ # This was "2 (hidden)" (copied hidden row)
+ self.assertEqual(table.getCellByName("A2").getString(), "3")
def test_tdf129083(self):
calc_doc = self.ui_test.create_doc_in_start_center("calc")
@@ -84,17 +78,16 @@ class sheetToTable(UITestCase):
self.ui_test.close_doc()
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf129083.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
- self.assertEqual(document.TextTables.getCount(), 1)
- table = document.getTextTables()[0]
- self.assertEqual(len(table.getRows()), 4)
- self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
- self.assertEqual(table.getCellByName("A2").getString(), "Test 2")
- self.assertEqual(table.getCellByName("A3").getString(), "Test 3")
- self.assertEqual(table.getCellByName("A4").getString(), "Test 4")
- self.ui_test.close_doc()
+ self.assertEqual(document.TextTables.getCount(), 1)
+ table = document.getTextTables()[0]
+ self.assertEqual(len(table.getRows()), 4)
+ self.assertEqual(table.getCellByName("A1").getString(), "Test 1")
+ self.assertEqual(table.getCellByName("A2").getString(), "Test 2")
+ self.assertEqual(table.getCellByName("A3").getString(), "Test 3")
+ self.assertEqual(table.getCellByName("A4").getString(), "Test 4")
diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py
index 402aab45d543..e4fdecac6fa0 100644
--- a/sw/qa/uitest/table/splitTable.py
+++ b/sw/qa/uitest/table/splitTable.py
@@ -11,74 +11,70 @@ from uitest.uihelper.common import get_url_for_data_file
class splitTable(UITestCase):
def test_split_table(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #go to row 2
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:GoDown")
- #dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #go to row 2
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ #dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows
+ self.ui_test.execute_dialog_through_command(".uno:SplitTable")
+ xDialog = self.xUITest.getTopFocusWindow()
- copyheading = xDialog.getChild("copyheading")
- copyheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[1].getRows()), 5)
- #undo -> verify 1 tables
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
-
- self.ui_test.close_doc()
+ copyheading = xDialog.getChild("copyheading")
+ copyheading.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(document.TextTables.getCount(), 2)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[1].getRows()), 5)
+ #undo -> verify 1 tables
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
#dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
- writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #go to row 2
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:GoDown")
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #go to row 2
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.ui_test.execute_dialog_through_command(".uno:SplitTable")
+ xDialog = self.xUITest.getTopFocusWindow()
- customheading = xDialog.getChild("customheading")
- customheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[1].getRows()), 4)
- #undo -> verify 1 tables
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ customheading = xDialog.getChild("customheading")
+ customheading.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(document.TextTables.getCount(), 2)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[1].getRows()), 4)
+ #undo -> verify 1 tables
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- self.ui_test.close_doc()
#dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
- writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #go to row 2
- self.xUITest.executeCommand(".uno:GoDown")
- self.xUITest.executeCommand(".uno:GoDown")
- self.ui_test.execute_dialog_through_command(".uno:SplitTable")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #go to row 2
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.ui_test.execute_dialog_through_command(".uno:SplitTable")
+ xDialog = self.xUITest.getTopFocusWindow()
- noheading = xDialog.getChild("noheading")
- noheading.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(document.TextTables.getCount(), 2)
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 2)
- self.assertEqual(len(tables[1].getRows()), 4)
- #undo -> verify 1 tables
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ noheading = xDialog.getChild("noheading")
+ noheading.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ self.assertEqual(document.TextTables.getCount(), 2)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[1].getRows()), 4)
+ #undo -> verify 1 tables
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py
index da75f2218255..4c2b34ab0a16 100644
--- a/sw/qa/uitest/table/tableProperties.py
+++ b/sw/qa/uitest/table/tableProperties.py
@@ -15,208 +15,207 @@ from uitest.uihelper.common import change_measurement_unit
class tableProperties(UITestCase):
def test_table_properties(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- change_measurement_unit(self, "Centimeter")
-
- #dialog Table Properties - Table
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- name = xDialog.getChild("name")
- free = xDialog.getChild("free")
- widthmf = xDialog.getChild("widthmf")
- leftmf = xDialog.getChild("leftmf")
- rightmf = xDialog.getChild("rightmf")
- abovemf = xDialog.getChild("abovemf")
- belowmf = xDialog.getChild("belowmf")
- textdirection = xDialog.getChild("textdirection")
-
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
- free.executeAction("CLICK", tuple())
- widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
- select_by_text(textdirection, "Left-to-right (LTR)")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "0")
-
- name = xDialog.getChild("name")
- free = xDialog.getChild("free")
- widthmf = xDialog.getChild("widthmf")
- leftmf = xDialog.getChild("leftmf")
- rightmf = xDialog.getChild("rightmf")
- abovemf = xDialog.getChild("abovemf")
- belowmf = xDialog.getChild("belowmf")
- textdirection = xDialog.getChild("textdirection")
-
- self.assertEqual(get_state_as_dict(name)["Text"], "NewName")
- self.assertEqual(get_state_as_dict(free)["Checked"], "true")
- self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm")
- self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm")
- self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #dialog Table Properties - Text flow
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- xbreak = xDialog.getChild("break")
- xbreak.executeAction("CLICK", tuple())
- column = xDialog.getChild("column")
- column.executeAction("CLICK", tuple())
- after = xDialog.getChild("after")
- after.executeAction("CLICK", tuple())
- keep = xDialog.getChild("keep")
- keep.executeAction("CLICK", tuple())
- headline = xDialog.getChild("headline")
- headline.executeAction("CLICK", tuple())
- textdirection = xDialog.getChild("textorientation")
- select_by_text(textdirection, "Vertical (bottom to top)")
- vertorient = xDialog.getChild("vertorient")
- select_by_text(vertorient, "Bottom")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "1")
-
- xbreak = xDialog.getChild("break")
- self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true")
- column = xDialog.getChild("column")
- self.assertEqual(get_state_as_dict(column)["Checked"], "true")
- after = xDialog.getChild("column")
- self.assertEqual(get_state_as_dict(after)["Checked"], "true")
- keep = xDialog.getChild("keep")
- self.assertEqual(get_state_as_dict(keep)["Selected"], "true")
- headline = xDialog.getChild("headline")
- self.assertEqual(get_state_as_dict(headline)["Selected"], "true")
- textdirection = xDialog.getChild("textorientation")
- self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)")
- vertorient = xDialog.getChild("vertorient")
- self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #dialog Table Properties - Columns
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2")
-
- adaptwidth = xDialog.getChild("adaptwidth")
- adaptwidth.executeAction("CLICK", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- #doesn't work / probably Bug 100537 - Width and relative checkboxes disabled in Table
- #dialog by default with automatic alignment
-# self.ui_test.execute_dialog_through_command(".uno:TableDialog")
-# xDialog = self.xUITest.getTopFocusWindow()
-# tabcontrol = xDialog.getChild("tabcontrol")
-# select_pos(tabcontrol, "2")
-# adaptwidth = xDialog.getChild("adaptwidth")
-# self.assertEqual(get_state_as_dict(adaptwidth)["Selected"], "true")
-# xOKBtn = xDialog.getChild("ok")
-# self.ui_test.close_dialog_through_button(xOKBtn)
-
- #dialog Table Properties - Borders
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
-
- sync = xDialog.getChild("sync")
- mergeadjacent = xDialog.getChild("mergeadjacent")
- sync.executeAction("CLICK", tuple())
- mergeadjacent.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "3")
- sync = xDialog.getChild("sync")
- mergeadjacent = xDialog.getChild("mergeadjacent")
-# self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique
- self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #dialog Table Properties - Background
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "4")
-
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
- R_custom = xDialog.getChild("R_custom")
- G_custom = xDialog.getChild("G_custom")
- B_custom = xDialog.getChild("B_custom")
- R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
- B_custom.executeAction("UP", tuple())
- B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value...
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- #verify
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "4")
- btncolor = xDialog.getChild("btncolor")
- btncolor.executeAction("CLICK", tuple())
- R_custom = xDialog.getChild("R_custom")
- G_custom = xDialog.getChild("G_custom")
- B_custom = xDialog.getChild("B_custom")
-
- self.assertEqual(get_state_as_dict(R_custom)["Text"], "100")
- self.assertEqual(get_state_as_dict(B_custom)["Text"], "100")
- self.assertEqual(get_state_as_dict(G_custom)["Text"], "100")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ #dialog Table Properties - Table
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ name = xDialog.getChild("name")
+ free = xDialog.getChild("free")
+ widthmf = xDialog.getChild("widthmf")
+ leftmf = xDialog.getChild("leftmf")
+ rightmf = xDialog.getChild("rightmf")
+ abovemf = xDialog.getChild("abovemf")
+ belowmf = xDialog.getChild("belowmf")
+ textdirection = xDialog.getChild("textdirection")
+
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
+ free.executeAction("CLICK", tuple())
+ widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ select_by_text(textdirection, "Left-to-right (LTR)")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ name = xDialog.getChild("name")
+ free = xDialog.getChild("free")
+ widthmf = xDialog.getChild("widthmf")
+ leftmf = xDialog.getChild("leftmf")
+ rightmf = xDialog.getChild("rightmf")
+ abovemf = xDialog.getChild("abovemf")
+ belowmf = xDialog.getChild("belowmf")
+ textdirection = xDialog.getChild("textdirection")
+
+ self.assertEqual(get_state_as_dict(name)["Text"], "NewName")
+ self.assertEqual(get_state_as_dict(free)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm")
+ self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #dialog Table Properties - Text flow
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xbreak = xDialog.getChild("break")
+ xbreak.executeAction("CLICK", tuple())
+ column = xDialog.getChild("column")
+ column.executeAction("CLICK", tuple())
+ after = xDialog.getChild("after")
+ after.executeAction("CLICK", tuple())
+ keep = xDialog.getChild("keep")
+ keep.executeAction("CLICK", tuple())
+ headline = xDialog.getChild("headline")
+ headline.executeAction("CLICK", tuple())
+ textdirection = xDialog.getChild("textorientation")
+ select_by_text(textdirection, "Vertical (bottom to top)")
+ vertorient = xDialog.getChild("vertorient")
+ select_by_text(vertorient, "Bottom")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xbreak = xDialog.getChild("break")
+ self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true")
+ column = xDialog.getChild("column")
+ self.assertEqual(get_state_as_dict(column)["Checked"], "true")
+ after = xDialog.getChild("column")
+ self.assertEqual(get_state_as_dict(after)["Checked"], "true")
+ keep = xDialog.getChild("keep")
+ self.assertEqual(get_state_as_dict(keep)["Selected"], "true")
+ headline = xDialog.getChild("headline")
+ self.assertEqual(get_state_as_dict(headline)["Selected"], "true")
+ textdirection = xDialog.getChild("textorientation")
+ self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)")
+ vertorient = xDialog.getChild("vertorient")
+ self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #dialog Table Properties - Columns
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ adaptwidth = xDialog.getChild("adaptwidth")
+ adaptwidth.executeAction("CLICK", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ #doesn't work / probably Bug 100537 - Width and relative checkboxes disabled in Table
+ #dialog by default with automatic alignment
+ # self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ # xDialog = self.xUITest.getTopFocusWindow()
+ # tabcontrol = xDialog.getChild("tabcontrol")
+ # select_pos(tabcontrol, "2")
+ # adaptwidth = xDialog.getChild("adaptwidth")
+ # self.assertEqual(get_state_as_dict(adaptwidth)["Selected"], "true")
+ # xOKBtn = xDialog.getChild("ok")
+ # self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #dialog Table Properties - Borders
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+
+ sync = xDialog.getChild("sync")
+ mergeadjacent = xDialog.getChild("mergeadjacent")
+ sync.executeAction("CLICK", tuple())
+ mergeadjacent.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #verify
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "3")
+ sync = xDialog.getChild("sync")
+ mergeadjacent = xDialog.getChild("mergeadjacent")
+ # self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique
+ self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #dialog Table Properties - Background
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "4")
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+ R_custom = xDialog.getChild("R_custom")
+ G_custom = xDialog.getChild("G_custom")
+ B_custom = xDialog.getChild("B_custom")
+ R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"}))
+ B_custom.executeAction("UP", tuple())
+ B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value...
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #verify
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "4")
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+ R_custom = xDialog.getChild("R_custom")
+ G_custom = xDialog.getChild("G_custom")
+ B_custom = xDialog.getChild("B_custom")
+
+ self.assertEqual(get_state_as_dict(R_custom)["Text"], "100")
+ self.assertEqual(get_state_as_dict(B_custom)["Text"], "100")
+ self.assertEqual(get_state_as_dict(G_custom)["Text"], "100")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py
index f131f914c93e..110a3e0837d6 100644
--- a/sw/qa/uitest/table/tableToText.py
+++ b/sw/qa/uitest/table/tableToText.py
@@ -12,68 +12,67 @@ from uitest.uihelper.common import get_url_for_data_file
class tableToText(UITestCase):
def test_table_to_text(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #dialog Table to text - Tabs; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- tabs = xDialog.getChild("tabs")
- tabs.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(document.Text.String[0:3], "a\ta")
- self.assertEqual(document.TextTables.getCount(), 0)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #dialog Table to text - Tabs; verify
+ self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabs = xDialog.getChild("tabs")
+ tabs.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(document.Text.String[0:3], "a\ta")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- #dialog Table to text - Paragraph; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- paragraph = xDialog.getChild("paragraph")
- paragraph.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
- self.assertEqual(document.TextTables.getCount(), 0)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ #dialog Table to text - Paragraph; verify
+ self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
+ xDialog = self.xUITest.getTopFocusWindow()
+ paragraph = xDialog.getChild("paragraph")
+ paragraph.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- #dialog Table to text - Semicolons; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- semicolons = xDialog.getChild("semicolons")
- semicolons.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
- self.assertEqual(document.TextTables.getCount(), 0)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ #dialog Table to text - Semicolons; verify
+ self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
+ xDialog = self.xUITest.getTopFocusWindow()
+ semicolons = xDialog.getChild("semicolons")
+ semicolons.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- #dialog Table to text - other; verify
- self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
- xDialog = self.xUITest.getTopFocusWindow()
- other = xDialog.getChild("other")
- other.executeAction("CLICK", tuple())
- othered = xDialog.getChild("othered")
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
- self.assertEqual(document.TextTables.getCount(), 0)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 1)
+ #dialog Table to text - other; verify
+ self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
+ xDialog = self.xUITest.getTopFocusWindow()
+ other = xDialog.getChild("other")
+ other.executeAction("CLICK", tuple())
+ othered = xDialog.getChild("othered")
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 1)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
index 019c492374a1..ff34dd75e9d0 100644
--- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
+++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py
@@ -14,38 +14,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
class tdf134881(UITestCase):
def test_tdf134881(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- change_measurement_unit(self, "Centimeter")
-
- #dialog Table Properties
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "2") #columns
-
- adaptcolumns = xDialog.getChild("adaptcolumns")
- width1 = xDialog.getChild("width1")
- width2 = xDialog.getChild("width2")
- # Get the baseline. The first column is much shorter than the second.
- self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0")
- self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0")
- # Set proportional adjust - so all columns are affected.
- adaptcolumns.executeAction("CLICK", tuple())
- # Cut the second column in half.
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"}))
- width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
-
- # The first column should now be half it's original value, not zero (not 3 - 7)
- self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ #dialog Table Properties
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2") #columns
+
+ adaptcolumns = xDialog.getChild("adaptcolumns")
+ width1 = xDialog.getChild("width1")
+ width2 = xDialog.getChild("width2")
+ # Get the baseline. The first column is much shorter than the second.
+ self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0")
+ self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0")
+ # Set proportional adjust - so all columns are affected.
+ adaptcolumns.executeAction("CLICK", tuple())
+ # Cut the second column in half.
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"}))
+ width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # The first column should now be half it's original value, not zero (not 3 - 7)
+ self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf135693.py b/sw/qa/uitest/table/tdf135693.py
index 39026fcbfd27..f4a0a7b8cfa3 100644
--- a/sw/qa/uitest/table/tdf135693.py
+++ b/sw/qa/uitest/table/tdf135693.py
@@ -11,27 +11,25 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf135693(UITestCase):
def test_tdf135693(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf135693.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")) as writer_doc:
- self.xUITest.getTopFocusWindow()
+ self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoDown")
- # Without the fix in place, this would have crashed here
- self.ui_test.execute_dialog_through_command(".uno:TableDialog")
+ # Without the fix in place, this would have crashed here
+ self.ui_test.execute_dialog_through_command(".uno:TableDialog")
- xTableDlg = self.xUITest.getTopFocusWindow()
+ xTableDlg = self.xUITest.getTopFocusWindow()
- xTabs = xTableDlg.getChild("tabcontrol")
- select_pos(xTabs, "0")
+ xTabs = xTableDlg.getChild("tabcontrol")
+ select_pos(xTabs, "0")
- # Check we are in the right table
- self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text'])
+ # Check we are in the right table
+ self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text'])
- xok = xTableDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xok)
-
- self.ui_test.close_doc()
+ xok = xTableDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xok)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py
index 343b1a89bb13..50996861d6ac 100644
--- a/sw/qa/uitest/table/tdf81292.py
+++ b/sw/qa/uitest/table/tdf81292.py
@@ -12,30 +12,29 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf81292(UITestCase):
def test_tdf81292_table_sort(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81292.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #select whole table
- self.xUITest.executeCommand(".uno:SelectTable")
- #Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xDown = xDialog.getChild("down1")
- xDown.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #verify
- tables = document.getTextTables()
- table = tables[0]
- tableText = table.getCellByName("B3")
- b3 = tableText.getString()
- tableTextc1 = table.getCellByName("C1").getString()
- self.assertEqual(b3, "https://www.hightail.com/")
- self.assertEqual(tableTextc1, "inlognaam")
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- b3 = tableText.getString()
- self.assertEqual(b3, "www.comicstripshop.com")
+ with self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #select whole table
+ self.xUITest.executeCommand(".uno:SelectTable")
+ #Tools - Sort
+ self.ui_test.execute_dialog_through_command(".uno:SortDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xDown = xDialog.getChild("down1")
+ xDown.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #verify
+ tables = document.getTextTables()
+ table = tables[0]
+ tableText = table.getCellByName("B3")
+ b3 = tableText.getString()
+ tableTextc1 = table.getCellByName("C1").getString()
+ self.assertEqual(b3, "https://www.hightail.com/")
+ self.assertEqual(tableTextc1, "inlognaam")
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ b3 = tableText.getString()
+ self.assertEqual(b3, "www.comicstripshop.com")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py
index e87226a0c485..9e1b649becbe 100644
--- a/sw/qa/uitest/table/tdf99334.py
+++ b/sw/qa/uitest/table/tdf99334.py
@@ -12,28 +12,27 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf99334(UITestCase):
def test_tdf99334_table_sort_umlauts(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf99334.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- #select whole table
- self.xUITest.executeCommand(".uno:SelectTable")
- #Tools - Sort
- self.ui_test.execute_dialog_through_command(".uno:SortDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- # xDown = xDialog.getChild("down1")
- # xDown.executeAction("CLICK", tuple())
- xOK = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOK)
- #verify
- tables = document.getTextTables()
- table = tables[0]
- tableText = table.getCellByName("B1")
- b1 = tableText.getString()
- self.assertEqual(b1, "two")
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- b1 = tableText.getString()
- self.assertEqual(b1, "one")
+ with self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #select whole table
+ self.xUITest.executeCommand(".uno:SelectTable")
+ #Tools - Sort
+ self.ui_test.execute_dialog_through_command(".uno:SortDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # xDown = xDialog.getChild("down1")
+ # xDown.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #verify
+ tables = document.getTextTables()
+ table = tables[0]
+ tableText = table.getCellByName("B1")
+ b1 = tableText.getString()
+ self.assertEqual(b1, "two")
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ b1 = tableText.getString()
+ self.assertEqual(b1, "one")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py
index d901ae6d2c04..2b820b360653 100644
--- a/sw/qa/uitest/table/textToTable.py
+++ b/sw/qa/uitest/table/textToTable.py
@@ -38,33 +38,32 @@ class textToTable(UITestCase):
self.ui_test.close_doc()
def test_text_to_table_header(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("textToTable.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #open file; select all text ; dialog Text to table - other ":"; verify
- self.xUITest.executeCommand(".uno:SelectAll")
- self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable")
- xDialog = self.xUITest.getTopFocusWindow()
- other = xDialog.getChild("other")
- other.executeAction("CLICK", tuple())
- othered = xDialog.getChild("othered")
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
- headingcb = xDialog.getChild("headingcb")
- headingcb.executeAction("CLICK", tuple())
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
- #verify
- self.assertEqual(document.TextTables.getCount(), 1)
- tables = document.getTextTables()
- self.assertEqual(len(tables[0].getRows()), 4)
- self.assertEqual(len(tables[0].getColumns()), 3)
- #undo
- self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.TextTables.getCount(), 0)
- self.assertEqual(document.Text.String[0:5], "A:B:C")
+ with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #open file; select all text ; dialog Text to table - other ":"; verify
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ other = xDialog.getChild("other")
+ other.executeAction("CLICK", tuple())
+ othered = xDialog.getChild("othered")
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
+ headingcb = xDialog.getChild("headingcb")
+ headingcb.executeAction("CLICK", tuple())
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #verify
+ self.assertEqual(document.TextTables.getCount(), 1)
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 4)
+ self.assertEqual(len(tables[0].getColumns()), 3)
+ #undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextTables.getCount(), 0)
+ self.assertEqual(document.Text.String[0:5], "A:B:C")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py b/sw/qa/uitest/writer_tests/compareDocuments.py
index 6cb90bf99466..ba308974d79f 100644
--- a/sw/qa/uitest/writer_tests/compareDocuments.py
+++ b/sw/qa/uitest/writer_tests/compareDocuments.py
@@ -16,76 +16,72 @@ class compareDocuments(UITestCase):
def test_tdf130960(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf130960.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) as writer_doc:
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
+ self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
- xOpenDialog = self.xUITest.getTopFocusWindow()
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
+ xOpenDialog = self.xUITest.getTopFocusWindow()
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
- # Close the dialog and open it again so the list of changes is updated
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
+ # Close the dialog and open it again so the list of changes is updated
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- changesList = xTrackDlg.getChild("writerchanges")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ changesList = xTrackDlg.getChild("writerchanges")
- text = "Unknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
- self.assertEqual(2, len(changesList.getChildren()))
- self.assertTrue(get_state_as_dict(changesList.getChild('0'))["Text"].startswith(text))
- self.assertTrue(get_state_as_dict(changesList.getChild('1'))["Text"].startswith(text))
+ text = "Unknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ self.assertEqual(2, len(changesList.getChildren()))
+ self.assertTrue(get_state_as_dict(changesList.getChild('0'))["Text"].startswith(text))
+ self.assertTrue(get_state_as_dict(changesList.getChild('1'))["Text"].startswith(text))
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
def test_tdf137855(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf137855.odt"))
-
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")) as writer_doc:
- self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- xOpenDialog = self.xUITest.getTopFocusWindow()
- xFileName = xOpenDialog.getChild("file_name")
- xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
+ self.ui_test.execute_dialog_through_command(".uno:CompareDocuments")
- xOpenBtn = xOpenDialog.getChild("open")
- xOpenBtn.executeAction("CLICK", tuple())
+ xOpenDialog = self.xUITest.getTopFocusWindow()
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
- # Close the dialog and open it again so the list of changes is updated
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- changesList = xTrackDlg.getChild("writerchanges")
+ # Close the dialog and open it again so the list of changes is updated
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
- # Check the number of changes
- self.assertEqual(263, len(changesList.getChildren()))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ changesList = xTrackDlg.getChild("writerchanges")
- # Without the fix in place, this test would have crashed here
- xAccBtn = xTrackDlg.getChild("acceptall")
- xAccBtn.executeAction("CLICK", tuple())
+ # Check the number of changes
+ self.assertEqual(263, len(changesList.getChildren()))
- self.assertEqual(0, len(changesList.getChildren()))
+ # Without the fix in place, this test would have crashed here
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
+ self.assertEqual(0, len(changesList.getChildren()))
- self.ui_test.close_doc()
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py
index bf615f99c2b0..7a15327a45bc 100644
--- a/sw/qa/uitest/writer_tests/tdf81457.py
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -15,29 +15,27 @@ class tdf81457(UITestCase):
#tdf 81457
def test_open_documentProperties_tdf81457(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81457.odt"))
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- xTabs = xDialog.getChild("tabcontrol")
- select_pos(xTabs, "2") #tab Custom properties
-
- aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
- 'BookMarkInfo12', 'BookMarkInfo13']
- aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
- '00FF0000FF210', '00FF0000FF230']
-
- for i in range(6):
- xNameBox = xDialog.getChild("namebox" + str(i + 1))
- xTypeBox = xDialog.getChild("typebox" + str(i + 1))
- xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
- self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
- self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
- self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
-
-
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) as writer_doc:
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2") #tab Custom properties
+
+ aExpectedNames = ['BookMarkCount', 'BookMarkInfo1', 'BookMarkInfo10', 'BookMarkInfo11',
+ 'BookMarkInfo12', 'BookMarkInfo13']
+ aExpectedValues = ['78', '00FF0000FF010', '00FF0000FF1E0', '00FF0000FF1E0',
+ '00FF0000FF210', '00FF0000FF230']
+
+ for i in range(6):
+ xNameBox = xDialog.getChild("namebox" + str(i + 1))
+ xTypeBox = xDialog.getChild("typebox" + str(i + 1))
+ xValueEdit = xDialog.getChild("valueedit" + str(i + 1))
+ self.assertEqual(aExpectedNames[i], get_state_as_dict(xNameBox)['Text'])
+ self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
+ self.assertEqual(aExpectedValues[i], get_state_as_dict(xValueEdit)['Text'][:13])
+
+
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
index a3ea2671c6c6..366954d76d16 100644
--- a/sw/qa/uitest/writer_tests/trackedChanges.py
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -151,105 +151,101 @@ class trackedchanges(UITestCase):
self.ui_test.close_doc()
def test_list_of_changes(self):
- self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ listText = [
+ "Unknown Author\t01/24/2020 16:19:32\t",
+ "Unknown Author\t01/24/2020 16:19:35\t",
+ "Unknown Author\t01/24/2020 16:19:39\t",
+ "Unknown Author\t01/24/2020 16:19:39\t",
+ "Xisco Fauli\t01/27/2020 17:42:55\t"]
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ resultsAccept = [
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger."]
+
+ for i in range(len(listText)):
+ self.assertEqual(document.Text.String.strip(), resultsAccept[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String.strip(), resultsAccept[5])
+ #List is empty
+ self.assertFalse('0' in changesList.getChildren())
+
+ for i in reversed(range(len(listText))):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(document.Text.String.strip(), resultsAccept[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+
+ resultsReject = [
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tenis ball is a small ball. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedball is much bigger.",
+ "The tenis ball is a small bal. The baskedball is much biger."]
+
+ for i in range(len(listText)):
+ self.assertEqual(document.Text.String.strip(), resultsReject[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String.strip(), resultsReject[5])
+ #List is empty
+ self.assertFalse('0' in changesList.getChildren())
+
+ for i in reversed(range(len(listText))):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(document.Text.String.strip(), resultsReject[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
- listText = [
- "Unknown Author\t01/24/2020 16:19:32\t",
- "Unknown Author\t01/24/2020 16:19:35\t",
- "Unknown Author\t01/24/2020 16:19:39\t",
- "Unknown Author\t01/24/2020 16:19:39\t",
- "Xisco Fauli\t01/27/2020 17:42:55\t"]
+ def test_tdf135018(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- changesList = xTrackDlg.getChild("writerchanges")
-
- resultsAccept = [
- "The tennis ball is a small ball. The baskedtball is much bigger.",
- "The tennis ball is a small ball. The baskedtball is much bigger.",
- "The tennis ball is a small ball. The baskedtball is much bigger.",
- "The tennis ball is a small ball. The basketball is much bigger.",
- "The tennis ball is a small ball. The basketball is much bigger.",
- "The tennis ball is a small ball. The basketball is much bigger."]
-
- for i in range(len(listText)):
- self.assertEqual(document.Text.String.strip(), resultsAccept[i])
- self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
- xAccBtn = xTrackDlg.getChild("accept")
- xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(5, document.CurrentController.PageCount)
- self.assertEqual(document.Text.String.strip(), resultsAccept[5])
- #List is empty
- self.assertFalse('0' in changesList.getChildren())
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ changesList = xTrackDlg.getChild("writerchanges")
+ self.assertEqual(147, len(changesList.getChildren()))
- for i in reversed(range(len(listText))):
- xUndoBtn = xTrackDlg.getChild("undo")
- xUndoBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String.strip(), resultsAccept[i])
- self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
-
- resultsReject = [
- "The tennis ball is a small ball. The baskedtball is much bigger.",
- "The tenis ball is a small ball. The baskedtball is much bigger.",
- "The tenis ball is a small bal. The baskedtball is much bigger.",
- "The tenis ball is a small bal. The baskedtball is much bigger.",
- "The tenis ball is a small bal. The baskedball is much bigger.",
- "The tenis ball is a small bal. The baskedball is much biger."]
-
- for i in range(len(listText)):
- self.assertEqual(document.Text.String.strip(), resultsReject[i])
- self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
- xAccBtn = xTrackDlg.getChild("reject")
+ # Without the fix in place, it would have crashed here
+ xAccBtn = xTrackDlg.getChild("acceptall")
xAccBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String.strip(), resultsReject[5])
- #List is empty
- self.assertFalse('0' in changesList.getChildren())
+ self.assertEqual(0, len(changesList.getChildren()))
- for i in reversed(range(len(listText))):
xUndoBtn = xTrackDlg.getChild("undo")
xUndoBtn.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String.strip(), resultsReject[i])
- self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
-
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
-
- def test_tdf135018(self):
- self.ui_test.load_file(get_url_for_data_file("tdf135018.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
-
- self.assertEqual(5, document.CurrentController.PageCount)
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges")
- xTrackDlg = self.xUITest.getTopFocusWindow()
- changesList = xTrackDlg.getChild("writerchanges")
- self.assertEqual(147, len(changesList.getChildren()))
- # Without the fix in place, it would have crashed here
- xAccBtn = xTrackDlg.getChild("acceptall")
- xAccBtn.executeAction("CLICK", tuple())
-
- self.assertEqual(0, len(changesList.getChildren()))
-
- xUndoBtn = xTrackDlg.getChild("undo")
- xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(147, len(changesList.getChildren()))
- self.assertEqual(147, len(changesList.getChildren()))
+ xcloseBtn = xTrackDlg.getChild("close")
+ xcloseBtn.executeAction("CLICK", tuple())
- xcloseBtn = xTrackDlg.getChild("close")
- xcloseBtn.executeAction("CLICK", tuple())
-
- # Check the changes are shown after opening the Manage Tracked Changes dialog
- self.assertGreater(document.CurrentController.PageCount, 5)
-
- self.ui_test.close_doc()
+ # Check the changes are shown after opening the Manage Tracked Changes dialog
+ self.assertGreater(document.CurrentController.PageCount, 5)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/versionDialog.py b/sw/qa/uitest/writer_tests/versionDialog.py
index 5d0e3c120b4e..6ab12611c2bc 100644
--- a/sw/qa/uitest/writer_tests/versionDialog.py
+++ b/sw/qa/uitest/writer_tests/versionDialog.py
@@ -14,29 +14,27 @@ class versionDialog(UITestCase):
def test_tdf131931(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf131931.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) as writer_doc:
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.ui_test.execute_dialog_through_command(".uno:VersionDialog")
+ self.ui_test.execute_dialog_through_command(".uno:VersionDialog")
- xVersionDialog = self.xUITest.getTopFocusWindow()
+ xVersionDialog = self.xUITest.getTopFocusWindow()
- versiondList = xVersionDialog.getChild("versions")
+ versiondList = xVersionDialog.getChild("versions")
- text = "04/06/2020 15:18\t\tHELLO"
- self.assertEqual(1, len(versiondList.getChildren()))
- self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text)
+ text = "04/06/2020 15:18\t\tHELLO"
+ self.assertEqual(1, len(versiondList.getChildren()))
+ self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text)
- xDeleteBtn = xVersionDialog.getChild("delete")
- xDeleteBtn.executeAction("CLICK", tuple())
+ xDeleteBtn = xVersionDialog.getChild("delete")
+ xDeleteBtn.executeAction("CLICK", tuple())
- self.assertEqual(0, len(versiondList.getChildren()))
+ self.assertEqual(0, len(versiondList.getChildren()))
- xCloseBtn = xVersionDialog.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ xCloseBtn = xVersionDialog.getChild("close")
+ xCloseBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py
index b7b88dcb4f74..3260e9c03309 100644
--- a/sw/qa/uitest/writer_tests/wordCount.py
+++ b/sw/qa/uitest/writer_tests/wordCount.py
@@ -48,37 +48,35 @@ class writerWordCount(UITestCase):
def test_tdf68347(self):
#Bug 68347 - Incorrect word count in a document with recorded changes
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf68347.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
-
- xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "4")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "15")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "12")
- #bug Bug 117703 Word Count: Wrong result for "Characters excluding spaces"
- #self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "15")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "12")
+ #bug Bug 117703 Word Count: Wrong result for "Characters excluding spaces"
+ #self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
def test_tdf91100(self):
self.ui_test.create_doc_in_start_center("writer")
@@ -93,32 +91,30 @@ class writerWordCount(UITestCase):
self.ui_test.close_doc()
def test_tdf58050(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf58050.html"))
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
-
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "3")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "14")
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "12")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as writer_doc:
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "14")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
def test_word_count_interpunction_counted_tdf56975_a(self):
@@ -243,84 +239,82 @@ class writerWordCount(UITestCase):
self.ui_test.close_doc()
def test_tdf51816(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf51816.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- #1. Open attached document
- #2. Tools> Word count
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- #3. Click after "At nunc" then <Ctrl><Shift><Left>
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:GoRight")
- self.xUITest.executeCommand(".uno:WordLeftSel")
-
- #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
- #Expected result : Words 1 & Characters 4 #Actual result : Words 0 & Characters 0
- self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "1")
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "1")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "4")
-
- #4. Click after "At nunc" then <Shift><Home>
- self.xUITest.executeCommand(".uno:StartOfParaSel")
-
- #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
- #Expected result : Words 2 & Characters 7 & excluding space 6 #Actual result : Words 0 & Characters 0
- self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "2")
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "7")
-
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "6")
-
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+ #1. Open attached document
+ #2. Tools> Word count
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ #3. Click after "At nunc" then <Ctrl><Shift><Left>
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:WordLeftSel")
+
+ #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
+ #Expected result : Words 1 & Characters 4 #Actual result : Words 0 & Characters 0
+ self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "1")
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "4")
+
+ #4. Click after "At nunc" then <Shift><Home>
+ self.xUITest.executeCommand(".uno:StartOfParaSel")
+
+ #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
+ #Expected result : Words 2 & Characters 7 & excluding space 6 #Actual result : Words 0 & Characters 0
+ self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "2")
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "7")
+
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "6")
+
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
def test_tdf117703(self):
- self.ui_test.load_file(get_url_for_data_file("tdf117703.odt"))
- self.xUITest.getTopFocusWindow()
-
- self.xUITest.executeCommand(".uno:SelectAll")
-
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf117703.odt")):
+ self.xUITest.getTopFocusWindow()
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "54")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
+
+ # Without the fix in place it would have failed with: AssertionError: '0' != '44'
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
- xselectwords = xDialog.getChild("selectwords")
- xdocwords = xDialog.getChild("docwords")
- xselectchars = xDialog.getChild("selectchars")
- xdocchars = xDialog.getChild("docchars")
- xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
- xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
- xselectcjkchars = xDialog.getChild("selectcjkchars")
- xdoccjkchars = xDialog.getChild("doccjkchars")
-
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "12")
- self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
- self.assertEqual(get_state_as_dict(xselectchars)["Text"], "54")
- self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
-
- # Without the fix in place it would have failed with: AssertionError: '0' != '44'
- self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "44")
- self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
- self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
- self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
-
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/goToPage.py b/sw/qa/uitest/writer_tests3/goToPage.py
index e8c0c6486a38..4d46a0740c53 100644
--- a/sw/qa/uitest/writer_tests3/goToPage.py
+++ b/sw/qa/uitest/writer_tests3/goToPage.py
@@ -10,34 +10,33 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class GoToPage_dialog(UITestCase):
def test_go_to_page(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("3pages.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.load_file(get_url_for_data_file("3pages.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
- # check cancel button
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
+ # check cancel button
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
- self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index fe329ab344c3..fea337bd2c3f 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -104,28 +104,28 @@ frog, dogg, catt"""
supported_locale = self.is_supported_locale("en", "US")
if not supported_locale:
self.skipTest("no dictionary support for en_US available")
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt"))
- document = self.ui_test.get_component()
- # Step 1: Initiate spellchecking, and make sure "Check grammar" is
- # unchecked
- spell_dialog = self.launch_dialog()
- checkgrammar = spell_dialog.getChild('checkgrammar')
- if get_state_as_dict(checkgrammar)['Selected'] == 'true':
- checkgrammar.executeAction('CLICK', ())
- self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
-
- # Step 2: Click on "Correct all" for each misspelling
- # prompt until end of document is reached.
- changeall = spell_dialog.getChild('changeall')
- changeall.executeAction("CLICK", ())
-
- xCloseBtn = spell_dialog.getChild("close")
- xCloseBtn.executeAction("CLICK", tuple())
-
- output_text = document.Text.getString().replace('\r\n', '\n')
- # This was "gooodgood baaad eeend" ("goood" is a deletion,
- # "good" is an insertion by fixing the first misspelling),
- # but now "goood" is not a misspelling because it is accepted
- # correctly without the redline containing a deleted "o"
- self.assertEqual(output_text, 'goood baaadbaaed eeend')
+ with self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) as writer_doc:
+ document = self.ui_test.get_component()
+ # Step 1: Initiate spellchecking, and make sure "Check grammar" is
+ # unchecked
+ spell_dialog = self.launch_dialog()
+ checkgrammar = spell_dialog.getChild('checkgrammar')
+ if get_state_as_dict(checkgrammar)['Selected'] == 'true':
+ checkgrammar.executeAction('CLICK', ())
+ self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
+
+ # Step 2: Click on "Correct all" for each misspelling
+ # prompt until end of document is reached.
+ changeall = spell_dialog.getChild('changeall')
+ changeall.executeAction("CLICK", ())
+
+ xCloseBtn = spell_dialog.getChild("close")
+ xCloseBtn.executeAction("CLICK", tuple())
+
+ output_text = document.Text.getString().replace('\r\n', '\n')
+ # This was "gooodgood baaad eeend" ("goood" is a deletion,
+ # "good" is an insertion by fixing the first misspelling),
+ # but now "goood" is not a misspelling because it is accepted
+ # correctly without the redline containing a deleted "o"
+ self.assertEqual(output_text, 'goood baaadbaaed eeend')
diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py
index 8bb43962d8fb..70bacd60ac77 100644
--- a/sw/qa/uitest/writer_tests4/tdf113284.py
+++ b/sw/qa/uitest/writer_tests4/tdf113284.py
@@ -10,34 +10,33 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf113284(UITestCase):
def test_tdf113284(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf113284.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
-
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- xPageCount = document.CurrentController.PageCount
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
- xOkBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOkBtn)
-
- xToolkit.processEventsToIdle()
-
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xCancBtn = xDiagIndex.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancBtn) # close dialog
-
- #page count is not constant
- #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
- #pagecount unchanged
- self.assertEqual(document.CurrentController.PageCount, xPageCount)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ xPageCount = document.CurrentController.PageCount
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ xToolkit.processEventsToIdle()
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
+ self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
+ xDiagIndex = self.xUITest.getTopFocusWindow()
+ xCancBtn = xDiagIndex.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancBtn) # close dialog
+
+ #page count is not constant
+ #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
+ #pagecount unchanged
+ self.assertEqual(document.CurrentController.PageCount, xPageCount)
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py
index 1fc69909a978..b893f4f643e1 100644
--- a/sw/qa/uitest/writer_tests4/tdf122449.py
+++ b/sw/qa/uitest/writer_tests4/tdf122449.py
@@ -14,38 +14,37 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf122449(UITestCase):
def test_tdf122449_crash_edit_index_entry(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122449.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- #search word Autocorrect (second find) .uno:SearchDialog
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #search word Autocorrect (second find) .uno:SearchDialog
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"}))
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple()) #first search
- xsearch.executeAction("CLICK", tuple()) #2nd search
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6")
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
- # invoke Index dialog Index entry .uno:IndexEntryDialog
- self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- # close
- # Go to page 2
- self.ui_test.execute_dialog_through_command(".uno:GotoPage")
- xDialog = self.xUITest.getTopFocusWindow()
- xPageText = xDialog.getChild("page")
- xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
- # verify
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple()) #first search
+ xsearch.executeAction("CLICK", tuple()) #2nd search
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6")
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
+ # invoke Index dialog Index entry .uno:IndexEntryDialog
+ self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ # close
+ # Go to page 2
+ self.ui_test.execute_dialog_through_command(".uno:GotoPage")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+ # verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py
index 07f4db79c934..6086ae289a12 100644
--- a/sw/qa/uitest/writer_tests4/tdf134439.py
+++ b/sw/qa/uitest/writer_tests4/tdf134439.py
@@ -13,47 +13,45 @@ class tdf134439(UITestCase):
def test_tdf134439(self):
- self.ui_test.load_file(get_url_for_data_file("tdf134439.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")):
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- self.assertEqual(document.CurrentController.PageCount, 3)
+ self.assertEqual(document.CurrentController.PageCount, 3)
- xCursor = document.CurrentController.ViewCursor
- self.assertEqual("Chap 1", xCursor.PageStyleName)
+ xCursor = document.CurrentController.ViewCursor
+ self.assertEqual("Chap 1", xCursor.PageStyleName)
- xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
- self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT")
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"])
- self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"])
+ self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"])
+ self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"])
- xPageStyle = xDialog.getChild("comboPageStyle")
- self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"])
+ xPageStyle = xDialog.getChild("comboPageStyle")
+ self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"])
- select_by_text(xPageStyle, "Chap 3")
+ select_by_text(xPageStyle, "Chap 3")
- self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"])
+ self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"])
- # tdf#116070: Without the fix in place, this test would have crashed here
- okBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ # tdf#116070: Without the fix in place, this test would have crashed here
+ okBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Chap 1' != 'Chap 3'
- self.assertEqual("Chap 1", xCursor.PageStyleName)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Chap 1' != 'Chap 3'
+ self.assertEqual("Chap 1", xCursor.PageStyleName)
- self.assertEqual(document.CurrentController.PageCount, 3)
+ self.assertEqual(document.CurrentController.PageCount, 3)
- xCursor.jumpToNextPage()
- self.assertEqual("Chap 3", xCursor.PageStyleName)
+ xCursor.jumpToNextPage()
+ self.assertEqual("Chap 3", xCursor.PageStyleName)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual("Chap 2", xCursor.PageStyleName)
-
- self.ui_test.close_doc()
+ self.assertEqual("Chap 2", xCursor.PageStyleName)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py
index 3347a4404722..f4efcddb3c2e 100644
--- a/sw/qa/uitest/writer_tests4/tdf135636.py
+++ b/sw/qa/uitest/writer_tests4/tdf135636.py
@@ -11,35 +11,33 @@ class tdf135636(UITestCase):
def test_tdf135636(self):
- self.ui_test.load_file(get_url_for_data_file("tdf135636.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")):
- document = self.ui_test.get_component()
+ document = self.ui_test.get_component()
- self.assertEqual(document.CurrentController.PageCount, 2)
+ self.assertEqual(document.CurrentController.PageCount, 2)
- xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
- self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT")
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- xBreak = xDialog.getChild("break")
- self.assertEqual("true", get_state_as_dict(xBreak)["Selected"])
+ xBreak = xDialog.getChild("break")
+ self.assertEqual("true", get_state_as_dict(xBreak)["Selected"])
- xBreak.executeAction("CLICK", tuple())
+ xBreak.executeAction("CLICK", tuple())
- self.assertEqual("false", get_state_as_dict(xBreak)["Selected"])
+ self.assertEqual("false", get_state_as_dict(xBreak)["Selected"])
- okBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(okBtn)
+ okBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
- # Without the fix in place, this test would have failed with
- # AssertionError: 2 != 1
- self.assertEqual(document.CurrentController.PageCount, 1)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 2 != 1
+ self.assertEqual(document.CurrentController.PageCount, 1)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentController.PageCount, 2)
-
- self.ui_test.close_doc()
+ self.assertEqual(document.CurrentController.PageCount, 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf136578.py b/sw/qa/uitest/writer_tests4/tdf136578.py
index 3de6e019ec41..4380a394a11e 100644
--- a/sw/qa/uitest/writer_tests4/tdf136578.py
+++ b/sw/qa/uitest/writer_tests4/tdf136578.py
@@ -11,22 +11,20 @@ class tdf136578(UITestCase):
def test_tdf136578(self):
- self.ui_test.load_file(get_url_for_data_file("tdf136578.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")):
- document = self.ui_test.get_component()
- self.assertEqual(document.CurrentController.PageCount, 2)
+ document = self.ui_test.get_component()
+ self.assertEqual(document.CurrentController.PageCount, 2)
- xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
- xPageBreak.executeAction("DELETE", tuple())
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ xPageBreak.executeAction("DELETE", tuple())
- # Without the fix in place, this test would have failed with
- # AssertionError: 1 != 2
- self.assertEqual(document.CurrentController.PageCount, 1)
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1 != 2
+ self.assertEqual(document.CurrentController.PageCount, 1)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentController.PageCount, 2)
-
- self.ui_test.close_doc()
+ self.assertEqual(document.CurrentController.PageCount, 2)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py
index b57c5748baf9..528fcda84911 100644
--- a/sw/qa/uitest/writer_tests4/tdf138546.py
+++ b/sw/qa/uitest/writer_tests4/tdf138546.py
@@ -12,33 +12,31 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf138546(UITestCase):
def test_tdf138546(self):
- self.ui_test.load_file(get_url_for_data_file("tdf138546.odt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- change_measurement_unit(self, "Centimeter")
+ change_measurement_unit(self, "Centimeter")
- #dialog Columns
- self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
- xDialog = self.xUITest.getTopFocusWindow()
+ #dialog Columns
+ self.ui_test.execute_dialog_through_command(".uno:FormatColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+ xOKBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "7") #Columns
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- xOKBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ self.ui_test.execute_dialog_through_command(".uno:PageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "7") #Columns
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+ xOKBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
index 0d110d315a21..021084932f9a 100644
--- a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -11,147 +11,137 @@ class dateFormFieldDialog(UITestCase):
def test_setting_date_format(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # open the dialog again
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # open the dialog again
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+ itemsList = xDialog.getChild("date_formats_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
def test_date_field_with_custom_format(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek")
+ itemsList = xDialog.getChild("date_formats_treeview")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek")
- self.ui_test.close_doc()
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
def test_date_reformat(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "07/17/19")
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
- itemsList = xDialog.getChild("date_formats_treeview")
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- # after applying the new format, the field content should be updated
- self.assertEqual(writer_doc.getText().getString(), "07-17")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
+ # after applying the new format, the field content should be updated
+ self.assertEqual(writer_doc.getText().getString(), "07-17")
def test_date_field_with_placeholder(self):
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "[select date]")
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- itemsList = xDialog.getChild("date_formats_treeview")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
- # select a new format
- itemsList.getChild("11").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # a placeholder text is not changed by format change
- self.assertEqual(writer_doc.getText().getString(), "[select date]")
-
- self.ui_test.close_doc()
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
def test_date_field_without_current_date(self):
# current date means the current date fieldmark parameter which contains the current date in YYYY-MM-DD format
# when this parameter is missing LO tries to parse the content string to find out the set date
# open a file with a date form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(writer_doc.getText().getString(), "07/17/19")
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
- itemsList = xDialog.getChild("date_formats_treeview")
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- # check whether we have the right format selected
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+ itemsList = xDialog.getChild("date_formats_treeview")
- # select a new format
- itemsList.getChild("3").executeAction("SELECT", tuple());
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # select a new format
+ itemsList.getChild("3").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
- # a placeholder text is not changed by format change
- self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
index 48608e3ee95d..b3274b124dac 100644
--- a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -13,236 +13,140 @@ class dropDownFormFieldDialog(UITestCase):
def test_add_new_items(self):
# open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # check whether items are the same after reopening
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
def test_remove_items(self):
# open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and remove it
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
-
- # check whether the right item was removed
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- removeButton = xDialog.getChild("remove_button")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
-
- # remove all items
- itemsList.getChild("1").executeAction("SELECT", tuple());
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
- removeButton.executeAction("CLICK", tuple())
-
- self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- def test_move_items(self):
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- # open a file with an empty form field
- writer_doc = self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- # open the dialog (cursor is at the field)
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemEntry = xDialog.getChild("item_entry")
- addButton = xDialog.getChild("add_button")
- itemsList = xDialog.getChild("items_treeview")
- upButton = xDialog.getChild("up_button")
- downButton = xDialog.getChild("down_button")
-
- # initial state
- self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # add some new items
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
- self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
- addButton.executeAction("CLICK", tuple())
- itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
- addButton.executeAction("CLICK", tuple())
-
- # check whether the items are there in the list
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # select an item from the list and move it up
- itemsList.getChild("1").executeAction("SELECT", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
- upButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
-
- # move down the selected item
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- downButton.executeAction("CLICK", tuple())
- self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
- self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
-
- # check whether the item was correctly moved
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # check whether items are the same after reopening
- self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
- xDialog = self.xUITest.getTopFocusWindow()
-
- itemsList = xDialog.getChild("items_treeview")
- self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
- self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.ui_test.close_doc()
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
- def test_drop_down_after_import(self):
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
- files = ["drop_down_form_field.odt", "drop_down_form_field.doc", "drop_down_form_field.docx"]
- for file in files:
- # open a file with a drop-down for field with items and selection
- writer_doc = self.ui_test.load_file(get_url_for_data_file(file))
+ # select an item from the list and remove it
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+
+ # check whether the right item was removed
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # check whether items are the same after reopening
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+ # remove all items
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ def test_move_items(self):
+
+ # open a file with an empty form field
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
@@ -250,7 +154,29 @@ class dropDownFormFieldDialog(UITestCase):
self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
xDialog = self.xUITest.getTopFocusWindow()
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
itemsList = xDialog.getChild("items_treeview")
+ upButton = xDialog.getChild("up_button")
+ downButton = xDialog.getChild("down_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
# check whether the items are there in the list
self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
@@ -259,11 +185,77 @@ class dropDownFormFieldDialog(UITestCase):
self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
- self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
+ # select an item from the list and move it up
+ itemsList.getChild("1").executeAction("SELECT", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+ upButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # move down the selected item
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # check whether items are the same after reopening
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
xOKBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
+ def test_drop_down_after_import(self):
+
+ files = ["drop_down_form_field.odt", "drop_down_form_field.doc", "drop_down_form_field.docx"]
+ for file in files:
+ # open a file with a drop-down for field with items and selection
+ with self.ui_test.load_file(get_url_for_data_file(file)) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ self.ui_test.execute_dialog_through_command(".uno:ControlProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ itemsList = xDialog.getChild("items_treeview")
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf117039.py b/sw/qa/uitest/writer_tests5/tdf117039.py
index b640ab65266a..49de2b42efaf 100644
--- a/sw/qa/uitest/writer_tests5/tdf117039.py
+++ b/sw/qa/uitest/writer_tests5/tdf117039.py
@@ -14,15 +14,14 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf117039(UITestCase):
def test_tdf117039_preview_signed_document(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf117039.odt"))
- document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+ with self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
- self.xUITest.getTopFocusWindow() #Get focus after closing preview
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
- #verify
- self.assertEqual(document.Text.String[0:22], "Test digital signature")
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(document.Text.String[0:22], "Test digital signature")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py
index 2959f2491b64..56dae2d761b1 100644
--- a/sw/qa/uitest/writer_tests5/tdf118540.py
+++ b/sw/qa/uitest/writer_tests5/tdf118540.py
@@ -14,19 +14,18 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf118540(UITestCase):
def test_tdf118540_preview_document_properties(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf118540.docx"))
- document = self.ui_test.get_component()
- self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog
- xDialog = self.xUITest.getTopFocusWindow()
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
- self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+ with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc:
+ document = self.ui_test.get_component()
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") #open properties dialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
- self.xUITest.getTopFocusWindow() #Get focus after closing preview
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
- #verify
- self.assertEqual(document.Text.String[0:4], "Test")
- self.ui_test.close_doc()
+ #verify
+ self.assertEqual(document.Text.String[0:4], "Test")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py
index bc5f275e8cfa..a69658ec9260 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py
@@ -13,202 +13,200 @@ from uitest.uihelper.common import get_url_for_data_file
# and inserting at the very end of the document.
class tdf138907(UITestCase):
def test_tdf138907(self):
- self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt"))
- document = self.ui_test.get_component()
-
- # Confirm the starting state. Just a page break, without a valid restart page number on page 2
- self.assertEqual(document.CurrentController.PageCount, 5)
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "7")
- self.assertEqual(Para2.PageDescName, None)
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "8")
- self.assertEqual(Para3.PageDescName, None)
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "9")
- self.assertEqual(Para4.PageDescName, None)
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "10")
- self.assertEqual(Para5.PageDescName, None)
-
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 2. With this doc, it defaults to resetting to 1.
- xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
- xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- self.assertEqual(Para2.String, "2")
- Para2 = Paragraphs.nextElement()
- # Without this fix, there was no PageDescName specified, just Landscape as default.
- self.assertEqual(Para2.PageDescName, "Landscape")
-
- #re-run dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #accept defaults and OK without making any changes.
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Without this fix, re-running the wizard was failing with the title page restarting at page 2.
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "2")
- self.assertEqual(Para2.PageDescName, "Landscape")
-
- #Note: 6 virtual pages, including blank, even page seen in book view
- self.assertEqual(document.CurrentController.PageCount, 6)
-
- #Now test replacing several pages with title and index styles
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Convert three pages to title/index pages starting at page two.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- xStartingPage.executeAction("UP", tuple()) #Start at page 2.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- # Without the fix, the following results are all off by one.
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "6")
- self.assertEqual(Para2.PageDescName, "First Page")
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "7")
- self.assertEqual(Para3.PageDescName, "Index")
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "8")
- self.assertEqual(Para4.PageDescName, "Index")
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "2")
- self.assertEqual(Para5.PageDescName, "Landscape")
-
- #Now test inserting at the end of the document
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert three title/index pages at the end of the document (plus a content page).
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,18):
- xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Without the fix, the pages were being inserted before the last page.
- text = document.Text.String.replace('\r\n', '\n')
- self.assertEqual(text[0:1], "6")
- self.assertEqual(text[2:3], "6")
- self.assertEqual(text[4:5], "7")
- self.assertEqual(text[6:7], "8")
- # Without the fix, the new pages were inserted before the last page.
- self.assertFalse("\n" in text[8:9])
- #Note: 13 total virtual pages, including four blanks, as seen in book view
- self.assertEqual(document.CurrentController.PageCount, 13)
-
- #Now test inserting in the middle of the document
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Insert three title/index pages starting at page 2.
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,10):
- xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
- xStartingPage.executeAction("UP", tuple()) #Start at page 2.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Without first re-calculating the layout, the styles were applied to the wrong pages.
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- # The next three pages are the ones that were just inserted.
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "")
- self.assertEqual(Para2.PageDescName, "First Page")
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "")
- self.assertEqual(Para3.PageDescName, "Index")
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "")
- self.assertEqual(Para4.PageDescName, "Index")
- # A bit of a quirk is that the style of the first page after the
- # title page is still First Page - so that is used as the Normal page style.
- # OK - this is a bit of a strange workflow, so just accept that.
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "6")
- self.assertEqual(Para5.PageDescName, "First Page")
- Para6 = Paragraphs.nextElement()
- self.assertEqual(Para6.String, "7")
- self.assertEqual(Para6.PageDescName, "Index")
- Para7 = Paragraphs.nextElement()
- self.assertEqual(Para7.String, "8")
- self.assertEqual(Para7.PageDescName, "Index")
- Para8 = Paragraphs.nextElement()
- self.assertEqual(Para8.String, "2")
- self.assertEqual(Para8.PageDescName, "Landscape")
- Para9 = Paragraphs.nextElement()
- self.assertEqual(Para9.String, "")
- self.assertEqual(Para9.PageDescName, "First Page")
- Para10 = Paragraphs.nextElement()
- self.assertEqual(Para10.String, "")
- self.assertEqual(Para10.PageDescName, "Index")
- Para11 = Paragraphs.nextElement()
- self.assertEqual(Para11.String, "")
- self.assertEqual(Para11.PageDescName, "Index")
- # The quirk resets this extra content page to the "style after First page == First Page"
- Para12 = Paragraphs.nextElement()
- self.assertEqual(Para12.String, "")
- self.assertEqual(Para12.PageDescName, "First Page")
- #Note: 17 total virtual pages, including five blanks, as seen in book view
- self.assertEqual(document.CurrentController.PageCount, 17)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")):
+ document = self.ui_test.get_component()
+
+ # Confirm the starting state. Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ self.assertEqual(Para2.String, "2")
+ Para2 = Paragraphs.nextElement()
+ # Without this fix, there was no PageDescName specified, just Landscape as default.
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #re-run dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #accept defaults and OK without making any changes.
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Without this fix, re-running the wizard was failing with the title page restarting at page 2.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "2")
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #Note: 6 virtual pages, including blank, even page seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 6)
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ print(xDialog.getChildren())
+ #Convert three pages to title/index pages starting at page two.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # Without the fix, the following results are all off by one.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "6")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "7")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "8")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "2")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+
+ #Now test inserting at the end of the document
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ print(xDialog.getChildren())
+ #Insert three title/index pages at the end of the document (plus a content page).
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,18):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Without the fix, the pages were being inserted before the last page.
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "6")
+ self.assertEqual(text[2:3], "6")
+ self.assertEqual(text[4:5], "7")
+ self.assertEqual(text[6:7], "8")
+ # Without the fix, the new pages were inserted before the last page.
+ self.assertFalse("\n" in text[8:9])
+ #Note: 13 total virtual pages, including four blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 13)
+
+ #Now test inserting in the middle of the document
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ print(xDialog.getChildren())
+ #Insert three title/index pages starting at page 2.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,10):
+ xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Without first re-calculating the layout, the styles were applied to the wrong pages.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # The next three pages are the ones that were just inserted.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "")
+ self.assertEqual(Para4.PageDescName, "Index")
+ # A bit of a quirk is that the style of the first page after the
+ # title page is still First Page - so that is used as the Normal page style.
+ # OK - this is a bit of a strange workflow, so just accept that.
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "6")
+ self.assertEqual(Para5.PageDescName, "First Page")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "7")
+ self.assertEqual(Para6.PageDescName, "Index")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "8")
+ self.assertEqual(Para7.PageDescName, "Index")
+ Para8 = Paragraphs.nextElement()
+ self.assertEqual(Para8.String, "2")
+ self.assertEqual(Para8.PageDescName, "Landscape")
+ Para9 = Paragraphs.nextElement()
+ self.assertEqual(Para9.String, "")
+ self.assertEqual(Para9.PageDescName, "First Page")
+ Para10 = Paragraphs.nextElement()
+ self.assertEqual(Para10.String, "")
+ self.assertEqual(Para10.PageDescName, "Index")
+ Para11 = Paragraphs.nextElement()
+ self.assertEqual(Para11.String, "")
+ self.assertEqual(Para11.PageDescName, "Index")
+ # The quirk resets this extra content page to the "style after First page == First Page"
+ Para12 = Paragraphs.nextElement()
+ self.assertEqual(Para12.String, "")
+ self.assertEqual(Para12.PageDescName, "First Page")
+ #Note: 17 total virtual pages, including five blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 17)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
index 9c57a7fa5054..2838c7ae2343 100644
--- a/sw/qa/uitest/writer_tests5/titlePageWizard2.py
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
@@ -10,127 +10,125 @@ from uitest.uihelper.common import get_url_for_data_file
# This tests both an edge cases, and some more realistic situations.
class tdf138907(UITestCase):
def test_tdf138907(self):
- self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt"))
- document = self.ui_test.get_component()
-
- # Test an undefined situation - try to modify pages beyond the end of the document.
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 2. With this doc, it defaults to resetting to 1.
- xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
- xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
-
- #Convert three pages to title/index pages starting at non-existing page twenty.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,2):
- xPageCount.executeAction("UP", tuple())
- xUseStartingPage = xDialog.getChild("RB_PAGE_START")
- xUseStartingPage.executeAction("CLICK", tuple())
- xStartingPage = xDialog.getChild("NF_PAGE_START")
- for _ in range(0,19):
- xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- # Nothing should happen when modifying pages that don't exist.
- # Just a page break, without a valid restart page number on page 2
- self.assertEqual(document.CurrentController.PageCount, 5)
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "6")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "7")
- self.assertEqual(Para2.PageDescName, None)
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "8")
- self.assertEqual(Para3.PageDescName, None)
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "9")
- self.assertEqual(Para4.PageDescName, None)
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "10")
- self.assertEqual(Para5.PageDescName, None)
-
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- #set restart page number to 1 - which is the default.
- #set restart title page to 1 - the current value for this document is 6.
- xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
- print(xDialog.getChildren())
- for _ in range(0,5):
- xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
- #Insert two title/index pages at beginning of the document.
- newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
- newPages.executeAction("CLICK", tuple())
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,1):
- xPageCount.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "")
- self.assertEqual(Para2.PageDescName, "Index")
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "1")
- self.assertEqual(Para3.PageDescName, "Landscape")
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "2")
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "3")
- Para6 = Paragraphs.nextElement()
- self.assertEqual(Para6.String, "4")
- Para7 = Paragraphs.nextElement()
- self.assertEqual(Para7.String, "5")
-
- #Now test replacing several pages with title and index styles
-
- #dialog Title Page
- self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- print(xDialog.getChildren())
- #Convert four pages to title/index pages starting at page one.
- xPageCount = xDialog.getChild("NF_PAGE_COUNT")
- for _ in range(0,3):
- xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
- for _ in range(0,3):
- xPageCount.executeAction("UP", tuple())
-
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- Paragraphs = document.Text.createEnumeration()
- Para1 = Paragraphs.nextElement()
- self.assertEqual(Para1.String, "")
- self.assertEqual(Para1.PageDescName, "First Page")
- Para2 = Paragraphs.nextElement()
- self.assertEqual(Para2.String, "")
- self.assertEqual(Para2.PageDescName, "Index")
- Para3 = Paragraphs.nextElement()
- self.assertEqual(Para3.String, "3")
- self.assertEqual(Para3.PageDescName, "Index")
- Para4 = Paragraphs.nextElement()
- self.assertEqual(Para4.String, "4")
- self.assertEqual(Para4.PageDescName, "Index")
- Para5 = Paragraphs.nextElement()
- self.assertEqual(Para5.String, "1")
- self.assertEqual(Para5.PageDescName, "Landscape")
- Para6 = Paragraphs.nextElement()
- self.assertEqual(Para6.String, "2")
- Para7 = Paragraphs.nextElement()
- self.assertEqual(Para7.String, "3")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")):
+ document = self.ui_test.get_component()
+
+ # Test an undefined situation - try to modify pages beyond the end of the document.
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+
+ #Convert three pages to title/index pages starting at non-existing page twenty.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,19):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Nothing should happen when modifying pages that don't exist.
+ # Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #set restart page number to 1 - which is the default.
+ #set restart title page to 1 - the current value for this document is 6.
+ xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
+ print(xDialog.getChildren())
+ for _ in range(0,5):
+ xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
+ #Insert two title/index pages at beginning of the document.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,1):
+ xPageCount.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "1")
+ self.assertEqual(Para3.PageDescName, "Landscape")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "2")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "3")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "4")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "5")
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ print(xDialog.getChildren())
+ #Convert four pages to title/index pages starting at page one.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,3):
+ xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
+ for _ in range(0,3):
+ xPageCount.executeAction("UP", tuple())
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "3")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "4")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "1")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "2")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "3")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py b/sw/qa/uitest/writer_tests6/tdf120731.py
index c7177922ad92..d9415d9aa7e8 100644
--- a/sw/qa/uitest/writer_tests6/tdf120731.py
+++ b/sw/qa/uitest/writer_tests6/tdf120731.py
@@ -11,15 +11,14 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf120731(UITestCase):
def test_tdf120731_crash_open_char_dialog(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf120731.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- self.xUITest.executeCommand(".uno:SelectAll")
- self.ui_test.execute_dialog_through_command(".uno:FontDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:5], "Lorem")
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+ self.assertEqual(document.Text.String[0:5], "Lorem")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py
index 612824ee740e..35e255c0cd39 100644
--- a/sw/qa/uitest/writer_tests6/tdf124586.py
+++ b/sw/qa/uitest/writer_tests6/tdf124586.py
@@ -12,25 +12,24 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf124586(UITestCase):
def test_tdf124586_crash_switch_outline_numbering(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124586.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
- #Goto Tools > Chapter Numbering.
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xstyle = xDialog.getChild("style")
- select_by_text(xstyle, "MyHeading")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
+ #Goto Tools > Chapter Numbering.
+ self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xstyle = xDialog.getChild("style")
+ select_by_text(xstyle, "MyHeading")
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
- self.assertEqual(document.Text.String[0:8], "Schritte")
+ self.assertEqual(document.Text.String[0:8], "Schritte")
- self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xstyle = xDialog.getChild("style")
- self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
- xOK = xDialog.getChild("ok")
- xOK.executeAction("CLICK", tuple())
- self.ui_test.close_doc()
+ self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xstyle = xDialog.getChild("style")
+ self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124675.py b/sw/qa/uitest/writer_tests6/tdf124675.py
index 15cc5c462041..200255e159fc 100644
--- a/sw/qa/uitest/writer_tests6/tdf124675.py
+++ b/sw/qa/uitest/writer_tests6/tdf124675.py
@@ -12,26 +12,24 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf124675(UITestCase):
def test_tdf124675_crash_moving_SwTextFrame_previous_page(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124675.docx"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ with self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.assertEqual(document.CurrentController.PageCount, 2)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+ self.assertEqual(document.CurrentController.PageCount, 2)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
- for i in range(52):
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ for i in range(52):
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
- self.assertEqual(document.CurrentController.PageCount, 4)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+ self.assertEqual(document.CurrentController.PageCount, 4)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
- for i in range(52):
- self.xUITest.executeCommand(".uno:Undo")
+ for i in range(52):
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.CurrentController.PageCount, 2)
- self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
-
- self.ui_test.close_doc()
+ self.assertEqual(document.CurrentController.PageCount, 2)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py
index d10a68517429..640c9bf8c236 100644
--- a/sw/qa/uitest/writer_tests6/tdf126017.py
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -12,40 +12,39 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf126017(UITestCase):
def test_tdf126017_crash_after_undo(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126017.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
-
- #go to TOC
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"}))
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- #edit index
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xOKBtn = xDiagIndex.getChild("ok")
- title = xDiagIndex.getChild("title")
- title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.xUITest.executeCommand(".uno:Undo")
-
- self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
- xDiagIndex = self.xUITest.getTopFocusWindow()
- xOKBtn = xDiagIndex.getChild("ok")
- title = xDiagIndex.getChild("title")
- title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
- self.ui_test.close_dialog_through_button(xOKBtn)
-
- self.xUITest.executeCommand(".uno:Undo")
- self.xUITest.executeCommand(".uno:Undo")
-
- self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ #go to TOC
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ #edit index
+ self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
+ xDiagIndex = self.xUITest.getTopFocusWindow()
+ xOKBtn = xDiagIndex.getChild("ok")
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
+ xDiagIndex = self.xUITest.getTopFocusWindow()
+ xOKBtn = xDiagIndex.getChild("ok")
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126226.py b/sw/qa/uitest/writer_tests6/tdf126226.py
index e13505fc1f64..9d397a060792 100644
--- a/sw/qa/uitest/writer_tests6/tdf126226.py
+++ b/sw/qa/uitest/writer_tests6/tdf126226.py
@@ -10,20 +10,19 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class Tdf126226(UITestCase):
def test_tdf126226(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126226.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf126226.odt")) as writer_doc:
- self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:SelectAll")
- # Without the fix in place, this test would have crashed here
- self.ui_test.execute_dialog_through_command(".uno:CommentChangeTracking")
+ # Without the fix in place, this test would have crashed here
+ self.ui_test.execute_dialog_through_command(".uno:CommentChangeTracking")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"])
- self.assertEqual("Autor desconocido, 07/04/2019 13:43:52",
- get_state_as_dict(xDialog.getChild("lastedit"))["Text"])
+ self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"])
+ self.assertEqual("Autor desconocido, 07/04/2019 13:43:52",
+ get_state_as_dict(xDialog.getChild("lastedit"))["Text"])
- xOKBtn = xDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests6/tdf126627.py b/sw/qa/uitest/writer_tests6/tdf126627.py
index d72f3d91416b..2da4c6d89fde 100644
--- a/sw/qa/uitest/writer_tests6/tdf126627.py
+++ b/sw/qa/uitest/writer_tests6/tdf126627.py
@@ -12,39 +12,38 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf126627(UITestCase):
def test_tdf126627_crash_undo_deletion(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126627.odt"))
- document = self.ui_test.get_component()
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf126627.odt")) as writer_doc:
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
- searchterm = xDialog.getChild("searchterm")
- searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bar"}))
- xsearch = xDialog.getChild("search")
- xsearch.executeAction("CLICK", tuple())
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bar"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
- xcloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xcloseBtn)
- #2. Place the cursor before 'bar'
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
- #3. Hit backspace 4 times -> Foo and bar are together
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- self.assertEqual(document.Text.String[0:6], "foobar")
- #4. Undo once-> Crash
- self.xUITest.executeCommand(".uno:Undo")
- #verify that we have now two words
- self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
- xDialog = self.xUITest.getTopFocusWindow()
- xselectwords = xDialog.getChild("selectwords")
- self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
- xCloseBtn = xDialog.getChild("close")
- self.ui_test.close_dialog_through_button(xCloseBtn)
+ xcloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xcloseBtn)
+ #2. Place the cursor before 'bar'
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ #3. Hit backspace 4 times -> Foo and bar are together
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ self.assertEqual(document.Text.String[0:6], "foobar")
+ #4. Undo once-> Crash
+ self.xUITest.executeCommand(".uno:Undo")
+ #verify that we have now two words
+ self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xselectwords = xDialog.getChild("selectwords")
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
+ xCloseBtn = xDialog.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py
index 5e7b42ca9a2f..2813c997ad1e 100644
--- a/sw/qa/uitest/writer_tests7/apply_line_cap.py
+++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py
@@ -11,92 +11,90 @@ from uitest.uihelper.common import select_pos
class apply_line_cap(UITestCase):
def test_apply_line_cap(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc:
- # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles
+ # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles
- # select second line shape (dashDot)
- writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+ # select second line shape (dashDot)
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
- # wait for available line style setting
- self.ui_test.wait_until_child_is_available('metricfield')
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
- # line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ # line setting dialog window
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # select 'Dot (Rounded)', but store the previous value
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
- select_pos(xLineStyle, "3")
+ # select 'Dot (Rounded)', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "3")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(cap_style, 'Flat')
- self.assertEqual(style, 'Long Dash Dot')
+ self.assertEqual(cap_style, 'Flat')
+ self.assertEqual(style, 'Long Dash Dot')
- # check round cap setting, opening the line style dialog again
- writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+ # check round cap setting, opening the line style dialog again
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
- # wait for available line style setting
- self.ui_test.wait_until_child_is_available('metricfield')
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
- # line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ # line setting dialog window
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # select 'Dot', but store the previous value
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
- select_pos(xLineStyle, "2")
+ # select 'Dot', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "2")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # This was 'Flat' (set only dash style of the line style before)
- self.assertEqual(cap_style, 'Round')
- self.assertEqual(style, 'Dot (Rounded)')
+ # This was 'Flat' (set only dash style of the line style before)
+ self.assertEqual(cap_style, 'Round')
+ self.assertEqual(style, 'Dot (Rounded)')
- # 2. check ROUND -> FLAT cap style change
- writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+ # 2. check ROUND -> FLAT cap style change
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
- # wait for available line style setting
- self.ui_test.wait_until_child_is_available('metricfield')
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
- # line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ # line setting dialog window
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get cap style combo box
- xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
- cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # This was 'Flat' (set only dash style of the line style before)
- self.assertEqual(cap_style, 'Flat')
- self.assertEqual(style, 'Dot')
-
- self.ui_test.close_doc()
+ # This was 'Flat' (set only dash style of the line style before)
+ self.assertEqual(cap_style, 'Flat')
+ self.assertEqual(style, 'Dot')
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py
index b931c5d6f3fb..d58d9a15ae91 100644
--- a/sw/qa/uitest/writer_tests7/forms.py
+++ b/sw/qa/uitest/writer_tests7/forms.py
@@ -14,201 +14,189 @@ class Forms(UITestCase):
def test_tdf140486(self):
- self.ui_test.load_file(get_url_for_data_file("tdf140486.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL')
-
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Yes' != 'No'
- self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL')
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Yes' != 'No'
+ self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText'])
def test_tdf140198(self):
- self.ui_test.load_file(get_url_for_data_file("tdf140198.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xChild = self.ui_test.wait_until_child_is_available('listbox-Text type')
-
- # Without the fix in place, this test would have failed with
- # AssertionError: 'Multi-line' != 'Single-line'
- self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xChild = self.ui_test.wait_until_child_is_available('listbox-Text type')
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Multi-line' != 'Single-line'
+ self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText'])
def test_tdf141084(self):
# Reuse document from tdf#140239
- self.ui_test.load_file(get_url_for_data_file("tdf140239.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties")
- xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
- xFrame = self.ui_test.wait_until_child_is_available('combobox-Frame')
+ self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties")
+ xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
+ xFrame = self.ui_test.wait_until_child_is_available('combobox-Frame')
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
- # Without the fix in place, this test would have failed with
- # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1'
- self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1'
+ self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
def test_tdf140239(self):
- self.ui_test.load_file(get_url_for_data_file("tdf140239.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xAction = self.ui_test.wait_until_child_is_available('listbox-Action')
- xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
- xEntry = self.ui_test.wait_until_child_is_available('entry')
-
- self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText'])
- self.assertEqual("false", get_state_as_dict(xURL)['Enabled'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xAction = self.ui_test.wait_until_child_is_available('listbox-Action')
+ xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
+ xEntry = self.ui_test.wait_until_child_is_available('entry')
- select_by_text(xAction, "Open document/web page")
+ self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText'])
+ self.assertEqual("false", get_state_as_dict(xURL)['Enabled'])
- self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText'])
- self.assertEqual("true", get_state_as_dict(xURL)['Enabled'])
+ select_by_text(xAction, "Open document/web page")
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
- xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+ self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText'])
+ self.assertEqual("true", get_state_as_dict(xURL)['Enabled'])
- # Without the fix in place, this test would have failed with
- # AssertionError: '12345' != '54321'
- self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
- xEntry.executeAction("FOCUS", tuple())
- self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text'])
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != '54321'
+ self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
- xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"}))
+ xEntry.executeAction("FOCUS", tuple())
+ self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text'])
- # Move the focus to another element so the changes done before will take effect
- xAction.executeAction("FOCUS", tuple())
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"}))
- # tdf#131522: Without the fix in place, this test would have failed with
- # AssertionError: 'Push' != 'Push Button'
- self.assertEqual("Push", get_state_as_dict(xEntry)['Text'])
+ # Move the focus to another element so the changes done before will take effect
+ xAction.executeAction("FOCUS", tuple())
- self.ui_test.close_doc()
+ # tdf#131522: Without the fix in place, this test would have failed with
+ # AssertionError: 'Push' != 'Push Button'
+ self.assertEqual("Push", get_state_as_dict(xEntry)['Text'])
def test_tdf138701(self):
# Reuse file from another test
- self.ui_test.load_file(get_url_for_data_file("tdf140198.odt"))
-
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xChild = self.ui_test.wait_until_child_is_available('combobox-Data field')
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xChild = self.ui_test.wait_until_child_is_available('combobox-Data field')
- # Without the fix in place, this test would have failed with
- # AssertionError: '12345' != '54321'
- self.assertEqual("12345", get_state_as_dict(xChild)['Text'])
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != '54321'
+ self.assertEqual("12345", get_state_as_dict(xChild)['Text'])
def test_tdf139486(self):
# Reuse file from another test
- self.ui_test.load_file(get_url_for_data_file("tdf140198.odt"))
-
- change_measurement_unit(self, "Centimeter")
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ change_measurement_unit(self, "Centimeter")
- document = self.ui_test.get_component()
- drawPage = document.getDrawPages().getByIndex(0)
- shape = drawPage.getByIndex(0)
- self.assertEqual(13996, shape.getSize().Width)
- self.assertEqual(2408, shape.getSize().Height)
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width')
- xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height')
+ document = self.ui_test.get_component()
+ drawPage = document.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+ self.assertEqual(13996, shape.getSize().Width)
+ self.assertEqual(2408, shape.getSize().Height)
- self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text'])
- self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width')
+ xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height')
- xWidth.executeAction("FOCUS", tuple())
- xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"}))
+ self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text'])
+ self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text'])
- self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text'])
+ xWidth.executeAction("FOCUS", tuple())
+ xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"}))
- xHeight.executeAction("FOCUS", tuple())
- xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"}))
+ self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text'])
- self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text'])
+ xHeight.executeAction("FOCUS", tuple())
+ xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"}))
- # Move the focus to another element so the changes done before take effect on the document
- xDialog = self.xUITest.getTopFocusWindow()
- xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple())
+ self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text'])
- # Without the fix in place, the size of the form wouldn't have changed
- self.assertEqual(20001, shape.getSize().Width)
- self.assertEqual(5001, shape.getSize().Height)
+ # Move the focus to another element so the changes done before take effect on the document
+ xDialog = self.xUITest.getTopFocusWindow()
+ xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple())
- self.ui_test.close_doc()
+ # Without the fix in place, the size of the form wouldn't have changed
+ self.assertEqual(20001, shape.getSize().Width)
+ self.assertEqual(5001, shape.getSize().Height)
def test_tdf138271(self):
- self.ui_test.load_file(get_url_for_data_file("tdf138271.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")):
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- aOldValue = ["-1000000.00", "1000000.00"]
- aNewValue = ["-100.00", "100.00"]
+ aOldValue = ["-1000000.00", "1000000.00"]
+ aNewValue = ["-100.00", "100.00"]
- for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']):
+ for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']):
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xChild = self.ui_test.wait_until_child_is_available(name)
-
- self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xChild = self.ui_test.wait_until_child_is_available(name)
- xChild.executeAction("FOCUS", tuple())
- xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
- xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
- xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]}))
+ self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text'])
- #Close the dialog and open it again
- self.xUITest.executeCommand(".uno:ControlProperties")
+ xChild.executeAction("FOCUS", tuple())
+ xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]}))
- self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
- xChild = self.ui_test.wait_until_child_is_available(name)
+ #Close the dialog and open it again
+ self.xUITest.executeCommand(".uno:ControlProperties")
- # Without the fix in place, this test would have failed here because
- # the values wouldn't have changed
- self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text'])
+ self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+ xChild = self.ui_test.wait_until_child_is_available(name)
- self.xUITest.executeCommand(".uno:ControlProperties")
+ # Without the fix in place, this test would have failed here because
+ # the values wouldn't have changed
+ self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text'])
- self.ui_test.close_doc()
+ self.xUITest.executeCommand(".uno:ControlProperties")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py
index 1fcc20f5b013..58316db101b5 100644
--- a/sw/qa/uitest/writer_tests7/tdf104795.py
+++ b/sw/qa/uitest/writer_tests7/tdf104795.py
@@ -13,19 +13,17 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf104795(UITestCase):
def test_tdf104795(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf104795.odt"))
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- xDialog = self.xUITest.getTopFocusWindow()
+ with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as writer_doc:
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
- sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']
+ sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- # Without the fix in place, this test would have failed with
- # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!'
- self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0])
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!'
+ self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py
index 9d09d25bb3c7..9ad178f8a722 100644
--- a/sw/qa/uitest/writer_tests7/tdf119661.py
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -77,18 +77,16 @@ class tdf119661(UITestCase):
# Close the Writer document
self.ui_test.close_doc()
- self.ui_test.load_file(systemPathToFileUrl(xFilePath))
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
- self.xUITest.executeCommand(".uno:LinkDialog")
+ self.xUITest.executeCommand(".uno:LinkDialog")
- # Since the image is no longer linked, the link dialog is not open.
- # Without the fix in place, this dialog would have been opened
- xMainWin = self.xUITest.getTopFocusWindow()
- self.assertTrue(sLinks not in xMainWin.getChildren())
- self.assertTrue(sFileName not in xMainWin.getChildren())
- self.assertTrue(sBreakLink not in xMainWin.getChildren())
- self.assertTrue("writer_edit" in xMainWin.getChildren())
-
- self.ui_test.close_doc()
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("writer_edit" in xMainWin.getChildren())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py
index 09f881c5c781..45f6a75b5906 100644
--- a/sw/qa/uitest/writer_tests7/tdf122780.py
+++ b/sw/qa/uitest/writer_tests7/tdf122780.py
@@ -13,16 +13,14 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
class tdf122780(UITestCase):
def test_tdf122780(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf122780.docx"))
- self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) as writer_doc:
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
- # Without the fix in place, this test would have hung here
- xDialog = self.xUITest.getTopFocusWindow()
- self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
- self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
-
- self.ui_test.close_doc()
+ # Without the fix in place, this test would have hung here
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
+ self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py
index db0c4ae3b47c..7e147f006326 100644
--- a/sw/qa/uitest/writer_tests7/tdf131936.py
+++ b/sw/qa/uitest/writer_tests7/tdf131936.py
@@ -10,18 +10,16 @@ import time
class tdf131936(UITestCase):
def test_tdf131936_saveas_docx_version(self):
- self.ui_test.load_file(get_url_for_data_file("tdf131936.docx"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")):
- self.ui_test.execute_dialog_through_command(".uno:SaveAs")
- time.sleep(DEFAULT_SLEEP)
- xDialog = self.xUITest.getTopFocusWindow()
- xFileTypeCombo = xDialog.getChild("file_type")
- state = get_state_as_dict(xFileTypeCombo)
- self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")
+ self.ui_test.execute_dialog_through_command(".uno:SaveAs")
+ time.sleep(DEFAULT_SLEEP)
+ xDialog = self.xUITest.getTopFocusWindow()
+ xFileTypeCombo = xDialog.getChild("file_type")
+ state = get_state_as_dict(xFileTypeCombo)
+ self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")
- xCancel = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancel)
-
- self.ui_test.close_doc()
+ xCancel = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancel)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py
index 7914fbf85e15..ef1ec666c029 100644
--- a/sw/qa/uitest/writer_tests7/tdf132169.py
+++ b/sw/qa/uitest/writer_tests7/tdf132169.py
@@ -11,38 +11,36 @@ from uitest.uihelper.common import change_measurement_unit
class tdf132169(UITestCase):
def test_tdf132169(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("shape.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc:
- #set measurement to points
- change_measurement_unit(self, "Point")
+ #set measurement to points
+ change_measurement_unit(self, "Point")
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- #wait until the toolbar is available
- xLineMetric = self.ui_test.wait_until_child_is_available('metricfield')
- self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt")
+ #wait until the toolbar is available
+ xLineMetric = self.ui_test.wait_until_child_is_available('metricfield')
+ self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt")
- #Check changing value from dialog also works
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
- type_text(xWidth, "4.0")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ #Check changing value from dialog also works
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
+ type_text(xWidth, "4.0")
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt")
- self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt")
+ self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt")
+ self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt")
- xLineMetric.executeAction("UP", tuple())
+ xLineMetric.executeAction("UP", tuple())
- document = self.ui_test.get_component()
- drawPage = document.getDrawPages().getByIndex(0)
- shape = drawPage.getByIndex(0)
+ document = self.ui_test.get_component()
+ drawPage = document.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
- #Without the fix in place, it would have been 310
- self.assertEqual(shape.LineWidth, 176)
-
- self.ui_test.close_doc()
+ #Without the fix in place, it would have been 310
+ self.assertEqual(shape.LineWidth, 176)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py
index 53e9109e22bb..e41cb5ce410c 100644
--- a/sw/qa/uitest/writer_tests7/tdf134243.py
+++ b/sw/qa/uitest/writer_tests7/tdf134243.py
@@ -10,17 +10,15 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf134243(UITestCase):
def test_tdf134243(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf134243.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as writer_doc:
- # Without the fix in place, it would hung launching the mailmerge wizard
- self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard")
+ # Without the fix in place, it would hung launching the mailmerge wizard
+ self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- xCancelBtn = xDialog.getChild("cancel")
- self.ui_test.close_dialog_through_button(xCancelBtn)
-
- self.ui_test.close_doc()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py
index a4067410f41c..99c6085f29dd 100644
--- a/sw/qa/uitest/writer_tests7/tdf137802.py
+++ b/sw/qa/uitest/writer_tests7/tdf137802.py
@@ -13,67 +13,65 @@ class tdf137802(UITestCase):
def test_tdf137802(self):
- self.ui_test.load_file(get_url_for_data_file("tdf137802.odt"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")):
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
- self.assertEqual(document.DrawPage.getCount(), 2)
- self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+ self.assertEqual(document.DrawPage.getCount(), 2)
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.wait_until_child_is_available('metricfield')
+ self.ui_test.wait_until_child_is_available('metricfield')
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- xDialog.getChild('topage').executeAction("CLICK", tuple())
+ xDialog.getChild('topage').executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
+ self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
- self.assertEqual(document.DrawPage.getCount(), 2)
+ self.assertEqual(document.DrawPage.getCount(), 2)
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
- # When shape 1 is selected, esc key doesn't put the focus back to the document
- # because the shape has a textbox. Move the focus to another shape with tab key
- # and then use escape
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
+ # When shape 1 is selected, esc key doesn't put the focus back to the document
+ # because the shape has a textbox. Move the focus to another shape with tab key
+ # and then use escape
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
- # Wait until the shape is deselected and the cursor is on the document
- self.ui_test.wait_until_child_is_available('FontNameBox')
+ # Wait until the shape is deselected and the cursor is on the document
+ self.ui_test.wait_until_child_is_available('FontNameBox')
- # Delete the second paragraph. Shape 2 is anchored to this paragraph
- # so it should be deleted
- xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ # Delete the second paragraph. Shape 2 is anchored to this paragraph
+ # so it should be deleted
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
- self.assertEqual(document.DrawPage.getCount(), 1)
+ self.assertEqual(document.DrawPage.getCount(), 1)
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.xUITest.executeCommand(".uno:Delete")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:Delete")
- self.assertEqual(document.DrawPage.getCount(), 0)
+ self.assertEqual(document.DrawPage.getCount(), 0)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.DrawPage.getCount(), 1)
+ self.assertEqual(document.DrawPage.getCount(), 1)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(document.DrawPage.getCount(), 2)
+ self.assertEqual(document.DrawPage.getCount(), 2)
- self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
- self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
-
- self.ui_test.close_doc()
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py
index 3e48c267ca55..3549cc9d0b77 100644
--- a/sw/qa/uitest/writer_tests7/tdf137803.py
+++ b/sw/qa/uitest/writer_tests7/tdf137803.py
@@ -11,42 +11,41 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf137803(UITestCase):
def test_tdf137803(self):
# load the sample file
- self.ui_test.load_file(get_url_for_data_file("tdf137803.odt"))
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")):
+ document = self.ui_test.get_component()
- # select the shape
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.wait_until_child_is_available('metricfield')
+ # select the shape
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.ui_test.wait_until_child_is_available('metricfield')
- # open textattrs dialog
- self.ui_test.execute_dialog_through_command(".uno:TextAttributes")
- TextDialog = self.xUITest.getTopFocusWindow();
+ # open textattrs dialog
+ self.ui_test.execute_dialog_through_command(".uno:TextAttributes")
+ TextDialog = self.xUITest.getTopFocusWindow();
- # check autosize on
- TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE')
- TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
- ok = TextDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
+ # check autosize on
+ TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE')
+ TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
+ ok = TextDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(ok)
- # get the shape
- drawPage = document.getDrawPages().getByIndex(0)
- shape = drawPage.getByIndex(0)
+ # get the shape
+ drawPage = document.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
- # and the textbox
- frame = shape.getText()
+ # and the textbox
+ frame = shape.getText()
- # get the positions
- shapeYPos = shape.getPropertyValue("VertOrientPosition")
- frameYPos = frame.getPropertyValue("VertOrientPosition")
- shpsize = shape.getSize().Height
+ # get the positions
+ shapeYPos = shape.getPropertyValue("VertOrientPosition")
+ frameYPos = frame.getPropertyValue("VertOrientPosition")
+ shpsize = shape.getSize().Height
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
- # without the fix, at this point the textbox falls apart so this won't be passed
- self.assertLess(frameYPos, shapeYPos + shpsize)
+ # without the fix, at this point the textbox falls apart so this won't be passed
+ self.assertLess(frameYPos, shapeYPos + shpsize)
- # close the doc
- self.ui_test.close_doc()
+ # close the doc
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py
index 064018889031..7436dce42bda 100644
--- a/sw/qa/uitest/writer_tests7/tdf139301.py
+++ b/sw/qa/uitest/writer_tests7/tdf139301.py
@@ -12,58 +12,54 @@ class tdf139301(UITestCase):
styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot')
def test_tdf139301(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx"))
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc:
- for i in range(len(self.styles)):
- # select next line shape
- writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
+ for i in range(len(self.styles)):
+ # select next line shape
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
- # wait for available line style setting
- self.ui_test.wait_until_child_is_available('metricfield')
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
- # line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # line setting dialog window
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- # check preset line style
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.assertEqual(style, self.styles[i])
-
- self.ui_test.close_doc()
+ self.assertEqual(style, self.styles[i])
def test_round_cap(self):
- writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx"))
-
- style_name_extension = ' (Rounded)'
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc:
- for i in range(len(self.styles)):
- # select next line shape
- writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
+ style_name_extension = ' (Rounded)'
- # wait for available line style setting
- self.ui_test.wait_until_child_is_available('metricfield')
+ for i in range(len(self.styles)):
+ # select next line shape
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
- # line setting dialog window
- self.ui_test.execute_dialog_through_command(".uno:FormatLine")
- xFormatLineDlg = self.xUITest.getTopFocusWindow()
- # get line style combo box
- xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
- # check preset line style
- style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ # line setting dialog window
+ self.ui_test.execute_dialog_through_command(".uno:FormatLine")
+ xFormatLineDlg = self.xUITest.getTopFocusWindow()
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
- xOKBtn = xFormatLineDlg.getChild("ok")
- self.ui_test.close_dialog_through_button(xOKBtn)
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
- self.assertEqual(style, self.styles[i] + style_name_extension)
+ xOKBtn = xFormatLineDlg.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
- self.ui_test.close_doc()
+ self.assertEqual(style, self.styles[i] + style_name_extension)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py
index c6244841241e..a1790e642a64 100644
--- a/sw/qa/uitest/writer_tests7/tdf140117.py
+++ b/sw/qa/uitest/writer_tests7/tdf140117.py
@@ -13,51 +13,49 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf140117(UITestCase):
def test_tdf140117(self):
# load the sample file
- self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
-
- for i in range(3):
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
-
- self.xUITest.executeCommand(".uno:JumpToHeader")
-
- xPageSytle = document.getStyleFamilies().getByIndex(2)
- xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
- xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String
- xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
- xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String
-
- # Option "same content on left and right pages" is false,
- # insert text "XXXX" before actual header text "left" on page 2
- if i == 0:
- type_text(xWriterEdit, "XXXX")
-
- # Option "same content on left and right pages" is true,
- # header of page 2 contains the same text as page 1
- elif i == 1:
- self.assertEqual("right", xHeaderText)
- self.assertEqual("right", xHeaderRightText)
-
- # Option "same content on left and right pages" is false again.
- # This was "right" instead of keeping the header content disabled
- # temporarily for the second interaction of the loop.
- elif i == 2:
- self.assertEqual("XXXXleft", xHeaderLeftText)
-
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- PageDialog = self.xUITest.getTopFocusWindow();
-
- xTabs = PageDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
-
- # Change option "same content on left and right pages" for the next iteration
- Button = xTabs.getChild('checkSameLR')
- Button.executeAction("CLICK", tuple())
- ok = PageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ for i in range(3):
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+
+ xPageSytle = document.getStyleFamilies().getByIndex(2)
+ xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
+ xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String
+ xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
+ xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String
+
+ # Option "same content on left and right pages" is false,
+ # insert text "XXXX" before actual header text "left" on page 2
+ if i == 0:
+ type_text(xWriterEdit, "XXXX")
+
+ # Option "same content on left and right pages" is true,
+ # header of page 2 contains the same text as page 1
+ elif i == 1:
+ self.assertEqual("right", xHeaderText)
+ self.assertEqual("right", xHeaderRightText)
+
+ # Option "same content on left and right pages" is false again.
+ # This was "right" instead of keeping the header content disabled
+ # temporarily for the second interaction of the loop.
+ elif i == 2:
+ self.assertEqual("XXXXleft", xHeaderLeftText)
+
+ self.ui_test.execute_dialog_through_command(".uno:PageDialog")
+ PageDialog = self.xUITest.getTopFocusWindow();
+
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ # Change option "same content on left and right pages" for the next iteration
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK", tuple())
+ ok = PageDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(ok)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py
index e29c36418958..6624530ee3cd 100644
--- a/sw/qa/uitest/writer_tests7/tdf141158.py
+++ b/sw/qa/uitest/writer_tests7/tdf141158.py
@@ -10,32 +10,31 @@ import time
class TestTdf141158(UITestCase):
def test_tdf141158(self):
# load the desired bugdoc
- self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
- # open the page styles dialog and select the headers tab
- self.xUITest.executeCommand(".uno:PageStyleName")
- TemplateDialog8 = self.xUITest.getTopFocusWindow()
- xTabs = TemplateDialog8.getChild("tabcontrol")
- select_pos(xTabs, "4")
- # make the same left right page header state to off and apply the setting
- checkSameLR = TemplateDialog8.getChild("checkSameLR")
- checkSameLR.executeAction("CLICK",tuple())
- ok = TemplateDialog8.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
- time.sleep(1)
- # go to the left header
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
- self.xUITest.executeCommand(".uno:JumpToHeader")
- # get the text of the header
- xPageSytle = document.getStyleFamilies().getByIndex(2)
- xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
- xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
- # without the fix in place it was "Right Header" (lost hidden left header),
- # with the fix it should pass...
- self.assertEqual("Left Header", xHeaderLeftText)
- time.sleep(1)
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+ # open the page styles dialog and select the headers tab
+ self.xUITest.executeCommand(".uno:PageStyleName")
+ TemplateDialog8 = self.xUITest.getTopFocusWindow()
+ xTabs = TemplateDialog8.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ # make the same left right page header state to off and apply the setting
+ checkSameLR = TemplateDialog8.getChild("checkSameLR")
+ checkSameLR.executeAction("CLICK",tuple())
+ ok = TemplateDialog8.getChild("ok")
+ self.ui_test.close_dialog_through_button(ok)
+ time.sleep(1)
+ # go to the left header
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+ # get the text of the header
+ xPageSytle = document.getStyleFamilies().getByIndex(2)
+ xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
+ xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
+ # without the fix in place it was "Right Header" (lost hidden left header),
+ # with the fix it should pass...
+ self.assertEqual("Left Header", xHeaderLeftText)
+ time.sleep(1)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py
index c641cd3e23f3..3d25c7908d99 100644
--- a/sw/qa/uitest/writer_tests7/tdf141557.py
+++ b/sw/qa/uitest/writer_tests7/tdf141557.py
@@ -12,29 +12,27 @@ from uitest.uihelper.common import get_url_for_data_file
class tdf141557(UITestCase):
def test_tdf141557(self):
# load the sample file
- self.ui_test.load_file(get_url_for_data_file("tdf141557.docx"))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
- self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType)
+ self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType)
- self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
- self.ui_test.wait_until_child_is_available('metricfield')
+ self.ui_test.wait_until_child_is_available('metricfield')
- self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
+ self.ui_test.execute_dialog_through_command(".uno:TransformDialog")
- xDialog = self.xUITest.getTopFocusWindow()
+ xDialog = self.xUITest.getTopFocusWindow()
- xDialog.getChild('topara').executeAction("CLICK", tuple())
+ xDialog.getChild('topara').executeAction("CLICK", tuple())
- xOkBtn = xDialog.getChild("ok")
- xOkBtn.executeAction("CLICK", tuple())
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
- # Without the fix in place, at this point crash occurs.
- self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
-
- self.ui_test.close_doc()
+ # Without the fix in place, at this point crash occurs.
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py
index 1c90dc3c404a..1c34a89a71b4 100644
--- a/sw/qa/uitest/writer_tests7/tdf46561.py
+++ b/sw/qa/uitest/writer_tests7/tdf46561.py
@@ -26,75 +26,73 @@ class tdf46561(UITestCase):
self.assertEqual(right, xHeaderTextRight)
def test_tdf46561(self):
- self.ui_test.load_file(get_url_for_data_file("tdf46561.odt"))
- self.document = self.ui_test.get_component()
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild("writer_edit")
- xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
- self.xUITest.executeCommand(".uno:JumpToHeader")
-
- # Switch "same left and right page headers" on and off a few times
- for _ in range(4):
- self.ui_test.execute_dialog_through_command(".uno:PageDialog")
- PageDialog = self.xUITest.getTopFocusWindow();
-
- xTabs = PageDialog.getChild("tabcontrol")
- select_pos(xTabs, "4")
-
- Button = xTabs.getChild('checkSameLR')
- Button.executeAction("CLICK",tuple())
- ok = PageDialog.getChild("ok")
- self.ui_test.close_dialog_through_button(ok)
-
- # We should be back to the starting state after 2*k on/off changes
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Enter some additional text in the left page header
- type_text(xWriterEdit, "XXXX")
- self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
-
- # Now go back one change (before entering "XXXX")
- self.xUITest.executeCommand(".uno:Undo")
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Undo the fourth change
- self.xUITest.executeCommand(".uno:Undo")
- self.check_header_texts(master="right", first="1st", left="right", right="right")
-
- # Undo the third change
- self.xUITest.executeCommand(".uno:Undo")
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Undo the second change
- self.xUITest.executeCommand(".uno:Undo")
- self.check_header_texts(master="right", first="1st", left="right", right="right")
-
- # Undo the first change
- self.xUITest.executeCommand(".uno:Undo")
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Redo the first change
- self.xUITest.executeCommand(".uno:Redo")
- self.check_header_texts(master="right", first="1st", left="right", right="right")
-
- # Redo the second change
- self.xUITest.executeCommand(".uno:Redo")
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Redo the third change
- self.xUITest.executeCommand(".uno:Redo")
- self.check_header_texts(master="right", first="1st", left="right", right="right")
-
- # Redo the fourth change
- self.xUITest.executeCommand(".uno:Redo")
- self.check_header_texts(master="right", first="1st", left="left", right="right")
-
- # Redo the final change
- self.xUITest.executeCommand(".uno:Redo")
- self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
-
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")):
+ self.document = self.ui_test.get_component()
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+
+ # Switch "same left and right page headers" on and off a few times
+ for _ in range(4):
+ self.ui_test.execute_dialog_through_command(".uno:PageDialog")
+ PageDialog = self.xUITest.getTopFocusWindow();
+
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK",tuple())
+ ok = PageDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(ok)
+
+ # We should be back to the starting state after 2*k on/off changes
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Enter some additional text in the left page header
+ type_text(xWriterEdit, "XXXX")
+ self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
+
+ # Now go back one change (before entering "XXXX")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Undo the fourth change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Undo the third change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Undo the second change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Undo the first change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the first change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Redo the second change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the third change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Redo the fourth change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the final change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
index e204ef8bb62a..cb70c401b142 100644
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -21,82 +21,83 @@ class tdf90401(UITestCase):
# load a test document with a tracked change, and add a comment
- writer_doc = self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt'))
- xWriterDoc = self.xUITest.getTopFocusWindow()
- xWriterEdit = xWriterDoc.getChild('writer_edit')
+ with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild('writer_edit')
- document = self.ui_test.get_component()
- selection = self.xUITest.executeCommand('.uno:SelectAll')
- self.xUITest.executeCommand('.uno:InsertAnnotation')
+ document = self.ui_test.get_component()
+ selection = self.xUITest.executeCommand('.uno:SelectAll')
+ self.xUITest.executeCommand('.uno:InsertAnnotation')
- # enable remove personal info security option
+ # enable remove personal info security option
- self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') #optionsdialog
- xDialog = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
- xPages = xDialog.getChild('pages')
- xGenEntry = xPages.getChild('0')
- xSecurityPage = xGenEntry.getChild('6')
- xSecurityPage.executeAction('SELECT', tuple())
- # Click Button Options...
- xOptions = xDialog.getChild('options')
+ xPages = xDialog.getChild('pages')
+ xGenEntry = xPages.getChild('0')
+ xSecurityPage = xGenEntry.getChild('6')
+ xSecurityPage.executeAction('SELECT', tuple())
+ # Click Button Options...
+ xOptions = xDialog.getChild('options')
- with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
- xRemovePersonal = dialog.getChild('removepersonal')
- xRemovePersonal.executeAction('CLICK', tuple())
- xOkBtn = dialog.getChild('ok')
- # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the
- # event DialogClosed after closing
- xOkBtn.executeAction('CLICK', tuple())
+ with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ xRemovePersonal = dialog.getChild('removepersonal')
+ xRemovePersonal.executeAction('CLICK', tuple())
+ xOkBtn = dialog.getChild('ok')
+ # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the
+ # event DialogClosed after closing
+ xOkBtn.executeAction('CLICK', tuple())
- xOKBtn = xDialog.getChild('ok')
- self.ui_test.close_dialog_through_button(xOKBtn)
+ xOKBtn = xDialog.getChild('ok')
+ self.ui_test.close_dialog_through_button(xOKBtn)
- # save and reload the document to remove personal info
+ # save and reload the document to remove personal info
- with TemporaryDirectory() as tempdir:
- xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt')
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt')
- # Save Copy as
- self.ui_test.execute_dialog_through_command('.uno:SaveAs')
- xDialog = self.xUITest.getTopFocusWindow()
+ # Save Copy as
+ self.ui_test.execute_dialog_through_command('.uno:SaveAs')
+ xDialog = self.xUITest.getTopFocusWindow()
- xFileName = xDialog.getChild('file_name')
- xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
- xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
- xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
- xOpenBtn = xDialog.getChild('open')
- self.ui_test.close_dialog_through_button(xOpenBtn)
+ xOpenBtn = xDialog.getChild('open')
+ self.ui_test.close_dialog_through_button(xOpenBtn)
- # Close the Writer document
- self.ui_test.close_doc()
+ # Close the Writer document
+ self.ui_test.close_doc()
- self.ui_test.load_file(systemPathToFileUrl(xFilePath))
- document = self.ui_test.get_component()
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
+ document = self.ui_test.get_component()
+
+ # check removed personal info on comments
+
+ textfields = document.getTextFields()
+ author = ""
+ year = -1
+ for textfield in textfields:
+ if textfield.supportsService("com.sun.star.text.TextField.Annotation"):
+ author = textfield.Author
+ year = textfield.Date.Year
+ # This was 'Unknown Author'
+ self.assertEqual(author, 'Author2')
+ # This was 2021
+ self.assertEqual(year, 0)
+
+ # check removed personal info on tracked changes
+
+ self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges')
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+ xTreeList = xTrackDlg.getChild('writerchanges')
+ state = get_state_as_dict(xTreeList)
+ # This was 'NL\t11/03/2020 19:19:05\t', containing personal info
+ self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t')
+
+ self.ui_test.close_doc()
- # check removed personal info on comments
-
- textfields = document.getTextFields()
- author = ""
- year = -1
- for textfield in textfields:
- if textfield.supportsService("com.sun.star.text.TextField.Annotation"):
- author = textfield.Author
- year = textfield.Date.Year
- # This was 'Unknown Author'
- self.assertEqual(author, 'Author2')
- # This was 2021
- self.assertEqual(year, 0)
-
- # check removed personal info on tracked changes
-
- self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges')
- xTrackDlg = self.xUITest.getTopFocusWindow()
- xTreeList = xTrackDlg.getChild('writerchanges')
- state = get_state_as_dict(xTreeList)
- # This was 'NL\t11/03/2020 19:19:05\t', containing personal info
- self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t')
-
- self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/demo_ui/handle_multiple_files.py b/uitest/demo_ui/handle_multiple_files.py
index 01e086f3d422..8abb59d9b17f 100644
--- a/uitest/demo_ui/handle_multiple_files.py
+++ b/uitest/demo_ui/handle_multiple_files.py
@@ -15,39 +15,33 @@ class HandleFiles(UITestCase):
def test_load_file(self):
- calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("test.ods")) as calc_file:
- calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods"))
+ with self.ui_test.load_file(get_url_for_data_file("test2.ods")):
- frames = self.ui_test.get_frames()
- self.assertEqual(len(frames), 2)
+ frames = self.ui_test.get_frames()
+ self.assertEqual(len(frames), 2)
- self.ui_test.close_doc()
+ frames = self.ui_test.get_frames()
+ self.assertEqual(len(frames), 1)
- frames = self.ui_test.get_frames()
- self.assertEqual(len(frames), 1)
-
- # this is currently still necessary as otherwise
- # the command is not forwarded to the correct frame
- # TODO: provide an additional event that we can use
- # and get rid of the sleep
- time.sleep(1)
-
- self.ui_test.close_doc()
+ # this is currently still necessary as otherwise
+ # the command is not forwarded to the correct frame
+ # TODO: provide an additional event that we can use
+ # and get rid of the sleep
+ time.sleep(1)
def test_select_frame(self):
- calc_file = self.ui_test.load_file(get_url_for_data_file("test.ods"))
-
- calc_file2 = self.ui_test.load_file(get_url_for_data_file("test2.ods"))
- frames = self.ui_test.get_frames()
- self.assertEqual(len(frames), 2)
- frames[0].activate()
+ with self.ui_test.load_file(get_url_for_data_file("test.ods")) as calc_file:
- self.ui_test.close_doc()
+ with self.ui_test.load_file(get_url_for_data_file("test2.ods")):
+ frames = self.ui_test.get_frames()
+ self.assertEqual(len(frames), 2)
+ frames[0].activate()
- frames = self.ui_test.get_frames()
- self.assertEqual(len(frames), 1)
+ frames = self.ui_test.get_frames()
+ self.assertEqual(len(frames), 1)
- self.assertTrue(frames[0].getTitle().startswith("test2.ods"))
+ self.assertTrue(frames[0].getTitle().startswith("test2.ods"))
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index c83759bf6b80..86da1ac79cb2 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -88,9 +88,14 @@ class UITest(object):
time_ += DEFAULT_SLEEP
time.sleep(DEFAULT_SLEEP)
+ # Calls UITest.close_doc at exit
+ @contextmanager
def load_file(self, url):
- with self.wait_until_component_loaded():
- return self.get_desktop().loadComponentFromURL(url, "_default", 0, tuple())
+ try:
+ with self.wait_until_component_loaded():
+ yield self.get_desktop().loadComponentFromURL(url, "_default", 0, tuple())
+ finally:
+ self.close_doc()
def execute_dialog_through_command(self, command, printNames=False):
with EventListener(self._xContext, "DialogExecute", printNames=printNames) as event:
diff --git a/uitest/uitest/uihelper/guarded.py b/uitest/uitest/uihelper/guarded.py
index b75aea332ff3..5cfed2d49e1a 100644
--- a/uitest/uitest/uihelper/guarded.py
+++ b/uitest/uitest/uihelper/guarded.py
@@ -11,15 +11,6 @@ from contextlib import contextmanager
# Calls UITest.close_doc at exit
@contextmanager
-def load_file(testCase, url):
- component = testCase.ui_test.load_file(url)
- try:
- yield component
- finally:
- testCase.ui_test.close_doc()
-
-# Calls UITest.close_doc at exit
-@contextmanager
def create_doc_in_start_center(testCase, app):
testCase.ui_test.create_doc_in_start_center(app)
component = testCase.ui_test.get_component()