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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 10 23:19:46 UTC 2021


 sc/qa/uitest/conditional_format/tdf117899.py |   75 +++++++++++++++++++++++++++
 sc/qa/uitest/data/tdf117899.ods              |binary
 2 files changed, 75 insertions(+)

New commits:
commit 79797620e4010453fc6ef0da73d9dc154ee3e015
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Feb 10 22:50:41 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Feb 11 00:19:01 2021 +0100

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

diff --git a/sc/qa/uitest/conditional_format/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py
new file mode 100644
index 000000000000..ac3dead06b46
--- /dev/null
+++ b/sc/qa/uitest/conditional_format/tdf117899.py
@@ -0,0 +1,75 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.calc.document import get_cell_by_position
+from tempfile import TemporaryDirectory
+
+class Tdf117899(UITestCase):
+
+  def execute_conditional_format_manager_dialog(self):
+
+    self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+    xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+    aExpectedResult = 'Formula is $E3="нет"'
+    xList = xCondFormatMgr.getChild("CONTAINER")
+    self.assertEqual(1, len(xList.getChildren()))
+    self.assertTrue(get_state_as_dict(xList.getChild('0'))['Text'].endswith(aExpectedResult))
+
+    xOKBtn = xCondFormatMgr.getChild("ok")
+    self.ui_test.close_dialog_through_button(xOKBtn)
+
+  def test_tdf117899(self):
+    self.ui_test.load_file(get_url_for_data_file("tdf117899.ods"))
+
+    self.execute_conditional_format_manager_dialog()
+
+    self.xUITest.executeCommand(".uno:SelectAll")
+
+    self.xUITest.executeCommand(".uno:Copy")
+
+    # Close the Calc document
+    self.ui_test.close_doc()
+
+    with TemporaryDirectory() as tempdir:
+        xFilePath = tempdir + "/tdf117899-temp.ods"
+
+        self.ui_test.load_empty_file("writer")
+
+        # Paste as an OLE spreadsheet
+        formatProperty = mkPropertyValues({"SelectedFormat": 85})
+        self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+
+        # Save Copy as
+        self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8")
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        xFileName = xDialog.getChild("file_name")
+        xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+
+        xOpenBtn = xDialog.getChild("open")
+        self.ui_test.close_dialog_through_button(xOpenBtn)
+
+        # Close the Writer document
+        self.ui_test.close_doc()
+
+        self.ui_test.load_file('file://' + xFilePath)
+
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+
+        # Without the fix in place, this test would have failed here
+        self.execute_conditional_format_manager_dialog()
+
+        # Close the Calc document
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf117899.ods b/sc/qa/uitest/data/tdf117899.ods
new file mode 100644
index 000000000000..6c75ed0d1578
Binary files /dev/null and b/sc/qa/uitest/data/tdf117899.ods differ


More information about the Libreoffice-commits mailing list