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 tdf130199(UITestCase
):
15 def test_tdf130199(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
19 # Insert an empty para
20 self
.xUITest
.executeCommand(".uno:InsertPara")
22 # Insert an empty section
23 with self
.ui_test
.execute_dialog_through_command(".uno:InsertSection"):
26 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
27 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
29 # Insert an extra empty para in the section
30 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
31 self
.xUITest
.executeCommand(".uno:InsertPara")
33 self
.assertEqual(1, len(document
.TextSections
))
34 self
.assertTrue(document
.TextSections
.Section1
.IsVisible
)
36 with self
.ui_test
.execute_dialog_through_command(".uno:EditRegion") as xDialog
:
37 xHide
= xDialog
.getChild('hide')
38 self
.assertEqual('false', get_state_as_dict(xHide
)['Selected'])
40 xHide
.executeAction('CLICK', tuple())
42 self
.assertFalse(document
.TextSections
.Section1
.IsVisible
)
44 # Select everything and do not delete the section
45 self
.xUITest
.executeCommand(".uno:SelectAll")
47 with self
.ui_test
.execute_dialog_through_command(".uno:Delete", close_button
="no") as xDialog
:
50 self
.assertEqual(1, len(document
.TextSections
))
51 self
.assertFalse(document
.TextSections
.Section1
.IsVisible
)
53 # Select everything and delete the section
54 self
.xUITest
.executeCommand(".uno:SelectAll")
56 with self
.ui_test
.execute_dialog_through_command(".uno:Delete", close_button
="yes") as xDialog
:
59 self
.assertEqual(0, len(document
.TextSections
))
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: