tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sw / qa / uitest / navigator / tdf140661.py
blobc3689f51cf663df0b2800e0c554514e6c6e0245a
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 libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
13 class tdf140661(UITestCase):
15 def get_item(self, xTree, name):
16 for i in xTree.getChildren():
17 xItem = xTree.getChild(i)
18 if name == get_state_as_dict(xItem)['Text']:
19 return xItem
21 def launch_navigator(self, bIsBeforeUngroup):
22 xMainWindow = self.xUITest.getTopFocusWindow()
23 xWriterEdit = xMainWindow.getChild("writer_edit")
25 self.xUITest.executeCommand(".uno:Sidebar")
27 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"}))
29 # wait until the navigator panel is available
30 xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel')
32 xContentTree = xNavigatorPanel.getChild("contenttree")
33 xDrawings = self.get_item(xContentTree, 'Drawing objects')
34 self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text'])
36 xDrawings.executeAction("EXPAND", tuple())
38 if bIsBeforeUngroup:
39 self.assertEqual(1, len(xDrawings.getChildren()))
40 self.assertEqual('DrawObject1', get_state_as_dict(xDrawings.getChild('0'))['Text'])
41 else:
42 self.assertEqual(12, len(xDrawings.getChildren()))
44 # tdf#134960
45 expectedShapeOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
46 for i in range(12):
47 self.assertEqual('Shape' + str(expectedShapeOrder[i]), get_state_as_dict(xDrawings.getChild(str(i)))['Text'])
49 xDrawings.executeAction("COLLAPSE", tuple())
51 self.xUITest.executeCommand(".uno:Sidebar")
53 def test_tdf140661(self):
55 with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")):
57 self.launch_navigator(True)
59 # Select the shape and ungroup it
60 self.xUITest.executeCommand(".uno:JumpToNextFrame")
62 self.ui_test.wait_until_child_is_available('metricfield')
64 self.xUITest.executeCommand(".uno:FormatUngroup")
66 # Without the fix in place, this test would have failed with
67 # AssertionError: 12 != 0
68 self.launch_navigator(False)
70 # vim: set shiftwidth=4 softtabstop=4 expandtab: