[Libreoffice-commits] core.git: uitest/demo_ui

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Feb 18 03:57:16 UTC 2017


 uitest/demo_ui/char_dialog.py |    2 +-
 uitest/demo_ui/checkbox.py    |    2 +-
 uitest/demo_ui/combobox.py    |    2 +-
 uitest/demo_ui/edit.py        |    2 +-
 uitest/demo_ui/hierarchy.py   |   35 +++++++++++++++++++++++++++++++++++
 uitest/demo_ui/listbox.py     |    4 ++--
 uitest/demo_ui/spinfield.py   |    6 +++---
 7 files changed, 44 insertions(+), 9 deletions(-)

New commits:
commit 19d52e56a4581bb12bc271765feec7b8ab78c45b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Feb 18 03:32:41 2017 +0100

    uitest: use the correct method to close a dialog through a button
    
    Change-Id: I210c1d9a99a93b7a21478f679f440c270375bedc
    Reviewed-on: https://gerrit.libreoffice.org/34398
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/uitest/demo_ui/char_dialog.py b/uitest/demo_ui/char_dialog.py
index 4c77163..d2b1fb0 100644
--- a/uitest/demo_ui/char_dialog.py
+++ b/uitest/demo_ui/char_dialog.py
@@ -29,7 +29,7 @@ class CharDialogText(UITestCase):
         sleep(5)
 
         xCancelBtn = xCharDialog.getChild("cancel")
-        xCancelBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(xCancelBtn)
 
         self.ui_test.close_doc()
 
diff --git a/uitest/demo_ui/checkbox.py b/uitest/demo_ui/checkbox.py
index 2138cf6..114473d 100644
--- a/uitest/demo_ui/checkbox.py
+++ b/uitest/demo_ui/checkbox.py
@@ -21,7 +21,7 @@ class CheckBoxTest(UITestCase):
         xNegativeNumRedCB.executeAction("CLICK",tuple())
 
         okBtn = xCellsDlg.getChild("ok")
-        okBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(okBtn)
 
         self.ui_test.close_doc()
 
diff --git a/uitest/demo_ui/combobox.py b/uitest/demo_ui/combobox.py
index 32e6402..8b47f83 100644
--- a/uitest/demo_ui/combobox.py
+++ b/uitest/demo_ui/combobox.py
@@ -23,7 +23,7 @@ class ComboBoxTest(UITestCase):
         select_pos(scopeCB, "1")
 
         xCancelBtn = xAddNameDlg.getChild("cancel")
-        xCancelBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(xCancelBtn)
 
         self.ui_test.close_doc()
 
diff --git a/uitest/demo_ui/edit.py b/uitest/demo_ui/edit.py
index 5eff4e0..135a724 100644
--- a/uitest/demo_ui/edit.py
+++ b/uitest/demo_ui/edit.py
@@ -24,7 +24,7 @@ class EditTest(UITestCase):
         type_text(xEdit, "simpleRangeName")
 
         xAddBtn = xAddNameDlg.getChild("cancel")
-        xAddBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(xAddBtn)
 
         self.ui_test.close_doc()
 
diff --git a/uitest/demo_ui/hierarchy.py b/uitest/demo_ui/hierarchy.py
new file mode 100644
index 0000000..5f7b3c2
--- /dev/null
+++ b/uitest/demo_ui/hierarchy.py
@@ -0,0 +1,35 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+from uitest.framework import UITestCase
+
+import json
+
+class CheckBoxTest(UITestCase):
+
+    def test_get_json(self):
+
+        self.ui_test.create_doc_in_start_center("calc")
+
+        self.ui_test.execute_dialog_through_command(".uno:About")
+
+        xAboutDlg = self.xUITest.getTopFocusWindow()
+
+        json_string = xAboutDlg.getHierarchy()
+        print(json_string)
+        json_content = json.loads(json_string)
+        print(json_content)
+        print(json.dumps(json_content, indent=4))
+
+        closeBtn = xAboutDlg.getChild("close")
+        self.ui_test.close_dialog_through_button(closeBtn)
+
+        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 15bd8ab..780da1f 100644
--- a/uitest/demo_ui/listbox.py
+++ b/uitest/demo_ui/listbox.py
@@ -23,7 +23,7 @@ class ListBoxTest(UITestCase):
         select_pos(categoryLB, "4")
 
         xOkBtn = xCellsDlg.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(xOkBtn)
 
         self.ui_test.close_doc()
 
@@ -41,7 +41,7 @@ class ListBoxTest(UITestCase):
         categoryLB.executeAction("SELECT", actionProps)
 
         xOkBtn = xCellsDlg.getChild("ok")
-        xOkBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(xOkBtn)
 
         self.ui_test.close_doc()
 
diff --git a/uitest/demo_ui/spinfield.py b/uitest/demo_ui/spinfield.py
index a36189a..3f73006 100644
--- a/uitest/demo_ui/spinfield.py
+++ b/uitest/demo_ui/spinfield.py
@@ -29,7 +29,7 @@ class SpinFieldTest(UITestCase):
         assert(decimal_places_state["Text"] == "2")
 
         okBtn = xCellsDlg.getChild("ok")
-        okBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(okBtn)
 
         self.ui_test.close_doc()
 
@@ -56,7 +56,7 @@ class SpinFieldTest(UITestCase):
         assert(decimal_places_state["Text"] == "2")
 
         okBtn = xCellsDlg.getChild("ok")
-        okBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(okBtn)
 
         self.ui_test.close_doc()
 
@@ -74,7 +74,7 @@ class SpinFieldTest(UITestCase):
         assert(decimal_places_state["Text"] == "41")
 
         okBtn = xCellsDlg.getChild("ok")
-        okBtn.executeAction("CLICK", tuple())
+        self.ui_test.close_dialog_through_button(okBtn)
 
         self.ui_test.close_doc()
 


More information about the Libreoffice-commits mailing list