summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/pasteSpecial
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2024-06-23 14:57:34 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2024-07-05 08:11:53 +0200
commit8cf0bc36a8baa1d53b0a5fb169c6a9d5d8455289 (patch)
treeee556c4484f14c4e8781c5ab950e69cba483ce90 /sc/qa/uitest/pasteSpecial
parent96c3d78f39ac4385880ae6f92f15f7ab3564ffcf (diff)
tdf#158110 - Paste special: improve check for cells with notes
Change-Id: Ia18d8f91ee2d4493174255424ce7e3b7310c369d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169355 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
Diffstat (limited to 'sc/qa/uitest/pasteSpecial')
-rw-r--r--sc/qa/uitest/pasteSpecial/tdf158110.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/sc/qa/uitest/pasteSpecial/tdf158110.py b/sc/qa/uitest/pasteSpecial/tdf158110.py
index 9b0dba6ed8cd..9d775226c030 100644
--- a/sc/qa/uitest/pasteSpecial/tdf158110.py
+++ b/sc/qa/uitest/pasteSpecial/tdf158110.py
@@ -12,6 +12,7 @@ from uitest.framework import UITestCase
from libreoffice.calc.document import get_cell_by_position
from libreoffice.uno.propertyvalue import mkPropertyValues
from libreoffice.calc.paste_special import reset_default_values
+from uitest.uihelper.common import get_state_as_dict
class tdf158110(UITestCase):
def test_tdf158110_paste_special_multiple_cells(self):
@@ -45,4 +46,41 @@ class tdf158110(UITestCase):
# i.e., the comment was not copied
self.assertEqual("Comment 1", get_cell_by_position(document, 0, 1, 0).Annotation.String)
+ def test_tdf158110_paste_special_overwrite_comments(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ # Insert a comments
+ targetCells = ["A1", "A2", "B3", "D2"]
+ for targetCell in targetCells:
+ xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell}))
+ xArgs = mkPropertyValues({"Text": "Comment 1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+ # Copy cell range A1:B3 to clipboard
+ xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"}))
+ self.xUITest.executeCommand(".uno:Copy")
+
+ # Paste data using special options (check only comments), i.e., overwrite comment in D2
+ xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ 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: 'CheckWarningDialog' != ''
+ # i.e., the warning dialog was not shown
+ xCheckWarningDlg = self.xUITest.getTopFocusWindow()
+ self.assertEqual("CheckWarningDialog", get_state_as_dict(xCheckWarningDlg)["ID"])
+ if get_state_as_dict(xCheckWarningDlg)["ID"] == "CheckWarningDialog":
+ xYesBtn = xCheckWarningDlg.getChild("yes")
+ xYesBtn.executeAction("CLICK", tuple())
+
# vim: set shiftwidth=4 softtabstop=4 expandtab: