summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/csv_dialog
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/csv_dialog
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/csv_dialog')
-rw-r--r--sc/qa/uitest/csv_dialog/tdf114878.py48
-rw-r--r--sc/qa/uitest/csv_dialog/tdf117868.py48
-rw-r--r--sc/qa/uitest/csv_dialog/tdf142395.py40
-rw-r--r--sc/qa/uitest/csv_dialog/tdf39716.py31
-rw-r--r--sc/qa/uitest/csv_dialog/tdf57841.py28
-rw-r--r--sc/qa/uitest/csv_dialog/tdf60468.py37
-rw-r--r--sc/qa/uitest/csv_dialog/tdf88359.py40
-rw-r--r--sc/qa/uitest/csv_dialog/tdf92503.py52
-rw-r--r--sc/qa/uitest/csv_dialog/tdf96561.py34
9 files changed, 358 insertions, 0 deletions
diff --git a/sc/qa/uitest/csv_dialog/tdf114878.py b/sc/qa/uitest/csv_dialog/tdf114878.py
new file mode 100644
index 000000000..90fa00ed9
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf114878.py
@@ -0,0 +1,48 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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 libreoffice.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Td114878(UITestCase):
+
+ def test_tdf114878(self):
+
+ # First import the file with 'Evaluate Formulas' unchecked
+ with load_csv_file(self, "tdf114878.csv", True):
+ # Without the fix in place, this test would have failed with
+ # Could not find child with id: evaluateformulas
+ pass
+
+ 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()
+
+ # Now import the file with 'Evaluate Formulas' checked
+ with load_csv_file(self, "tdf114878.csv", True) as xDialog:
+ xEvalutateFormulas = xDialog.getChild("evaluateformulas")
+ xEvalutateFormulas.executeAction("CLICK", tuple())
+ self.assertEqual('true', get_state_as_dict(xEvalutateFormulas)['Selected'])
+
+ 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/csv_dialog/tdf117868.py b/sc/qa/uitest/csv_dialog/tdf117868.py
new file mode 100644
index 000000000..d5306117e
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf117868.py
@@ -0,0 +1,48 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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 libreoffice.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Td117868(UITestCase):
+
+ def test_tdf117868(self):
+
+ with load_csv_file(self, "tdf117868.csv", False) as xDialog:
+ # Set text delimiter in case it's changed by another test
+ xSeparatedBy = xDialog.getChild("toseparatedby")
+ xSeparatedBy.executeAction("CLICK", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'true' != 'false'
+ self.assertEqual('true', get_state_as_dict(xDialog.getChild("other"))['Selected'])
+ self.assertEqual('false', get_state_as_dict(xDialog.getChild("tab"))['Selected'])
+ self.assertEqual('false', get_state_as_dict(xDialog.getChild("comma"))['Selected'])
+ self.assertEqual('false', get_state_as_dict(xDialog.getChild("semicolon"))['Selected'])
+
+ self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text'])
+
+ xInputOther = xDialog.getChild("inputother")
+ self.assertEqual("|", get_state_as_dict(xInputOther)['Text'])
+
+ document = self.ui_test.get_component()
+
+ self.assertEqual("LETTER", get_cell_by_position(document, 0, 0, 1).getString())
+ self.assertEqual("ANIMAL", get_cell_by_position(document, 0, 1, 1).getString())
+ self.assertEqual('a', get_cell_by_position(document, 0, 0, 2).getString())
+ self.assertEqual('aardvark', get_cell_by_position(document, 0, 1, 2).getString())
+ self.assertEqual('b', get_cell_by_position(document, 0, 0, 3).getString())
+ self.assertEqual('bear', get_cell_by_position(document, 0, 1, 3).getString())
+ self.assertEqual('c', get_cell_by_position(document, 0, 0, 4).getString())
+ self.assertEqual('cow', get_cell_by_position(document, 0, 1, 4).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/csv_dialog/tdf142395.py b/sc/qa/uitest/csv_dialog/tdf142395.py
new file mode 100644
index 000000000..718a3ac47
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf142395.py
@@ -0,0 +1,40 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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 libreoffice.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Tdf142395(UITestCase):
+
+ def test_tdf142395(self):
+ with load_csv_file(self, "tdf142395.csv", True) as xDialog:
+ # Remove the text delimiter
+ xTextDelimiter = xDialog.getChild("textdelimiter")
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+
+ 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/csv_dialog/tdf39716.py b/sc/qa/uitest/csv_dialog/tdf39716.py
new file mode 100644
index 000000000..395596602
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf39716.py
@@ -0,0 +1,31 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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.calc.csv_dialog import load_csv_file
+from libreoffice.calc.document import get_cell_by_position
+
+
+class Tdf39716(UITestCase):
+
+ def test_tdf39716(self):
+
+ with load_csv_file(self, "tdf39716.csv", True):
+ pass
+
+ document = self.ui_test.get_component()
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 2.5e-13 != 0.0
+ self.assertEqual(2.5e-13, get_cell_by_position(document, 0, 0, 0).getValue())
+ self.assertEqual(5e-13, get_cell_by_position(document, 0, 0, 1).getValue())
+ self.assertEqual(7.5e-13, get_cell_by_position(document, 0, 0, 2).getValue())
+ self.assertEqual(1e-12, get_cell_by_position(document, 0, 0, 3).getValue())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/csv_dialog/tdf57841.py b/sc/qa/uitest/csv_dialog/tdf57841.py
new file mode 100644
index 000000000..3fb4da921
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf57841.py
@@ -0,0 +1,28 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Tdf57841(UITestCase):
+
+ def test_tdf57841(self):
+ with load_csv_file(self, "tdf57841.csv", True):
+ pass
+
+ document = self.ui_test.get_component()
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '2' != ''
+ for i in range(4):
+ self.assertEqual(str(i + 1), get_cell_by_position(document, 0, i, 0).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/csv_dialog/tdf60468.py b/sc/qa/uitest/csv_dialog/tdf60468.py
new file mode 100644
index 000000000..db83664fe
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf60468.py
@@ -0,0 +1,37 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Tdf60468(UITestCase):
+
+ def test_tdf60468(self):
+
+ # Load file from Open dialog
+ with load_csv_file(self, "tdf60468.csv", True):
+ pass
+
+ 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/csv_dialog/tdf88359.py b/sc/qa/uitest/csv_dialog/tdf88359.py
new file mode 100644
index 000000000..19fa8b919
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf88359.py
@@ -0,0 +1,40 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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, select_pos
+from libreoffice.calc.csv_dialog import load_csv_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class Tdf88359(UITestCase):
+
+ def test_tdf88359(self):
+
+ # Import the file with 'Detect Special Numbers' unchecked
+ with load_csv_file(self, "tdf88359.csv", True):
+ pass
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xliststore1 = xDialog.getChild("categorylb")
+ xliststore2 = xDialog.getChild("formatlb")
+ xformatted = xDialog.getChild("formatted")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Date' != 'Text'
+ self.assertEqual("Date", get_state_as_dict(xliststore1)["SelectEntryText"])
+ self.assertEqual("1999-12-31T13:37:46", get_state_as_dict(xliststore2)["SelectEntryText"])
+ self.assertEqual("YYYY-MM-DD\"T\"HH:MM:SS", get_state_as_dict(xformatted)["Text"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/csv_dialog/tdf92503.py b/sc/qa/uitest/csv_dialog/tdf92503.py
new file mode 100644
index 000000000..9774b03c3
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf92503.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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, select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Tdf92503(UITestCase):
+
+ def test_tdf92503(self):
+ with load_csv_file(self, "tdf92503.csv", True) as xDialog:
+ xFixedWidth = xDialog.getChild("tofixedwidth")
+ xGrid = xDialog.getChild("csvgrid")
+ xColumnType = xDialog.getChild("columntype")
+
+ xFixedWidth.executeAction("CLICK", tuple())
+ self.assertEqual('true', get_state_as_dict(xFixedWidth)['Checked'])
+
+ # Use the right arrow to put the focus in the grid
+ xGrid.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"}))
+
+ self.assertEqual('true', get_state_as_dict(xColumnType)['Enabled'])
+
+ select_by_text(xColumnType, "Date (DMY)")
+
+ self.assertEqual('Date (DMY)', get_state_as_dict(xColumnType)['SelectEntryText'])
+
+ document = self.ui_test.get_component()
+
+ self.assertEqual("03/31/13 01:00 AM", get_cell_by_position(document, 0, 0, 0).getString())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '03/31/13 02:00 AM' != '31 Mar 2013, 02:00'
+ self.assertEqual("03/31/13 02:00 AM", get_cell_by_position(document, 0, 0, 1).getString())
+ self.assertEqual("03/31/13 03:00 AM", get_cell_by_position(document, 0, 0, 2).getString())
+ self.assertEqual("03/30/14 01:00 AM", get_cell_by_position(document, 0, 0, 3).getString())
+ self.assertEqual("03/30/14 02:00 AM", get_cell_by_position(document, 0, 0, 4).getString())
+ self.assertEqual("03/30/14 03:00 AM", get_cell_by_position(document, 0, 0, 5).getString())
+ self.assertEqual("03/29/15 01:00 AM", get_cell_by_position(document, 0, 0, 6).getString())
+ self.assertEqual("03/29/15 02:00 AM", get_cell_by_position(document, 0, 0, 7).getString())
+ self.assertEqual("03/29/15 03:00 AM", get_cell_by_position(document, 0, 0, 8).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/csv_dialog/tdf96561.py b/sc/qa/uitest/csv_dialog/tdf96561.py
new file mode 100644
index 000000000..a22b9180c
--- /dev/null
+++ b/sc/qa/uitest/csv_dialog/tdf96561.py
@@ -0,0 +1,34 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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.calc.document import get_cell_by_position
+from libreoffice.calc.csv_dialog import load_csv_file
+
+class Tdf96561(UITestCase):
+
+ def test_tdf96561(self):
+ with load_csv_file(self, "tdf96561.csv", True):
+ pass
+
+ document = self.ui_test.get_component()
+
+ self.assertEqual('Campo con ";" en medio', get_cell_by_position(document, 0, 0, 0).getString())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '""; esta al """""principio del Campo' != 'Campo la tiene al final;"'
+ self.assertEqual('""; esta al """""principio del Campo', get_cell_by_position(document, 0, 0, 1).getString())
+ self.assertEqual('Campo la tiene al final;"', get_cell_by_position(document, 0, 0, 2).getString())
+
+ for i in range(1,5):
+ for j in range(0,3):
+ self.assertEqual("1", get_cell_by_position(document, 0, i, j).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: