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
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from uitest
.uihelper
.common
import get_url_for_data_file
15 class Tdf1254400(UITestCase
):
17 def test_tdf125440(self
):
18 # In order to simulate copy&paste from external source,
19 # import the text in Writer, copy it and paste it in Calc
20 with self
.ui_test
.load_file(get_url_for_data_file("tdf125440.odt")):
22 self
.xUITest
.executeCommand(".uno:SelectAll")
23 self
.xUITest
.executeCommand(".uno:Copy")
25 with self
.ui_test
.load_empty_file("calc") as calc_document
:
27 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
28 gridwin
= xCalcDoc
.getChild("grid_window")
30 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
32 self
.xUITest
.executeCommand(".uno:PasteUnformatted")
34 # Without the fix in place, this test would have failed with
35 # AssertionError: 'Row' != '"Row"'
36 self
.assertEqual("Row", get_cell_by_position(calc_document
, 0, 0, 0).getString())
37 self
.assertEqual("", get_cell_by_position(calc_document
, 0, 1, 0).getString())
38 self
.assertEqual("", get_cell_by_position(calc_document
, 0, 2, 0).getString())
39 self
.assertEqual("50", get_cell_by_position(calc_document
, 0, 3, 0).getString())
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: