From 2c22c95d41cd67ab865d40292e659abdd04a1b3e Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 24 Jan 2022 17:00:31 +0100 Subject: tdf#139974: sc: fix test See https://gerrit.libreoffice.org/c/core/+/128651 Change-Id: Ib38890351d7fb83ab4bffebfa9564427c16b6bcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128874 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/qa/uitest/calc_tests3/tdf139974.py | 48 ++++++++++++++++++++++++++++++ sc/qa/uitest/data/tdf139974.ods | Bin 8699 -> 9523 bytes sc/qa/uitest/inputLine/tdf139974.py | 54 ---------------------------------- 3 files changed, 48 insertions(+), 54 deletions(-) create mode 100644 sc/qa/uitest/calc_tests3/tdf139974.py delete mode 100644 sc/qa/uitest/inputLine/tdf139974.py (limited to 'sc') diff --git a/sc/qa/uitest/calc_tests3/tdf139974.py b/sc/qa/uitest/calc_tests3/tdf139974.py new file mode 100644 index 000000000000..1e7009b36fce --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf139974.py @@ -0,0 +1,48 @@ +# -*- 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(1930864179960.0, get_cell_by_position(document, 0, 0, 0).getValue()) + self.assertEqual(17204.0, get_cell_by_position(document, 0, 1, 0).getValue()) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + + self.xUITest.executeCommand(".uno:Paste") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 17205 != 17204 + self.assertEqual(17205.0, get_cell_by_position(document, 0, 1, 1).getValue()) + + self.assertEqual(1930864179960.0, get_cell_by_position(document, 0, 0, 1).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/tdf139974.ods b/sc/qa/uitest/data/tdf139974.ods index bc89066900bc..77ec2524798d 100644 Binary files a/sc/qa/uitest/data/tdf139974.ods 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 deleted file mode 100644 index 25f57b3442bf..000000000000 --- a/sc/qa/uitest/inputLine/tdf139974.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- 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: -- cgit