Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf146605.py
blob3de6f6c10738ef2e0928bedbb575b5e5c7aa4018
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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
11 from uitest.uihelper.common import select_pos
13 class tdf146605(UITestCase):
15 def test_tdf146605(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as document:
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
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"])
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'])
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")
40 xTextEnd = xOptDialog.getChild("endntattextend")
41 xNum = xOptDialog.getChild("endntnum")
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'])
47 xTextEnd.executeAction('CLICK', tuple())
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'])
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)
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"])
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: