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_state_as_dict
11 from uitest
.uihelper
.calc
import enter_text_to_cell
12 from libreoffice
.calc
.document
import get_cell_by_position
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 #Bug 51700 - Text to columns puts result into first line if whole column is selected
16 class tdf51700(UITestCase
):
17 def test_tdf51700_text_to_columns(self
):
18 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
23 enter_text_to_cell(gridwin
, "A2", "3242,43242,3242,2342")
24 enter_text_to_cell(gridwin
, "A3", "fdsfa,afsdfa,adfdas,fsad")
25 enter_text_to_cell(gridwin
, "A4", "21312,1111,1111,111")
27 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
28 self
.xUITest
.executeCommand(".uno:SelectColumn")
29 # Data - Text to Columns
30 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns") as xDialog
:
31 xcomma
= xDialog
.getChild("comma")
32 if (get_state_as_dict(xcomma
)["Selected"]) == "false":
33 xcomma
.executeAction("CLICK", tuple())
37 self
.assertEqual(get_cell_by_position(document
, 0, 0, 1).getValue(), 3242)
38 self
.assertEqual(get_cell_by_position(document
, 0, 0, 2).getString(), "fdsfa")
39 self
.assertEqual(get_cell_by_position(document
, 0, 0, 3).getValue(), 21312)
40 self
.assertEqual(get_cell_by_position(document
, 0, 1, 1).getValue(), 43242)
41 self
.assertEqual(get_cell_by_position(document
, 0, 1, 2).getString(), "afsdfa")
42 self
.assertEqual(get_cell_by_position(document
, 0, 1, 3).getValue(), 1111)
43 self
.assertEqual(get_cell_by_position(document
, 0, 2, 1).getValue(), 3242)
44 self
.assertEqual(get_cell_by_position(document
, 0, 2, 2).getString(), "adfdas")
45 self
.assertEqual(get_cell_by_position(document
, 0, 2, 3).getValue(), 1111)
46 self
.assertEqual(get_cell_by_position(document
, 0, 3, 1).getValue(), 2342)
47 self
.assertEqual(get_cell_by_position(document
, 0, 3, 2).getString(), "fsad")
48 self
.assertEqual(get_cell_by_position(document
, 0, 3, 3).getValue(), 111)
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: