diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-06 13:52:58 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-07 09:33:40 +0000 |
commit | 7355c2ee8a9f0811d1cd3d37fc9dac2ad5f95774 (patch) | |
tree | a5fd1f08a00eac447ca2e6b8da00c75cfa947442 | |
parent | ca57cee2ae5718378193a9c7050248c63b5fa47e (diff) |
uitest: reset value when changing the measurement unit
Otherwise, changing it in one test might affect other tests
Use @contextmanager decorator to change it back to default 'Inch'
at the end of the test even if the test hits an assert
Change-Id: I1e7b35019cd19b490aa619c0a866bb9f93820950
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146583
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
42 files changed, 2711 insertions, 2710 deletions
diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py index 6813471d71fe..ed594510f175 100644 --- a/sc/qa/uitest/calc_tests/columns.py +++ b/sc/qa/uitest/calc_tests/columns.py @@ -14,97 +14,97 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcColumns(UITestCase): def test_column_width(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #column width - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected - - # tdf#144247: Without the fix in place, this test would have failed with - # AssertionError: '2.26 cm' != '2.2578 cm' - self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) - xvalue.executeAction("UP", tuple()) - self.assertEqual("2.30 cm", get_state_as_dict(xvalue)["Text"]) - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected - xdefault.executeAction("CLICK", tuple()) #click default - self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) - - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #verify - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth", close_button="cancel") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + + # tdf#144247: Without the fix in place, this test would have failed with + # AssertionError: '2.26 cm' != '2.2578 cm' + self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) + xvalue.executeAction("UP", tuple()) + self.assertEqual("2.30 cm", get_state_as_dict(xvalue)["Text"]) + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) + + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #verify + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_width_two_columns(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_width_copy(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #column width - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #select column 1 - self.xUITest.executeCommand(".uno:SelectColumn") - #copy - self.xUITest.executeCommand(".uno:Copy") - #select C1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - #paste - self.xUITest.executeCommand(".uno:Paste") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #select column 1 + self.xUITest.executeCommand(".uno:SelectColumn") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_column_hide_show(self): @@ -155,73 +155,73 @@ class CalcColumns(UITestCase): def test_tdf117522_column_width_insert_left(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") - - #select C1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - #column width - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #select D1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - #column width - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"2 cm"})) - # Click Ok - #select E1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) - #column width - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"3 cm"})) - # Click Ok - #select columns C-E - gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - #Insert Columns Left - self.xUITest.executeCommand(".uno:InsertColumnsBefore") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") - - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) - with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #select D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"2 cm"})) + # Click Ok + #select E1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"3 cm"})) + # Click Ok + #select columns C-E + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #Insert Columns Left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py index 16fb19c8cc18..e00f6d0fe01a 100644 --- a/sc/qa/uitest/calc_tests/formatCells.py +++ b/sc/qa/uitest/calc_tests/formatCells.py @@ -246,108 +246,109 @@ class formatCell(UITestCase): def test_minimal_border_width(self): #borderpage.ui, tdf#137790 with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") #set points pt measurement - change_measurement_unit(self, "Point") + with change_measurement_unit(self, "Point"): - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders - linewidthmf = xDialog.getChild("linewidthmf") - xLineSet = xDialog.getChild('lineset') + linewidthmf = xDialog.getChild("linewidthmf") + xLineSet = xDialog.getChild('lineset') - # check line-width for default solid line - self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos']) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '0.75 pt') + # check line-width for default solid line + self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos']) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '0.75 pt') - # set line style to "double" (minimal width is taken) - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - # minimum predefined width is Medium (1.50 pt) - self.assertEqual(widthVal, '1.50 pt') + # set line style to "double" (minimal width is taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + # minimum predefined width is Medium (1.50 pt) + self.assertEqual(widthVal, '1.50 pt') - # set line style to "solid" - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '1.50 pt') + # set line style to "solid" + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '1.50 pt') - # make custom line width - linewidthmf.executeAction("UP", tuple()) - linewidthmf.executeAction("UP", tuple()) - linewidthmf.executeAction("UP", tuple()) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '2.25 pt') + # make custom line width + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '2.25 pt') - # set line style to "double" (minimal width is not taken) - xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) - widthVal = get_state_as_dict(linewidthmf)["Text"] - self.assertEqual(widthVal, '2.25 pt') + # set line style to "double" (minimal width is not taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '2.25 pt') def test_format_cell_borders_tab(self): #borderpage.ui with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") #set points pt measurement - change_measurement_unit(self, "Point") - - #select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders - xsync = xDialog.getChild("sync") - xleftmf = xDialog.getChild("leftmf") - xrightmf = xDialog.getChild("rightmf") - xtopmf = xDialog.getChild("topmf") - xbottommf = xDialog.getChild("bottommf") - - xsync.executeAction("CLICK", tuple()) #uncheck Synchronize - xleftmf.executeAction("UP", tuple()) - xrightmf.executeAction("UP", tuple()) - xrightmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xtopmf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - xbottommf.executeAction("UP", tuple()) - - leftVal = get_state_as_dict(xleftmf)["Text"] - rightVal = get_state_as_dict(xrightmf)["Text"] - topVal = get_state_as_dict(xtopmf)["Text"] - bottomVal = get_state_as_dict(xbottommf)["Text"] - - - # Verify select cell A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #format - cell - with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") #tab Borders - xsync = xDialog.getChild("sync") - xleftmf = xDialog.getChild("leftmf") - xrightmf = xDialog.getChild("rightmf") - xtopmf = xDialog.getChild("topmf") - xbottommf = xDialog.getChild("bottommf") - - self.assertEqual(get_state_as_dict(xsync)["Selected"], "false") - self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True) - self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True) - self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True) - self.assertEqual(get_state_as_dict(xbottommf)["Text"] == bottomVal, True) + with change_measurement_unit(self, "Point"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + xsync.executeAction("CLICK", tuple()) #uncheck Synchronize + xleftmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + + leftVal = get_state_as_dict(xleftmf)["Text"] + rightVal = get_state_as_dict(xrightmf)["Text"] + topVal = get_state_as_dict(xtopmf)["Text"] + bottomVal = get_state_as_dict(xbottommf)["Text"] + + + # Verify select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + self.assertEqual(get_state_as_dict(xsync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True) + self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True) + self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True) + self.assertEqual(get_state_as_dict(xbottommf)["Text"] == bottomVal, True) diff --git a/sc/qa/uitest/calc_tests/rows.py b/sc/qa/uitest/calc_tests/rows.py index fe65f72365cd..a9e34c67347b 100644 --- a/sc/qa/uitest/calc_tests/rows.py +++ b/sc/qa/uitest/calc_tests/rows.py @@ -14,99 +14,101 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcRows(UITestCase): def test_row_height(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #row height - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - xdefault = xDialog.getChild("default") - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected - - # tdf#144247: Without the fix in place, this test would have failed with - # AssertionError: '0.45 cm' != '0.4516 cm' - self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) - xvalue.executeAction("UP", tuple()) - self.assertEqual("0.50 cm", get_state_as_dict(xvalue)["Text"]) - - self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected - xdefault.executeAction("CLICK", tuple()) #click default - self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) - - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #verify - with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + + # tdf#144247: Without the fix in place, this test would have failed with + # AssertionError: '0.45 cm' != '0.4516 cm' + self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) + xvalue.executeAction("UP", tuple()) + self.assertEqual("0.50 cm", get_state_as_dict(xvalue)["Text"]) + + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) + + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #verify + with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_row_height_two_rows(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - #write your own value - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_tdf89140_row_height_copy(self): #Bug 89140 - Calc row paste doesn't keep row height with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") - - #select A1 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - #row height - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #select row 1 - self.xUITest.executeCommand(".uno:SelectRow") - #copy - self.xUITest.executeCommand(".uno:Copy") - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #paste - self.xUITest.executeCommand(".uno:Paste") - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #select row 1 + self.xUITest.executeCommand(".uno:SelectRow") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") def test_row_hide_show(self): @@ -157,36 +159,36 @@ class CalcRows(UITestCase): def test_row_height_insert_below(self): with self.ui_test.create_doc_in_start_center("calc"): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - change_measurement_unit(self, "Centimeter") - - #select A3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - #row height - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) - # Click Ok - #select row 3 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - self.xUITest.executeCommand(".uno:SelectRow") - #insert rows below - self.xUITest.executeCommand(".uno:InsertRowsAfter") - - #verify - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) - with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + #select row 3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.xUITest.executeCommand(".uno:SelectRow") + #insert rows below + self.xUITest.executeCommand(".uno:InsertRowsAfter") + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") # 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 c98a706d20ed..f1d84bf37a63 100644 --- a/sc/qa/uitest/calc_tests7/tdf137397.py +++ b/sc/qa/uitest/calc_tests7/tdf137397.py @@ -17,25 +17,25 @@ class tdf137397(UITestCase): with self.ui_test.load_file(get_url_for_data_file("tdf137397.ods")): - change_measurement_unit(self, 'Centimeter') + with 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.xUITest.executeCommand(".uno:Sidebar") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf126673.py b/sc/qa/uitest/calc_tests9/tdf126673.py index 7d60d5195b32..d06730f93ebc 100644 --- a/sc/qa/uitest/calc_tests9/tdf126673.py +++ b/sc/qa/uitest/calc_tests9/tdf126673.py @@ -17,23 +17,23 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf126673(UITestCase): def test_tdf126673_auto_fit_row_height(self): with self.ui_test.load_file(get_url_for_data_file("tdf126673.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - #select A2 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - #optimal row height - with self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual("0.00 cm", get_state_as_dict(xvalue)["Text"]) + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #optimal row height + with self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("0.00 cm", get_state_as_dict(xvalue)["Text"]) - #select A2 - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) - #row height - with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual("1.24 cm", get_state_as_dict(xvalue)["Text"]) + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("1.24 cm", get_state_as_dict(xvalue)["Text"]) # 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 e6aa046678fc..94bb7c0c97c4 100644 --- a/sc/qa/uitest/calc_tests9/tdf137446.py +++ b/sc/qa/uitest/calc_tests9/tdf137446.py @@ -16,36 +16,36 @@ class tdf137446(UITestCase): def test_tdf137446(self): with self.ui_test.load_file(get_url_for_data_file("tdf137446.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"})) + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"})) - with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: - 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()) - with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: - 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']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py index 44040f8e835f..520ab8e83a2d 100644 --- a/sc/qa/uitest/chart/chartArea.py +++ b/sc/qa/uitest/chart/chartArea.py @@ -17,139 +17,139 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartArea(UITestCase): def test_chart_area_dialog(self): 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") - - xArea = calc_doc.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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - #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()) - - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - - 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 - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - - 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()) - - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: - - 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(xArea.LineWidth, 100) - self.assertEqual(xArea.LineTransparence, 5) - self.assertEqual(hex(xArea.FillColor), '0x23a9d3') - self.assertEqual(xArea.FillTransparence, 51) + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xArea = calc_doc.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + #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()) + + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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 + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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()) + + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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(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/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py index a6e00e599c47..b20180353472 100644 --- a/sc/qa/uitest/chart/chartDataLabels.py +++ b/sc/qa/uitest/chart/chartDataLabels.py @@ -256,35 +256,35 @@ class chartDataLabels(UITestCase): def test_tdf136573(self): with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - 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()) - with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - self.assertEqual("0.74", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("2.82", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + self.assertEqual("0.74", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.82", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - # Use OK button in order to test tdf#137165 + # Use OK button in order to test tdf#137165 - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - # Check the position has changed after moving the label using the arrows keys - self.assertEqual("0.64", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("2.72", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + # Check the position has changed after moving the label using the arrows keys + self.assertEqual("0.64", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.72", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartGrid.py b/sc/qa/uitest/chart/chartGrid.py index c54e03637ee7..bd017248adeb 100644 --- a/sc/qa/uitest/chart/chartGrid.py +++ b/sc/qa/uitest/chart/chartGrid.py @@ -17,184 +17,184 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartGrid(UITestCase): def test_tdf98390_chart_grid_dialog(self): with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: - #tab "Line". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: + #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()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + 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(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + 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(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: - 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%") + 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%") - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + 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(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") - xWidth.executeAction("UP", tuple()) - transparency.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") - transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + 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%") + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "10%") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartLegend.py b/sc/qa/uitest/chart/chartLegend.py index 45938e23017d..a1cf40f44e2f 100644 --- a/sc/qa/uitest/chart/chartLegend.py +++ b/sc/qa/uitest/chart/chartLegend.py @@ -73,31 +73,31 @@ class chartLegend(UITestCase): def test_legends_move_with_arrows_keys(self): with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - 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 legends - xLegends = xChartMain.getChild("CID/D=0:Legend=") - xLegends.executeAction("SELECT", tuple()) + # Select the legends + xLegends = xChartMain.getChild("CID/D=0:Legend=") + xLegends.executeAction("SELECT", tuple()) - with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - self.assertEqual("4.61", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("1.54", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + self.assertEqual("4.61", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("1.54", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - # Check the position has changed after moving the label using the arrows keys - with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - self.assertEqual("4.51", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) - self.assertEqual("1.44", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + # Check the position has changed after moving the label using the arrows keys + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + self.assertEqual("4.51", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("1.44", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) def test_Tdf147394(self): diff --git a/sc/qa/uitest/chart/chartTitles.py b/sc/qa/uitest/chart/chartTitles.py index cd1955b670e4..793b634922a6 100644 --- a/sc/qa/uitest/chart/chartTitles.py +++ b/sc/qa/uitest/chart/chartTitles.py @@ -86,34 +86,34 @@ class chartTitles(UITestCase): def test_title_move_with_arrows_keys(self): with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - 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()) - with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - 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']) + 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']) - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: - # Check the position has changed after moving the title using the arrows keys - 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 + 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']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartWall.py b/sc/qa/uitest/chart/chartWall.py index 4ca6d240d465..8afacc0c54ba 100644 --- a/sc/qa/uitest/chart/chartWall.py +++ b/sc/qa/uitest/chart/chartWall.py @@ -17,154 +17,154 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartWall(UITestCase): def test_chart_wall_dialog(self): 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") - - change_measurement_unit(self, "Centimeter") - - xWall = calc_doc.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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - #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()) - - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - - 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%") + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xWall = calc_doc.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + #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()) + 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 - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - - 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") + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + 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 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% + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: - transparency.executeAction("CLICK", tuple()) - transparencyPercent.executeAction("UP", tuple()) + 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(xWall.LineWidth, 100) - self.assertEqual(xWall.LineTransparence, 5) - self.assertEqual(hex(xWall.FillColor), '0x23a9d3') - self.assertEqual(xWall.FillTransparence, 51) + 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") - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 0) - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + #change tab "Transparency" + select_pos(tabcontrol, "2") + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% - transparency = xDialog.getChild("RBT_TRANS_LINEAR") - transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + transparency.executeAction("CLICK", tuple()) + transparencyPercent.executeAction("UP", tuple()) - 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) + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - self.assertEqual(xWall.LineWidth, 100) - self.assertEqual(xWall.LineTransparence, 5) - self.assertEqual(hex(xWall.FillColor), '0x23a9d3') - self.assertEqual(xWall.FillTransparence, 51) + 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) + + + 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 ea1878e4860f..c61cbd97ef01 100644 --- a/sc/qa/uitest/chart/chartXAxis.py +++ b/sc/qa/uitest/chart/chartXAxis.py @@ -18,225 +18,225 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartXAxis(UITestCase): def test_chart_x_axis_dialog(self): with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - #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 - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - #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") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - - 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 - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - - 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()) - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - - 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") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - - 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") + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_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/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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 + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartYAxis.py b/sc/qa/uitest/chart/chartYAxis.py index ba1dbeb75a58..0bae8f8142d4 100644 --- a/sc/qa/uitest/chart/chartYAxis.py +++ b/sc/qa/uitest/chart/chartYAxis.py @@ -17,227 +17,227 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartYAxis(UITestCase): def test_chart_y_axis_dialog(self): with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - #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 - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - #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") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - - 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 - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - - 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()) - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - - 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") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: - - 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") + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_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/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #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 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #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") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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 + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/formatDataSeries.py b/sc/qa/uitest/chart/formatDataSeries.py index f21c3076f291..171371151d52 100644 --- a/sc/qa/uitest/chart/formatDataSeries.py +++ b/sc/qa/uitest/chart/formatDataSeries.py @@ -17,80 +17,80 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class chartFormatDataSeries(UITestCase): def test_chart_format_data_series_dialog(self): with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: - #Click on tab "Options". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") - leaveGap = xDialog.getChild("RB_DONT_PAINT") - 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()) - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: - #Click on tab "Options". - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "0") - - secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") - leaveGap = xDialog.getChild("RB_DONT_PAINT") - 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") + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_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/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + 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") # 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 a70a75a922b8..4ba39930bca2 100644 --- a/sc/qa/uitest/chart/tdf93506_trendline.py +++ b/sc/qa/uitest/chart/tdf93506_trendline.py @@ -18,416 +18,416 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf93506(UITestCase): def test_tdf93506_chart_trendline_dialog(self): with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") - - - #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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: - #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%") + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_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/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf133630.py b/sc/qa/uitest/chart2/tdf133630.py index a632ba4fa233..ba8099bdc074 100644 --- a/sc/qa/uitest/chart2/tdf133630.py +++ b/sc/qa/uitest/chart2/tdf133630.py @@ -16,46 +16,46 @@ class tdf133630(UITestCase): def test_tdf133630(self): 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") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - xCS = calc_doc.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 = calc_doc.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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + # 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + 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()) - 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") - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + # Now change the line width of another element + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + 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 + # Without the fix in place, this test would have crashed here - 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) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf89907.py b/sc/qa/uitest/textToColumns/tdf89907.py index f0b007c7a17b..ef5f164f9261 100644 --- a/sc/qa/uitest/textToColumns/tdf89907.py +++ b/sc/qa/uitest/textToColumns/tdf89907.py @@ -17,50 +17,50 @@ from uitest.uihelper.common import change_measurement_unit class tdf89907(UITestCase): def test_tdf89907_text_to_columns(self): with self.ui_test.create_doc_in_start_center("calc") as document: - xCalcDoc = self.xUITest.getTopFocusWindow() - gridwin = xCalcDoc.getChild("grid_window") - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") - #Add data - enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") - enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") - enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") - enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") - #select column A - gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) - self.xUITest.executeCommand(".uno:SelectColumn") - #Optimal Width - with self.ui_test.execute_dialog_through_command(".uno:SetOptimalColumnWidth") as xDialog: - xvalue = xDialog.getChild("value") - self.assertEqual("0.20 cm", get_state_as_dict(xvalue)["Text"]) + #Add data + enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd") + enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342") + enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad") + enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #Optimal Width + with self.ui_test.execute_dialog_through_command(".uno:SetOptimalColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("0.20 cm", get_state_as_dict(xvalue)["Text"]) - # Data - Text to Columns - with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: - 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 + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + 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 - #Verify - self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") - self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") - self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) - self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") - self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) - self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") - self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") - self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) - self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") - self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) - self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") - self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) - self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") - self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111) + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342) + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf119246.py b/sd/qa/uitest/impress_tests/tdf119246.py index 8ccd057d40c8..5461f714d9ff 100644 --- a/sd/qa/uitest/impress_tests/tdf119246.py +++ b/sd/qa/uitest/impress_tests/tdf119246.py @@ -18,31 +18,31 @@ class tdf119246(UITestCase): def test_tdf119246(self): with self.ui_test.load_file(get_url_for_data_file("tdf119246.odp")) as document: - change_measurement_unit(self, "Centimeter") - - xImpressDoc = self.xUITest.getTopFocusWindow() - - self.assertIsNone(document.CurrentSelection) - - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"DimensionShape"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - - with self.ui_test.execute_dialog_through_command(".uno:MeasureAttributes") as xDialog: - xLineDist = xDialog.getChild('MTR_LINE_DIST') - xGuideOvergang = xDialog.getChild('MTR_FLD_HELPLINE_OVERHANG') - xGuideDist = xDialog.getChild('MTR_FLD_HELPLINE_DIST') - xLeftDist = xDialog.getChild('MTR_FLD_HELPLINE1_LEN') - xRightDist = xDialog.getChild('MTR_FLD_HELPLINE2_LEN') - xDecimalPlace = xDialog.getChild('MTR_FLD_DECIMALPLACES') - - # Without the fix in place, this test would have failed with - # AssertionError: '2.80 cm' != '1.00 cm' - self.assertEqual("2.80 cm", get_state_as_dict(xLineDist)['Text']) - self.assertEqual("0.20 cm", get_state_as_dict(xGuideOvergang)['Text']) - self.assertEqual("0.50 cm", get_state_as_dict(xGuideDist)['Text']) - self.assertEqual("4.00 cm", get_state_as_dict(xLeftDist)['Text']) - self.assertEqual("-1.40 cm", get_state_as_dict(xRightDist)['Text']) - self.assertEqual("2", get_state_as_dict(xDecimalPlace)['Text']) + with change_measurement_unit(self, "Centimeter"): + + xImpressDoc = self.xUITest.getTopFocusWindow() + + self.assertIsNone(document.CurrentSelection) + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"DimensionShape"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + with self.ui_test.execute_dialog_through_command(".uno:MeasureAttributes") as xDialog: + xLineDist = xDialog.getChild('MTR_LINE_DIST') + xGuideOvergang = xDialog.getChild('MTR_FLD_HELPLINE_OVERHANG') + xGuideDist = xDialog.getChild('MTR_FLD_HELPLINE_DIST') + xLeftDist = xDialog.getChild('MTR_FLD_HELPLINE1_LEN') + xRightDist = xDialog.getChild('MTR_FLD_HELPLINE2_LEN') + xDecimalPlace = xDialog.getChild('MTR_FLD_DECIMALPLACES') + + # Without the fix in place, this test would have failed with + # AssertionError: '2.80 cm' != '1.00 cm' + self.assertEqual("2.80 cm", get_state_as_dict(xLineDist)['Text']) + self.assertEqual("0.20 cm", get_state_as_dict(xGuideOvergang)['Text']) + self.assertEqual("0.50 cm", get_state_as_dict(xGuideDist)['Text']) + self.assertEqual("4.00 cm", get_state_as_dict(xLeftDist)['Text']) + self.assertEqual("-1.40 cm", get_state_as_dict(xRightDist)['Text']) + self.assertEqual("2", get_state_as_dict(xDecimalPlace)['Text']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/tdf134734.py b/sd/qa/uitest/impress_tests/tdf134734.py index 8320246272b7..07985e8f6b43 100644 --- a/sd/qa/uitest/impress_tests/tdf134734.py +++ b/sd/qa/uitest/impress_tests/tdf134734.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_state_as_dict, select_pos -from uitest.uihelper.common import change_measurement_unit from com.sun.star.drawing.FillStyle import SOLID @@ -20,8 +19,6 @@ class TestClass(UITestCase): close = TemplateDialog.getChild("close") self.ui_test.close_dialog_through_button(close) - change_measurement_unit(self, "Inch") - # set margins and fill color with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: xTabs = DrawPageDialog.getChild("tabcontrol") diff --git a/sd/qa/uitest/impress_tests/tdf137729.py b/sd/qa/uitest/impress_tests/tdf137729.py index fe742e0e1537..4362b056e156 100644 --- a/sd/qa/uitest/impress_tests/tdf137729.py +++ b/sd/qa/uitest/impress_tests/tdf137729.py @@ -10,8 +10,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import select_pos from com.sun.star.drawing.HatchStyle import SINGLE -from uitest.uihelper.common import change_measurement_unit - class tdf137729(UITestCase): @@ -23,8 +21,6 @@ class tdf137729(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, "Inch") - with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: tabcontrol = xPageSetupDlg.getChild("tabcontrol") diff --git a/sd/qa/uitest/impress_tests/tdf152295.py b/sd/qa/uitest/impress_tests/tdf152295.py index e6994d09ee61..9c0b00719bb7 100644 --- a/sd/qa/uitest/impress_tests/tdf152295.py +++ b/sd/qa/uitest/impress_tests/tdf152295.py @@ -14,42 +14,41 @@ from uitest.uihelper.common import change_measurement_unit class tdf152295(UITestCase): def test_tdf152295(self): with self.ui_test.create_doc_in_start_center("impress") as document: - change_measurement_unit(self, "Centimeter") TemplateDialog = self.xUITest.getTopFocusWindow() close = TemplateDialog.getChild("close") self.ui_test.close_dialog_through_button(close) - with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) - width = DrawPageDialog.getChild("width") - for _ in range(50): - width.executeAction("UP",tuple()) - height = DrawPageDialog.getChild("height") - for _ in range(50): - height.executeAction("UP",tuple()) - - with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) - - with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: - xTabs = DrawPageDialog.getChild("tabcontrol") - select_pos(xTabs, "1") - btnbitmap = DrawPageDialog.getChild("btnbitmap") - btnbitmap.executeAction("CLICK",tuple()) - width = DrawPageDialog.getChild("width") - height = DrawPageDialog.getChild("height") - - # Without the fix in place, this test would have failed with - # AssertionError: '6.00 cm' != '13.55 cm' - # AssertionError: '6.00 cm' != '13.55 cm' - self.assertEqual("6.00 cm", get_state_as_dict(width)['Text']) - self.assertEqual("6.00 cm", get_state_as_dict(height)['Text']) - + with change_measurement_unit(self, "Centimeter"): + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + btnbitmap = DrawPageDialog.getChild("btnbitmap") + btnbitmap.executeAction("CLICK",tuple()) + width = DrawPageDialog.getChild("width") + for _ in range(50): + width.executeAction("UP",tuple()) + height = DrawPageDialog.getChild("height") + for _ in range(50): + height.executeAction("UP",tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + btnbitmap = DrawPageDialog.getChild("btnbitmap") + btnbitmap.executeAction("CLICK",tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as DrawPageDialog: + xTabs = DrawPageDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + btnbitmap = DrawPageDialog.getChild("btnbitmap") + btnbitmap.executeAction("CLICK",tuple()) + width = DrawPageDialog.getChild("width") + height = DrawPageDialog.getChild("height") + + # Without the fix in place, this test would have failed with + # AssertionError: '6.00 cm' != '13.55 cm' + # AssertionError: '6.00 cm' != '13.55 cm' + self.assertEqual("6.00 cm", get_state_as_dict(width)['Text']) + self.assertEqual("6.00 cm", get_state_as_dict(height)['Text']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests/textColumnsDialog.py b/sd/qa/uitest/impress_tests/textColumnsDialog.py index 2d13c6a9fb5d..98416f82172a 100644 --- a/sd/qa/uitest/impress_tests/textColumnsDialog.py +++ b/sd/qa/uitest/impress_tests/textColumnsDialog.py @@ -21,32 +21,31 @@ class textColumnsDialog(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') - - xImpressDoc = self.xUITest.getTopFocusWindow() - - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - - # Test defaults and set some values - with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - colNumber = xDialog.getChild('FLD_COL_NUMBER') - colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') - self.assertEqual('1', get_state_as_dict(colNumber)['Text']) - self.assertEqual('0.00 cm', get_state_as_dict(colSpacing)['Text']) - colNumber.executeAction("SET", mkPropertyValues({"TEXT": "3"})) - colSpacing.executeAction("SET", mkPropertyValues({"TEXT": "1.5"})) - - # Test that settings persist - with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "2") - colNumber = xDialog.getChild('FLD_COL_NUMBER') - colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') - self.assertEqual('3', get_state_as_dict(colNumber)['Text']) - self.assertEqual('1.50 cm', get_state_as_dict(colSpacing)['Text']) + with change_measurement_unit(self, 'Centimeter'): + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + # Test defaults and set some values + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + colNumber = xDialog.getChild('FLD_COL_NUMBER') + colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') + self.assertEqual('1', get_state_as_dict(colNumber)['Text']) + self.assertEqual('0.00 cm', get_state_as_dict(colSpacing)['Text']) + colNumber.executeAction("SET", mkPropertyValues({"TEXT": "3"})) + colSpacing.executeAction("SET", mkPropertyValues({"TEXT": "1.5"})) + + # Test that settings persist + with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + colNumber = xDialog.getChild('FLD_COL_NUMBER') + colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') + self.assertEqual('3', get_state_as_dict(colNumber)['Text']) + self.assertEqual('1.50 cm', get_state_as_dict(colSpacing)['Text']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests2/tdf139511.py b/sd/qa/uitest/impress_tests2/tdf139511.py index c20fbc84c666..80410d3dc5b5 100644 --- a/sd/qa/uitest/impress_tests2/tdf139511.py +++ b/sd/qa/uitest/impress_tests2/tdf139511.py @@ -19,33 +19,33 @@ class tdf139511(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4") + self.xUITest.executeCommand(".uno:InsertTable?Columns:short=4&Rows:short=4") - self.assertEqual(8036, document.DrawPages[0].getByIndex(2).BoundRect.Height) - self.assertEqual(14136, document.DrawPages[0].getByIndex(2).BoundRect.Width) + self.assertEqual(8036, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(14136, document.DrawPages[0].getByIndex(2).BoundRect.Width) - with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: - xWidth = xDialog.getChild('MTR_FLD_WIDTH') - xHeight = xDialog.getChild('MTR_FLD_HEIGHT') + xWidth = xDialog.getChild('MTR_FLD_WIDTH') + xHeight = xDialog.getChild('MTR_FLD_HEIGHT') - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xWidth.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) - xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + xHeight.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) - # Without the fix in place, this test would have failed with - # AssertionError: 5037 != 8036 - self.assertEqual(5037, document.DrawPages[0].getByIndex(2).BoundRect.Height) - self.assertEqual(10037, document.DrawPages[0].getByIndex(2).BoundRect.Width) + # Without the fix in place, this test would have failed with + # AssertionError: 5037 != 8036 + self.assertEqual(5037, document.DrawPages[0].getByIndex(2).BoundRect.Height) + self.assertEqual(10037, document.DrawPages[0].getByIndex(2).BoundRect.Width) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sd/qa/uitest/impress_tests2/tdf82616.py b/sd/qa/uitest/impress_tests2/tdf82616.py index 7f6b1db826f8..134be9bb428f 100644 --- a/sd/qa/uitest/impress_tests2/tdf82616.py +++ b/sd/qa/uitest/impress_tests2/tdf82616.py @@ -21,50 +21,50 @@ class Tdf82616(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') + with change_measurement_unit(self, 'Centimeter'): - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) - xHorizontalPos = xImpressDoc.getChild("horizontalpos") - self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") - self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) + xHorizontalPos = xImpressDoc.getChild("horizontalpos") + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") + self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) - xVerticalPos = xImpressDoc.getChild("verticalpos") - self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") - self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) + xVerticalPos = xImpressDoc.getChild("verticalpos") + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") + self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('-3.6', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('-6.32', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('-3.6', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('-6.32', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - # Without the fix in place, this test would have failed with - # AssertionError: '-3.6' != '0' - self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") - self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) + # Without the fix in place, this test would have failed with + # AssertionError: '-3.6' != '0' + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") + self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) - self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") - self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") + self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/chapterNumbering/chapterNumbering.py b/sw/qa/uitest/chapterNumbering/chapterNumbering.py index 28a17f235bee..8d51a454b781 100644 --- a/sw/qa/uitest/chapterNumbering/chapterNumbering.py +++ b/sw/qa/uitest/chapterNumbering/chapterNumbering.py @@ -21,65 +21,65 @@ class WriterChapterNumbering(UITestCase): def test_chapter_numbering_dialog(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Millimeter") + with change_measurement_unit(self, "Millimeter"): - with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: - xstyle = xDialog.getChild("style") - xnumbering = xDialog.getChild("numbering") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xstartat = xDialog.getChild("startat") - xtab = xDialog.getChild("tabcontrol") - #second tab - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - select_pos(xtab, "0") #first tab - select_by_text(xstyle, "Heading") - select_by_text(xnumbering, "1, 2, 3, ...") - select_by_text(xcharstyle, "Bullets") - xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) - xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) - xstartat.executeAction("UP", tuple()) + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog: + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") #first tab + select_by_text(xstyle, "Heading") + select_by_text(xnumbering, "1, 2, 3, ...") + select_by_text(xcharstyle, "Bullets") + xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xstartat.executeAction("UP", tuple()) - select_pos(xtab, "1") #second tab Position - xalignedatmf.executeAction("UP", tuple()) - select_by_text(xnum2alignlb, "Centered") - select_by_text(xnumfollowedbylb, "Tab stop") - xatmf.executeAction("UP", tuple()) - xindentatmf.executeAction("UP", tuple()) + select_pos(xtab, "1") #second tab Position + xalignedatmf.executeAction("UP", tuple()) + select_by_text(xnum2alignlb, "Centered") + select_by_text(xnumfollowedbylb, "Tab stop") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) - with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog", close_button="cancel") as xDialog: + with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog", close_button="cancel") as xDialog: - xstyle = xDialog.getChild("style") - xnumbering = xDialog.getChild("numbering") - xcharstyle = xDialog.getChild("charstyle") - xprefix = xDialog.getChild("prefix") - xsuffix = xDialog.getChild("suffix") - xstartat = xDialog.getChild("startat") - xtab = xDialog.getChild("tabcontrol") - #second tab - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xnumfollowedbylb = xDialog.getChild("numfollowedbylb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") - select_pos(xtab, "0") - self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading") - self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...") - self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xprefix)["Text"], "A") - self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B") - self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") - select_pos(xtab, "1") #second tab Position - self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm") - self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") - self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop") - self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm") - self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm") + xstyle = xDialog.getChild("style") + xnumbering = xDialog.getChild("numbering") + xcharstyle = xDialog.getChild("charstyle") + xprefix = xDialog.getChild("prefix") + xsuffix = xDialog.getChild("suffix") + xstartat = xDialog.getChild("startat") + xtab = xDialog.getChild("tabcontrol") + #second tab + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xnumfollowedbylb = xDialog.getChild("numfollowedbylb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") + select_pos(xtab, "0") + self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "Heading") + self.assertEqual(get_state_as_dict(xnumbering)["SelectEntryText"], "1, 2, 3, ...") + self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xprefix)["Text"], "A") + self.assertEqual(get_state_as_dict(xsuffix)["Text"], "B") + self.assertEqual(get_state_as_dict(xstartat)["Text"], "2") + select_pos(xtab, "1") #second tab Position + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Tab stop") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "0.1 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "0.1 mm") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py index 9274de35eecd..bc050cb7e108 100644 --- a/sw/qa/uitest/sidebar/tdf133189.py +++ b/sw/qa/uitest/sidebar/tdf133189.py @@ -27,9 +27,6 @@ class tdf133189(UITestCase): xPaperOrient = xWriterEdit.getChild('paperorientation') xPaperMargin = xWriterEdit.getChild('marginLB') - #change measurement to Inches - change_measurement_unit(self, 'Inch') - with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "1") @@ -55,20 +52,19 @@ class tdf133189(UITestCase): self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″") self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″") - #change measurement again to Centimeters - change_measurement_unit(self, 'Centimeter') + with change_measurement_unit(self, 'Centimeter'): - self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)") - # tdf#129267 - self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)") - self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") - self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") - self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") - self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") - self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm") - self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm") - self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm") - self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm") + self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)") + # tdf#129267 + self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)") + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait") + self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait") + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm") + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm") self.xUITest.executeCommand(".uno:Sidebar") diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py index 399d90bfa848..20bd7a9fb152 100644 --- a/sw/qa/uitest/sidebar/tdf135590.py +++ b/sw/qa/uitest/sidebar/tdf135590.py @@ -16,59 +16,58 @@ class tdf135590(UITestCase): def test_tdf135590(self): with self.ui_test.create_doc_in_start_center("writer"): - #change measurement to Centimeter - change_measurement_unit(self, 'Centimeter') + with change_measurement_unit(self, 'Centimeter'): - with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog: + with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xWidth = xDialog.getChild('width') - xHeight = xDialog.getChild('height') - xFormat = xDialog.getChild("format") + xWidth = xDialog.getChild('width') + xHeight = xDialog.getChild('height') + xFormat = xDialog.getChild("format") - select_by_text(xFormat, "C6 Envelope") + select_by_text(xFormat, "C6 Envelope") - self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) - self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) - # A new document is created - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + # A new document is created + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") - xWidth = xDialog.getChild('spinWidth') - xHeight = xDialog.getChild('spinHeight') - xFormatList = xDialog.getChild("comboPageFormat") + xWidth = xDialog.getChild('spinWidth') + xHeight = xDialog.getChild('spinHeight') + xFormatList = xDialog.getChild("comboPageFormat") - # Without the fix in place, this test would have failed with - # AssertionError: '16.2' != '11.4' - self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) - self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) - self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText']) + # Without the fix in place, this test would have failed with + # AssertionError: '16.2' != '11.4' + self.assertEqual("16.2", get_state_as_dict(xWidth)['Value']) + self.assertEqual("11.4", get_state_as_dict(xHeight)['Value']) + self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText']) - self.xUITest.executeCommand(".uno:Sidebar") - xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"})) - xPaperSize = xWriterEdit.getChild('papersize') - self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") - self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") + xPaperSize = xWriterEdit.getChild('papersize') + self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User") + self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User") - xPaperHeight = xWriterEdit.getChild('paperheight') - self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm") - self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm") + xPaperHeight = xWriterEdit.getChild('paperheight') + self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm") + self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm") - xPaperWidth = xWriterEdit.getChild('paperwidth') - self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm") - self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm") + xPaperWidth = xWriterEdit.getChild('paperwidth') + self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm") + self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm") - self.xUITest.executeCommand(".uno:Sidebar") + 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 af6cd972ddd6..145b0373be2c 100644 --- a/sw/qa/uitest/sidebar/tdf99711.py +++ b/sw/qa/uitest/sidebar/tdf99711.py @@ -16,24 +16,23 @@ class tdf99711(UITestCase): with self.ui_test.load_file(get_url_for_data_file("shape.odt")): - #set measurement to millimeters - change_measurement_unit(self, "Millimeter") + with 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.xUITest.executeCommand(".uno:Sidebar") # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py index 771038e2e3a1..1549dfec63c7 100644 --- a/sw/qa/uitest/table/tableProperties.py +++ b/sw/qa/uitest/table/tableProperties.py @@ -19,176 +19,176 @@ class tableProperties(UITestCase): def test_table_properties(self): with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")): - change_measurement_unit(self, "Centimeter") - - #dialog Table Properties - Table - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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)") - #verify - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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") - - #dialog Table Properties - Text flow - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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") - #verify - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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") - - #dialog Table Properties - Columns - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") - - adaptwidth = xDialog.getChild("adaptwidth") - adaptwidth.executeAction("CLICK", tuple()) - - #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 - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "3") - - sync = xDialog.getChild("sync") - mergeadjacent = xDialog.getChild("mergeadjacent") - sync.executeAction("CLICK", tuple()) - mergeadjacent.executeAction("CLICK", tuple()) - - #verify - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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") - - #dialog Table Properties - Background - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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... - - #verify - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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") + with change_measurement_unit(self, "Centimeter"): + + #dialog Table Properties - Table + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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)") + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Text flow + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Columns + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + adaptwidth = xDialog.getChild("adaptwidth") + adaptwidth.executeAction("CLICK", tuple()) + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") + sync.executeAction("CLICK", tuple()) + mergeadjacent.executeAction("CLICK", tuple()) + + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") + + #dialog Table Properties - Background + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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... + + #verify + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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") # 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 3fe74d0ae4d7..0325ea56e68f 100644 --- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py +++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py @@ -18,29 +18,29 @@ class tdf134881(UITestCase): def test_tdf134881(self): with self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")): - change_measurement_unit(self, "Centimeter") - - #dialog Table Properties - with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: - 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 + with change_measurement_unit(self, "Centimeter"): + + #dialog Table Properties + with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog: + 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 # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py index 1b993cb95d16..f04fb1e27335 100644 --- a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py +++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py @@ -20,34 +20,34 @@ class formatBulletsNumbering(UITestCase): def test_bullets_and_numbering_dialog_tab_position(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Millimeter") + with change_measurement_unit(self, "Millimeter"): - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") - xalignedatmf.executeAction("UP", tuple()) - select_by_text(xnum2alignlb, "Centered") - xatmf.executeAction("UP", tuple()) - xindentatmf.executeAction("UP", tuple()) + xalignedatmf.executeAction("UP", tuple()) + select_by_text(xnum2alignlb, "Centered") + xatmf.executeAction("UP", tuple()) + xindentatmf.executeAction("UP", tuple()) - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xalignedatmf = xDialog.getChild("alignedatmf") - xnum2alignlb = xDialog.getChild("num2alignlb") - xatmf = xDialog.getChild("atmf") - xindentatmf = xDialog.getChild("indentatmf") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xalignedatmf = xDialog.getChild("alignedatmf") + xnum2alignlb = xDialog.getChild("num2alignlb") + xatmf = xDialog.getChild("atmf") + xindentatmf = xDialog.getChild("indentatmf") - self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm") - self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") - self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm") - self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm") + self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm") + self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered") + self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm") + self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm") @@ -133,62 +133,62 @@ class formatBulletsNumbering(UITestCase): def test_bullets_and_numbering_tab_move(self): with self.ui_test.create_doc_in_start_center("writer"): - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - change_measurement_unit(self, "Millimeter") + with change_measurement_unit(self, "Millimeter"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue < indentValue2 , True) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue == indentValue3 , True) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) def test_bullets_and_numbering_button_move(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Millimeter") - - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - - - self.xUITest.executeCommand(".uno:DecrementSubLevels") - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue < indentValue2 , True) - - self.xUITest.executeCommand(".uno:IncrementLevel") - with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "4") - xindentatmf = xDialog.getChild("indentatmf") - indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] - self.assertEqual(indentValue == indentValue3 , True) + with change_measurement_unit(self, "Millimeter"): + + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + + + self.xUITest.executeCommand(".uno:DecrementSubLevels") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue < indentValue2 , True) + + self.xUITest.executeCommand(".uno:IncrementLevel") + with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xindentatmf = xDialog.getChild("indentatmf") + indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3] + self.assertEqual(indentValue == indentValue3 , True) def test_bullets_and_numbering_selection(self): diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py index 5756c92e64c1..cd72dbf7efe7 100644 --- a/sw/qa/uitest/writer_tests2/formatParagraph.py +++ b/sw/qa/uitest/writer_tests2/formatParagraph.py @@ -249,112 +249,112 @@ class formatParagraph(UITestCase): def test_format_paragraph_tab_tabs(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - - xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") - xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") - xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") - xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - xED_TABPOS = xDialog.getChild("ED_TABPOS") - - xDecimal.executeAction("CLICK", tuple()) - xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) - xFill.executeAction("CLICK", tuple()) - xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"})) - xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - xNewButtn.executeAction("CLICK", tuple()) + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + xDecimal.executeAction("CLICK", tuple()) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"})) + xFill.executeAction("CLICK", tuple()) + xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xNewButtn.executeAction("CLICK", tuple()) - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") - xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") - xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") - xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") - xNewButtn = xDialog.getChild("buttonBTN_NEW") - xED_TABPOS = xDialog.getChild("ED_TABPOS") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") - self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true") - self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i") - self.assertEqual(get_state_as_dict(xFill)["Checked"], "true") - self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p") - self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm") + xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL") + xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR") + xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER") + xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER") + xNewButtn = xDialog.getChild("buttonBTN_NEW") + xED_TABPOS = xDialog.getChild("ED_TABPOS") + self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i") + self.assertEqual(get_state_as_dict(xFill)["Checked"], "true") + self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p") + self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") - xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") - xNewButtn = xDialog.getChild("buttonBTN_NEW") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") - xCentered.executeAction("CLICK", tuple()) - xUnderscore.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") + xCentered.executeAction("CLICK", tuple()) + xUnderscore.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) - xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") - xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") - self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true") - self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER") + xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE") + self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true") + self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") - xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") - xNewButtn = xDialog.getChild("buttonBTN_NEW") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") - xRight.executeAction("CLICK", tuple()) - xDashLine.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + xNewButtn = xDialog.getChild("buttonBTN_NEW") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") + xRight.executeAction("CLICK", tuple()) + xDashLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) - xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") - xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") - self.assertEqual(get_state_as_dict(xRight)["Checked"], "true") - self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN") + xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE") + self.assertEqual(get_state_as_dict(xRight)["Checked"], "true") + self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") - xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") - xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") - xNewButtn = xDialog.getChild("buttonBTN_NEW") + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") - xLeft.executeAction("CLICK", tuple()) - xPointsLine.executeAction("CLICK", tuple()) - xNewButtn.executeAction("CLICK", tuple()) + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + xNewButtn = xDialog.getChild("buttonBTN_NEW") - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "5") + xLeft.executeAction("CLICK", tuple()) + xPointsLine.executeAction("CLICK", tuple()) + xNewButtn.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") - xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") - xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") - self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true") - self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true") + xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN") + xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS") + self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true") + self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true") @@ -400,48 +400,48 @@ class formatParagraph(UITestCase): def test_format_paragraph_tab_borders(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") - - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "7") - - xwidth = xDialog.getChild("linewidthmf") - xSync = xDialog.getChild("sync") - xLeft = xDialog.getChild("leftmf") - xRight = xDialog.getChild("rightmf") - xTop = xDialog.getChild("topmf") - xBottom = xDialog.getChild("bottommf") - xMerge = xDialog.getChild("mergewithnext") - - xwidth.executeAction("UP", tuple()) - xSync.executeAction("CLICK", tuple()) - xLeft.executeAction("UP", tuple()) - xLeft.executeAction("UP", tuple()) - xRight.executeAction("UP", tuple()) - xTop.executeAction("UP", tuple()) - xBottom.executeAction("UP", tuple()) - xMerge.executeAction("CLICK", tuple()) - - - with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: - xTabs = xDialog.getChild("tabcontrol") - select_pos(xTabs, "7") - - xwidth = xDialog.getChild("linewidthmf") - xSync = xDialog.getChild("sync") - xLeft = xDialog.getChild("leftmf") - xRight = xDialog.getChild("rightmf") - xTop = xDialog.getChild("topmf") - xBottom = xDialog.getChild("bottommf") - xMerge = xDialog.getChild("mergewithnext") - - self.assertEqual(get_state_as_dict(xSync)["Selected"], "false") - self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false") - self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm") - self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm") + with change_measurement_unit(self, "Centimeter"): + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + xwidth.executeAction("UP", tuple()) + xSync.executeAction("CLICK", tuple()) + xLeft.executeAction("UP", tuple()) + xLeft.executeAction("UP", tuple()) + xRight.executeAction("UP", tuple()) + xTop.executeAction("UP", tuple()) + xBottom.executeAction("UP", tuple()) + xMerge.executeAction("CLICK", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "7") + + xwidth = xDialog.getChild("linewidthmf") + xSync = xDialog.getChild("sync") + xLeft = xDialog.getChild("leftmf") + xRight = xDialog.getChild("rightmf") + xTop = xDialog.getChild("topmf") + xBottom = xDialog.getChild("bottommf") + xMerge = xDialog.getChild("mergewithnext") + + self.assertEqual(get_state_as_dict(xSync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false") + self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm") def test_format_paragraph_area(self): diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py index ddcd0a583463..8a505cc8d146 100644 --- a/sw/qa/uitest/writer_tests3/lineNumbering.py +++ b/sw/qa/uitest/writer_tests3/lineNumbering.py @@ -18,61 +18,61 @@ class WriterLineNumbering(UITestCase): def test_line_numbering_dialog(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") as xDialog: - xshownumbering = xDialog.getChild("shownumbering") - xstyledropdown = xDialog.getChild("styledropdown") - xformatdropdown = xDialog.getChild("formatdropdown") - xpositiondropdown = xDialog.getChild("positiondropdown") - xspacingspin = xDialog.getChild("spacingspin") - xintervalspin = xDialog.getChild("intervalspin") - xtextentry = xDialog.getChild("textentry") - xlinesspin = xDialog.getChild("linesspin") - xblanklines = xDialog.getChild("blanklines") - xlinesintextframes = xDialog.getChild("linesintextframes") - xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") - xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") as xDialog: + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") - xshownumbering.executeAction("CLICK", tuple()) - select_by_text(xstyledropdown, "Bullets") - select_by_text(xformatdropdown, "A, B, C, ...") - select_by_text(xpositiondropdown, "Right") - xspacingspin.executeAction("UP", tuple()) - xintervalspin.executeAction("UP", tuple()) - xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) - xlinesspin.executeAction("UP", tuple()) - xblanklines.executeAction("CLICK", tuple()) - xlinesintextframes.executeAction("CLICK", tuple()) - xshowfooterheadernumbering.executeAction("CLICK", tuple()) - xrestarteverynewpage.executeAction("CLICK", tuple()) + xshownumbering.executeAction("CLICK", tuple()) + select_by_text(xstyledropdown, "Bullets") + select_by_text(xformatdropdown, "A, B, C, ...") + select_by_text(xpositiondropdown, "Right") + xspacingspin.executeAction("UP", tuple()) + xintervalspin.executeAction("UP", tuple()) + xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"})) + xlinesspin.executeAction("UP", tuple()) + xblanklines.executeAction("CLICK", tuple()) + xlinesintextframes.executeAction("CLICK", tuple()) + xshowfooterheadernumbering.executeAction("CLICK", tuple()) + xrestarteverynewpage.executeAction("CLICK", tuple()) - with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog: - xshownumbering = xDialog.getChild("shownumbering") - xstyledropdown = xDialog.getChild("styledropdown") - xformatdropdown = xDialog.getChild("formatdropdown") - xpositiondropdown = xDialog.getChild("positiondropdown") - xspacingspin = xDialog.getChild("spacingspin") - xintervalspin = xDialog.getChild("intervalspin") - xtextentry = xDialog.getChild("textentry") - xlinesspin = xDialog.getChild("linesspin") - xblanklines = xDialog.getChild("blanklines") - xlinesintextframes = xDialog.getChild("linesintextframes") - xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") - xrestarteverynewpage = xDialog.getChild("restarteverynewpage") + with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog: + xshownumbering = xDialog.getChild("shownumbering") + xstyledropdown = xDialog.getChild("styledropdown") + xformatdropdown = xDialog.getChild("formatdropdown") + xpositiondropdown = xDialog.getChild("positiondropdown") + xspacingspin = xDialog.getChild("spacingspin") + xintervalspin = xDialog.getChild("intervalspin") + xtextentry = xDialog.getChild("textentry") + xlinesspin = xDialog.getChild("linesspin") + xblanklines = xDialog.getChild("blanklines") + xlinesintextframes = xDialog.getChild("linesintextframes") + xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering") + xrestarteverynewpage = xDialog.getChild("restarteverynewpage") - self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true") - self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets") - self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...") - self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right") - self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm") - self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6") - self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";") - self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4") - self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false") - self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true") - self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true") - self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true") + self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets") + self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...") + self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right") + self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm") + self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6") + self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";") + self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4") + self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false") + self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true") + self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true") + self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true") def test_tdf86185(self): with self.ui_test.create_doc_in_start_center("writer"): diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py index dc323cbb7eae..7e95e08d8570 100644 --- a/sw/qa/uitest/writer_tests3/pageDialog.py +++ b/sw/qa/uitest/writer_tests3/pageDialog.py @@ -9,6 +9,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import select_pos, get_state_as_dict +from uitest.uihelper.common import change_measurement_unit from com.sun.star.awt.GradientStyle import LINEAR from com.sun.star.drawing.HatchStyle import SINGLE from com.sun.star.drawing.BitmapMode import REPEAT @@ -118,23 +119,25 @@ class WriterPageDialog(UITestCase): with self.ui_test.create_doc_in_start_center("writer"): - buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] - for index, button in enumerate(buttons): + with change_measurement_unit(self, "Centimeter"): - with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") - self.click_button(xDialog, button) + buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] + for index, button in enumerate(buttons): - self.check_default_area(button) + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + self.click_button(xDialog, button) + + self.check_default_area(button) - with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") - self.click_button(xDialog, 'btnnone') + self.click_button(xDialog, 'btnnone') - self.check_default_area('btnnone') + self.check_default_area('btnnone') def test_paper_format(self): diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py index dedaf36d1ff8..11305bf8234e 100644 --- a/sw/qa/uitest/writer_tests4/tdf138546.py +++ b/sw/qa/uitest/writer_tests4/tdf138546.py @@ -16,22 +16,22 @@ class tdf138546(UITestCase): def test_tdf138546(self): with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")): - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - #dialog Columns - with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: + #dialog Columns + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: - 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 + 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 - with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: - 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 + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + 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 # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py index b14bb56e7992..8da22cef4178 100644 --- a/sw/qa/uitest/writer_tests5/columns.py +++ b/sw/qa/uitest/writer_tests5/columns.py @@ -16,32 +16,32 @@ class columns(UITestCase): def test_columns(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - #dialog Columns - with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog: + #dialog Columns + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog: - colsnf = xDialog.getChild("colsnf") - colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) - colsnf.executeAction("UP", tuple()) - colsnf.executeAction("DOWN", tuple()) - spacing1mf = xDialog.getChild("spacing1mf") - spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) - autowidth = xDialog.getChild("autowidth") - autowidth.executeAction("CLICK", tuple()) - #verify - with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: - colsnf = xDialog.getChild("colsnf") - spacing1mf = xDialog.getChild("spacing1mf") - autowidth = xDialog.getChild("autowidth") + colsnf = xDialog.getChild("colsnf") + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + colsnf.executeAction("UP", tuple()) + colsnf.executeAction("DOWN", tuple()) + spacing1mf = xDialog.getChild("spacing1mf") + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + autowidth = xDialog.getChild("autowidth") + autowidth.executeAction("CLICK", tuple()) + #verify + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: + colsnf = xDialog.getChild("colsnf") + spacing1mf = xDialog.getChild("spacing1mf") + autowidth = xDialog.getChild("autowidth") - self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") - self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm") - self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false") + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false") def test_tdf150293_separator_width_unit_conversion(self): with self.ui_test.load_file(get_url_for_data_file("section-columns-separator.fodt")): diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py index ee8941d4b0d8..aae1290f446f 100644 --- a/sw/qa/uitest/writer_tests6/tdf128431.py +++ b/sw/qa/uitest/writer_tests6/tdf128431.py @@ -17,24 +17,24 @@ class tdf128431(UITestCase): def test_tdf128431_pageFormat_sync_padding(self): with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") - - with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "6") #borders - - sync = xDialog.getChild("sync") - bottomft = xDialog.getChild("bottommf") - topft = xDialog.getChild("topmf") - rightft = xDialog.getChild("rightmf") - leftft = xDialog.getChild("leftmf") - - self.assertEqual(get_state_as_dict(sync)["Selected"], "true") - bottomft.executeAction("UP", tuple()) - self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm") - self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm") + with change_measurement_unit(self, "Centimeter"): + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "6") #borders + + sync = xDialog.getChild("sync") + bottomft = xDialog.getChild("bottommf") + topft = xDialog.getChild("topmf") + rightft = xDialog.getChild("rightmf") + leftft = xDialog.getChild("leftmf") + + self.assertEqual(get_state_as_dict(sync)["Selected"], "true") + bottomft.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm") diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py index 2e44dbea6126..3d6cbf410888 100644 --- a/sw/qa/uitest/writer_tests7/forms.py +++ b/sw/qa/uitest/writer_tests7/forms.py @@ -128,46 +128,46 @@ class Forms(UITestCase): # Reuse file from another test with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) as document: - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - self.xUITest.executeCommand(".uno:JumpToNextFrame") + self.xUITest.executeCommand(".uno:JumpToNextFrame") - drawPage = document.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) - self.assertEqual(13996, shape.getSize().Width) - self.assertEqual(2408, shape.getSize().Height) + drawPage = document.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) + self.assertEqual(13996, shape.getSize().Width) + self.assertEqual(2408, shape.getSize().Height) - with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): - xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') - xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width') + xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height') - self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) - self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text']) + self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text']) + self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['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"})) + 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("20 cm", get_state_as_dict(xWidth)['Text']) + self.assertEqual("20 cm", get_state_as_dict(xWidth)['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"})) + 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("5 cm", get_state_as_dict(xHeight)['Text']) + self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text']) - # 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()) + # 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()) - 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 in place, the size of the form wouldn't have changed - self.assertEqual(20001, shape.getSize().Width) - self.assertEqual(5001, shape.getSize().Height) + # 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): diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py index b2704b341b97..75a4f27bd4c7 100644 --- a/sw/qa/uitest/writer_tests7/tdf132169.py +++ b/sw/qa/uitest/writer_tests7/tdf132169.py @@ -15,29 +15,28 @@ class tdf132169(UITestCase): 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") + with 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 - with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: - xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') - type_text(xWidth, "4.0") + #Check changing value from dialog also works + with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg: + xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH') + type_text(xWidth, "4.0") - 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()) - drawPage = writer_doc.getDrawPages().getByIndex(0) - shape = drawPage.getByIndex(0) + drawPage = writer_doc.getDrawPages().getByIndex(0) + shape = drawPage.getByIndex(0) - #Without the fix in place, it would have been 310 - self.assertEqual(shape.LineWidth, 176) + #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/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py index 063211d413c6..ca9d84bb16aa 100644 --- a/uitest/impress_tests/drawinglayer.py +++ b/uitest/impress_tests/drawinglayer.py @@ -21,36 +21,36 @@ class ImpressDrawinglayerTest(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') + with change_measurement_unit(self, 'Centimeter'): - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"})) + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"})) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('4.69', 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("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) def test_resize_object(self): with self.ui_test.create_doc_in_start_center("impress") as document: @@ -59,39 +59,39 @@ class ImpressDrawinglayerTest(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - change_measurement_unit(self, 'Centimeter') + with change_measurement_unit(self, 'Centimeter'): - xImpressDoc = self.xUITest.getTopFocusWindow() + xImpressDoc = self.xUITest.getTopFocusWindow() - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"})) + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"})) - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.84', 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("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) def test_rotate_object(self): with self.ui_test.create_doc_in_start_center("impress") as document: @@ -100,33 +100,34 @@ class ImpressDrawinglayerTest(UITestCase): xCancelBtn = xTemplateDlg.getChild("close") self.ui_test.close_dialog_through_button(xCancelBtn) - xImpressDoc = self.xUITest.getTopFocusWindow() + with change_measurement_unit(self, 'Centimeter'): + xImpressDoc = self.xUITest.getTopFocusWindow() - self.assertIsNone(document.CurrentSelection) + self.assertIsNone(document.CurrentSelection) - xEditWin = xImpressDoc.getChild("impress_win") - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) - self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) - self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) - self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) - self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") - xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"})) + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"})) - xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: - self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog: + self.assertEqual('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) - self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) - xEditWin.executeAction("DESELECT", tuple()) - self.assertIsNone(document.CurrentSelection) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py index ffdf90d48db8..17b682b0e0eb 100644 --- a/uitest/uitest/uihelper/common.py +++ b/uitest/uitest/uihelper/common.py @@ -6,6 +6,7 @@ # from libreoffice.uno.propertyvalue import convert_property_values_to_dict, mkPropertyValues +from contextlib import contextmanager import org.libreoffice.unotest import pathlib @@ -28,7 +29,16 @@ def select_text(ui_object, from_pos, to): def get_url_for_data_file(file_name): return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() +@contextmanager def change_measurement_unit(UITestCase, unit): + try: + launch_option_dialog(UITestCase, unit) + yield + finally: + # change to default value + launch_option_dialog(UITestCase, 'Inch') + +def launch_option_dialog(UITestCase, unit): with UITestCase.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: xPages = xDialogOpt.getChild("pages") xAppEntry = xPages.getChild('3') |