| 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, get_url_for_data_file |
| 13 |
|
| 14 |
class tdf143569(UITestCase): |
| 15 |
|
| 16 |
def test_Tdf143569(self): |
| 17 |
|
| 18 |
with self.ui_test.load_file(get_url_for_data_file("tdf143569.odt")): |
| 19 |
|
| 20 |
xMainWindow = self.xUITest.getTopFocusWindow() |
| 21 |
xWriterEdit = xMainWindow.getChild("writer_edit") |
| 22 |
|
| 23 |
self.xUITest.executeCommand(".uno:Sidebar") |
| 24 |
|
| 25 |
xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) |
| 26 |
|
| 27 |
# wait until the navigator panel is available |
| 28 |
xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') |
| 29 |
|
| 30 |
xContentTree = xNavigatorPanel.getChild("contenttree") |
| 31 |
|
| 32 |
xHeadings = xContentTree.getChild('0') |
| 33 |
self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) |
| 34 |
self.assertEqual("1", get_state_as_dict(xHeadings)['Children']) |
| 35 |
|
| 36 |
xHeadings.executeAction("EXPAND", tuple()) |
| 37 |
|
| 38 |
xChild = xHeadings.getChild('0') |
| 39 |
|
| 40 |
# Without the fix in place, this test would have failed with |
| 41 |
# AssertionError: 'Introduction' != 'Anchored to Paragraph' |
| 42 |
self.assertEqual('Introduction', get_state_as_dict(xChild)['Text']) |
| 43 |
self.assertEqual("1", get_state_as_dict(xChild)['Children']) |
| 44 |
|
| 45 |
xChild.executeAction("EXPAND", tuple()) |
| 46 |
|
| 47 |
xChild = xChild.getChild('0') |
| 48 |
self.assertEqual('Problem', get_state_as_dict(xChild)['Text']) |
| 49 |
self.assertEqual("1", get_state_as_dict(xChild)['Children']) |
| 50 |
|
| 51 |
xChild.executeAction("EXPAND", tuple()) |
| 52 |
|
| 53 |
xChild = xChild.getChild('0') |
| 54 |
self.assertEqual('Discussion Agenda', get_state_as_dict(xChild)['Text']) |
| 55 |
self.assertEqual("2", get_state_as_dict(xChild)['Children']) |
| 56 |
|
| 57 |
xChild.executeAction("EXPAND", tuple()) |
| 58 |
|
| 59 |
xChild1 = xChild.getChild('0') |
| 60 |
self.assertEqual('Anchored to Paragraph', get_state_as_dict(xChild1)['Text']) |
| 61 |
self.assertEqual("0", get_state_as_dict(xChild1)['Children']) |
| 62 |
|
| 63 |
xChild2 = xChild.getChild('1') |
| 64 |
self.assertEqual('Anchored as Character', get_state_as_dict(xChild2)['Text']) |
| 65 |
self.assertEqual("0", get_state_as_dict(xChild2)['Children']) |
| 66 |
|
| 67 |
self.xUITest.executeCommand(".uno:Sidebar") |
| 68 |
|
| 69 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |