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/.
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
14 class tdf150307(UITestCase
):
16 def check_navigator(self
, xGridWin
, nLen
):
17 xGridWin
.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 xNavigatorPanel
= xCalcDoc
.getChild("NavigatorPanel")
21 xContentBox
= xNavigatorPanel
.getChild('contentbox')
22 xSheets
= xContentBox
.getChild("0")
23 self
.assertEqual('Sheets', get_state_as_dict(xSheets
)['Text'])
25 self
.ui_test
.wait_until_property_is_updated(xSheets
, "Children", str(nLen
))
26 self
.assertEqual(nLen
, len(xSheets
.getChildren()))
27 self
.assertEqual('Sheet1', get_state_as_dict(xSheets
.getChild('0'))['Text'])
30 self
.assertEqual('Sheet1_2', get_state_as_dict(xSheets
.getChild('1'))['Text'])
32 xRangeNames
= xContentBox
.getChild("1")
33 self
.assertEqual('Range names', get_state_as_dict(xRangeNames
)['Text'])
35 self
.ui_test
.wait_until_property_is_updated(xRangeNames
, "Children", str(nLen
))
36 self
.assertEqual(nLen
, len(xRangeNames
.getChildren()))
37 self
.assertEqual('Test', get_state_as_dict(xRangeNames
.getChild('0'))['Text'])
40 self
.assertEqual('Test (Sheet1_2)', get_state_as_dict(xRangeNames
.getChild('1'))['Text'])
42 def test_tdf150307(self
):
44 with self
.ui_test
.create_doc_in_start_center("calc"):
45 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
46 xGridWin
= xCalcDoc
.getChild("grid_window")
48 self
.xUITest
.executeCommand(".uno:Sidebar")
50 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:AddName", close_button
="add") as xAddNameDlg
:
51 xEdit
= xAddNameDlg
.getChild("edit")
52 type_text(xEdit
, "Test")
54 self
.check_navigator(xGridWin
, 1)
56 self
.xUITest
.executeCommand(".uno:DuplicateSheet")
58 self
.check_navigator(xGridWin
, 2)
60 self
.xUITest
.executeCommand(".uno:Remove")
62 self
.check_navigator(xGridWin
, 1)
64 self
.xUITest
.executeCommand(".uno:DuplicateSheet")
66 self
.check_navigator(xGridWin
, 2)
69 self
.xUITest
.executeCommand(".uno:Undo")
71 self
.check_navigator(xGridWin
, 1)
73 self
.xUITest
.executeCommand(".uno:Sidebar")
75 # vim: set shiftwidth=4 softtabstop=4 expandtab: