Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf144439.py
blob34911ee4c542ed8c676bbf752bbab5f93353206a
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 type_text, select_by_text, select_pos, get_state_as_dict
12 class tdf144439(UITestCase):
14 def test_tdf144439_list(self):
15 with self.ui_test.create_doc_in_start_center("writer") as document:
16 xWriterDoc = self.xUITest.getTopFocusWindow()
17 xWriterEdit = xWriterDoc.getChild("writer_edit")
18 # Enter some text
19 type_text(xWriterEdit, "List item")
20 # Apply numbering
21 self.xUITest.executeCommand(".uno:DefaultNumbering")
22 # Increase level up to 2
23 self.xUITest.executeCommand(".uno:IncrementIndent")
25 with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
26 # Select custom tab
27 xTabs = xDialog.getChild("tabcontrol")
28 select_pos(xTabs, "5")
30 # Select numbering
31 xNumFmt = xDialog.getChild("numfmtlb")
32 select_by_text(xNumFmt, "1, 2, 3, ...")
34 # Increase number of sublevels to show
35 xSubLevels = xDialog.getChild("sublevels")
36 xSubLevels.executeAction("UP", tuple())
38 Paragraphs = document.Text.createEnumeration()
39 Para1 = Paragraphs.nextElement()
40 self.assertEqual(Para1.String, "List item")
41 self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1.")
43 def test_tdf144439_outline(self):
44 with self.ui_test.create_doc_in_start_center("writer") as document:
45 xWriterDoc = self.xUITest.getTopFocusWindow()
46 xWriterEdit = xWriterDoc.getChild("writer_edit")
47 # Enter some text
48 type_text(xWriterEdit, "Outline2")
49 # Apply outline level 2 (as a style)
50 self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
52 with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
53 # Select level "2"
54 xLevel = xDialog.getChild("level")
55 xLevel2 = xLevel.getChild("1")
56 xLevel2.executeAction("SELECT", tuple())
57 self.assertEqual("2", get_state_as_dict(xLevel)['SelectEntryText'])
59 # Select custom tab
60 xTab = xDialog.getChild("tabcontrol")
61 select_pos(xTab, "0")
63 # Select numbering
64 xNumFmt = xDialog.getChild("numbering")
65 select_by_text(xNumFmt, "1, 2, 3, ...")
67 # Increase number of sublevels to show
68 xSubLevels = xDialog.getChild("sublevelsnf")
69 xSubLevels.executeAction("UP", tuple())
71 Paragraphs = document.Text.createEnumeration()
72 Para1 = Paragraphs.nextElement()
73 self.assertEqual(Para1.String, "Outline2")
74 self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1")
76 with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
77 # Select level "1"
78 xLevel = xDialog.getChild("level")
79 xLevel2 = xLevel.getChild("0")
80 xLevel2.executeAction("SELECT", tuple())
81 self.assertEqual("1", get_state_as_dict(xLevel)['SelectEntryText'])
83 # Select custom tab
84 xTab = xDialog.getChild("tabcontrol")
85 select_pos(xTab, "0")
87 # Select numbering
88 xNumFmt = xDialog.getChild("numbering")
89 select_by_text(xNumFmt, "1, 2, 3, ...")
91 self.assertEqual(Para1.String, "Outline2")
92 self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1")
94 # vim: set shiftwidth=4 softtabstop=4 expandtab: