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
.calc
import enter_text_to_cell
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
14 class tdf143759(UITestCase
):
16 def test_tdf143759(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
, "C2", "A")
22 enter_text_to_cell(gridwin
, "E3", "1")
23 enter_text_to_cell(gridwin
, "B5", "2")
25 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F6"}))
27 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
29 # More Options is expanded when there is a selection with data
30 xExpander
= xDialog
.getChild("OptionsExpander")
31 self
.assertEqual("true", get_state_as_dict(xExpander
)['Expanded'])
33 xSearchterm
= xDialog
.getChild("searchterm")
34 xSearchterm
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
35 xSearchterm
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
36 xSearchterm
.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"}))
38 xRegexp
= xDialog
.getChild("regexp")
39 xRegexp
.executeAction("CLICK", tuple())
40 self
.assertEqual("true", get_state_as_dict(xRegexp
)['Selected'])
42 xSelection
= xDialog
.getChild("selection")
43 if get_state_as_dict(xSelection
)['Selected'] == 'false':
44 xSelection
.executeAction("CLICK", tuple())
45 self
.assertEqual("true", get_state_as_dict(xSelection
)['Selected'])
47 xSearchall
= xDialog
.getChild("searchall")
48 with self
.ui_test
.execute_dialog_through_action(
49 xSearchall
, "CLICK", event_name
= "ModelessDialogVisible", close_button
="close") as dialog
:
50 # Without the fix in place, this test would have failed with
51 # AssertionError: 13 != 0
52 self
.assertEqual(13, len(dialog
.getChild("results").getChildren()))
54 # Deselect regex button, otherwise it might affect other tests
55 xRegexp
.executeAction("CLICK", tuple())
56 self
.assertEqual("false", get_state_as_dict(xRegexp
)['Selected'])
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: