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
14 from uitest
.uihelper
.calc
import enter_text_to_cell
15 from libreoffice
.calc
.paste_special
import reset_default_values
17 class ManualCalcTests(UITestCase
):
18 def test_paste_special(self
):
19 # EN-8:Paste special with options
20 # This test is to check that paste special combined with some options and link is ok.
23 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
25 # Write text to cell A1
26 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
27 enter_text_to_cell(xGridWin
, "A1", "abcd")
29 # Copy cell A1 to clipboard
30 xGridWin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
31 self
.xUITest
.executeCommand(".uno:Copy")
33 # Set cursor to cell A3
34 xGridWin
.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
36 # Choose Paste Special Options and paste data
37 with self
.ui_test
.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg
:
38 reset_default_values(self
, xPasteSpecialDlg
)
39 xAllChkBox
= xPasteSpecialDlg
.getChild("paste_all")
40 xAllChkBox
.executeAction("CLICK", tuple())
41 xLinkChkBox
= xPasteSpecialDlg
.getChild("link")
42 xLinkChkBox
.executeAction("CLICK", tuple())
44 # Assert successful paste
45 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getString(), "abcd")
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: