/usr/share/doc/ldtp/examples/gcalctool.py is in ldtp 2.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | '''
LDTP v2 gcalctool example
@author: Eitan Isaacson <eitan@ascender.com>
@copyright: Copyright (c) 2009 Eitan Isaacson
@license: LGPL
http://ldtp.freedesktop.org
This file may be distributed and/or modified under the terms of the GNU General
Public License version 2 as published by the Free Software Foundation. This file
is distributed without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
See "COPYING" in the source distribution for more information.
Headers in this file shall remain intact.
'''
import ldtp
from time import sleep
import unittest
class WidgetTestCase(unittest.TestCase):
def setUp(self):
try:
ldtp.launchapp('gcalctool')
ldtp.waittillguiexist('frmCalculator*', guiTimeOut=5)
except:
self.tearDown()
raise
def tearDown(self):
ldtp.selectmenuitem('frmCalculator*', 'mnuQuit')
ldtp.waittillguinotexist('frmCalculator*')
def testViews(self):
for menu_item in ('mnuAdvanced',
'mnuFinancial',
'mnuScientific',
'mnuProgramming',
'mnuBasic'):
ldtp.selectmenuitem('frmCalculator*', menu_item)
sleep(1)
def testInteraction(self):
ldtp.click('frmCalculator*', 'btnNumeric1')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnNumeric2')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnNumeric3')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnNumeric4')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnMultiply')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnNumeric2')
sleep(0.5)
ldtp.click('frmCalculator*', 'btnCalculateresult')
if __name__ == '__main__':
unittest.main()
|