sw/qa/uitest/data/tdf146605.odt         |binary
 sw/qa/uitest/writer_tests7/tdf146605.py |   63 ++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

New commits:
commit 44cf7a7f3cd585b442b404ff9e791dc7df513a51
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Jan 14 11:27:04 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jan 14 12:36:46 2022 +0100

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

diff --git a/sw/qa/uitest/data/tdf146605.odt b/sw/qa/uitest/data/tdf146605.odt
new file mode 100644
index 000000000000..88dda70a0496
Binary files /dev/null and b/sw/qa/uitest/data/tdf146605.odt differ
diff --git a/sw/qa/uitest/writer_tests7/tdf146605.py 
b/sw/qa/uitest/writer_tests7/tdf146605.py
new file mode 100644
index 000000000000..c63ae0bc9705
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf146605.py
@@ -0,0 +1,63 @@
+# -*- 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
+from uitest.uihelper.common import select_pos
+
+class tdf146605(UITestCase):
+
+    def test_tdf146605(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as 
document:
+
+            xWriterDoc = self.xUITest.getTopFocusWindow()
+            xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+            self.assertEqual(1, len(document.TextSections))
+            self.assertTrue(document.TextSections.Section1.IsVisible)
+            
self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
+            
self.assertFalse(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
+            self.assertEqual("2", get_state_as_dict(xWriterEdit)["Pages"])
+
+            with 
self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+                xTree = xDialog.getChild("tree")
+                self.assertEqual("1", get_state_as_dict(xTree)['Children'])
+                self.assertEqual("Section1", 
get_state_as_dict(xTree.getChild('0'))['Text'])
+                self.assertEqual("Section1", 
get_state_as_dict(xDialog.getChild('curname'))['Text'])
+
+                xOptions = xDialog.getChild("options")
+                with self.ui_test.execute_blocking_action(
+                        xOptions.executeAction, args=('CLICK', ())) as 
xOptDialog:
+                    xTabs = xOptDialog.getChild("tabcontrol")
+                    select_pos(xTabs, "3")
+
+                    xTextEnd = xOptDialog.getChild("endntattextend")
+                    xNum = xOptDialog.getChild("endntnum")
+
+                    self.assertEqual("true", 
get_state_as_dict(xTextEnd)['Enabled'])
+                    self.assertEqual("false", 
get_state_as_dict(xTextEnd)['Selected'])
+                    self.assertEqual("false", 
get_state_as_dict(xNum)['Enabled'])
+
+                    xTextEnd.executeAction('CLICK', tuple())
+
+                    self.assertEqual("true", 
get_state_as_dict(xTextEnd)['Enabled'])
+                    self.assertEqual("true", 
get_state_as_dict(xTextEnd)['Selected'])
+                    self.assertEqual("true", 
get_state_as_dict(xNum)['Enabled'])
+
+            self.assertEqual(1, len(document.TextSections))
+            self.assertTrue(document.TextSections.Section1.IsVisible)
+            
self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
+            
self.assertTrue(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: '1' != '2'
+            self.assertEqual("1", get_state_as_dict(xWriterEdit)["Pages"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to