diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-22 05:57:06 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-06-22 18:19:34 +0200 |
commit | 19e380cfd980233b71915f34a1ba83d24bd5303e (patch) | |
tree | 8f70893172995635f070830baab037eb6622deb4 /uitest | |
parent | uitest: convert all calc demos to the unittest based approach (diff) | |
download | core-19e380cfd980233b71915f34a1ba83d24bd5303e.tar.gz core-19e380cfd980233b71915f34a1ba83d24bd5303e.zip |
uitest: move the demo ui tests to the new unittest approach
Change-Id: I70222d701191f28f9dffb3bfdfbb7510d64d0251
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/demo_ui/checkbox.py | 24 | ||||
-rw-r--r-- | uitest/demo_ui/combobox.py | 28 | ||||
-rw-r--r-- | uitest/demo_ui/demo_ui.txt | 15 | ||||
-rw-r--r-- | uitest/demo_ui/edit.py | 28 | ||||
-rw-r--r-- | uitest/demo_ui/gridwin.py | 60 | ||||
-rw-r--r-- | uitest/demo_ui/listbox.py | 52 | ||||
-rw-r--r-- | uitest/demo_ui/radiobutton.py | 24 | ||||
-rw-r--r-- | uitest/demo_ui/spinfield.py | 104 | ||||
-rw-r--r-- | uitest/demo_ui/tabcontrol.py | 34 | ||||
-rw-r--r-- | uitest/demo_ui/tabdialog.py | 48 | ||||
-rw-r--r-- | uitest/demo_ui/treelist.py | 44 |
11 files changed, 211 insertions, 250 deletions
diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py index 5cc456bc4f19..a15d686471ab 100644 --- a/uitest/demo_ui/checkbox.py +++ b/uitest/demo_ui/checkbox.py @@ -9,6 +9,8 @@ from uitest_helper import UITest from helper import mkPropertyValues +from UITestCase import UITestCase + import time try: @@ -21,22 +23,20 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def toggle_checkbox(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +class CheckBoxTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_toggle_checkbox(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:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() - xNegativeNumRedCB = xCellsDlg.getChild("negnumred") - xNegativeNumRedCB.executeAction("CLICK",tuple()) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) - okBtn = xCellsDlg.getChild("ok") - okBtn.executeAction("CLICK", tuple()) + okBtn = xCellsDlg.getChild("ok") + okBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py index 6df980be9af8..b33644b362f9 100644 --- a/uitest/demo_ui/combobox.py +++ b/uitest/demo_ui/combobox.py @@ -9,25 +9,25 @@ from uitest_helper import UITest from helper import mkPropertyValues -def select_entry_pos(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +from UITestCase import UITestCase - ui_test = UITest(xUITest, xContext) +class ComboBoxTest(UITestCase): - ui_test.create_doc_in_start_center("calc") + def test_select_entry_pos(self): - ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") - scopeCB = xAddNameDlg.getChild("scope") - props = {"POS": "1"} - actionProps = mkPropertyValues(props) - scopeCB.executeAction("SELECT", actionProps) + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - xCancelBtn = xAddNameDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + scopeCB = xAddNameDlg.getChild("scope") + props = {"POS": "1"} + actionProps = mkPropertyValues(props) + scopeCB.executeAction("SELECT", actionProps) - ui_test.close_doc() + xCancelBtn = xAddNameDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/demo_ui.txt b/uitest/demo_ui/demo_ui.txt deleted file mode 100644 index 512da3f0a8da..000000000000 --- a/uitest/demo_ui/demo_ui.txt +++ /dev/null @@ -1,15 +0,0 @@ -demo_ui.checkbox.toggle_checkbox -demo_ui.combobox.select_entry_pos -demo_ui.edit.type_text -demo_ui.gridwin.select_cell -demo_ui.gridwin.select_range -demo_ui.gridwin.extend_range -demo_ui.listbox.select_entry_pos -demo_ui.listbox.select_entry_text -demo_ui.tabcontrol.select_pos -demo_ui.tabdialog.select_tab_page_pos -demo_ui.tabdialog.select_tab_page_name -demo_ui.treelist.expand -demo_ui.spinfield.up -demo_ui.spinfield.down -demo_ui.spinfield.text diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py index f418a3600e63..8ddbb1c5876c 100644 --- a/uitest/demo_ui/edit.py +++ b/uitest/demo_ui/edit.py @@ -9,6 +9,8 @@ from uitest_helper import UITest from helper import mkPropertyValues +from UITestCase import UITestCase + try: import pyuno import uno @@ -19,26 +21,24 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def type_text(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +class EditTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_type_text(self): - ui_test.create_doc_in_start_center("calc") + self.ui_test.create_doc_in_start_center("calc") - ui_test.execute_modeless_dialog_through_command(".uno:AddName") - xAddNameDlg = xUITest.getTopFocusWindow() + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + xAddNameDlg = self.xUITest.getTopFocusWindow() - xEdit = xAddNameDlg.getChild("edit") + xEdit = xAddNameDlg.getChild("edit") - props = {"TEXT": "simpleRangeName"} - actionProps = mkPropertyValues(props) - xEdit.executeAction("TYPE", actionProps) + props = {"TEXT": "simpleRangeName"} + actionProps = mkPropertyValues(props) + xEdit.executeAction("TYPE", actionProps) - xAddBtn = xAddNameDlg.getChild("cancel") - xAddBtn.executeAction("CLICK", tuple()) + xAddBtn = xAddNameDlg.getChild("cancel") + xAddBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/gridwin.py b/uitest/demo_ui/gridwin.py index 4ca63ac8b2ae..5c2fae90b14d 100644 --- a/uitest/demo_ui/gridwin.py +++ b/uitest/demo_ui/gridwin.py @@ -9,6 +9,8 @@ from uitest_helper import UITest from helper import mkPropertyValues +from UITestCase import UITestCase + import time try: @@ -21,53 +23,43 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def select_cell(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) - - ui_test = UITest(xUITest, xContext) - - ui_test.create_doc_in_start_center("calc") - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") +class GridWinTest(UITestCase): - selectProps = mkPropertyValues({"CELL": "B10"}) - xGridWindow.executeAction("SELECT", selectProps) + def test_select_cell(self): - ui_test.close_doc() + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") -def select_range(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + selectProps = mkPropertyValues({"CELL": "B10"}) + xGridWindow.executeAction("SELECT", selectProps) - ui_test = UITest(xUITest, xContext) + self.ui_test.close_doc() - ui_test.create_doc_in_start_center("calc") - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") + def test_select_range(self): - selectProps = mkPropertyValues({"RANGE": "B10:C20"}) - xGridWindow.executeAction("SELECT", selectProps) + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") - ui_test.close_doc() + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) -def extend_range(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + self.ui_test.close_doc() - ui_test = UITest(xUITest, xContext) + def test_extend_range(self): - ui_test.create_doc_in_start_center("calc") - xTopWindow = xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() - xGridWindow = xTopWindow.getChild("grid_window") + xGridWindow = xTopWindow.getChild("grid_window") - selectProps = mkPropertyValues({"RANGE": "B10:C20"}) - xGridWindow.executeAction("SELECT", selectProps) + selectProps = mkPropertyValues({"RANGE": "B10:C20"}) + xGridWindow.executeAction("SELECT", selectProps) - select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"}) - xGridWindow.executeAction("SELECT", select2Props) + select2Props = mkPropertyValues({"RANGE": "D3:F5", "EXTEND": "true"}) + xGridWindow.executeAction("SELECT", select2Props) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/listbox.py b/uitest/demo_ui/listbox.py index 03a4c9e0a9ed..f6857c2f01d2 100644 --- a/uitest/demo_ui/listbox.py +++ b/uitest/demo_ui/listbox.py @@ -9,47 +9,43 @@ from uitest_helper import UITest from helper import mkPropertyValues -def select_entry_pos(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +from UITestCase import UITestCase - ui_test = UITest(xUITest, xContext) +class ListBoxTest(UITestCase): - ui_test.create_doc_in_start_center("calc") + def test_select_entry_pos(self): - ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") - categoryLB = xCellsDlg.getChild("categorylb") - props = {"POS": "4"} - actionProps = mkPropertyValues(props) - categoryLB.executeAction("SELECT", actionProps) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCellsDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + categoryLB = xCellsDlg.getChild("categorylb") + props = {"POS": "4"} + actionProps = mkPropertyValues(props) + categoryLB.executeAction("SELECT", actionProps) - ui_test.close_doc() + xOkBtn = xCellsDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) -def select_entry_text(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + self.ui_test.close_doc() - ui_test = UITest(xUITest, xContext) + def test_select_entry_text(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:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - categoryLB = xCellsDlg.getChild("categorylb") - props = {"TEXT": "Time"} + categoryLB = xCellsDlg.getChild("categorylb") + props = {"TEXT": "Time"} - actionProps = mkPropertyValues(props) - categoryLB.executeAction("SELECT", actionProps) + actionProps = mkPropertyValues(props) + categoryLB.executeAction("SELECT", actionProps) - xOkBtn = xCellsDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xCellsDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/radiobutton.py b/uitest/demo_ui/radiobutton.py index bd8b1db576ab..fef71f5e238a 100644 --- a/uitest/demo_ui/radiobutton.py +++ b/uitest/demo_ui/radiobutton.py @@ -9,6 +9,8 @@ from uitest_helper import UITest from helper import mkPropertyValues +from UITestCase import UITestCase + import time try: @@ -21,23 +23,21 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def toggle_radiobutton(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +class RadioButtonTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_toggle_radiobutton(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:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() - xNegativeNumRedCB = xCellsDlg.getChild("negnumred") - xNegativeNumRedCB.executeAction("CLICK",tuple()) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + xNegativeNumRedCB = xCellsDlg.getChild("negnumred") + xNegativeNumRedCB.executeAction("CLICK",tuple()) - okBtn = xCellsDlg.getChild("ok") - okBtn.executeAction("CLICK", tuple()) + okBtn = xCellsDlg.getChild("ok") + okBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py index 4adde0c6163c..761c9ac3a736 100644 --- a/uitest/demo_ui/spinfield.py +++ b/uitest/demo_ui/spinfield.py @@ -12,6 +12,8 @@ from uitest_helper import get_state_as_dict import time +from UITestCase import UITestCase + try: import pyuno import uno @@ -22,82 +24,72 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def up(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) - - ui_test = UITest(xUITest, xContext) - - ui_test.create_doc_in_start_center("calc") +class SpinFieldTest(UITestCase): - ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + def test_up(self): - # select the numbers tab page - xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) - - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - xDecimalPlaces.executeAction("UP", tuple()) + self.ui_test.create_doc_in_start_center("calc") - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "2") + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - okBtn = xCellsDlg.getChild("ok") - okBtn.executeAction("CLICK", tuple()) + # select the numbers tab page + xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) - ui_test.close_doc() + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") -def down(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + okBtn = xCellsDlg.getChild("ok") + okBtn.executeAction("CLICK", tuple()) - ui_test = UITest(xUITest, xContext) + self.ui_test.close_doc() - ui_test.create_doc_in_start_center("calc") + def test_down(self): - ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") - # select the numbers tab page - xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) - - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - xDecimalPlaces.executeAction("UP", tuple()) - xDecimalPlaces.executeAction("UP", tuple()) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "3") - - xDecimalPlaces.executeAction("DOWN", tuple()) + # select the numbers tab page + xCellsDlg.executeAction("SELECT", mkPropertyValues({"POS": "0"})) + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("UP", tuple()) + xDecimalPlaces.executeAction("UP", tuple()) - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "2") + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "3") + + xDecimalPlaces.executeAction("DOWN", tuple()) - okBtn = xCellsDlg.getChild("ok") - okBtn.executeAction("CLICK", tuple()) + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "2") - ui_test.close_doc() + okBtn = xCellsDlg.getChild("ok") + okBtn.executeAction("CLICK", tuple()) -def text(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + self.ui_test.close_doc() - ui_test = UITest(xUITest, xContext) + def test_text(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:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() - - xDecimalPlaces = xCellsDlg.getChild("leadzerosed") - xDecimalPlaces.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() + + xDecimalPlaces = xCellsDlg.getChild("leadzerosed") + xDecimalPlaces.executeAction("TYPE", mkPropertyValues({"TEXT": "4"})) - decimal_places_state = get_state_as_dict(xDecimalPlaces) - assert(decimal_places_state["Text"] == "41") + decimal_places_state = get_state_as_dict(xDecimalPlaces) + assert(decimal_places_state["Text"] == "41") - okBtn = xCellsDlg.getChild("ok") - okBtn.executeAction("CLICK", tuple()) + okBtn = xCellsDlg.getChild("ok") + okBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/tabcontrol.py b/uitest/demo_ui/tabcontrol.py index b9d79adbf919..9ef9d7bcde97 100644 --- a/uitest/demo_ui/tabcontrol.py +++ b/uitest/demo_ui/tabcontrol.py @@ -13,6 +13,8 @@ from helper import mkPropertyValues from uihelper.calc import enter_text_to_cell +from UITestCase import UITestCase + try: import pyuno import uno @@ -23,32 +25,30 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def select_pos(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +class TabControlTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_select_pos(self): - ui_test.create_doc_in_start_center("calc") + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "B2", "=2+3+4") - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xFunctionDlg = xUITest.getTopFocusWindow() + xFunctionDlg = self.xUITest.getTopFocusWindow() - xTabs = xFunctionDlg.getChild("tabs") - xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) + xTabs = xFunctionDlg.getChild("tabs") + xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) - time.sleep(1) + time.sleep(1) - xCancelBtn = xFunctionDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/tabdialog.py b/uitest/demo_ui/tabdialog.py index 09bf600424cf..99e7b9f327d4 100644 --- a/uitest/demo_ui/tabdialog.py +++ b/uitest/demo_ui/tabdialog.py @@ -11,44 +11,40 @@ from helper import mkPropertyValues import time -def select_tab_page_pos(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +from UITestCase import UITestCase - ui_test = UITest(xUITest, xContext) +class TabDialogTest(UITestCase): - ui_test.create_doc_in_start_center("calc") + def test_select_tab_page_pos(self): - ui_test.execute_dialog_through_command(".uno:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + self.ui_test.create_doc_in_start_center("calc") - props = {"POS": "1"} - propsUNO = mkPropertyValues(props) - xCellsDlg.executeAction("SELECT", propsUNO) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - xOkBtn = xCellsDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + props = {"POS": "1"} + propsUNO = mkPropertyValues(props) + xCellsDlg.executeAction("SELECT", propsUNO) - ui_test.close_doc() + xOkBtn = xCellsDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) -def select_tab_page_name(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) + self.ui_test.close_doc() - ui_test = UITest(xUITest, xContext) + def test_select_tab_page_name(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:FormatCellDialog") - xCellsDlg = xUITest.getTopFocusWindow() + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xCellsDlg = self.xUITest.getTopFocusWindow() - props = {"NAME": "Borders"} - propsUNO = mkPropertyValues(props) - xCellsDlg.executeAction("SELECT", propsUNO) + props = {"NAME": "Borders"} + propsUNO = mkPropertyValues(props) + xCellsDlg.executeAction("SELECT", propsUNO) - xOkBtn = xCellsDlg.getChild("ok") - xOkBtn.executeAction("CLICK", tuple()) + xOkBtn = xCellsDlg.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uitest/demo_ui/treelist.py b/uitest/demo_ui/treelist.py index 4523dca94b7a..f1681cd45c5a 100644 --- a/uitest/demo_ui/treelist.py +++ b/uitest/demo_ui/treelist.py @@ -14,6 +14,8 @@ from uihelper.calc import enter_text_to_cell from uitest_helper import get_state_as_dict +from UITestCase import UITestCase + try: import pyuno import uno @@ -24,41 +26,39 @@ except ImportError: print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -def expand(xContext): - xUITest = xContext.ServiceManager.createInstanceWithContext( - "org.libreoffice.uitest.UITest", xContext) +class TreeListTest(UITestCase): - ui_test = UITest(xUITest, xContext) + def test_expand(self): - ui_test.create_doc_in_start_center("calc") + self.ui_test.create_doc_in_start_center("calc") - xCalcDoc = xUITest.getTopFocusWindow() - xGridWindow = xCalcDoc.getChild("grid_window") - enter_text_to_cell(xGridWindow, "B2", "=2+3+4") - xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "=2+3+4") + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) - ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") - xFunctionDlg = xUITest.getTopFocusWindow() + xFunctionDlg = self.xUITest.getTopFocusWindow() - xTabs = xFunctionDlg.getChild("tabs") - xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) + xTabs = xFunctionDlg.getChild("tabs") + xTabs.executeAction("SELECT", mkPropertyValues({"POS":"1"})) - xTreelist = xTabs.getChild("struct") + xTreelist = xTabs.getChild("struct") - xTreeEntry = xTreelist.getChild('0') + xTreeEntry = xTreelist.getChild('0') - xTreeEntry.executeAction("COLLAPSE", tuple()) + xTreeEntry.executeAction("COLLAPSE", tuple()) - time.sleep(1) + time.sleep(1) - xTreeEntry.executeAction("EXPAND", tuple()) + xTreeEntry.executeAction("EXPAND", tuple()) - time.sleep(1) + time.sleep(1) - xCancelBtn = xFunctionDlg.getChild("cancel") - xCancelBtn.executeAction("CLICK", tuple()) + xCancelBtn = xFunctionDlg.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) - ui_test.close_doc() + self.ui_test.close_doc() # vim:set shiftwidth=4 softtabstop=4 expandtab: */ |