summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests7/tdf137802.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sw/qa/uitest/writer_tests7/tdf137802.py
parentInitial commit. (diff)
downloadlibreoffice-upstream/4%7.4.7.tar.xz
libreoffice-upstream/4%7.4.7.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 'sw/qa/uitest/writer_tests7/tdf137802.py')
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137802.py77
1 files changed, 77 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py
new file mode 100644
index 000000000..8616e5255
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf137802.py
@@ -0,0 +1,77 @@
+# -*- 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
+from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH
+
+class tdf137802(UITestCase):
+
+ def test_tdf137802(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
+
+
+ xDialog.getChild('topage').executeAction("CLICK", tuple())
+
+
+ self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ # When shape 1 is selected, esc key doesn't put the focus back to the document
+ # because the shape has a textbox. Move the focus to another shape with tab key
+ # and then use escape
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
+
+ # Wait until the shape is deselected and the cursor is on the document
+ self.ui_test.wait_until_child_is_available('FontNameBox')
+
+ # Delete the second paragraph. Shape 2 is anchored to this paragraph
+ # so it should be deleted
+ # tdf#137587 fly is no longer deleted by backspace so explicitly select
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+
+ self.assertEqual(document.DrawPage.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:Delete")
+
+ self.assertEqual(document.DrawPage.getCount(), 0)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.DrawPage.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: