[Libreoffice-commits] core.git: 2 commits - sc/Module_sc.mk sc/qa sc/UITest_range_name.mk uitest/uitest

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Mar 18 01:04:49 UTC 2017


 sc/Module_sc.mk                     |    1 
 sc/UITest_range_name.mk             |   15 ++++++++++
 sc/qa/uitest/range_name/tdf86214.py |   53 ++++++++++++++++++++++++++++++++++++
 uitest/uitest/uihelper/keyboard.py  |   13 ++++++++
 4 files changed, 82 insertions(+)

New commits:
commit 224a8b3856ec3cbe6d9f864789184d49ecb8c8d8
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 18 01:58:05 2017 +0100

    add test for tdf#86214
    
    We should extend the test and check for all invalid names. At the same
    time this can be used as indirect documentation of the names that are
    not allowed.
    
    Change-Id: I9c8b760d49ce2bfe40158a9096246a75f727ff9d

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 274e3e527620..d1cd0fd72c76 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -139,6 +139,7 @@ $(eval $(call gb_Module_add_screenshot_targets,sc,\
 
 $(eval $(call gb_Module_add_uicheck_targets,sc,\
 	UITest_conditional_format \
+	UITest_range_name \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/UITest_range_name.mk b/sc/UITest_range_name.mk
new file mode 100644
index 000000000000..db8146dfd567
--- /dev/null
+++ b/sc/UITest_range_name.mk
@@ -0,0 +1,15 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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/.
+#
+
+$(eval $(call gb_UITest_UITest,range_name))
+
+$(eval $(call gb_UITest_add_modules,range_name,$(SRCDIR)/sc/qa/uitest,\
+	range_name/ \
+))
+# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/uitest/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py
new file mode 100644
index 000000000000..d32660ba7581
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf86214.py
@@ -0,0 +1,53 @@
+# -*- 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
+from uitest.uihelper.common import type_text, get_state_as_dict
+from uitest.uihelper.keyboard import select_all
+
+class InvalidNames(UITestCase):
+
+    def test_invalid_names(self):
+
+        self.ui_test.create_doc_in_start_center("calc")
+
+        self.ui_test.execute_modeless_dialog_through_command(".uno:AddName")
+
+        xAddNameDlg = self.xUITest.getTopFocusWindow()
+
+        invalid_names = ["A1", "12", "1.2", "A1:B2" ]
+
+        xLabel = xAddNameDlg.getChild("label")
+        xAddBtn = xAddNameDlg.getChild("add")
+        xEdit = xAddNameDlg.getChild("edit")
+
+        success_text = get_state_as_dict(xLabel)["Text"]
+
+        for name in invalid_names:
+            with self.subTest(name = name):
+                select_all(xEdit)
+                type_text(xEdit, name)
+
+                new_text = get_state_as_dict(xLabel)["Text"]
+                self.assertNotEqual(success_text, new_text)
+                self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false")
+
+
+        select_all(xEdit)
+        type_text(xEdit, "valid_name")
+
+        new_text = get_state_as_dict(xLabel)["Text"]
+        self.assertEqual(success_text, new_text)
+        self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true")
+
+        self.ui_test.close_dialog_through_button(xAddBtn)
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
commit 58323be71c721e7eb4029c255e42be7061b61d73
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Mar 18 01:57:12 2017 +0100

    uitest: add method to simplify sending CTRL+A
    
    Change-Id: I708cc0fdb416d3347e9e5c531d7720c902ec0a86

diff --git a/uitest/uitest/uihelper/keyboard.py b/uitest/uitest/uihelper/keyboard.py
new file mode 100644
index 000000000000..f2d8890afed0
--- /dev/null
+++ b/uitest/uitest/uihelper/keyboard.py
@@ -0,0 +1,13 @@
+# -*- 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 convert_property_values_to_dict, mkPropertyValues
+
+def select_all(ui_object):
+    ui_object.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list