sw/qa/uitest/data/tdf167956.docx        |binary
 sw/qa/uitest/writer_tests4/tdf167956.py |   46 ++++++++++++++++++++++++++++++++
 2 files changed, 46 insertions(+)

New commits:
commit 7ccc90a37fc179124f991c4629d90dee82bc4fe2
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Aug 27 16:36:57 2025 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Aug 27 18:02:47 2025 +0200

    tdf#167956: sw: Add UItest
    
    Change-Id: I0fc7426f7d8a8b6cf45d4ea49fbdcd45383df425
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190292
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sw/qa/uitest/data/tdf167956.docx b/sw/qa/uitest/data/tdf167956.docx
new file mode 100644
index 000000000000..9a3ca12b1820
Binary files /dev/null and b/sw/qa/uitest/data/tdf167956.docx differ
diff --git a/sw/qa/uitest/writer_tests4/tdf167956.py 
b/sw/qa/uitest/writer_tests4/tdf167956.py
new file mode 100644
index 000000000000..53bd073414e9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf167956.py
@@ -0,0 +1,46 @@
+# -*- 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.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+import time
+
+class tdf167956(UITestCase):
+
+    def wait_until_styles_are_displayed(self, xStylesView):
+        while True:
+            nChildren = len(xStylesView.getChildren())
+            if nChildren > 0:
+                break
+            time.sleep(self.ui_test.get_default_sleep())
+
+    def test_tdf167956(self):
+        with self.ui_test.create_doc_in_start_center("writer"):
+            
self.xUITest.executeCommand(".uno:ToolbarMode?Mode:string=notebookbar.ui")
+
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xStylesView = xWriterDoc.getChild("stylesview")
+            self.wait_until_styles_are_displayed(xStylesView)
+            self.assertEqual("10", get_state_as_dict(xStylesView)["Children"])
+            self.assertEqual("Default Paragraph Style", 
get_state_as_dict(xStylesView)["SelectEntryText"])
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf167956.docx")):
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xStylesView = xWriterDoc.getChild("stylesview")
+
+            # Without the fix in place, this test would have crashed here
+            self.wait_until_styles_are_displayed(xStylesView)
+            self.assertEqual("14", get_state_as_dict(xStylesView)["Children"])
+            self.assertEqual("Intense Quote", 
get_state_as_dict(xStylesView)["SelectEntryText"])
+
+            # Reset to the default toolbar
+            self.xUITest.executeCommand(".uno:ToolbarMode?Mode:string=Default")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to