diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-22 05:27:22 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-22 18:19:33 +0200 |
commit | 4fa28812f3574efaca42769e9e4ff28f7d545bd8 (patch) | |
tree | ef0376117ac6f402595b84598b341f8c0c41e4b8 /uitest/calc_tests | |
parent | 660e5597813f88b1aca564198fdf5f78298adc13 (diff) |
uitest: start the switch to python's unittest
Change-Id: Ic6e0d99a567b7080928accb61ed036b1c25ec7ff
Diffstat (limited to 'uitest/calc_tests')
-rw-r--r-- | uitest/calc_tests/about_test.py | 22 | ||||
-rw-r--r-- | uitest/calc_tests/calc_demo.txt | 1 | ||||
-rw-r--r-- | uitest/calc_tests/create_chart.py | 228 |
3 files changed, 111 insertions, 140 deletions
diff --git a/uitest/calc_tests/about_test.py b/uitest/calc_tests/about_test.py index b5120841e1e8..df90e7da79bc 100644 --- a/uitest/calc_tests/about_test.py +++ b/uitest/calc_tests/about_test.py @@ -5,25 +5,23 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -import time - from uitest_helper import UITest -def test_about_dlg(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +from UITestCase import UITestCase + +class AboutDlgTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_about_dlg(self): - ui_test.create_doc_in_start_center("calc") + self.ui_test.create_doc_in_start_center("calc") - ui_test.execute_dialog_through_command(".uno:About") + self.ui_test.execute_dialog_through_command(".uno:About") - xAboutDlg = xUITest.getTopFocusWindow() + xAboutDlg = self.xUITest.getTopFocusWindow() - xCloseBtn = xAboutDlg.getChild("close") - xCloseBtn.executeAction("CLICK", tuple()) + xCloseBtn = xAboutDlg.getChild("close") + xCloseBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/calc_tests/calc_demo.txt b/uitest/calc_tests/calc_demo.txt index 6ff4e2219175..1c2629e91f73 100644 --- a/uitest/calc_tests/calc_demo.txt +++ b/uitest/calc_tests/calc_demo.txt @@ -2,4 +2,3 @@ calc_tests.create_range_name.create_range_name calc_tests.create_range_name.create_local_range_name calc_tests.function_wizard.open_function_wizard calc_tests.gridwindow.input -calc_tests.about_test.test_about_dlg diff --git a/uitest/calc_tests/create_chart.py b/uitest/calc_tests/create_chart.py index 6ec7082e7c77..6db4d58d474c 100644 --- a/uitest/calc_tests/create_chart.py +++ b/uitest/calc_tests/create_chart.py @@ -9,6 +9,8 @@ from uitest_helper import UITest from helper import mkPropertyValues +from UITestCase import UITestCase + import time try: @@ -21,199 +23,171 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def add_content_to_cell(gridwin, cell, content): - selectProps = mkPropertyValues({"CELL": cell}) - gridwin.executeAction("SELECT", selectProps) - - contentProps = mkPropertyValues({"TEXT": content}) - gridwin.executeAction("TYPE", contentProps) - - -def fill_spreadsheet(xUITest): - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - - add_content_to_cell(xGridWindow, "A1", "col1") - add_content_to_cell(xGridWindow, "B1", "col2") - add_content_to_cell(xGridWindow, "C1", "col3") - add_content_to_cell(xGridWindow, "A2", "1") - add_content_to_cell(xGridWindow, "B2", "3") - add_content_to_cell(xGridWindow, "C2", "5") - - xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C2"})) - -def cancel_immediately(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) - - ui_test = UITest(xUITest, xContext) - - ui_test.create_doc_in_start_center("calc") +class CalcChartUIDemo(UITestCase): - fill_spreadsheet(xUITest) + def add_content_to_cell(self, gridwin, cell, content): + selectProps = mkPropertyValues({"CELL": cell}) + gridwin.executeAction("SELECT", selectProps) - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + contentProps = mkPropertyValues({"TEXT": content}) + gridwin.executeAction("TYPE", contentProps) - xChartDlg = xUITest.getTopFocusWindow() + def fill_spreadsheet(self): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xCancelBtn = xChartDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + self.add_content_to_cell(xGridWindow, "A1", "col1") + self.add_content_to_cell(xGridWindow, "B1", "col2") + self.add_content_to_cell(xGridWindow, "C1", "col3") + self.add_content_to_cell(xGridWindow, "A2", "1") + self.add_content_to_cell(xGridWindow, "B2", "3") + self.add_content_to_cell(xGridWindow, "C2", "5") - ui_test.close_doc() + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C2"})) -def create_from_first_page(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + def test_cancel_immediately(self): - ui_test = UITest(xUITest, xContext) + self.ui_test.create_doc_in_start_center("calc") - ui_test.create_doc_in_start_center("calc") + self.fill_spreadsheet() - fill_spreadsheet(xUITest) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() - xChartDlg = xUITest.getTopFocusWindow() - print(xChartDlg.getChildren()) - time.sleep(2) + xCancelBtn = xChartDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) - xOkBtn = xChartDlg.getChild("finish") - xOkBtn.executeAction("CLICK", tuple()) + self.ui_test.close_doc() - time.sleep(2) + def test_create_from_first_page(self): - ui_test.close_doc() + self.ui_test.create_doc_in_start_center("calc") -def create_from_second_page(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + self.fill_spreadsheet() - ui_test = UITest(xUITest, xContext) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - ui_test.create_doc_in_start_center("calc") + xChartDlg = self.xUITest.getTopFocusWindow() + print(xChartDlg.getChildren()) + time.sleep(2) - fill_spreadsheet(xUITest) + xOkBtn = xChartDlg.getChild("finish") + xOkBtn.executeAction("CLICK", tuple()) - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + time.sleep(2) - xChartDlg = xUITest.getTopFocusWindow() - print(xChartDlg.getChildren()) - time.sleep(2) + self.ui_test.close_doc() - xNextBtn = xChartDlg.getChild("next") - xNextBtn.executeAction("CLICK", tuple()) + def test_create_from_second_page(self): - print(xChartDlg.getChildren()) + self.ui_test.create_doc_in_start_center("calc") - time.sleep(2) + self.fill_spreadsheet() - xDataInRows = xChartDlg.getChild("RB_DATAROWS") - xDataInRows.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - time.sleep(2) + xChartDlg = self.xUITest.getTopFocusWindow() + print(xChartDlg.getChildren()) + time.sleep(2) - xDataInCols = xChartDlg.getChild("RB_DATACOLS") - xDataInCols.executeAction("CLICK", tuple()) + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) - time.sleep(2) + print(xChartDlg.getChildren()) - xCancelBtn = xChartDlg.getChild("finish") - xCancelBtn.executeAction("CLICK", tuple()) + time.sleep(2) - time.sleep(5) + xDataInRows = xChartDlg.getChild("RB_DATAROWS") + xDataInRows.executeAction("CLICK", tuple()) - ui_test.close_doc() + time.sleep(2) -def deselect_chart(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + xDataInCols = xChartDlg.getChild("RB_DATACOLS") + xDataInCols.executeAction("CLICK", tuple()) - ui_test = UITest(xUITest, xContext) + time.sleep(2) - ui_test.create_doc_in_start_center("calc") + xCancelBtn = xChartDlg.getChild("finish") + xCancelBtn.executeAction("CLICK", tuple()) - fill_spreadsheet(xUITest) + time.sleep(5) - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + self.ui_test.close_doc() - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + def test_deselect_chart(self): + self.ui_test.create_doc_in_start_center("calc") - xChartDlg = xUITest.getTopFocusWindow() + self.fill_spreadsheet() - xNextBtn = xChartDlg.getChild("finish") - xNextBtn.executeAction("CLICK", tuple()) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - time.sleep(2) + xChartDlg = self.xUITest.getTopFocusWindow() - ui_test.close_doc() + xNextBtn = xChartDlg.getChild("finish") + xNextBtn.executeAction("CLICK", tuple()) -def activate_chart(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - ui_test = UITest(xUITest, xContext) + time.sleep(2) - ui_test.create_doc_in_start_center("calc") + self.ui_test.close_doc() - fill_spreadsheet(xUITest) + def test_activate_chart(self): - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + self.ui_test.create_doc_in_start_center("calc") - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + self.fill_spreadsheet() - xChartDlg = xUITest.getTopFocusWindow() + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xNextBtn = xChartDlg.getChild("finish") - xNextBtn.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xChartDlg = self.xUITest.getTopFocusWindow() - time.sleep(2) + xNextBtn = xChartDlg.getChild("finish") + xNextBtn.executeAction("CLICK", tuple()) - xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) - xGridWindow.executeAction("ACTIVATE", tuple()) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - time.sleep(2) + time.sleep(2) - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) - ui_test.close_doc() + time.sleep(2) -def select_chart_element(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - ui_test = UITest(xUITest, xContext) + self.ui_test.close_doc() - ui_test.create_doc_in_start_center("calc") + def select_chart_element(self): - fill_spreadsheet(xUITest) + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + self.fill_spreadsheet() - ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - xChartDlg = xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") - xNextBtn = xChartDlg.getChild("finish") - xNextBtn.executeAction("CLICK", tuple()) + xChartDlg = self.xUITest.getTopFocusWindow() - xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + xNextBtn = xChartDlg.getChild("finish") + xNextBtn.executeAction("CLICK", tuple()) - time.sleep(2) + xGridWindow.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) - xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) - xGridWindow.executeAction("ACTIVATE", tuple()) + xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + xGridWindow.executeAction("ACTIVATE", tuple()) - time.sleep(2) - xCalcDoc = xUITest.getTopFocusWindow() - print(xCalcDoc.getChildren()) - time.sleep(1) - ui_test.close_doc() + xCalcDoc = self.xUITest.getTopFocusWindow() + print(xCalcDoc.getChildren()) + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ |