Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf144578.py
blobbde11e6b815fc05097c4cf51d002676a6b42b94e
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
12 class tdf144578(UITestCase):
14 def test_tdf144578(self):
15 with self.ui_test.load_file(get_url_for_data_file("tdf144578.odt")) as writer_doc:
16 with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
17 # Select level "1"
18 xLevelsTree = xDialog.getChild("level")
19 xLevel = xLevelsTree.getChild("0")
20 xLevel.executeAction("SELECT", tuple())
21 # Check value for show upper levels
22 xSubLevels = xDialog.getChild("sublevelsnf")
23 self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1")
25 # Select level "2"
26 xLevel = xLevelsTree.getChild("1")
27 xLevel.executeAction("SELECT", tuple())
28 # Check value for show upper levels
29 xSubLevels = xDialog.getChild("sublevelsnf")
30 self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "2")
32 # Select level "3"
33 xLevel = xLevelsTree.getChild("2")
34 xLevel.executeAction("SELECT", tuple())
35 # Check value for show upper levels
36 xSubLevels = xDialog.getChild("sublevelsnf")
37 self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "3")
39 # Select level "3"
40 xLevel = xLevelsTree.getChild("3")
41 xLevel.executeAction("SELECT", tuple())
42 # Check value for show upper levels
43 xSubLevels = xDialog.getChild("sublevelsnf")
44 self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1")
46 # And also verify label strings in outlines
47 Paragraphs = []
48 ParagraphEnum = writer_doc.Text.createEnumeration()
49 while ParagraphEnum.hasMoreElements():
50 Para = ParagraphEnum.nextElement()
51 Paragraphs.append(Para)
53 self.assertEqual(Paragraphs[0].getPropertyValue("ListLabelString"), "I.")
54 self.assertEqual(Paragraphs[2].getPropertyValue("ListLabelString"), "II.")
55 self.assertEqual(Paragraphs[4].getPropertyValue("ListLabelString"), "II.A.")
56 self.assertEqual(Paragraphs[6].getPropertyValue("ListLabelString"), "II.B.")
57 self.assertEqual(Paragraphs[8].getPropertyValue("ListLabelString"), "III.")
58 self.assertEqual(Paragraphs[10].getPropertyValue("ListLabelString"), "III.A.")
59 self.assertEqual(Paragraphs[11].getPropertyValue("ListLabelString"), "III.A.1.")
60 self.assertEqual(Paragraphs[13].getPropertyValue("ListLabelString"), "III.A.2.")
61 self.assertEqual(Paragraphs[15].getPropertyValue("ListLabelString"), "III.B.")
62 self.assertEqual(Paragraphs[17].getPropertyValue("ListLabelString"), "III.C.")
63 self.assertEqual(Paragraphs[19].getPropertyValue("ListLabelString"), "III.C.1.")
64 self.assertEqual(Paragraphs[21].getPropertyValue("ListLabelString"), "III.C.2.")
66 # vim: set shiftwidth=4 softtabstop=4 expandtab: