1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from uitest
.uihelper
.common
import get_state_as_dict
9 from libreoffice
.calc
.document
import get_sheet_from_doc
10 from uitest
.debug
import sleep
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.calc
import enter_text_to_cell
13 from libreoffice
.calc
.document
import get_cell_by_position
15 class tdf69450(UITestCase
):
17 def test_tdf69450(self
):
18 calc_doc
= self
.ui_test
.create_doc_in_start_center("calc")
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
21 document
= self
.ui_test
.get_component()
23 #add text to A1 and B1
24 enter_text_to_cell(gridwin
, "A1", "A")
25 enter_text_to_cell(gridwin
, "B1", "B")
26 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
27 self
.xUITest
.executeCommand(".uno:Copy")
28 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
29 self
.ui_test
.execute_dialog_through_command(".uno:PasteSpecial")
30 xDialog
= self
.xUITest
.getTopFocusWindow()
32 xtext
= xDialog
.getChild("text")
33 xnumbers
= xDialog
.getChild("numbers")
34 xdatetime
= xDialog
.getChild("datetime")
35 xformats
= xDialog
.getChild("formats")
37 xtext
.executeAction("CLICK", tuple())
38 xnumbers
.executeAction("CLICK", tuple())
39 xdatetime
.executeAction("CLICK", tuple())
40 xformats
.executeAction("CLICK", tuple())
42 xOkBtn
= xDialog
.getChild("ok")
43 self
.ui_test
.close_dialog_through_button(xOkBtn
)
46 self
.assertEqual(get_cell_by_position(document
, 0, 1, 0).getString(), "B")
48 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
49 self
.xUITest
.executeCommand(".uno:Bold")
50 self
.xUITest
.executeCommand(".uno:Copy")
51 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
52 self
.ui_test
.execute_dialog_through_command(".uno:PasteSpecial")
53 xDialog
= self
.xUITest
.getTopFocusWindow() #previous settings should be remembered (only format)
55 xOkBtn
= xDialog
.getChild("ok")
56 self
.ui_test
.close_dialog_through_button(xOkBtn
)
59 self
.assertEqual(get_cell_by_position(document
, 0, 1, 0).getString(), "B")
60 self
.ui_test
.close_doc()
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: