Debian Codegraph @

sw/qa/uitest/styleInspector/tdf137513.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
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_state_as_dict, type_text
13
14 class tdf137513(UITestCase):
15
16 def test_tdf137513(self):
17 with self.ui_test.create_doc_in_start_center("writer"):
18
19 self.xUITest.executeCommand(".uno:InsertTable?Columns:short=2&Rows:short=2")
20
21 xWriterDoc = self.xUITest.getTopFocusWindow()
22 xWriterEdit = xWriterDoc.getChild("writer_edit")
23 type_text(xWriterEdit, "test")
24
25 self.xUITest.executeCommand(".uno:SelectAll")
26
27 self.xUITest.executeCommand(".uno:Bold")
28
29 self.xUITest.executeCommand(".uno:Sidebar")
30 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
31
32 xListBox = xWriterEdit.getChild('listbox_fonts')
33
34 # The cursor is on text inside the table with direct formatting
35 self.assertEqual(2, len(xListBox.getChild('0').getChildren()))
36 self.assertEqual("Default Paragraph Style\t", get_state_as_dict(xListBox.getChild('0').getChild('0'))['Text'])
37 self.assertEqual("Table Contents\t", get_state_as_dict(xListBox.getChild('0').getChild('1'))['Text'])
38 self.assertEqual(156, len(xListBox.getChild('0').getChild('0').getChildren()))
39
40 xTableContent = xListBox.getChild('0').getChild('1')
41 self.assertEqual(5, len(xTableContent.getChildren()))
42 self.assertEqual("Follow Style\tTable Contents", get_state_as_dict(xTableContent.getChild('0'))['Text'])
43 self.assertEqual("Para Don’t split at beginning (lines)\t0", get_state_as_dict(xTableContent.getChild('1'))['Text'])
44 self.assertEqual("Para Don’t split at end (lines)\t0", get_state_as_dict(xTableContent.getChild('2'))['Text'])
45 self.assertEqual("Para Line Number Count\tFalse", get_state_as_dict(xTableContent.getChild('3'))['Text'])
46 self.assertEqual("Para Line Number Start Value\t0", get_state_as_dict(xTableContent.getChild('4'))['Text'])
47
48 xParDirFormatting = xListBox.getChild('1')
49
50 # Without the fix in place, this test would have failed here with
51 # AssertionError: 3 != 0
52 self.assertEqual(3, len(xParDirFormatting.getChildren()))
53 self.assertEqual("Char Weight\tBold", get_state_as_dict(xParDirFormatting.getChild('0'))['Text'])
54 self.assertEqual("Char Weight Asian\tBold", get_state_as_dict(xParDirFormatting.getChild('1'))['Text'])
55 self.assertEqual("Char Weight Complex\tBold", get_state_as_dict(xParDirFormatting.getChild('2'))['Text'])
56 self.assertEqual(0, len(xListBox.getChild('2').getChildren()))
57 self.assertEqual(0, len(xListBox.getChild('3').getChildren()))
58
59 self.xUITest.executeCommand(".uno:Sidebar")
60
61
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: