Debian Codegraph @

sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py

raw symbols SCIP
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9 from uitest.framework import UITestCase
10 from libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import get_url_for_data_file
12 from uitest.uihelper.common import get_state_as_dict
13 from libreoffice.calc.document import get_cell_by_position
14
15 class tdf129701(UITestCase):
16
17 def test_tdf129701(self):
18
19 with self.ui_test.load_file(get_url_for_data_file("tdf129701.ods")):
20 xCalcDoc = self.xUITest.getTopFocusWindow()
21 gridwin = xCalcDoc.getChild("grid_window")
22 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D21:F25"}))
23 self.xUITest.executeCommand(".uno:Copy")
24
25 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "J4"}))
26 with self.ui_test.execute_dialog_through_command(".uno:PasteUnformatted", close_button="ok") as xDialog:
27
28 xSkipEmtyCells = xDialog.getChild("skipemptycells")
29 xSeparatedBy = xDialog.getChild("toseparatedby")
30 xTab = xDialog.getChild("tab")
31 xMergeDelimiters = xDialog.getChild("mergedelimiters")
32
33 xSeparatedBy.executeAction("CLICK", tuple())
34 if get_state_as_dict(xTab)['Selected'] == 'false':
35 xTab.executeAction("CLICK", tuple())
36 if get_state_as_dict(xMergeDelimiters)['Selected'] == 'true':
37 xMergeDelimiters.executeAction("CLICK", tuple())
38 if get_state_as_dict(xSkipEmtyCells)['Selected'] == 'true':
39 xSkipEmtyCells.executeAction("CLICK", tuple())
40 # Check whether Skip empty cells is unselected
41 self.assertEqual('false', get_state_as_dict(xSkipEmtyCells)['Selected'])
42
43 document = self.ui_test.get_component()
44 # Without the fix in place, this test would have failed with
45 # non empty cells in column 11
46
47 self.assertEqual( "x1", get_cell_by_position(document, 0, 9, 3).getString())
48 self.assertEqual( "" , get_cell_by_position(document, 0,10, 3).getString())
49 self.assertEqual( "" , get_cell_by_position(document, 0,11, 3).getString())
50 self.assertEqual("A16", get_cell_by_position(document, 0,12, 3).getString())
51 self.assertEqual( "" , get_cell_by_position(document, 0, 9, 4).getString())
52 self.assertEqual( "x2", get_cell_by_position(document, 0,10, 4).getString())
53 self.assertEqual( "" , get_cell_by_position(document, 0,11, 4).getString())
54 self.assertEqual("A17", get_cell_by_position(document, 0,12, 4).getString())
55 self.assertEqual( "" , get_cell_by_position(document, 0, 9, 5).getString())
56 self.assertEqual( "" , get_cell_by_position(document, 0,10, 5).getString())
57 self.assertEqual( "x3", get_cell_by_position(document, 0,11, 5).getString())
58 self.assertEqual("A18", get_cell_by_position(document, 0,12, 5).getString())
59 self.assertEqual( "" , get_cell_by_position(document, 0, 9, 6).getString())
60 self.assertEqual( "x4", get_cell_by_position(document, 0,10, 6).getString())
61 self.assertEqual( "" , get_cell_by_position(document, 0,11, 6).getString())
62 self.assertEqual("A19", get_cell_by_position(document, 0,12, 6).getString())
63 self.assertEqual( "x5", get_cell_by_position(document, 0, 9, 7).getString())
64 self.assertEqual( "x6", get_cell_by_position(document, 0,10, 7).getString())
65 self.assertEqual( "x7", get_cell_by_position(document, 0,11, 7).getString())
66 self.assertEqual("A20", get_cell_by_position(document, 0,12, 7).getString())
67
68 self.ui_test.close_doc()
69
70 # vim: set shiftwidth=4 softtabstop=4 expandtab: