Debian Codegraph @

sw/qa/uitest/writer_tests8/tdf146605.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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
11 from uitest.uihelper.common import select_pos
12
13 class tdf146605(UITestCase):
14
15 def test_tdf146605(self):
16
17 with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as document:
18
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
21
22 self.assertEqual(1, len(document.TextSections))
23 self.assertTrue(document.TextSections.Section1.IsVisible)
24 self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
25 self.assertFalse(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
26 self.assertEqual("2", get_state_as_dict(xWriterEdit)["Pages"])
27
28 with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
29 xTree = xDialog.getChild("tree")
30 self.assertEqual("1", get_state_as_dict(xTree)['Children'])
31 self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text'])
32 self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text'])
33
34 xOptions = xDialog.getChild("options")
35 with self.ui_test.execute_blocking_action(
36 xOptions.executeAction, args=('CLICK', ())) as xOptDialog:
37 xTabs = xOptDialog.getChild("tabcontrol")
38 select_pos(xTabs, "3")
39
40 xTextEnd = xOptDialog.getChild("endntattextend")
41 xNum = xOptDialog.getChild("endntnum")
42
43 self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled'])
44 self.assertEqual("false", get_state_as_dict(xTextEnd)['Selected'])
45 self.assertEqual("false", get_state_as_dict(xNum)['Enabled'])
46
47 xTextEnd.executeAction('CLICK', tuple())
48
49 self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled'])
50 self.assertEqual("true", get_state_as_dict(xTextEnd)['Selected'])
51 self.assertEqual("true", get_state_as_dict(xNum)['Enabled'])
52
53 self.assertEqual(1, len(document.TextSections))
54 self.assertTrue(document.TextSections.Section1.IsVisible)
55 self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
56 self.assertTrue(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
57
58 # Without the fix in place, this test would have failed with
59 # AssertionError: '1' != '2'
60 self.assertEqual("1", get_state_as_dict(xWriterEdit)["Pages"])
61
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: