nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / calc_tests3 / tdf69981.py
blob34a4852b8aa3d2a7abb67e3b8c73a6129cd2e43f
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_sheet_from_doc
12 from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
13 from uitest.debug import sleep
14 from libreoffice.calc.document import get_cell_by_position
15 from libreoffice.uno.propertyvalue import mkPropertyValues
16 import org.libreoffice.unotest
17 import pathlib
19 def get_url_for_data_file(file_name):
20 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
22 class tdf69981(UITestCase):
24 def test_tdf69981_text_to_columns(self):
26 # FIXME flaky test, passed once, but broke multiple times.
27 return
28 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf69981.ods"))
29 xCalcDoc = self.xUITest.getTopFocusWindow()
30 gridwin = xCalcDoc.getChild("grid_window")
31 document = self.ui_test.get_component()
32 #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
33 self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
34 xDialogOpt = self.xUITest.getTopFocusWindow()
36 xPages = xDialogOpt.getChild("pages")
37 xWriterEntry = xPages.getChild('3') # Calc
38 xWriterEntry.executeAction("EXPAND", tuple())
39 xWriterGeneralEntry = xWriterEntry.getChild('0')
40 xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
41 xreplwarncb = xDialogOpt.getChild("replwarncb")
42 if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
43 xreplwarncb.executeAction("CLICK", tuple())
44 xOKBtn = xDialogOpt.getChild("ok")
45 self.ui_test.close_dialog_through_button(xOKBtn)
47 #Select A2:A7
48 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"}))
49 #Data - Text to Columns
50 self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
51 xDialog = self.xUITest.getTopFocusWindow()
52 xtab = xDialog.getChild("tab")
53 xcomma = xDialog.getChild("comma")
54 xtab.executeAction("CLICK", tuple())
55 xcomma.executeAction("CLICK", tuple())
56 #Click Ok
57 #overwrite warning come up
58 #press Ok.
59 xOK = xDialog.getChild("ok")
60 def handle_warn_dlg(dialog):
61 xyesBtn = dialog.getChild("yes")
62 self.ui_test.close_dialog_through_button(xyesBtn)
64 self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
65 dialog_handler=handle_warn_dlg)
66 #Verify
67 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Original")
68 self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a")
69 self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "")
70 self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "")
71 self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "a")
72 self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "a")
73 self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "a")
75 self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Copy")
76 self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "b")
77 self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "b")
78 self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "")
79 self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "")
80 self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "b")
81 self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "")
83 self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "")
84 self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "c")
85 self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "c")
86 self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "c")
87 self.assertEqual(get_cell_by_position(document, 0, 2, 4).getString(), "")
88 self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "")
89 self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "c")
91 self.ui_test.close_doc()
93 # vim: set shiftwidth=4 softtabstop=4 expandtab: