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 uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from libreoffice
.calc
.document
import get_cell_by_position
15 class Tdf149529(UITestCase
):
17 def test_tdf149529(self
):
18 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
20 with self
.ui_test
.execute_dialog_through_command(".uno:Insert") as xDialog
:
21 xBrowse
= xDialog
.getChild("browse")
22 xFromFile
= xDialog
.getChild("fromfile")
23 xTables
= xDialog
.getChild("tables")
25 self
.assertEqual("false", get_state_as_dict(xBrowse
)['Enabled'])
26 self
.assertEqual("0", get_state_as_dict(xTables
)['Children'])
28 xFromFile
.executeAction("CLICK", tuple())
30 self
.assertEqual("true", get_state_as_dict(xBrowse
)['Enabled'])
32 with self
.ui_test
.execute_blocking_action(
33 xBrowse
.executeAction
, args
=('CLICK', ()), close_button
="") as dialog
:
34 xFileName
= dialog
.getChild("file_name")
35 xFileName
.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf149529.ods")}))
36 xOpen
= dialog
.getChild("open")
37 xOpen
.executeAction("CLICK", tuple())
39 self
.ui_test
.wait_until_property_is_updated(xTables
, "Children", "1")
40 self
.assertEqual("Codes", get_state_as_dict(xTables
.getChild('0'))['Text'])
42 self
.assertEqual("GROUP", get_cell_by_position(document
, 0, 0, 0).getString())
44 with self
.ui_test
.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") as xCondFormatMgr
:
45 xList
= xCondFormatMgr
.getChild("CONTAINER")
46 self
.assertEqual("1", get_state_as_dict(xList
)['Children'])
47 self
.assertEqual("P6:P10\tColorScale", get_state_as_dict(xList
.getChild('0'))['Text'])
49 # Without the fix in place, this test would have crashed here
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: