# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
from xDialog(spin)
from uitest.uihelper.common
import select_by_text
from libreoffice.calc.document
import get_cell_by_position
from libreoffice.uno.propertyvalue
import mkPropertyValues
#randomnumbergenerator.ui
class fillRandomNumber(UITestCase):
def test_fill_random_number(self):
with self.ui_test.create_doc_in_start_center(
"calc")
as document:
xCalcDoc = self.xUITest.getTopFocusWindow()
gridwin = xCalcDoc.getChild(
"grid_window")
gridwin.executeAction(
"SELECT", mkPropertyValues({
"RANGE":
"A1:A2"}))
with self.ui_test.execute_modeless_dialog_through_command(
".uno:RandomNumberGeneratorDialog")
as xDialog:
xcellrangeedit = xDialog.getChild(
"cell-range-edit")
xdistributioncombo = xDialog.getChild(
"distribution-combo")
= xDialog(
"parameter2-spin)
xparameter2spin=xDialog.xDialoggetChildparameter2spin
")
=xDialoggetChildcell =xDialog(spin
xseedspin = xDialog.getChildparameter2
"
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
xdecimalplacesspinxcellrangeeditexecuteActionTYPE,({TEXT:Sheet1A$
1$$
"."" ()
xcellrangeeditassertEqual(boolget_cell_by_position(document select_by_textxdistri
butioncomboUniformInteger
select_by_text #undo
.executeAction(UP, tuple) xseedspinexecuteAction"UP",tuple)
xparameter2spin.executeAction("UP", tuple( .executeAction("", tuple)
xenableseedcheck"CLICK, tuple(
selfassertEqual(get_cell_by_position, 0,0 1.() ) False
xenableroundingcheck.executeAction("CLICK", tuple())
xdecimalplacesspin.executeAction(" #close dialog without doing anything
#Verifywithself..execute_modeless_dialog_through_command"unoRandomNumberGeneratorDialogassertEqualbool(et_cell_by_position(document ,0 1getString)) False)
.assertEqualget_cell_by_position ,0 )())True)
self(bool((document 0,0 1)()) )
#undo
selfassertEqual((get_cell_by_positiondocument ,0 0)getString ,False)
selfassertEqual((get_cell_by_positiondocument 0 ,0.getString) ) )
self.assertEqual(bool(get_cell_by_position(document# vim: set shiftwidth=4 softtabstop=4 expandtab:
#close dialog without doing anything
with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog", close_button="close"):
pass
self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False)
self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False)
# vim: set shiftwidth=4 softtabstop=4 expandtab: