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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
# Basic window tests
# Copyright 2001, 2003 Red Hat, Inc.
#
# This Program Is Free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# This file was written by Keith Seitz (keiths@cygnus.com)
# Read in the standard defs file
if {![gdbtk_read_defs]} {
break
}
global objdir test_ran
# Windows to test
# FIXME: TfindArgs needs to be updated before it can go in the list...
set windows [list BpWin BrowserWin Console DebugWin KodWin LocalsWin \
MemWin ProcessWin RegWin StackWin TdumpWin WatchWin]
# Dialogs to test
# FIXME: ActionhDlg,TraceDlg cannot be independently opened
set dialogs [list About AttachDlg GlobalPref SrcPref TargetSelection]
# Helper proc to do all the testing
proc do_open_close {num winlist} {
set i 1
foreach win $winlist {
# Test: windows-$num.*
# Desc: Open each window before running
set win_obj ""
gdbtk_test windows-$num.$i "open $win before running" {
set err [catch {ManagedWin::open $win} txt]
if {$err} {
# display error
set txt
} else {
# display "0"
set win_obj $txt
set err
}
} {0}
# Update screen
update idletasks
# Test: windows-{$num+1}.*
# Desc: Close each window before running
gdbtk_test windows-[expr {$num+1}].$i "close $win before running" {
set err [catch {delete object $win_obj} txt]
if {$err} {
# display error
set txt
} else {
# display "0"
set err
}
} {0}
# Update screen
update idletasks
incr i
}
}
#
# Tests start here
#
# Counter for tests. Increment by 2 after each call to do_open_close.
set num 1
#
# Check if all windows open with no file loaded
#
do_open_close $num $windows
incr num 2
# Sadly, there is no good way to unpost dialogs (except for setting
# an after callback). Until something better comes along, skip them.
# do_open_close $num $dialogs
# incr num 2
#
# Check if all windows open with file loaded
#
# Load in a file
set program [file join $objdir c_variable]
if {[catch {gdbtk_test_file $program} t]} {
# This isn't a test case, since if this fails, we're hosed.
gdbtk_test_error "loading \"$program\": $t"
}
do_open_close $num $windows
incr num 2
#do_open_close $num $dialogs
incr num 2
#
# Check if all windows open after running
#
# Break in main and run
gdb_cmd "break main"
gdbtk_test_run
do_open_close $num $windows
incr num 2
#do_open_close $num $dialogs
#incr num 2
#
# Exit
#
gdbtk_test_done
|