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
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.calc
import enter_text_to_cell
14 class tdf83126(UITestCase
):
16 def test_tdf132097(self
):
17 with self
.ui_test
.create_doc_in_start_center("calc"):
18 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
19 gridwin
= xCalcDoc
.getChild("grid_window")
21 enter_text_to_cell(gridwin
, "A4", "Test")
22 enter_text_to_cell(gridwin
, "D1", "Test")
23 enter_text_to_cell(gridwin
, "D4", "Test")
25 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
27 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
28 xRows
= xDialog
.getChild('rows')
29 self
.assertEqual('true', get_state_as_dict(xRows
)['Checked'])
31 xSearchTerm
= xDialog
.getChild("searchterm")
33 xSearchTerm
.executeAction("TYPE", mkPropertyValues({"TEXT":"Test"}))
35 xSearchall
= xDialog
.getChild("searchall")
36 with self
.ui_test
.execute_dialog_through_action(
37 xSearchall
, "CLICK", event_name
= "ModelessDialogVisible", close_button
="close") as xResultsDialog
:
38 xResults
= xResultsDialog
.getChild("results")
39 self
.assertEqual(3, len(xResults
.getChildren()))
41 # Without the fix in place, this test would have failed with
42 # AssertionError: 'Sheet1\t$D$1\tTest' != 'Sheet1\t$A$4\tTest'
43 self
.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults
.getChild('0'))['Text'])
44 self
.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults
.getChild('1'))['Text'])
45 self
.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults
.getChild('2'))['Text'])
47 xCols
= xDialog
.getChild('cols')
48 xCols
.executeAction("CLICK", tuple())
50 with self
.ui_test
.execute_dialog_through_action(
51 xSearchall
, "CLICK", event_name
= "ModelessDialogVisible", close_button
="close") as xResultsDialog
:
52 xResults
= xResultsDialog
.getChild("results")
53 self
.assertEqual(3, len(xResults
.getChildren()))
54 self
.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults
.getChild('0'))['Text'])
55 self
.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults
.getChild('1'))['Text'])
56 self
.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults
.getChild('2'))['Text'])
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: