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 43693 - Goal Seek: reproducible crash using "target value search"
21 class tdf43693(UITestCase
):
22 def test_tdf43693_goalSeek(self
):
23 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf43693.ods"))
24 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
25 gridwin
= xCalcDoc
.getChild("grid_window")
26 document
= self
.ui_test
.get_component()
27 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "K248"}))
28 self
.ui_test
.execute_modeless_dialog_through_command(".uno:GoalSeekDialog")
29 xDialog
= self
.xUITest
.getTopFocusWindow()
30 xformulaedit
= xDialog
.getChild("formulaedit")
31 xtarget
= xDialog
.getChild("target")
32 xvaredit
= xDialog
.getChild("varedit")
33 xtarget
.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
34 xvaredit
.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"}))
35 xOKBtn
= xDialog
.getChild("ok")
36 def handle_OK_dlg(dialog
):
37 xYesButn
= dialog
.getChild("yes")
38 self
.ui_test
.close_dialog_through_button(xYesButn
)
40 self
.ui_test
.execute_blocking_action(xOKBtn
.executeAction
, args
=('CLICK', ()),
41 dialog_handler
=handle_OK_dlg
)
43 self
.assertEqual(get_cell_by_position(document
, 0, 7, 4).getValue(), 0.04)
44 self
.ui_test
.close_doc()
46 # vim: set shiftwidth=4 softtabstop=4 expandtab: