Debian Codegraph @

sw/qa/uitest/writer_tests8/tdf140863.py

raw symbols SCIP
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 #
9 from uitest.framework import UITestCase
10 from libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import get_state_as_dict
12
13 class tdf140863(UITestCase):
14
15 def test_tdf140863(self):
16
17 with self.ui_test.create_doc_in_start_center("writer") as document:
18
19 # Insert one section
20 with self.ui_test.execute_dialog_through_command(".uno:InsertSection"):
21 pass
22
23 xWriterDoc = self.xUITest.getTopFocusWindow()
24 xWriterEdit = xWriterDoc.getChild("writer_edit")
25
26 # Insert a page break in the section
27 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
28 self.xUITest.executeCommand(".uno:InsertPagebreak")
29 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
30
31 self.assertEqual(1, len(document.TextSections))
32 self.assertTrue(document.TextSections.Section1.IsVisible)
33
34
35 with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
36 xHide = xDialog.getChild('hide')
37 self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
38
39 xHide.executeAction('CLICK', tuple())
40
41
42 self.assertEqual(1, len(document.TextSections))
43 self.assertFalse(document.TextSections.Section1.IsVisible)
44 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
45
46 with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
47 xHide = xDialog.getChild('hide')
48 self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
49
50 xHide.executeAction('CLICK', tuple())
51
52 self.assertEqual(1, len(document.TextSections))
53 self.assertTrue(document.TextSections.Section1.IsVisible)
54
55 # Without the fix in place, this test would have failed with
56 # AssertionError: '1' != '2'
57 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
58
59
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: