Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / search_replace / tdf132097.py
blob6fe09754ac2da1d022dbb2635519eaadbbf5ebe4
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
13 class tdf132097(UITestCase):
15 def test_tdf132097(self):
16 with self.ui_test.create_doc_in_start_center("calc"):
17 with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
18 xCols = xDialog.getChild('cols')
19 xSearchTerm = xDialog.getChild("searchterm")
20 xBackSearch = xDialog.getChild("backsearch")
21 xSeachLabel = xDialog.getChild("searchlabel")
23 xCols.executeAction("CLICK", tuple())
24 xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"}))
26 for i in range(10):
27 # without the fix in place it would crash here.
28 # Sometimes it doesn't crash at first so try a few times to be sure
29 xBackSearch.executeAction("CLICK", tuple())
31 self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found")
35 # vim: set shiftwidth=4 softtabstop=4 expandtab: