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 uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
12 class tdf131170(UITestCase
):
13 def test_DefineLabelRange(self
):
14 with self
.ui_test
.load_file(get_url_for_data_file("tdf131170.ods")):
16 with self
.ui_test
.execute_dialog_through_command(".uno:DefineLabelRange") as xDialog
:
18 xRange
= xDialog
.getChild("range")
19 self
.assertEqual(4, len(xRange
.getChildren()))
20 self
.assertEqual(get_state_as_dict(xRange
.getChild('0'))["Text"].strip(), "--- Column ---")
21 self
.assertEqual(get_state_as_dict(xRange
.getChild('1'))["Text"].strip(), "$Sheet1.$I$6:$K$6 [AA, BB, CC]")
22 self
.assertEqual(get_state_as_dict(xRange
.getChild('2'))["Text"].strip(), "--- Row ---")
23 self
.assertEqual(get_state_as_dict(xRange
.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
25 xDeleteBtn
= xDialog
.getChild("delete")
27 xRange
.getChild('1').executeAction("SELECT", tuple())
28 with self
.ui_test
.execute_blocking_action(xDeleteBtn
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
31 self
.assertEqual(3, len(xRange
.getChildren()))
32 self
.assertEqual(get_state_as_dict(xRange
.getChild('0'))["Text"].strip(), "--- Column ---")
33 self
.assertEqual(get_state_as_dict(xRange
.getChild('1'))["Text"].strip(), "--- Row ---")
34 self
.assertEqual(get_state_as_dict(xRange
.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
36 xRange
.getChild('2').executeAction("SELECT", tuple())
37 with self
.ui_test
.execute_blocking_action(xDeleteBtn
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
40 self
.assertEqual(2, len(xRange
.getChildren()))
41 self
.assertEqual(get_state_as_dict(xRange
.getChild('0'))["Text"].strip(), "--- Column ---")
42 self
.assertEqual(get_state_as_dict(xRange
.getChild('1'))["Text"].strip(), "--- Row ---")
45 # vim: set shiftwidth=4 softtabstop=4 expandtab: