| 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 tdf149268(UITestCase): |
| 15 |
|
| 16 |
def get_item(self, xTree, name): |
| 17 |
for i in xTree.getChildren(): |
| 18 |
xItem = xTree.getChild(i) |
| 19 |
if name == get_state_as_dict(xItem)['Text']: |
| 20 |
return xItem |
| 21 |
|
| 22 |
def test_tdf149268(self): |
| 23 |
with self.ui_test.load_file(get_url_for_data_file("tdf149268.odt")): |
| 24 |
xWriterDoc = self.xUITest.getTopFocusWindow() |
| 25 |
xWriterEdit = xWriterDoc.getChild("writer_edit") |
| 26 |
|
| 27 |
self.xUITest.executeCommand(".uno:Sidebar") |
| 28 |
|
| 29 |
# Without the fix in place, this test would have crashed here |
| 30 |
xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) |
| 31 |
|
| 32 |
# wait until the navigator panel is available |
| 33 |
xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') |
| 34 |
|
| 35 |
xContentTree = xNavigatorPanel.getChild("contenttree") |
| 36 |
xHyperlinks = self.get_item(xContentTree, 'Hyperlinks') |
| 37 |
self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) |
| 38 |
|
| 39 |
xHyperlinks.executeAction("EXPAND", tuple()) |
| 40 |
|
| 41 |
self.assertEqual("4", get_state_as_dict(xHyperlinks)['Children']) |
| 42 |
self.assertEqual('Internet', get_state_as_dict(xHyperlinks.getChild('0'))['Text']) |
| 43 |
self.assertEqual('1234567', get_state_as_dict(xHyperlinks.getChild('1'))['Text']) |
| 44 |
self.assertEqual('yyyy', get_state_as_dict(xHyperlinks.getChild('2'))['Text']) |
| 45 |
self.assertEqual('zzz', get_state_as_dict(xHyperlinks.getChild('3'))['Text']) |
| 46 |
|
| 47 |
self.xUITest.executeCommand(".uno:Sidebar") |
| 48 |
|
| 49 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |