sw/qa/uitest/data/tdf149916.odt     |binary
 sw/qa/uitest/navigator/tdf149916.py |   42 ++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

New commits:
commit a5df8f82938973b2dd63e39d96b95833670005ba
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Aug 9 12:34:31 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Aug 9 15:51:17 2022 +0200

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

diff --git a/sw/qa/uitest/data/tdf149916.odt b/sw/qa/uitest/data/tdf149916.odt
new file mode 100644
index 000000000000..8294e0bb5c72
Binary files /dev/null and b/sw/qa/uitest/data/tdf149916.odt differ
diff --git a/sw/qa/uitest/navigator/tdf149916.py 
b/sw/qa/uitest/navigator/tdf149916.py
new file mode 100644
index 000000000000..176bdb4d0b57
--- /dev/null
+++ b/sw/qa/uitest/navigator/tdf149916.py
@@ -0,0 +1,42 @@
+# -*- 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
+
+class tdf149916(UITestCase):
+
+    def test_tdf149916(self):
+
+        with self.ui_test.load_file(get_url_for_data_file('tdf149916.odt')):
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xWriterEdit = xWriterDoc.getChild('writer_edit')
+
+            self.xUITest.executeCommand('.uno:Sidebar')
+            xWriterEdit.executeAction('SIDEBAR', mkPropertyValues({'PANEL': 
'SwNavigatorPanel'}))
+
+            # wait until the navigator panel is available
+            xNavigatorPanel = 
self.ui_test.wait_until_child_is_available('NavigatorPanel')
+
+            xContentTree = xNavigatorPanel.getChild('contenttree')
+            xFields = xContentTree.getChild('12')
+            self.assertEqual('Fields', get_state_as_dict(xFields)['Text'])
+
+            xFields.executeAction('EXPAND', tuple())
+
+            self.assertEqual('1', get_state_as_dict(xFields)['Children'])
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: 'cross-reference - First - 1' != 
'cross-reference -  __RefHeading___Toc45_480138666 - 1'
+            self.assertEqual('cross-reference - First - 1', 
get_state_as_dict(xFields.getChild('0'))['Text'])
+
+            self.xUITest.executeCommand('.uno:Sidebar')
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to