sc/qa/uitest/calc_tests9/tdf159707.py   |   33 ++++++++++++++++++++++
 sc/qa/uitest/data/tdf159707.xls         |binary
 sw/qa/uitest/data/tdf157569.docx        |binary
 sw/qa/uitest/writer_tests6/tdf157569.py |   47 ++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)

New commits:
commit 582dbb28efb39d93b6f9197590a5c64b69dec393
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Feb 14 16:31:07 2024 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Feb 15 08:56:50 2024 +0100

    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 <[email protected]>

diff --git a/sw/qa/uitest/data/tdf157569.docx b/sw/qa/uitest/data/tdf157569.docx
new file mode 100644
index 000000000000..2143a831a0dd
Binary files /dev/null and b/sw/qa/uitest/data/tdf157569.docx 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:
commit fc1e5bf5c1c75acd6bb8f62b9363aa1a30b9acd6
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Feb 14 12:25:47 2024 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Feb 15 08:56:42 2024 +0100

    tdf#159707: sc: Add UItest
    
    I tried to create this test as a Cppunittest but it fails with
    
    Run: 1   Failure total: 2   Failures: 1   Errors: 1
    warn:vcl:428912:428912:vcl/source/app/svmain.cxx:494: DeInitVCL: some top 
Windows are still alive
    text = "" type = "14FloatingWindow", ptr = 0x5608715e49e0
    text = "tdf159707.xls (read-only) — LibreOfficeDev Calc" type = 
"10WorkWindow", ptr = 0x5608709ab420
    
    Change-Id: I1b9e16d57050fe07f74c632d441e3a06f49e9438
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163363
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/uitest/calc_tests9/tdf159707.py 
b/sc/qa/uitest/calc_tests9/tdf159707.py
new file mode 100644
index 000000000000..1e7b240f4b56
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf159707.py
@@ -0,0 +1,33 @@
+# -*- 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.beans import PropertyValue
+
+class tdf159707(UITestCase):
+
+    def test_tdf159707(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf159707.xls")) as 
document:
+
+            self.assertFalse(document.isReadonly())
+
+            # Without the fix in place, this test would have crashed here
+            self.xUITest.executeCommand(".uno:EditDoc")
+
+            document = self.ui_test.get_component()
+            self.assertTrue(document.isReadonly())
+
+            self.xUITest.executeCommand(".uno:EditDoc")
+
+            self.assertFalse(document.isReadonly())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf159707.xls b/sc/qa/uitest/data/tdf159707.xls
new file mode 100644
index 000000000000..c75d53097e13
Binary files /dev/null and b/sc/qa/uitest/data/tdf159707.xls differ

Reply via email to