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
11 from uitest
.uihelper
.common
import select_pos
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 class tdf57465(UITestCase
):
17 def test_tdf57465(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("tdf57465.ods")) as calc_doc
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
22 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:G4"}))
24 with self
.ui_test
.execute_dialog_through_command(".uno:DataSort") as xDialog
:
25 xTabs
= xDialog
.getChild("tabcontrol")
26 select_pos(xTabs
, "0")
28 xHeader
= xDialog
.getChild("cbHeader")
29 if (get_state_as_dict(xHeader
)["Selected"]) == 'true':
30 xHeader
.executeAction("CLICK", tuple())
32 xLeftRight
= xDialog
.getChild("rbLeftRight")
33 xLeftRight
.executeAction("CLICK", tuple())
35 self
.assertEqual("1", get_state_as_dict(xDialog
.getChild("sortlb"))['DisplayText'])
38 self
.assertEqual("a", get_cell_by_position(calc_doc
, 0, 1, 1).getString())
40 # Without the fix in place, this test would have failed with
41 # AssertionError: 'b' != ''
42 self
.assertEqual("b", get_cell_by_position(calc_doc
, 0, 2, 2).getString())
43 self
.assertEqual("c", get_cell_by_position(calc_doc
, 0, 3, 3).getString())
44 self
.assertEqual("d", get_cell_by_position(calc_doc
, 0, 4, 1).getString())
45 self
.assertEqual("e", get_cell_by_position(calc_doc
, 0, 5, 2).getString())
46 self
.assertEqual("f", get_cell_by_position(calc_doc
, 0, 6, 3).getString())
48 # vim: set shiftwidth=4 softtabstop=4 expandtab: