diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sc/qa/uitest/pasteSpecial | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf114710.py | 44 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf118308.py | 42 | ||||
-rwxr-xr-x | sc/qa/uitest/pasteSpecial/tdf139858.py | 60 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf142932.py | 56 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf57274.py | 42 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf62267.py | 46 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf65856.py | 88 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf69450.py | 54 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf74577.py | 65 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf84810.py | 47 | ||||
-rw-r--r-- | sc/qa/uitest/pasteSpecial/tdf86253.py | 52 |
11 files changed, 596 insertions, 0 deletions
diff --git a/sc/qa/uitest/pasteSpecial/tdf114710.py b/sc/qa/uitest/pasteSpecial/tdf114710.py new file mode 100644 index 0000000000..cb6fb3654a --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf114710.py @@ -0,0 +1,44 @@ +# -*- 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, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf114710(UITestCase): + + def test_tdf114710(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114710.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"})) + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_document: + + self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + + xList = xDialog.getChild('list') + + for childName in xList.getChildren(): + xChild = xList.getChild(childName) + if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)": + break + + xChild.executeAction("SELECT", tuple()) + self.assertEqual( + get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)") + + + # Without the fix in place, this test would have crashed here + self.assertEqual(1, writer_document.GraphicObjects.getCount()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf118308.py b/sc/qa/uitest/pasteSpecial/tdf118308.py new file mode 100644 index 0000000000..68c462414b --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf118308.py @@ -0,0 +1,42 @@ +# -*- 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf118308(UITestCase): + + def test_tdf118308(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + + # Without the fix in place, this test would have failed here + # since a different dialog would have been opened and the children + # wouldn't have been found + reset_default_values(self, xDialog) + + self.assertEqual("A", get_cell_by_position(calc_document, 0, 0, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py b/sc/qa/uitest/pasteSpecial/tdf139858.py new file mode 100755 index 0000000000..ca81c7715c --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf139858.py @@ -0,0 +1,60 @@ +# -*- 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.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.paste_special import reset_default_values + +class tdf139858(UITestCase): + def test_tdf139858_paste_comment(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # Write text to cell A1 and B1 + enter_text_to_cell(xGridWin, "A1", "A1 sample text") + enter_text_to_cell(xGridWin, "B1", "B1 sample text") + + # Insert a comment in cell B1 + xArgs = mkPropertyValues({"Text": "Comment 1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Insert a comment in cell A2 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A2"})) + xArgs = mkPropertyValues({"Text": "Comment 2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Copy cell A2 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Copy") + + # Set cursor to cells and paste data using special options (check only comments) + targetCells = ["A1", "B1"] + for index, targetCell in enumerate(targetCells): + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + reset_default_values(self, xPasteSpecialDlg) + xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") + xDateTimeChkBox.executeAction("CLICK", tuple()) + xTextChkBox = xPasteSpecialDlg.getChild("text") + xTextChkBox.executeAction("CLICK", tuple()) + xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") + xNumbersChkBox.executeAction("CLICK", tuple()) + xCommentsChkBox = xPasteSpecialDlg.getChild("comments") + xCommentsChkBox.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'A1 sample text' != '' + # i.e., the cell content was overwritten + self.assertEqual(targetCell + " sample text", get_cell_by_position(document, 0, index, 0).getString()) + self.assertEqual("Comment 2", get_cell_by_position(document, 0, index, 0).Annotation.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf142932.py b/sc/qa/uitest/pasteSpecial/tdf142932.py new file mode 100644 index 0000000000..18e45f2b55 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf142932.py @@ -0,0 +1,56 @@ +# -*- 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.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.paste_special import reset_default_values + +class tdf142932(UITestCase): + + def test_tdf142932(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142932.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectRow") + + self.assertEqual("some comment", get_cell_by_position(calc_doc, 0, 4, 0).Annotation.String) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + xAfter = xDialog.getChild('after') + xAfter.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xSkipEmpty = xDialog.getChild("skip_empty") + xSkipEmpty.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xSkipEmpty)['Selected']) + + # Without the fix in place, this test would have crashed here + + self.assertEqual("A", get_cell_by_position(calc_doc, 1, 0, 0).getString()) + self.assertEqual("row", get_cell_by_position(calc_doc, 1, 1, 0).getString()) + self.assertEqual("with", get_cell_by_position(calc_doc, 1, 2, 0).getString()) + self.assertEqual("comment", get_cell_by_position(calc_doc, 1, 3, 0).getString()) + self.assertEqual("for", get_cell_by_position(calc_doc, 1, 4, 0).getString()) + self.assertEqual("a", get_cell_by_position(calc_doc, 1, 5, 0).getString()) + self.assertEqual("certain", get_cell_by_position(calc_doc, 1, 6, 0).getString()) + self.assertEqual("cell", get_cell_by_position(calc_doc, 1, 7, 0).getString()) + + self.assertEqual("", get_cell_by_position(calc_doc, 1, 4, 0).Annotation.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf57274.py b/sc/qa/uitest/pasteSpecial/tdf57274.py new file mode 100644 index 0000000000..977c063938 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf57274.py @@ -0,0 +1,42 @@ +# -*- 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.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +#Bug: Paste Special Link Checkbox fails to insert cell references when the source cell is blank + +class tdf57274(UITestCase): + + def test_tdf57274_tdf116385_row_only(self): + with self.ui_test.load_file(get_url_for_data_file("tdf57274.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* Source Cells, range B6..E6 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="") as xDialog: + reset_default_values(self, xDialog) + #We paste here using Paste Special with 'Link' Checkbox activated + xLink = xDialog.getChild("link") + xLink.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank. + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 10).getFormula(), "=$Sheet1.$E$6") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf62267.py b/sc/qa/uitest/pasteSpecial/tdf62267.py new file mode 100644 index 0000000000..608875db49 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf62267.py @@ -0,0 +1,46 @@ +# -*- 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, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +#Bug 62267 - Conditional formatting lost after paste special of text, numbers and dates. +#If you have a cell with conditional formatting and you use paste special only inserting only text, +#numbers and dates the formatting is lost. Undo do not recover the conditional formatting. + +class tdf62267(UITestCase): + + def test_tdf62267(self): + with self.ui_test.load_file(get_url_for_data_file("tdf62267.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* Copy A1, then paste special to C1; + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + pass + + #--> Cell formatting should stay as before + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="cancel") as xCondFormatMgr: + + + # check that we have exactly 1 conditional format + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + xTreeEntry = xList.getChild('0') + self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1\tCell value = 1") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf65856.py b/sc/qa/uitest/pasteSpecial/tdf65856.py new file mode 100644 index 0000000000..6b9e928b42 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf65856.py @@ -0,0 +1,88 @@ +# -*- 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, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf65856(UITestCase): + + def test_tdf65856_paste_special_shift_right(self): + with self.ui_test.load_file(get_url_for_data_file("tdf65856.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #- mark D1:E14; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + #check + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "T1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "TE1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "TES1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getString(), "T14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 13).getString(), "TE14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 13).getString(), "TES14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 13).getString(), "TEST14") + + def test_tdf65856_paste_special_shift_right_2(self): + with self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #- select range C2:D4; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell B2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + xmove_right = xDialog.getChild("move_right") + + # tdf#69750: Without the fix in place, this test would have failed here + self.assertEqual("true", get_state_as_dict(xmove_right)["Checked"]) + + #check + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getFormula(), "=F4") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getFormula(), "=F4") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf69450.py b/sc/qa/uitest/pasteSpecial/tdf69450.py new file mode 100644 index 0000000000..133a4f6782 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf69450.py @@ -0,0 +1,54 @@ +# -*- 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 uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf69450(UITestCase): + + def test_tdf69450(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #add text to A1 and B1 + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xtext = xDialog.getChild("text") + xnumbers = xDialog.getChild("numbers") + xdatetime = xDialog.getChild("datetime") + xformats = xDialog.getChild("formats") + + xtext.executeAction("CLICK", tuple()) + xnumbers.executeAction("CLICK", tuple()) + xdatetime.executeAction("CLICK", tuple()) + xformats.executeAction("CLICK", tuple()) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial"): + pass + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf74577.py b/sc/qa/uitest/pasteSpecial/tdf74577.py new file mode 100644 index 0000000000..87fdd2f9a1 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf74577.py @@ -0,0 +1,65 @@ +# -*- 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, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position + + +class tdf74577(UITestCase): + + def test_tdf74577(self): + + # Open the HTML in writer + with self.ui_test.load_file(get_url_for_data_file("tdf74577.html")): + + # Use SelectAll twice to select the table + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="") as xDialog: + + xList = xDialog.getChild('list') + + for childName in xList.getChildren(): + xChild = xList.getChild(childName) + if get_state_as_dict(xChild)['Text'] == "HyperText Markup Language (HTML)": + break + + xChild.executeAction("SELECT", tuple()) + self.assertEqual( + get_state_as_dict(xList)['SelectEntryText'], "HyperText Markup Language (HTML)") + + xOkBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())): + pass + + self.assertEqual("Cell1", get_cell_by_position(calc_document, 0, 0, 0).getString()) + self.assertEqual("Cell1", get_cell_by_position(calc_document, 0, 0, 1).getString()) + self.assertEqual("Cell1 + Cell2", get_cell_by_position(calc_document, 0, 0, 2).getString()) + self.assertEqual("Cell1 + Cell2 + Cell3", get_cell_by_position(calc_document, 0, 0, 3).getString()) + self.assertEqual("Cell1 + Cell2", get_cell_by_position(calc_document, 0, 0, 4).getString()) + + self.assertEqual("Cell2 + 3", get_cell_by_position(calc_document, 0, 1, 0).getString()) + self.assertEqual("Cell2", get_cell_by_position(calc_document, 0, 1, 1).getString()) + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Cell3' != '' + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 2).getString()) + + self.assertEqual("Cell2 + Cell3", get_cell_by_position(calc_document, 0, 1, 4).getString()) + self.assertEqual("Cell2", get_cell_by_position(calc_document, 0, 1, 5).getString()) + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 5).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf84810.py b/sc/qa/uitest/pasteSpecial/tdf84810.py new file mode 100644 index 0000000000..95d72df17a --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf84810.py @@ -0,0 +1,47 @@ +# -*- 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.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.paste_special import reset_default_values + +class ManualCalcTests(UITestCase): + def test_paste_special(self): + # EN-8:Paste special with options + # This test is to check that paste special combined with some options and link is ok. + # Refers to tdf#84810 + + with self.ui_test.create_doc_in_start_center("calc") as document: + + # Write text to cell A1 + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "A1", "abcd") + + # Copy cell A1 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + # Set cursor to cell A3 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + + # Choose Paste Special Options and paste data + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + reset_default_values(self, xPasteSpecialDlg) + xAllChkBox = xPasteSpecialDlg.getChild("paste_all") + xAllChkBox.executeAction("CLICK", tuple()) + xLinkChkBox = xPasteSpecialDlg.getChild("link") + xLinkChkBox.executeAction("CLICK", tuple()) + + # Assert successful paste + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "abcd") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf86253.py b/sc/qa/uitest/pasteSpecial/tdf86253.py new file mode 100644 index 0000000000..6e6e1bcd49 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf86253.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, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +class tdf86253(UITestCase): + + def test_tdf86253(self): + with self.ui_test.load_file(get_url_for_data_file("tdf86253.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* Copy A1, then paste special only "formatting" to C1:C17; + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C17"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xtext = xDialog.getChild("text") + xnumbers = xDialog.getChild("numbers") + xdatetime = xDialog.getChild("datetime") + xformats = xDialog.getChild("formats") + + xtext.executeAction("CLICK", tuple()) + xnumbers.executeAction("CLICK", tuple()) + xdatetime.executeAction("CLICK", tuple()) + xformats.executeAction("CLICK", tuple()) + + + #--> Cell formatting for C1:C17 is changed. But, if you go to "Format - Conditional Formatting - Manage", + #you will see that a new formatting condition is created with the range "C1:C6", rather than "C1:C17". This is wrong behavior. + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="cancel") as xCondFormatMgr: + + + # check that we have exactly 1 conditional format and range is C1:C17 + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + xTreeEntry = xList.getChild('0') + self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1:A6,C1:C17\tCell value >= 0") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |