summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-02-14 16:31:07 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-02-15 08:56:50 +0100
commit582dbb28efb39d93b6f9197590a5c64b69dec393 (patch)
tree10681b6be8ef0a628069dbdc8a45ae44df0e4822
parentfc1e5bf5c1c75acd6bb8f62b9363aa1a30b9acd6 (diff)
tdf#1575639: sw: Add UItest
I tried to implement this test as a CppUnittest but it fails with - Expression: false - Unexpected dialog: Error activating object Error: General OLE error. See https://gerrit.libreoffice.org/c/core/+/160917 Change-Id: I36714146cc67119070b9799c4eb251a69f80b0cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163381 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sw/qa/uitest/data/tdf157569.docxbin0 -> 12158 bytes
-rw-r--r--sw/qa/uitest/writer_tests6/tdf157569.py47
2 files changed, 47 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/tdf157569.docx b/sw/qa/uitest/data/tdf157569.docx
new file mode 100644
index 000000000000..2143a831a0dd
--- /dev/null
+++ b/sw/qa/uitest/data/tdf157569.docx
Binary files differ
diff --git a/sw/qa/uitest/writer_tests6/tdf157569.py b/sw/qa/uitest/writer_tests6/tdf157569.py
new file mode 100644
index 000000000000..1a9e3344ac8c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf157569.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 uitest.uihelper.common import get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf157569(UITestCase):
+
+ def test_tdf157569(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf157569.docx")) as document:
+
+ xShape = document.getDrawPages()[0][0]
+ nHeight = xShape.getSize().Height
+ nWidth = xShape.getSize().Width
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1663 != 944
+ self.assertEqual(1663, nHeight)
+ self.assertEqual(2111, nWidth)
+
+ xDoc = self.xUITest.getTopFocusWindow()
+ xEditWin = xDoc.getChild("writer_edit")
+
+ # Select the formula
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object1"}))
+ self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
+
+ # Go into edit mode
+ xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+ self.assertEqual(nHeight, xShape.getSize().Height)
+ self.assertEqual(nWidth, xShape.getSize().Width)
+
+ # leave edit mode
+ xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"ESC"}))
+
+ self.assertEqual(nHeight, xShape.getSize().Height)
+ self.assertEqual(nWidth, xShape.getSize().Width)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: