[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 22 15:22:50 UTC 2021
sc/qa/uitest/calc_tests9/tdf142395.py | 53 ++++++++++++++++++++++++++++++++++
sc/qa/uitest/calc_tests9/tdf57841.py | 6 +++
sc/qa/uitest/calc_tests9/tdf60468.py | 6 +++
sc/qa/uitest/data/tdf142395.csv | 2 +
4 files changed, 67 insertions(+)
New commits:
commit f4a9dcc471f5cefb2c16e104a270339afa88b4d7
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri May 21 17:23:06 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sat May 22 17:22:11 2021 +0200
tdf#142395: sc: Add UItest
Change-Id: I428b77283a9828bd3902702fb23b3acc560dea94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115947
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/uitest/calc_tests9/tdf142395.py b/sc/qa/uitest/calc_tests9/tdf142395.py
new file mode 100644
index 000000000000..a101b56dcc17
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf142395.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 uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+
+class Tdf142395(UITestCase):
+
+ def test_tdf142395(self):
+
+ # Load file from Open dialog
+ self.ui_test.execute_dialog_through_command(".uno:Open")
+
+ xOpenDialog = self.xUITest.getTopFocusWindow()
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf142395.csv")}))
+
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ # Remove the text delimiter
+ xTextDelimiter = xDialog.getChild("textdelimiter")
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+
+ xOK = xDialog.getChild('ok')
+ self.ui_test.close_dialog_through_button(xOK)
+
+ document = self.ui_test.get_component()
+
+ self.assertEqual("a", get_cell_by_position(document, 0, 0, 0).getString())
+ self.assertEqual(" b", get_cell_by_position(document, 0, 1, 0).getString())
+ self.assertEqual(" c", get_cell_by_position(document, 0, 2, 0).getString())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: ' ' != '晦餪'
+ self.assertEqual(" ", get_cell_by_position(document, 0, 3, 0).getString())
+
+ self.assertEqual("e", get_cell_by_position(document, 0, 0, 1).getString())
+ self.assertEqual(" f", get_cell_by_position(document, 0, 1, 1).getString())
+ self.assertEqual(" g", get_cell_by_position(document, 0, 2, 1).getString())
+ self.assertEqual(" ", get_cell_by_position(document, 0, 3, 1).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests9/tdf57841.py b/sc/qa/uitest/calc_tests9/tdf57841.py
index 9cc12467f65d..4c3722bf29d2 100644
--- a/sc/qa/uitest/calc_tests9/tdf57841.py
+++ b/sc/qa/uitest/calc_tests9/tdf57841.py
@@ -29,6 +29,12 @@ class Tdf57841(UITestCase):
self.assertEqual('true', get_state_as_dict(xDialog.getChild("semicolon"))['Selected'])
self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text'])
+ # Set text delimiter in case it's changed by another test
+ xTextDelimiter = xDialog.getChild("textdelimiter")
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"TEXT": "\""}))
+
xOK = xDialog.getChild('ok')
self.ui_test.close_dialog_through_button(xOK)
diff --git a/sc/qa/uitest/calc_tests9/tdf60468.py b/sc/qa/uitest/calc_tests9/tdf60468.py
index 8990194a8b0d..33230737db73 100644
--- a/sc/qa/uitest/calc_tests9/tdf60468.py
+++ b/sc/qa/uitest/calc_tests9/tdf60468.py
@@ -29,6 +29,12 @@ class Tdf60468(UITestCase):
self.assertEqual('true', get_state_as_dict(xDialog.getChild("semicolon"))['Selected'])
self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text'])
+ # Set text delimiter in case it's changed by another test
+ xTextDelimiter = xDialog.getChild("textdelimiter")
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"TEXT": "\""}))
+
xOK = xDialog.getChild('ok')
self.ui_test.close_dialog_through_button(xOK)
diff --git a/sc/qa/uitest/data/tdf142395.csv b/sc/qa/uitest/data/tdf142395.csv
new file mode 100644
index 000000000000..56fc9c357550
--- /dev/null
+++ b/sc/qa/uitest/data/tdf142395.csv
@@ -0,0 +1,2 @@
+a, b, c,
+e, f, g,
More information about the Libreoffice-commits
mailing list