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/.
10 from uitest
.framework
import UITestCase
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
14 class ReplaceTest(UITestCase
):
16 def test_tdf106194(self
):
17 with self
.ui_test
.load_file(get_url_for_data_file("tdf106194.ods")):
19 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
21 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button
="close") as xSearchDlg
:
24 xSearchTerm
= xSearchDlg
.getChild("searchterm")
25 xSearchTerm
.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
26 xReplaceTerm
= xSearchDlg
.getChild("replaceterm")
27 xReplaceTerm
.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
29 xSearchBtn
= xSearchDlg
.getChild("search")
30 xSearchBtn
.executeAction("CLICK", tuple())
32 self
.assertEqual(get_state_as_dict(xGridWin
)["CurrentRow"], "1")
33 lastTopVisibleRow
= int(get_state_as_dict(xGridWin
)["TopVisibleRow"])
36 xReplaceBtn
= xSearchDlg
.getChild("replace")
37 xReplaceBtn
.executeAction("CLICK", tuple())
39 # check position and visible range
40 self
.assertEqual(get_state_as_dict(xGridWin
)["CurrentRow"], "199")
41 currentTopVisibleRow
= int(get_state_as_dict(xGridWin
)["TopVisibleRow"])
42 self
.assertGreater(currentTopVisibleRow
, lastTopVisibleRow
)
44 lastTopVisibleRow
= currentTopVisibleRow
47 xReplaceBtn
.executeAction("CLICK", tuple())
49 # check position and visible range
50 self
.assertEqual(get_state_as_dict(xGridWin
)["CurrentRow"], "499")
51 currentTopVisibleRow
= int(get_state_as_dict(xGridWin
)["TopVisibleRow"])
52 self
.assertGreater(currentTopVisibleRow
, lastTopVisibleRow
)
54 xReplaceBtn
.executeAction("CLICK", tuple())
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: