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
, get_url_for_data_file
14 class namedRanges(UITestCase
):
16 def test_tdf130371(self
):
17 with self
.ui_test
.load_file(get_url_for_data_file("tdf130371.ods")):
18 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
19 gridwin
= xCalcDoc
.getChild("grid_window")
21 text1
= "value\t$Sheet2.$B$2\tSheet2"
22 text2
= "value\t$Sheet3.$B$2\tSheet3"
23 text3
= "value\t$Sheet4.$B$2\tSheet4"
25 with self
.ui_test
.execute_dialog_through_command(".uno:DefineName") as xDialog
:
26 namesList
= xDialog
.getChild('names')
27 self
.assertEqual(2, len(namesList
.getChildren()))
28 self
.assertEqual(get_state_as_dict(namesList
.getChild('0'))["Text"], text1
)
29 self
.assertEqual(get_state_as_dict(namesList
.getChild('1'))["Text"], text2
)
32 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
33 self
.xUITest
.executeCommand(".uno:Copy")
35 self
.xUITest
.executeCommand(".uno:JumpToNextTable")
36 self
.xUITest
.executeCommand(".uno:JumpToNextTable")
38 self
.xUITest
.executeCommand(".uno:Paste")
40 with self
.ui_test
.execute_dialog_through_command(".uno:DefineName") as xDialog
:
41 namesList
= xDialog
.getChild('names')
42 self
.assertEqual(3, len(namesList
.getChildren()))
43 self
.assertEqual(get_state_as_dict(namesList
.getChild('0'))["Text"], text1
)
44 self
.assertEqual(get_state_as_dict(namesList
.getChild('1'))["Text"], text2
)
45 self
.assertEqual(get_state_as_dict(namesList
.getChild('2'))["Text"], text3
)
48 self
.xUITest
.executeCommand(".uno:Undo")
50 with self
.ui_test
.execute_dialog_through_command(".uno:DefineName", close_button
="cancel") as xDialog
:
51 namesList
= xDialog
.getChild('names')
52 self
.assertEqual(2, len(namesList
.getChildren()))
53 self
.assertEqual(get_state_as_dict(namesList
.getChild('0'))["Text"], text1
)
54 self
.assertEqual(get_state_as_dict(namesList
.getChild('1'))["Text"], text2
)
57 # vim: set shiftwidth=4 softtabstop=4 expandtab: