Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / qa / uitest / external_links / tdf95217.py
blobfb0125a995d8bfa0202d77be08916ac0b76d7477
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
13 from libreoffice.calc.document import get_cell_by_position
14 from libreoffice.uno.propertyvalue import mkPropertyValues
17 class tdf95217(UITestCase):
19 def test_tdf95217(self):
21 with self.ui_test.create_doc_in_start_center("calc") as calc_doc:
23 with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog:
24 xUrl = xDialog.getChild("url")
25 xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf95217.html")}))
27 with self.ui_test.execute_blocking_action(xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))):
28 pass
30 xRanges = xDialog.getChild("ranges")
31 self.assertEqual("3", get_state_as_dict(xRanges)["Children"])
33 # tdf#142600: Without the fix in place, this test would have failed with
34 # AssertionError: 'HTML_all' != 'HTML_1'
35 self.assertEqual("HTML_all", get_state_as_dict(xRanges.getChild("0"))["Text"])
36 self.assertEqual("HTML_tables", get_state_as_dict(xRanges.getChild("1"))["Text"])
37 self.assertEqual("HTML_1", get_state_as_dict(xRanges.getChild("2"))["Text"])
39 # FIXME: close_dialog_through_button fails here
40 xOkBtn = xDialog.getChild("ok")
41 xOkBtn.executeAction("CLICK", tuple())
43 # Without the fix in place, this test would have failed with
44 # AssertionError: 'وضعیت بازار' != 'وضعیت بازار'
45 self.assertEqual("وضعیت بازار", get_cell_by_position(calc_doc, 0, 0, 0).getString())
46 self.assertEqual("شاخص کل", get_cell_by_position(calc_doc, 0, 0, 1).getString())
47 self.assertEqual("شاخص كل (هم وزن)", get_cell_by_position(calc_doc, 0, 0, 2).getString())
48 self.assertEqual("بسته", get_cell_by_position(calc_doc, 0, 1, 0).getString())
49 self.assertEqual("63175", get_cell_by_position(calc_doc, 0, 1, 1).getString())
50 self.assertEqual("9,690.30 (22.80)", get_cell_by_position(calc_doc, 0, 1, 2).getString())
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: