Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf85979.py
blob359a0f35c51174df7a4f76d5db60933768cd641f
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 import org.libreoffice.unotest
14 import pathlib
15 #Bug 85979 - Crash: data text to columns
16 def get_url_for_data_file(file_name):
17 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
19 class tdf85979(UITestCase):
20 def test_td85979_text_to_columns(self):
21 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf85979.ods"))
22 xCalcDoc = self.xUITest.getTopFocusWindow()
23 gridwin = xCalcDoc.getChild("grid_window")
24 document = self.ui_test.get_component()
26 #(I selected C1 to C5, then Text to Columns, unselected "Tab" and selected "Space")
27 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C5"}))
28 # Data - Text to Columns
29 self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
30 xDialog = self.xUITest.getTopFocusWindow()
31 xspace = xDialog.getChild("space")
32 if (get_state_as_dict(xspace)["Selected"]) == "false":
33 xspace.executeAction("CLICK", tuple())
34 # Click Ok
35 xOK = xDialog.getChild("ok")
36 self.ui_test.close_dialog_through_button(xOK)
38 #Verify
39 self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 99)
40 self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 4)
41 self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 9)
42 self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 9)
43 self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 260)
44 self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 10)
45 self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 23)
46 self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 23)
47 self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 149)
48 self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 6)
49 self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 14)
50 self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 14)
51 self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
52 self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 16)
53 self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 35)
54 self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 35)
56 self.ui_test.close_doc()
58 # vim: set shiftwidth=4 softtabstop=4 expandtab: