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
16 def get_url_for_data_file(file_name
):
17 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
19 #Bug 118207 - CRASH: Cutting and pasting a conditional format column and undoing
21 class tdf118207(UITestCase
):
22 def test_tdf118207(self
):
23 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf118189.xlsx"))
24 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
25 gridwin
= xCalcDoc
.getChild("grid_window")
26 document
= self
.ui_test
.get_component()
27 #Make sure that tools-options-LibreOffice Calc-General-Input settings-Show overwrite warning when pasting data is NOT tagged.
28 self
.ui_test
.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
29 xDialogOpt
= self
.xUITest
.getTopFocusWindow()
31 xPages
= xDialogOpt
.getChild("pages")
32 xCalcEntry
= xPages
.getChild('3') # Calc
33 xCalcEntry
.executeAction("EXPAND", tuple())
34 xCalcGeneralEntry
= xCalcEntry
.getChild('0')
35 xCalcGeneralEntry
.executeAction("SELECT", tuple()) #General / replwarncb
36 xreplwarncb
= xDialogOpt
.getChild("replwarncb")
37 if (get_state_as_dict(xreplwarncb
)["Selected"]) == "true":
38 xreplwarncb
.executeAction("CLICK", tuple())
39 xOKBtn
= xDialogOpt
.getChild("ok")
40 self
.ui_test
.close_dialog_through_button(xOKBtn
)
43 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
44 self
.xUITest
.executeCommand(".uno:SelectColumn")
45 self
.xUITest
.executeCommand(".uno:Cut")
46 #Paste it in Column B , Paste it in Column B again
47 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
48 self
.xUITest
.executeCommand(".uno:Paste")
49 self
.xUITest
.executeCommand(".uno:Paste")
51 self
.xUITest
.executeCommand(".uno:Undo")
52 self
.xUITest
.executeCommand(".uno:Undo")
53 self
.xUITest
.executeCommand(".uno:Undo")
55 self
.assertEqual(get_cell_by_position(document
, 0, 0, 0).getString() , "On Back Order")
58 self
.ui_test
.close_doc()
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: