OSDN Git Service

*** empty log message ***
[pf3gnuchains/pf3gnuchains4x.git] / gdb / testsuite / gdb.gdbtk / windows.test
1 # Basic window tests
2 # Copyright 2001, 2003 Red Hat, Inc.
3 #
4 # This Program Is Free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 # This file was written by Keith Seitz (keiths@cygnus.com)
19
20 # Read in the standard defs file
21 if {![gdbtk_read_defs]} {
22   break
23 }
24
25 global objdir test_ran
26
27 # Windows to test
28 # FIXME: TfindArgs needs to be updated before it can go in the list...
29 set windows [list BpWin BrowserWin Console DebugWin KodWin LocalsWin \
30              MemWin ProcessWin RegWin StackWin TdumpWin WatchWin]
31
32 # Dialogs to test
33 # FIXME: ActionhDlg,TraceDlg cannot be independently opened
34 set dialogs [list About AttachDlg GlobalPref SrcPref TargetSelection]
35
36 # Helper proc to do all the testing
37 proc do_open_close {num winlist} {
38   set i 1
39   foreach win $winlist {
40
41     # Test: windows-$num.*
42     # Desc: Open each window before running
43     set win_obj ""
44     gdbtk_test windows-$num.$i "open $win before running" {
45       set err [catch {ManagedWin::open $win} txt]
46       if {$err} {
47         # display error
48         set txt
49       } else {
50         # display "0"
51         set win_obj $txt
52         set err
53       }
54     } {0}
55
56     # Update screen
57     update idletasks
58
59     # Test: windows-{$num+1}.*
60     # Desc: Close each window before running
61     gdbtk_test windows-[expr {$num+1}].$i "close $win before running" {
62       set err [catch {delete object $win_obj} txt]
63       if {$err} {
64         # display error
65         set txt
66       } else {
67         # display "0"
68         set err
69       }
70     } {0}
71
72     # Update screen
73     update idletasks
74     incr i
75   }
76 }
77
78 #
79 # Tests start here
80 #
81
82 # Counter for tests. Increment by 2 after each call to do_open_close.
83 set num 1
84
85 #
86 # Check if all windows open with no file loaded
87 #
88 do_open_close $num $windows
89 incr num 2
90
91 # Sadly, there is no good way to unpost dialogs (except for setting
92 # an after callback). Until something better comes along, skip them.
93 # do_open_close $num $dialogs
94 # incr num 2
95
96 #
97 # Check if all windows open with file loaded
98 #
99
100 # Load in a file
101 set program [file join $objdir c_variable]
102 if {[catch {gdbtk_test_file $program} t]} {
103   # This isn't a test case, since if this fails, we're hosed.
104   gdbtk_test_error "loading \"$program\": $t"
105 }
106
107 do_open_close $num $windows
108 incr num 2
109 #do_open_close $num $dialogs
110 incr num 2
111
112 #
113 # Check if all windows open after running
114 #
115
116 # Break in main and run
117 gdb_cmd "break main"
118 gdbtk_test_run
119
120 do_open_close $num $windows
121 incr num 2
122 #do_open_close $num $dialogs
123 #incr num 2
124
125 #
126 #  Exit
127 #
128 gdbtk_test_done