1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
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/.
9 from uitest
.framework
import UITestCase
10 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
11 from uitest
.uihelper
.common
import get_state_as_dict
13 class tdf140863(UITestCase
):
15 def test_tdf140863(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
20 with self
.ui_test
.execute_dialog_through_command(".uno:InsertSection"):
23 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
24 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
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")
31 self
.assertEqual(1, len(document
.TextSections
))
32 self
.assertTrue(document
.TextSections
.Section1
.IsVisible
)
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'])
39 xHide
.executeAction('CLICK', tuple())
42 self
.assertEqual(1, len(document
.TextSections
))
43 self
.assertFalse(document
.TextSections
.Section1
.IsVisible
)
44 self
.assertEqual(get_state_as_dict(xWriterEdit
)["CurrentPage"], "1")
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'])
50 xHide
.executeAction('CLICK', tuple())
52 self
.assertEqual(1, len(document
.TextSections
))
53 self
.assertTrue(document
.TextSections
.Section1
.IsVisible
)
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")
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: