summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-22 05:46:59 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-06-22 18:19:34 +0200
commitd8b376adba93a48e77ec9e81c96744d1e4997d88 (patch)
treec590c099c572bca67af66bd9b33236887ce5a0d1 /uitest
parent4fa28812f3574efaca42769e9e4ff28f7d545bd8 (diff)
uitest: convert all calc demos to the unittest based approach
Change-Id: I6ad7898f92c74f37ed2936337d6570904860d535
Diffstat (limited to 'uitest')
-rw-r--r--uitest/calc_tests/calc_demo.txt4
-rw-r--r--uitest/calc_tests/create_range_name.py62
-rw-r--r--uitest/calc_tests/function_wizard.py28
-rw-r--r--uitest/calc_tests/gridwin.py45
-rw-r--r--uitest/calc_tests/gridwindow.py46
5 files changed, 108 insertions, 77 deletions
diff --git a/uitest/calc_tests/calc_demo.txt b/uitest/calc_tests/calc_demo.txt
deleted file mode 100644
index 1c2629e91f73..000000000000
--- a/uitest/calc_tests/calc_demo.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-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
diff --git a/uitest/calc_tests/create_range_name.py b/uitest/calc_tests/create_range_name.py
index a2726a37db90..01d01fd6690b 100644
--- a/uitest/calc_tests/create_range_name.py
+++ b/uitest/calc_tests/create_range_name.py
@@ -9,6 +9,8 @@ from uitest_helper import UITest
from helper import mkPropertyValues
+from UITestCase import UITestCase
+
try:
import pyuno
import uno
@@ -19,54 +21,48 @@ except ImportError:
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
raise
-def create_range_name(xContext):
- xUITest = xContext.ServiceManager.createInstanceWithContext(
- "org.libreoffice.uitest.UITest", xContext)
-
- ui_test = UITest(xUITest, xContext)
+class CreateRangeNameTest(UITestCase):
- ui_test.create_doc_in_start_center("calc")
+ def test_create_range_name(self):
- ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+ self.ui_test.create_doc_in_start_center("calc")
- xAddNameDlg = xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- props = {"TEXT": "simpleRangeName"}
- actionProps = mkPropertyValues(props)
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- xEdit = xAddNameDlg.getChild("edit")
- xEdit.executeAction("TYPE", actionProps)
- xAddBtn = xAddNameDlg.getChild("add")
- xAddBtn.executeAction("CLICK", tuple())
+ props = {"TEXT": "simpleRangeName"}
+ actionProps = mkPropertyValues(props)
- ui_test.close_doc()
+ xEdit = xAddNameDlg.getChild("edit")
+ xEdit.executeAction("TYPE", actionProps)
+ xAddBtn = xAddNameDlg.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
-def create_local_range_name(xContext):
- xUITest = xContext.ServiceManager.createInstanceWithContext(
- "org.libreoffice.uitest.UITest", xContext)
+ self.ui_test.close_doc()
- ui_test = UITest(xUITest, xContext)
+ def test_create_local_range_name(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")
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
- xAddNameDlg = xUITest.getTopFocusWindow()
+ xAddNameDlg = self.xUITest.getTopFocusWindow()
- props = {"TEXT": "simpleRangeName"}
- actionProps = mkPropertyValues(props)
+ props = {"TEXT": "simpleRangeName"}
+ actionProps = mkPropertyValues(props)
- xEdit = xAddNameDlg.getChild("edit")
- xEdit.executeAction("TYPE", actionProps)
+ xEdit = xAddNameDlg.getChild("edit")
+ xEdit.executeAction("TYPE", actionProps)
- xScope = xAddNameDlg.getChild("scope")
- props = {"POS": "1"}
- scopeProps = mkPropertyValues(props)
- xScope.executeAction("SELECT", scopeProps)
+ xScope = xAddNameDlg.getChild("scope")
+ props = {"POS": "1"}
+ scopeProps = mkPropertyValues(props)
+ xScope.executeAction("SELECT", scopeProps)
- xAddBtn = xAddNameDlg.getChild("add")
- xAddBtn.executeAction("CLICK", tuple())
+ xAddBtn = xAddNameDlg.getChild("add")
+ xAddBtn.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/function_wizard.py b/uitest/calc_tests/function_wizard.py
index 1aadbe5e716d..bbdb0c15966b 100644
--- a/uitest/calc_tests/function_wizard.py
+++ b/uitest/calc_tests/function_wizard.py
@@ -10,6 +10,8 @@ from uitest_helper import UITest
from helper import mkPropertyValues
import time
+from UITestCase import UITestCase
+
try:
import pyuno
import uno
@@ -20,25 +22,21 @@ except ImportError:
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
raise
-# tdf#98427
-def open_function_wizard(xContext):
- xUITest = xContext.ServiceManager.createInstanceWithContext(
- "org.libreoffice.uitest.UITest", xContext)
-
- ui_test = UITest(xUITest, xContext)
-
- ui_test.create_doc_in_start_center("calc")
+class FunctionWizardTest(UITestCase):
+ # tdf#98427
+ def test_open_function_wizard(self):
+ self.ui_test.create_doc_in_start_center("calc")
- 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()
- xArrayChkBox = xFunctionDlg.getChild("array")
- xArrayChkBox.executeAction("CLICK", tuple())
+ xArrayChkBox = xFunctionDlg.getChild("array")
+ xArrayChkBox.executeAction("CLICK", tuple())
- 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/calc_tests/gridwin.py b/uitest/calc_tests/gridwin.py
new file mode 100644
index 000000000000..7077f4bebf23
--- /dev/null
+++ b/uitest/calc_tests/gridwin.py
@@ -0,0 +1,45 @@
+# -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest_helper import UITest
+
+from helper import mkPropertyValues
+
+from UITestCase import UITestCase
+
+import time
+
+try:
+ import pyuno
+ import uno
+ import unohelper
+except ImportError:
+ print("pyuno not found: try to set PYTHONPATH and URE_BOOTSTRAP variables")
+ print("PYTHONPATH=/installation/opt/program")
+ print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
+ raise
+
+class GridWinTest(UITestCase):
+
+ def test_select_object(self):
+
+ self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+
+ selectProps = mkPropertyValues({"CELL": "B10"})
+ xGridWindow.executeAction("SELECT", selectProps)
+
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+
+ xGridWindow.executeAction("ACTIVATE", tuple())
+
+ xGridWindow.executeAction("DESELECT", tuple())
+
+ self.ui_test.close_doc()
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/uitest/calc_tests/gridwindow.py b/uitest/calc_tests/gridwindow.py
index 1f01ec9d8622..1b63fe544fee 100644
--- a/uitest/calc_tests/gridwindow.py
+++ b/uitest/calc_tests/gridwindow.py
@@ -11,6 +11,8 @@ from helper import mkPropertyValues
from uihelper.calc import enter_text_to_cell
+from UITestCase import UITestCase
+
import time
try:
@@ -23,43 +25,37 @@ except ImportError:
print("URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc")
raise
-def input(xContext):
- xUITest = xContext.ServiceManager.createInstanceWithContext(
- "org.libreoffice.uitest.UITest", xContext)
-
- ui_test = UITest(xUITest, xContext)
+class GridWindowTest(UITestCase):
- ui_test.create_doc_in_start_center("calc")
- xTopWindow = xUITest.getTopFocusWindow()
+ def test_input(self):
- xGridWindow = xTopWindow.getChild("grid_window")
+ self.ui_test.create_doc_in_start_center("calc")
+ xTopWindow = self.xUITest.getTopFocusWindow()
- enter_text_to_cell(xGridWindow, "C3", "=A1")
- enter_text_to_cell(xGridWindow, "A1", "2")
+ xGridWindow = xTopWindow.getChild("grid_window")
- time.sleep(2)
+ enter_text_to_cell(xGridWindow, "C3", "=A1")
+ enter_text_to_cell(xGridWindow, "A1", "2")
- ui_test.close_doc()
+ time.sleep(2)
-def special_keys(xContext):
- xUITest = xContext.ServiceManager.createInstanceWithContext(
- "org.libreoffice.uitest.UITest", xContext)
+ self.ui_test.close_doc()
- ui_test = UITest(xUITest, xContext)
+ def test_special_keys(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({"CELL": "C3"})
- xGridWindow.executeAction("SELECT", selectProps)
+ selectProps = mkPropertyValues({"CELL": "C3"})
+ xGridWindow.executeAction("SELECT", selectProps)
- typeProps = mkPropertyValues({"KEYCODE": "CTRL+DOWN"})
- xGridWindow.executeAction("TYPE", typeProps)
+ typeProps = mkPropertyValues({"KEYCODE": "CTRL+DOWN"})
+ xGridWindow.executeAction("TYPE", typeProps)
- time.sleep(2)
+ time.sleep(2)
- ui_test.close_doc()
+ self.ui_test.close_doc()
# vim:set shiftwidth=4 softtabstop=4 expandtab: */