nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / goalSeek / goalSeek.py
blob59d8b894009d942307939dfe9f8ff493594a822e
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 from uitest.debug import sleep
14 import org.libreoffice.unotest
15 import pathlib
17 def get_url_for_data_file(file_name):
18 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
21 class goalSeek(UITestCase):
22 def test_goalSeek(self):
23 calc_doc = self.ui_test.load_file(get_url_for_data_file("goalSeek.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": "B4"}))
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":"15000"}))
34 xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"}))
35 xOKBtn = xDialog.getChild("ok")
37 def handle_OK_dlg(dialog):
38 print(dialog.getChildren())
39 xYesButn = dialog.getChild("yes")
40 self.ui_test.close_dialog_through_button(xYesButn)
42 self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()),
43 dialog_handler=handle_OK_dlg)
44 #verify
45 self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 200000)
46 self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 15000)
47 self.ui_test.close_doc()
49 # vim: set shiftwidth=4 softtabstop=4 expandtab: