summaryrefslogtreecommitdiff
path: root/reg-suite/checkmenuitem.py
blob: fb6154a14509e125c5958cf8705e021a4f3f59b8 (plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
#!/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

try:
    check_open('gedit')
except:
    raise


log ('menucheck','teststart')
try:
    if menucheck ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('Undefined return value','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    #time.sleep (2)
    if verifymenucheck ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('verifymenucheck - Check Menu item not checked','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    if verifymenuuncheck ('*gedit','mnuView;mnuStatusbar') != 0:
        log ('verifymenuuncheck - Check Menu item not checked','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
except:
    testfail ('menucheck')
    raise LdtpExecutionError (str (traceback.format_exc ()))
testpass ('menucheck')



log ('menuuncheck','teststart')
try:
    if menuuncheck ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('Undefined return value','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    #time.sleep (2)
    if verifymenuuncheck ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('verifymenuuncheck - Check Menu item not checked','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    if verifymenucheck ('*gedit','mnuView;mnuStatusbar') != 0:
        log ('verifymenucheck - Check Menu item not checked','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
except:
    testfail ('menuuncheck')
    raise LdtpExecutionError (str (traceback.format_exc ()))
testpass ('menuuncheck')


log ('selectmenuitem on checkmenu','teststart')
try:
    curstate = verifymenucheck ('*gedit','mnuView;mnuStatusbar')
    if selectmenuitem ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('Undefined return value','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    #time.sleep (2)
    if verifymenucheck ('*gedit','mnuView;mnuStatusbar') == curstate:
        log ('verifymenucheck - Check Menu item not inverted','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    curstate = verifymenucheck ('*gedit','mnuView;mnuStatusbar')
    if selectmenuitem ('*gedit','mnuView;mnuStatusbar') != 1:
        log ('Undefined return value','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
    #time.sleep (2)
    if verifymenucheck ('*gedit','mnuView;mnuStatusbar') == curstate:
        log ('verifymenucheck - Check Menu item not inverted 2nd time','cause')
        raise LdtpExecutionError (str (traceback.format_exc ()))
except:
    testfail ('selectmenuitem on checkmenu')
    raise LdtpExecutionError (str (traceback.format_exc ()))
testpass ('selectmenuitem on checkmenu')