summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-02-03 20:30:02 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-02-03 23:34:27 +0100
commit356848ed36f958c283d1863934161d6823d8b121 (patch)
treec800fbf938bf9e1370970c1c2b3d5f6ff7f0f0f6 /sc
parentbbc5cc71fd1723db8cb5020f83db5cafc0f8a52a (diff)
tdf#120348: sc: Add UItest
Change-Id: I040dc2c8e1c84e972c2f8f9545fb79e3d51de0f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110389 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/chart/tdf120348.py62
-rw-r--r--sc/qa/uitest/data/tdf120348.odsbin0 -> 43612 bytes
2 files changed, 62 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart/tdf120348.py b/sc/qa/uitest/chart/tdf120348.py
new file mode 100644
index 000000000000..5eb83a0f66d1
--- /dev/null
+++ b/sc/qa/uitest/chart/tdf120348.py
@@ -0,0 +1,62 @@
+# -*- 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.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf120348(UITestCase):
+
+ def test_tdf120348(self):
+
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120348.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ xFirstMatrix = []
+ for row in range(1, 159):
+ xRow = []
+ for column in range(5, 9):
+ xRow.append(round(get_cell_by_position(document, 0, column, row).getValue(), 5))
+ xFirstMatrix.append(xRow)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 2"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ self.ui_test.close_doc()
+
+ self.ui_test.load_empty_file("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ self.xUITest.executeCommand(".uno:Paste")
+
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+
+ columnNames = ('Finland', 'Sweden', 'Poland', '')
+ self.assertEqual(columnNames, xData.ColumnDescriptions)
+
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(round(value, 5))
+ xSecondMatrix.append(xRow)
+
+ # Without the fix in place, this test would have failed with
+ # First differing element 51:
+ # [3.31618, 3.65089, 3.33626, 0.0]
+ # [3.31618, 3.65089, 0.0, 0.0]
+
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf120348.ods b/sc/qa/uitest/data/tdf120348.ods
new file mode 100644
index 000000000000..7a593c1bff7b
--- /dev/null
+++ b/sc/qa/uitest/data/tdf120348.ods
Binary files differ