summaryrefslogtreecommitdiff
path: root/sc/qa/uitest/pasteSpecial
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2024-05-06 14:53:19 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2024-05-22 07:27:32 +0200
commit76941af9837406b1526b2f2d13c89df7a2023072 (patch)
tree3fd8d6ed4d7d0ae67e08e622199d8c92fbb4c75b /sc/qa/uitest/pasteSpecial
parent101b08fe1ec77ffe8c1a9b2b8f9f20884269a1ed (diff)
tdf#158110 - Paste special: Remove special ADDNOTES flag handling
Remove special ADDNOTES flag handling and just add it to existing NOTE flag to ensure no content will be deleted. However, the check for empty cells needs to be improved. Change-Id: I44ae75aa3997a0b1041447106bc3c07146043351 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167202 Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Tested-by: Jenkins
Diffstat (limited to 'sc/qa/uitest/pasteSpecial')
-rw-r--r--[-rwxr-xr-x]sc/qa/uitest/pasteSpecial/tdf139858.py7
-rw-r--r--sc/qa/uitest/pasteSpecial/tdf158110.py48
-rw-r--r--[-rwxr-xr-x]sc/qa/uitest/pasteSpecial/tdf160765.py9
3 files changed, 63 insertions, 1 deletions
diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py b/sc/qa/uitest/pasteSpecial/tdf139858.py
index ca81c7715cb6..b5689ec3fdca 100755..100644
--- a/sc/qa/uitest/pasteSpecial/tdf139858.py
+++ b/sc/qa/uitest/pasteSpecial/tdf139858.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 uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
from libreoffice.calc.paste_special import reset_default_values
class tdf139858(UITestCase):
@@ -51,6 +52,12 @@ class tdf139858(UITestCase):
xCommentsChkBox = xPasteSpecialDlg.getChild("comments")
xCommentsChkBox.executeAction("CLICK", tuple())
+ # After tdf#158110 when an existing comment is overwritten, a confirmation dialog is shown
+ xCheckWarningDlg = self.xUITest.getTopFocusWindow()
+ if get_state_as_dict(xCheckWarningDlg)["ID"] == "CheckWarningDialog":
+ xYesBtn = xCheckWarningDlg.getChild("yes")
+ xYesBtn.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
diff --git a/sc/qa/uitest/pasteSpecial/tdf158110.py b/sc/qa/uitest/pasteSpecial/tdf158110.py
new file mode 100644
index 000000000000..9b0dba6ed8cd
--- /dev/null
+++ b/sc/qa/uitest/pasteSpecial/tdf158110.py
@@ -0,0 +1,48 @@
+# -*- 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 libreoffice.calc.paste_special import reset_default_values
+
+class tdf158110(UITestCase):
+ def test_tdf158110_paste_special_multiple_cells(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ # Insert a comment in cell A1
+ xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A1"}))
+ xArgs = mkPropertyValues({"Text": "Comment 1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+ # Copy cell range A1:A2 to clipboard
+ xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+ self.xUITest.executeCommand(".uno:Copy")
+
+ # Paste data using special options (check only comments)
+ xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ 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: 'Comment 1' != ''
+ # i.e., the comment was not copied
+ self.assertEqual("Comment 1", get_cell_by_position(document, 0, 1, 0).Annotation.String)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/pasteSpecial/tdf160765.py b/sc/qa/uitest/pasteSpecial/tdf160765.py
index c0c264432ef4..7c4dd4b9cf5c 100755..100644
--- a/sc/qa/uitest/pasteSpecial/tdf160765.py
+++ b/sc/qa/uitest/pasteSpecial/tdf160765.py
@@ -42,7 +42,8 @@ class tdf160765(UITestCase):
xCommentsChkBox = xPasteSpecialDlg.getChild("comments")
xCommentsChkBox.executeAction("CLICK", tuple())
- with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg:
+ # After tdf#158110 when an existing comment is overwritten, a confirmation dialog is shown, so close dialog without any action
+ with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="cancel") as xPasteSpecialDlg:
xCommentsChkBox = xPasteSpecialDlg.getChild("comments")
# Without the fix in place, this test would have failed with
# AssertionError: 'true' != 'false'
@@ -85,6 +86,12 @@ class tdf160765(UITestCase):
xCommentsChkBox = xPasteSpecialDlg.getChild("comments")
xCommentsChkBox.executeAction("CLICK", tuple())
+ # After tdf#158110 when an existing comment is overwritten, a confirmation dialog is shown
+ xCheckWarningDlg = self.xUITest.getTopFocusWindow()
+ if get_state_as_dict(xCheckWarningDlg)["ID"] == "CheckWarningDialog":
+ xYesBtn = xCheckWarningDlg.getChild("yes")
+ xYesBtn.executeAction("CLICK", tuple())
+
# Undo both inserted comments
self.xUITest.executeCommand(".uno:Undo")
# Without the fix in place, this test would have failed with