tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / qa / uitest / calc_tests / fillRandomNumber.py
blobda40859232330dededa52f4dec06f2bdbeab0b06
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from uitest.framework import UITestCase
10 from uitest.uihelper.common import select_by_text
11 from libreoffice.calc.document import get_cell_by_position
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 #randomnumbergenerator.ui
15 class fillRandomNumber(UITestCase):
16 def test_fill_random_number(self):
17 with self.ui_test.create_doc_in_start_center("calc") as document:
18 xCalcDoc = self.xUITest.getTopFocusWindow()
19 gridwin = xCalcDoc.getChild("grid_window")
20 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
21 with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xDialog:
22 xcellrangeedit = xDialog.getChild("cell-range-edit")
23 xdistributioncombo = xDialog.getChild("distribution-combo")
24 xparameter1spin = xDialog.getChild("parameter1-spin")
25 xparameter2spin = xDialog.getChild("parameter2-spin")
26 xenableseedcheck = xDialog.getChild("enable-seed-check")
27 xseedspin = xDialog.getChild("seed-spin")
28 xenableroundingcheck = xDialog.getChild("enable-rounding-check")
29 xdecimalplacesspin = xDialog.getChild("decimal-places-spin")
31 xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"}))
32 select_by_text(xdistributioncombo, "Uniform Integer")
34 xparameter1spin.executeAction("UP", tuple())
35 xparameter2spin.executeAction("UP", tuple())
36 xenableseedcheck.executeAction("CLICK", tuple())
37 xseedspin.executeAction("UP", tuple())
38 xenableroundingcheck.executeAction("CLICK", tuple())
39 xdecimalplacesspin.executeAction("UP", tuple())
41 #Verify
42 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True)
43 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True)
44 #undo
45 self.xUITest.executeCommand(".uno:Undo")
46 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False)
47 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False)
48 #close dialog without doing anything
49 with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog", close_button="close"):
50 pass
52 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False)
53 self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False)
54 # vim: set shiftwidth=4 softtabstop=4 expandtab: