summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-05-03 13:07:49 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-05-04 00:21:00 +0200
commit4ee58a0dedc5160551260793e5fed9e6c3842976 (patch)
treebe1ae6614bfa70768aec321438b3c93bd25208a8 /sc
parent45b952f64755a1ae34a8bb432b4909c5b91da474 (diff)
tdf#60468, tdf#142040: sc: Add UItest
Change-Id: I44eb029087708d85fa1f3712cd40bebb6174c58e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115034 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/calc_tests9/tdf60468.py51
-rw-r--r--sc/qa/uitest/data/tdf60468.csv5
2 files changed, 56 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests9/tdf60468.py b/sc/qa/uitest/calc_tests9/tdf60468.py
new file mode 100644
index 000000000000..8990194a8b0d
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf60468.py
@@ -0,0 +1,51 @@
+# -*- 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 Tdf60468(UITestCase):
+
+ def test_tdf60468(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("tdf60468.csv")}))
+
+ xOpenBtn = xOpenDialog.getChild("open")
+ xOpenBtn.executeAction("CLICK", tuple())
+
+ xDialog = self.xUITest.getTopFocusWindow()
+ self.assertEqual('true', get_state_as_dict(xDialog.getChild("tab"))['Selected'])
+ self.assertEqual('true', get_state_as_dict(xDialog.getChild("comma"))['Selected'])
+ self.assertEqual('true', get_state_as_dict(xDialog.getChild("semicolon"))['Selected'])
+ self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text'])
+
+ xOK = xDialog.getChild('ok')
+ self.ui_test.close_dialog_through_button(xOK)
+
+ document = self.ui_test.get_component()
+
+ # tdf#142040: Without the fix in place, this test would have failed with
+ # AssertionError: 'head1' != ''
+ for i in range(3):
+ self.assertEqual("head" + str(i + 1), get_cell_by_position(document, 0, i, 0).getString())
+
+ self.assertEqual("value1.1\nvalue1.2", get_cell_by_position(document, 0, 0, 1).getString())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'value2.1\n\tvalue2.2\nvalue2.3' != 'value2.1\n\tvalue2.2'
+ self.assertEqual("value2.1\n\tvalue2.2\nvalue2.3", get_cell_by_position(document, 0, 1, 1).getString())
+ self.assertEqual("value3", get_cell_by_position(document, 0, 2, 1).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf60468.csv b/sc/qa/uitest/data/tdf60468.csv
new file mode 100644
index 000000000000..9f9cfa7238ba
--- /dev/null
+++ b/sc/qa/uitest/data/tdf60468.csv
@@ -0,0 +1,5 @@
+head1 head2 head3
+"value1.1
+value1.2" "value2.1
+ value2.2
+value2.3" value3