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 libreoffice
.calc
.document
import get_cell_by_position
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_url_for_data_file
14 class tdf153622(UITestCase
):
16 def test_tdf153622(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("tdf153622.xlsx")) as calc_doc
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 A1DropDown
= ['apple', 'banana']
22 for i
in range(len(A1DropDown
)):
23 gridwin
= xCalcDoc
.getChild("grid_window")
25 # Without the fix in place, this test would have crashed here
26 gridwin
.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "0", "ROW": "1"}))
28 #Select the TreeList UI Object
29 xWin
= self
.xUITest
.getTopFocusWindow()
30 xlist
= xWin
.getChild("list")
32 xListItem
= xlist
.getChild( str(i
) )
33 xListItem
.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
35 # tdf#151794: Without the fix in place, this test would have failed with
36 # AssertionError: '' != 'apple'
37 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getString(), A1DropDown
[i
])
39 A2DropDown
= ['', 'apple', 'banana']
40 for i
in range(len(A2DropDown
)):
41 gridwin
= xCalcDoc
.getChild("grid_window")
43 gridwin
.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "0", "ROW": "2"}))
45 #Select the TreeList UI Object
46 xWin
= self
.xUITest
.getTopFocusWindow()
47 xlist
= xWin
.getChild("list")
49 xListItem
= xlist
.getChild( str(i
) )
50 xListItem
.executeAction("DOUBLECLICK" , mkPropertyValues({}) )
52 # tdf#79571: Without the fix in place, this test would have failed with
53 # AssertionError: 'banana' != ''
54 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getString(), A2DropDown
[i
])
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: