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
, type_text
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 class tdf142031(UITestCase
):
16 def test_tdf142031(self
):
17 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
18 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
19 gridwin
= xCalcDoc
.getChild("grid_window")
20 xPosWindow
= xCalcDoc
.getChild('pos_window')
22 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:AddName", close_button
="add") as xAddNameDlg
:
23 xEdit
= xAddNameDlg
.getChild("edit")
24 type_text(xEdit
, "crédit")
26 self
.assertEqual('crédit', get_state_as_dict(xPosWindow
)['Text'])
28 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
30 xInputWin
= xCalcDoc
.getChild("sc_input_window")
31 xInputWin
.executeAction("TYPE", mkPropertyValues({"TEXT":"=cré"}))
32 xInputWin
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
34 # Without the fix in place, this test would have failed here
35 self
.assertEqual("=crédit", get_state_as_dict(xInputWin
)["Text"])
37 xInputWin
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
39 self
.assertEqual("0", get_cell_by_position(document
, 0, 1, 0).getString())
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: