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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/usr/bin/env python
#
# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
#
# Description:
# This set of test scripts will test the LDTP framework for correct
# functioning of its APIs. This is a Regression Suite.
#
# Author:
# Prashanth Mohan <prashmohan@gmail.com>
#
#
# This test script is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
from regression import *
import random, os
data_object = LdtpDataFileParser (datafilename)
tab_width = data_object.gettagvalue ('tabwidth')
if tab_width == []:
tab_width = 10
else:
tab_width = int(tab_width[0])
try:
check_open('gedit')
except:
raise
pref = '*Pref*'
log ('getvalue','teststart')
try:
open_pref()
if guiexist (pref) != 1:
log ('Gedit Preferences Window not open','cause')
raise LdtpExecutionError (0)
tab = getvalue (pref,'sbtnTabwidth')
flag = True
try:
getvalue (pref,'sbtnSOMETHINGNOTPRESENT')
except:
flag = False
if flag:
log ('get value works for non present objects','cause')
raise LdtpExecutionError (0)
except:
testfail ('getvalue')
raise LdtpExecutionError (0)
testpass ('getvalue')
log ('setvalue','teststart')
try:
setvalue (pref,'sbtnTabwidth',tab_width)
time.sleep (2)
if int(getvalue (pref,'sbtnTabwidth')) != tab_width: #and \
# verifysetvalue (pref,'sbtnTabwidth',tab_width) == 1:
log ('Spin Button value not set','cause')
raise LdtpExecutionError (0)
setvalue (pref,'sbtnTabwidth',tab)
if getvalue (pref,'sbtnTabwidth') != tab:# and \:
# verifysetvalue (pref,'sbtnTabwidth',tab) == 1:
log ('Spin Button value not set to initial value','cause')
raise LdtpExecutionError (0)
except:
testfail ('setvalue')
raise LdtpExecutionError (0)
testpass ('setvalue')
click (pref, 'btnClose')
|