sc/qa/uitest/csv_dialog/tdf114878.py |   70 +++++++++++++++++++++++++++++++++++
 sc/qa/uitest/data/tdf114878.csv      |    4 ++
 2 files changed, 74 insertions(+)

New commits:
commit 11622c2eb319bb096d4d587ea06a932ba5fceafb
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Sep 8 10:56:05 2021 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 8 14:58:18 2021 +0200

    tdf#114878: sc: Add UItest
    
    Change-Id: I4edac5f45f18e1aa85d1936a2577420ee274f43e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121804
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/csv_dialog/tdf114878.py 
b/sc/qa/uitest/csv_dialog/tdf114878.py
new file mode 100644
index 000000000000..b94368a71343
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf114878.py
@@ -0,0 +1,70 @@
+# -*- 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 Td114878(UITestCase):
+
+    def test_tdf114878(self):
+
+        # Load file from Open dialog
+        with self.ui_test.execute_dialog_through_command(".uno:Open", 
close_button="open") as xOpenDialog:
+
+            xFileName = xOpenDialog.getChild("file_name")
+            xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
get_url_for_data_file("tdf114878.csv")}))
+
+        xDialog = self.ui_test.wait_for_top_focus_window('TextImportCsvDialog')
+
+        # First import the file with 'Evaluate Formulas' unchecked
+
+        # Without the fix in place, this test would have failed with
+        # Could not find child with id: evaluateformulas
+        xEvalutateFormulas = xDialog.getChild("evaluateformulas")
+        self.assertEqual('false', 
get_state_as_dict(xEvalutateFormulas)['Selected'])
+
+        xOK = xDialog.getChild('ok')
+        with self.ui_test.wait_until_component_loaded():
+            self.ui_test.close_dialog_through_button(xOK)
+
+        document = self.ui_test.get_component()
+
+        self.assertEqual("=-3+5", get_cell_by_position(document, 0, 0, 
0).getString())
+        self.assertEqual('=TRUE()', get_cell_by_position(document, 0, 0, 
1).getString())
+        self.assertEqual('=4*10', get_cell_by_position(document, 0, 0, 
2).getString())
+        self.assertEqual('=SUM(A1:A3)', get_cell_by_position(document, 0, 0, 
3).getString())
+
+        self.ui_test.close_doc()
+
+        # Load the same file again
+        with self.ui_test.execute_dialog_through_command(".uno:Open", 
close_button="open") as xOpenDialog:
+
+            xFileName = xOpenDialog.getChild("file_name")
+            xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": 
get_url_for_data_file("tdf114878.csv")}))
+
+        xDialog = self.ui_test.wait_for_top_focus_window('TextImportCsvDialog')
+
+        # Now import the file with 'Evaluate Formulas' checked
+        xEvalutateFormulas = xDialog.getChild("evaluateformulas")
+        xEvalutateFormulas.executeAction("CLICK", tuple())
+        self.assertEqual('true', 
get_state_as_dict(xEvalutateFormulas)['Selected'])
+
+        xOK = xDialog.getChild('ok')
+        with self.ui_test.wait_until_component_loaded():
+            self.ui_test.close_dialog_through_button(xOK)
+
+        document = self.ui_test.get_component()
+
+        self.assertEqual("2", get_cell_by_position(document, 0, 0, 
0).getString())
+        self.assertEqual('1', get_cell_by_position(document, 0, 0, 
1).getString())
+        self.assertEqual('40', get_cell_by_position(document, 0, 0, 
2).getString())
+        self.assertEqual('43', get_cell_by_position(document, 0, 0, 
3).getString())
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf114878.csv b/sc/qa/uitest/data/tdf114878.csv
new file mode 100644
index 000000000000..2104f559ebcf
--- /dev/null
+++ b/sc/qa/uitest/data/tdf114878.csv
@@ -0,0 +1,4 @@
+=-3+5
+=TRUE()
+=4*10
+=SUM(A1:A3)

Reply via email to