Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / function_wizard / tdf37864.py
blobb38b550fc6049ae8de170642d2e2ccf6ae9b21a4
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 uitest.uihelper.calc import enter_text_to_cell
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class tdf37864(UITestCase):
16 def test_tdf37864(self):
18 with self.ui_test.create_doc_in_start_center("calc"):
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
21 enter_text_to_cell(gridwin, "A1", "test")
23 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
25 self.xUITest.executeCommand(".uno:Copy")
27 with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog:
28 xFormula = xDialog.getChild("ed_formula")
29 xFormula.executeAction("TYPE", mkPropertyValues({"KEYCODE": 'CTRL+v'}))
31 # Without the fix in place, this test would have failed with
32 # AssertionError: '=test' != '=test\n'
33 self.assertEqual("=test", get_state_as_dict(xFormula)["Text"])
35 # vim: set shiftwidth=4 softtabstop=4 expandtab: