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
.common
import select_by_text
13 from uitest
.uihelper
.calc
import enter_text_to_cell
15 class tdf65334(UITestCase
):
17 def test_tdf65334(self
):
18 with self
.ui_test
.create_doc_in_start_center("calc"):
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
22 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A5"}))
24 # Insert a comment in a cell without text
25 xArgs
= mkPropertyValues({"Text": "Comment 1"})
26 self
.xUITest
.executeCommandWithParameters(".uno:InsertAnnotation", xArgs
)
28 # Insert a comment in a cell with text
29 enter_text_to_cell(gridwin
, "C10", "Cell with text")
30 xArgs
= mkPropertyValues({"Text": "Comment 2"})
31 self
.xUITest
.executeCommandWithParameters(".uno:InsertAnnotation", xArgs
)
33 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
35 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
36 xExpander
= xDialog
.getChild("OptionsExpander")
38 # tdf#129629: Without the fix in place, this test would have failed with
39 # AssertionError: 'false' != 'true'
40 self
.assertEqual("false", get_state_as_dict(xExpander
)['Expanded'])
42 xExpander
.executeAction("EXPAND", tuple())
43 self
.assertEqual("true", get_state_as_dict(xExpander
)['Expanded'])
45 xCalcsearchin
= xDialog
.getChild("calcsearchin")
46 select_by_text(xCalcsearchin
, "Comments")
48 xSearchterm
= xDialog
.getChild("searchterm")
49 xSearchterm
.executeAction("TYPE", mkPropertyValues({"TEXT":"Comment"}))
51 xSearch
= xDialog
.getChild("search")
52 xSearch
.executeAction("CLICK", tuple())
54 self
.assertEqual("0", get_state_as_dict(gridwin
)["CurrentColumn"])
56 # Without the fix in place, this test would have failed with
57 # AssertionError: '4' != '0'
58 self
.assertEqual("4", get_state_as_dict(gridwin
)["CurrentRow"])
60 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xDialog
:
61 xSearchterm
= xDialog
.getChild("searchterm")
62 xCalcsearchin
= xDialog
.getChild("calcsearchin")
63 xExpander
= xDialog
.getChild("OptionsExpander")
65 self
.assertEqual("false", get_state_as_dict(xExpander
)['Expanded'])
66 self
.assertEqual("Comment", get_state_as_dict(xSearchterm
)['Text'])
67 self
.assertEqual("Comments", get_state_as_dict(xCalcsearchin
)['SelectEntryText'])
69 xSearch
= xDialog
.getChild("search")
70 xSearch
.executeAction("CLICK", tuple())
72 self
.assertEqual("2", get_state_as_dict(gridwin
)["CurrentColumn"])
73 self
.assertEqual("9", get_state_as_dict(gridwin
)["CurrentRow"])
75 # vim: set shiftwidth=4 softtabstop=4 expandtab: