summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests7/tdf145178.py
blob: 328539627afd178225a4fea2bcf86b6bd53d8741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from uitest.framework import UITestCase
from uitest.uihelper.common import get_state_as_dict, select_pos
from uitest.uihelper.common import get_url_for_data_file

class tdf145178(UITestCase):

    def test_tdf145178(self):

        with self.ui_test.load_file(get_url_for_data_file('tdf145178.fodt')):

            with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
                xTree = xDialog.getChild("tree")
                self.assertEqual("1", get_state_as_dict(xTree)['Children'])
                self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text'])
                self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text'])

                xOptions = xDialog.getChild("options")
                with self.ui_test.execute_blocking_action(
                        xOptions.executeAction, args=('CLICK', ())) as xOptDialog:
                    xTabs = xOptDialog.getChild("tabcontrol")
                    select_pos(xTabs, "3")

                    xFtnExt = xOptDialog.getChild("ftnntattextend")
                    xFtnNum = xOptDialog.getChild("ftnntnum")
                    xFtnFrm = xOptDialog.getChild("ftnntnumfmt")
                    xFtnPre = xOptDialog.getChild("ftnprefix")
                    xFtnSuf = xOptDialog.getChild("ftnsuffix")
                    xFtnView = xOptDialog.getChild("ftnnumviewbox")
                    xFtnOffset = xOptDialog.getChild("ftnoffset")

                    self.assertEqual("true", get_state_as_dict(xFtnExt)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnNum)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnFrm)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnPre)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnSuf)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnView)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xFtnOffset)["Enabled"])

                    self.assertEqual("1, 2, 3, ...", get_state_as_dict(xFtnView)["DisplayText"])
                    self.assertEqual("(", get_state_as_dict(xFtnPre)["Text"])

                    # Without the fix in place, this test would have failed with
                    # AssertionError: ')' != ''
                    self.assertEqual(")", get_state_as_dict(xFtnSuf)["Text"])

                    self.assertEqual("3", get_state_as_dict(xFtnOffset)["Text"])

                    xEndExt = xOptDialog.getChild("endntattextend")
                    xEndNum = xOptDialog.getChild("endntnum")
                    xEndFrm = xOptDialog.getChild("endntnumfmt")
                    xEndPre = xOptDialog.getChild("endprefix")
                    xEndSuf = xOptDialog.getChild("endsuffix")
                    xEndView = xOptDialog.getChild("endnumviewbox")
                    xEndOffset = xOptDialog.getChild("endoffset")

                    self.assertEqual("true", get_state_as_dict(xEndExt)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndNum)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndFrm)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndPre)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndSuf)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndView)["Enabled"])
                    self.assertEqual("true", get_state_as_dict(xEndOffset)["Enabled"])

                    self.assertEqual("i, ii, iii, ...", get_state_as_dict(xEndView)["DisplayText"])
                    self.assertEqual("[", get_state_as_dict(xEndPre)["Text"])
                    self.assertEqual("]", get_state_as_dict(xEndSuf)["Text"])

                    self.assertEqual("2", get_state_as_dict(xEndOffset)["Text"])

# vim: set shiftwidth=4 softtabstop=4 expandtab: