sc/qa/uitest/data/tdf139974.ods |binary sc/qa/uitest/inputLine/tdf139974.py | 54 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+)
New commits: commit 36a186f28757eadb8fddac5887f5ebecebfe8229 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jan 20 12:19:29 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jan 20 20:32:22 2022 +0100 tdf#139974: sc: Add UItest Change-Id: I2fe60ece55cd5f8298ed656fa043287eeaef1a53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128651 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/data/tdf139974.ods b/sc/qa/uitest/data/tdf139974.ods new file mode 100644 index 000000000000..bc89066900bc Binary files /dev/null and b/sc/qa/uitest/data/tdf139974.ods differ diff --git a/sc/qa/uitest/inputLine/tdf139974.py b/sc/qa/uitest/inputLine/tdf139974.py new file mode 100644 index 000000000000..25f57b3442bf --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf139974.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict + +class tdf139974(UITestCase): + + def test_tdf139974(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf139974.ods")) as document: + + self.assertEqual(1929753068859.0, get_cell_by_position(document, 0, 0, 0).getValue()) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Move focus to the input line + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+SHIFT+F2"})) + + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual('true', get_state_as_dict(xInputWin)["HasFocus"]) + self.assertEqual(17204, len(get_state_as_dict(xInputWin)["Text"])) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + # Move focus to the input line + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+SHIFT+F2"})) + + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual('true', get_state_as_dict(xInputWin)["HasFocus"]) + + self.xUITest.executeCommand(".uno:Paste") + + # Without the fix in place, this test would have failed with + # AssertionError: 17205 != 17204 + self.assertEqual(17205, len(get_state_as_dict(xInputWin)["Text"])) + + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertEqual(1929753068859.0, get_cell_by_position(document, 0, 0, 1).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: