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
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 #Bug 67346 - EDITING: Undo broken when pasting text that has been copied from the input line
17 class tdf67346(UITestCase
):
19 def test_tdf67346_undo_paste_text_input_line(self
):
20 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
24 enter_text_to_cell(gridwin
, "A1", "Apple")
26 # Move focus to input window and copy the text from there
27 gridwin
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+SHIFT+F2"}))
29 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
30 xToolkit
.processEventsToIdle()
31 xInputWin
= xCalcDoc
.getChild("sc_input_window")
32 self
.assertEqual('true', get_state_as_dict(xInputWin
)["HasFocus"])
34 self
.xUITest
.executeCommand(".uno:SelectAll")
35 self
.xUITest
.executeCommand(".uno:Copy")
37 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
39 self
.xUITest
.executeCommand(".uno:Paste")
40 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getString(), "Apple")
41 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getString(), "Apple")
42 # this test keeps failing here on jenkins
43 # self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple")
45 # self.xUITest.executeCommand(".uno:Undo")
46 # self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple")
47 # self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "")
48 # self.assertEqual(get_state_as_dict(xInputWin)["Text"], "")
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: