Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf89907.py
blob13a96014572e4831cf934effeab68e8d26da591d
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest.framework import UITestCase
8 from uitest.uihelper.common import get_state_as_dict
9 from uitest.uihelper.common import select_pos
10 from uitest.uihelper.calc import enter_text_to_cell
11 from libreoffice.calc.document import get_cell_by_position
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 #Bug 89907 - Text to columns only affects first line when width is auto set
15 class tdf89907(UITestCase):
16 def test_tdf89907_text_to_columns(self):
17 calc_doc = self.ui_test.create_doc_in_start_center("calc")
18 xCalcDoc = self.xUITest.getTopFocusWindow()
19 gridwin = xCalcDoc.getChild("grid_window")
20 document = self.ui_test.get_component()
22 #Add data
23 enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd")
24 enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342")
25 enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad")
26 enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111")
27 #select column A
28 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
29 self.xUITest.executeCommand(".uno:SelectColumn")
30 #Optimal Width
31 self.xUITest.executeCommand(".uno:SetOptimalColumnWidthDirect")
32 # Data - Text to Columns
33 self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
34 xDialog = self.xUITest.getTopFocusWindow()
35 xother = xDialog.getChild("other")
36 xinputother = xDialog.getChild("inputother")
37 if (get_state_as_dict(xother)["Selected"]) == "false":
38 xother.executeAction("CLICK", tuple())
39 xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
40 # Click Ok
41 xOK = xDialog.getChild("ok")
42 self.ui_test.close_dialog_through_button(xOK)
44 #Verify
45 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs")
46 self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242)
47 self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa")
48 self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312)
49 self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd")
50 self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242)
51 self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa")
52 self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111)
53 self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf")
54 self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242)
55 self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas")
56 self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111)
57 self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd")
58 self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342)
59 self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad")
60 self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111)
62 self.ui_test.close_doc()
64 # vim: set shiftwidth=4 softtabstop=4 expandtab: