diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/chart/copyPaste.py | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.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/chart/copyPaste.py')
-rw-r--r-- | sc/qa/uitest/chart/copyPaste.py | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart/copyPaste.py b/sc/qa/uitest/chart/copyPaste.py new file mode 100644 index 000000000..fe58d5991 --- /dev/null +++ b/sc/qa/uitest/chart/copyPaste.py @@ -0,0 +1,70 @@ +# -*- 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_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class CopyPaste(UITestCase): + + def test_copy_paste_chart_with_dot_in_sheet_name(self): + with self.ui_test.load_file(get_url_for_data_file("chartWithDotInSheetName.ods")) as calc_doc: + + xChart = calc_doc.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(4, len(xDataSeries)) + + xOldSheetRanges = [] + for i in range(4): + xRow = [] + xDS = xDataSeries[i].DataSequences + + self.assertEqual(1, len(xDS)) + xRow.append(xDS[0].Values.SourceRangeRepresentation) + xOldSheetRanges.append(xRow) + + self.xUITest.executeCommand(".uno:SelectAll") + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + # Rename the sheet to match the same name as the first document + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + + xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"Sheet.1"})) + + self.xUITest.executeCommand(".uno:Paste") + + xChart = calc_document.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(4, len(xDataSeries)) + + xNewSheetRanges = [] + for i in range(4): + xRow = [] + xDS = xDataSeries[i].DataSequences + + self.assertEqual(1, len(xDS)) + xRow.append(xDS[0].Values.SourceRangeRepresentation) + xNewSheetRanges.append(xRow) + + # Without the fix in place, this test would have failed with + # ["$'Sheet.1'.$B$12:$B$18"] + # ["'file:///home/<user>/Documents/Sheet.1'#$Sheet1.$B$12:$B$18"] + self.assertEqual(xOldSheetRanges, xNewSheetRanges) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |