[Libreoffice-commits] core.git: sw/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 31 14:54:29 UTC 2021
sw/qa/uitest/writer_dialogs/openDialogs.py | 3 -
sw/qa/uitest/writer_tests7/tdf140863.py | 75 +++++++++++++++++++++++++++++
2 files changed, 77 insertions(+), 1 deletion(-)
New commits:
commit b5558e4ac6c2f134f07ea87a143694b17adb4482
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Mar 31 15:05:09 2021 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 31 16:53:46 2021 +0200
tdf#140863: sw: Add UItest
Change-Id: Ic1d3a56857dd68f436b870168ab394729a31d629
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113416
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/uitest/writer_dialogs/openDialogs.py b/sw/qa/uitest/writer_dialogs/openDialogs.py
index 6c8cb699a7a6..b4d9b356e153 100644
--- a/sw/qa/uitest/writer_dialogs/openDialogs.py
+++ b/sw/qa/uitest/writer_dialogs/openDialogs.py
@@ -37,7 +37,8 @@ dialogs = [
# {"command": ".uno:InsertBreak", "closeButton": "cancel"},
# tested in uitest/writer_tests/insertBreakDialog.py
{"command": ".uno:InsertObject", "closeButton": "cancel"},
- {"command": ".uno:InsertSection", "closeButton": "cancel"},
+ # {"command": ".uno:InsertSection", "closeButton": "cancel"},
+ # tested in sw/qa/uitest/writer_tests7/tdf140863.py
{"command": ".uno:InsertFrame", "closeButton": "cancel"},
{"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"},
{"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"},
diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py
new file mode 100644
index 000000000000..f0355e4684ed
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf140863.py
@@ -0,0 +1,75 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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
+
+class tdf140863(UITestCase):
+
+ def test_tdf140863(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ # Insert one section
+ self.ui_test.execute_dialog_through_command(".uno:InsertSection")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ # Insert a page break in the section
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ document = self.ui_test.get_component()
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+
+
+ self.ui_test.execute_dialog_through_command(".uno:EditRegion")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
+
+ xHide.executeAction('CLICK', tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertFalse(document.TextSections.Section1.IsVisible)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+ self.ui_test.execute_dialog_through_command(".uno:EditRegion")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
+
+ xHide.executeAction('CLICK', tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '1' != '2'
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list