[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Feb 3 22:35:19 UTC 2021
sc/qa/uitest/chart/tdf120348.py | 62 ++++++++++++++++++++++++++++++++++++++++
sc/qa/uitest/data/tdf120348.ods |binary
2 files changed, 62 insertions(+)
New commits:
commit 356848ed36f958c283d1863934161d6823d8b121
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Feb 3 20:30:02 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Feb 3 23:34:27 2021 +0100
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 at libreoffice.org>
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
Binary files /dev/null and b/sc/qa/uitest/data/tdf120348.ods differ
More information about the Libreoffice-commits
mailing list