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_url_for_data_file
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from uitest
.uihelper
.common
import get_state_as_dict
14 from libreoffice
.calc
.paste_special
import reset_default_values
16 class tdf142932(UITestCase
):
18 def test_tdf142932(self
):
19 with self
.ui_test
.load_file(get_url_for_data_file("tdf142932.ods")) as calc_doc
:
20 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= xCalcDoc
.getChild("grid_window")
23 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
24 self
.xUITest
.executeCommand(".uno:SelectRow")
26 self
.assertEqual("some comment", get_cell_by_position(calc_doc
, 0, 4, 0).Annotation
.String
)
28 self
.xUITest
.executeCommand(".uno:Copy")
30 with self
.ui_test
.execute_dialog_through_command(".uno:Insert") as xDialog
:
31 xAfter
= xDialog
.getChild('after')
32 xAfter
.executeAction("CLICK", tuple())
34 self
.assertEqual(get_state_as_dict(gridwin
)["SelectedTable"], "1")
36 with self
.ui_test
.execute_dialog_through_command(".uno:PasteSpecial") as xDialog
:
37 reset_default_values(self
, xDialog
)
39 xSkipEmpty
= xDialog
.getChild("skip_empty")
40 xSkipEmpty
.executeAction("CLICK", tuple())
41 self
.assertEqual('true', get_state_as_dict(xSkipEmpty
)['Selected'])
43 # Without the fix in place, this test would have crashed here
45 self
.assertEqual("A", get_cell_by_position(calc_doc
, 1, 0, 0).getString())
46 self
.assertEqual("row", get_cell_by_position(calc_doc
, 1, 1, 0).getString())
47 self
.assertEqual("with", get_cell_by_position(calc_doc
, 1, 2, 0).getString())
48 self
.assertEqual("comment", get_cell_by_position(calc_doc
, 1, 3, 0).getString())
49 self
.assertEqual("for", get_cell_by_position(calc_doc
, 1, 4, 0).getString())
50 self
.assertEqual("a", get_cell_by_position(calc_doc
, 1, 5, 0).getString())
51 self
.assertEqual("certain", get_cell_by_position(calc_doc
, 1, 6, 0).getString())
52 self
.assertEqual("cell", get_cell_by_position(calc_doc
, 1, 7, 0).getString())
54 self
.assertEqual("", get_cell_by_position(calc_doc
, 1, 4, 0).Annotation
.String
)
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: