sw/qa/uitest/writer_tests8/tdf125969.py | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-)
New commits: commit d39bd751c940782122a234e5e426e2da17c6f1f4 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Jul 14 11:40:29 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Jul 14 17:18:53 2025 +0200 sw: fix another UItest * Use self.ui_test.load_empty_file instead of self.ui_test.create_doc_in_start_center, otherwise it fails when running the test from a shell script * Do not use time.sleep * Remove commented out code Change-Id: I5618e23ae40bd8cb37c3dd95ae9cd9766fb88104 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187855 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/uitest/writer_tests8/tdf125969.py b/sw/qa/uitest/writer_tests8/tdf125969.py index 2334bec06fc4..89f5e4d45f70 100644 --- a/sw/qa/uitest/writer_tests8/tdf125969.py +++ b/sw/qa/uitest/writer_tests8/tdf125969.py @@ -11,17 +11,12 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file from uitest.uihelper.common import select_pos, get_state_as_dict -import time # bug 125969: make in-use bitmap-area-fill available for re-use, but ONLY IN THE SAME DOCUMENT class tdf125969(UITestCase): number_of_images = 0 - def click_button(self, dialog, button): - xButton = dialog.getChild(button) - xButton.executeAction("CLICK", tuple()) - def test_tdf125969(self): with self.ui_test.load_file(get_url_for_data_file("paragraphAreaFill.odt")): xWriterDoc = self.xUITest.getTopFocusWindow() @@ -35,9 +30,7 @@ class tdf125969(UITestCase): self.ui_test.wait_until_property_is_updated(backgroundType, "SelectEntryText", "Bitmap") imageCollection = xWriterEdit.getChild("lbbitmap") #listbox containing image names - number_of_images = get_state_as_dict(imageCollection)["EntryCount"] - # print (get_state_as_dict(imageCollection)) - # time.sleep (10) + number_of_images = int(get_state_as_dict(imageCollection)["EntryCount"]) # The paragraph area has a custom background logo - which we want to become available # for re-use everywhere as a background fill @@ -46,17 +39,14 @@ class tdf125969(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "8") # area tab - #time.sleep(1) - self.ui_test.wait_until_property_is_updated(imageCollection, "SelectEntryText", "Painted White") - # xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # xToolkit.waitUntilAllIdlesDispatched() - time.sleep (1) # test: the paragraph's wasta-offline logo was added and the list box was refreshed - self.assertEqual(int(number_of_images) + 1, int(get_state_as_dict(imageCollection)["EntryCount"])) + self.ui_test.wait_until_property_is_updated(imageCollection, "EntryCount", str(number_of_images + 1)) + self.assertEqual(number_of_images + 1, int(get_state_as_dict(imageCollection)["EntryCount"])) + self.assertEqual("Painted White", get_state_as_dict(imageCollection)["SelectEntryText"]) # A new document must not have access to the collected images from another document - with self.ui_test.create_doc_in_start_center("writer"): + with self.ui_test.load_empty_file("writer"): xWriterDoc = self.xUITest.getTopFocusWindow() xWriterEdit = xWriterDoc.getChild("writer_edit") @@ -64,18 +54,15 @@ class tdf125969(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="ok") as xDialog: tabcontrol = xDialog.getChild("tabcontrol") select_pos(tabcontrol, "2") # area tab - self.click_button(xDialog, 'btnbitmap') - #time.sleep (2) + xButton = xDialog.getChild('btnbitmap') + xButton.executeAction("CLICK", tuple()) backgroundType = xWriterEdit.getChild('bgselect') imageCollection = xWriterEdit.getChild("lbbitmap") self.ui_test.wait_until_property_is_updated(backgroundType, "SelectEntryText", "Bitmap") # This number MUST NOT be higher than the initial state. # We must not allow document images to leak into the user profile - self.assertEqual(number_of_images, get_state_as_dict(imageCollection)["EntryCount"]) - #time.sleep (10) - - # xWriterEdit.getChild("bogus for debugging") + self.assertEqual(number_of_images, int(get_state_as_dict(imageCollection)["EntryCount"])) - self.xUITest.executeCommand(".uno:Sidebar") # good idea to turn off sidebar again + self.xUITest.executeCommand(".uno:Sidebar") # good idea to turn off sidebar again # vim: set shiftwidth=4 softtabstop=4 expandtab: