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/.
10 from uitest
.framework
import UITestCase
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 from uitest
.uihelper
.calc
import enter_text_to_cell
18 class ManualCalcTests(UITestCase
):
19 def test_paste_special(self
):
20 # EN-8:Paste special with options
21 # This test is to check that paste special combined with some options and link is ok.
24 self
.ui_test
.create_doc_in_start_center("calc")
26 # Write text to cell A1
27 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
28 enter_text_to_cell(xGridWin
, "A1", "abcd")
30 # Copy cell A1 to clipboard
31 xGridWin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
32 self
.xUITest
.executeCommand(".uno:Copy")
34 # Set cursor to cell A3
35 xGridWin
.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
37 # Choose Paste Special Options and paste data
38 self
.ui_test
.execute_dialog_through_command(".uno:PasteSpecial")
39 xPasteSpecialDlg
= self
.xUITest
.getTopFocusWindow()
40 xAllChkBox
= xPasteSpecialDlg
.getChild("paste_all")
41 xAllChkBox
.executeAction("CLICK", tuple())
42 xLinkChkBox
= xPasteSpecialDlg
.getChild("link")
43 xLinkChkBox
.executeAction("CLICK", tuple())
44 xOkBtn
= xPasteSpecialDlg
.getChild("ok")
45 self
.ui_test
.close_dialog_through_button(xOkBtn
)
47 # Assert successful paste
48 document
= self
.ui_test
.get_component()
49 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getString(), "abcd")
50 self
.ui_test
.close_doc()
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: