[Libreoffice-commits] core.git: sc/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 17 12:14:33 UTC 2020


 sc/qa/uitest/range_name/tdf138822.py |   63 +++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

New commits:
commit 456cc328c43f67994629204003247923d783db96
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Dec 17 10:52:50 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Dec 17 13:13:52 2020 +0100

    tdf#138822: sc: Add UItest
    
    Change-Id: Ibb1ad62679480e51caf8b89ebb14c7fb4cb9f5ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107868
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/range_name/tdf138822.py b/sc/qa/uitest/range_name/tdf138822.py
new file mode 100644
index 000000000000..361cc379e828
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf138822.py
@@ -0,0 +1,63 @@
+# -*- 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 uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import type_text
+
+class tdf138822(UITestCase):
+
+    def test_tdf138822(self):
+        self.ui_test.create_doc_in_start_center("calc")
+
+        calcDoc = self.xUITest.getTopFocusWindow()
+        xPosWindow = calcDoc.getChild('pos_window')
+        self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text'])
+
+        self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName")
+
+        xManageNamesDialog = self.xUITest.getTopFocusWindow()
+
+        xAddBtn = xManageNamesDialog.getChild("add")
+        self.ui_test.close_dialog_through_button(xAddBtn)
+
+        xDefineNamesDialog = self.xUITest.getTopFocusWindow()
+
+        xAddBtn = xDefineNamesDialog.getChild("add")
+        self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled'])
+
+        xEdit = xDefineNamesDialog.getChild("edit")
+        type_text(xEdit, "rangeName")
+
+        self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled'])
+
+        self.ui_test.close_dialog_through_button(xAddBtn)
+
+        xManageNamesDialog = self.xUITest.getTopFocusWindow()
+
+        xNamesList = xManageNamesDialog.getChild('names')
+        self.assertEqual(1, len(xNamesList.getChildren()))
+        self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)")
+
+        xCancelBtn = xManageNamesDialog.getChild("cancel")
+        self.ui_test.close_dialog_through_button(xCancelBtn)
+
+        # Open the dialog again
+        self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName")
+
+        xManageNamesDialog = self.xUITest.getTopFocusWindow()
+        xNamesList = xManageNamesDialog.getChild('names')
+
+        # Without the fix in place, this test would have failed with
+        # AssertionError: 0 != 1
+        self.assertEqual(0, len(xNamesList.getChildren()))
+
+        xOkBtn = xManageNamesDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOkBtn)
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list