OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [tests/] [window.test] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# This file is a Tcl script to test the procedures in the file
2
# tkWindow.c.  It is organized in the standard fashion for Tcl tests.
3
#
4
# Copyright (c) 1995 Sun Microsystems, Inc.
5
#
6
# See the file "license.terms" for information on usage and redistribution
7
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8
#
9
# RCS: @(#) $Id: window.test,v 1.1.1.1 2002-01-16 10:26:00 markom Exp $
10
 
11
if {[info procs test] != "test"} {
12
    source defs
13
}
14
 
15
foreach i [winfo children .] {
16
    destroy $i
17
}
18
wm geometry . {}
19
raise .
20
update
21
 
22
# XXX This file is woefully incomplete.  Right now it only tests
23
# a few parts of a few procedures in tkWindow.c
24
 
25
test window-1.1 {Tk_CreateWindowFromPath procedure, parent dead} {
26
    proc bgerror msg {
27
        global x errorInfo
28
        set x [list $msg $errorInfo]
29
    }
30
    set x unchanged
31
    catch {destroy .t}
32
    frame .t -width 100 -height 50
33
    place .t -x 10 -y 10
34
    bind .t  {button .t.b -text hello; pack .t.b}
35
    update
36
    destroy .t
37
    update
38
    rename bgerror {}
39
    set x
40
} {{can't create window: parent has been destroyed} {can't create window: parent has been destroyed
41
    while executing
42
"button .t.b -text hello"
43
    (command bound to event)}}
44
 
45
# Most of the tests below don't produce meaningful results;  they
46
# will simply dump core if there are bugs.
47
 
48
test window-2.1 {Tk_DestroyWindow procedure, destroy handler deletes parent} {
49
    toplevel .t -width 300 -height 200
50
    wm geometry .t +0+0
51
    frame .t.f  -width 200 -height 200 -relief raised -bd 2
52
    place .t.f -x 0 -y 0
53
    frame .t.f.f -width 100 -height 100 -relief raised -bd 2
54
    place .t.f.f -relx 1 -rely 1 -anchor se
55
    bind .t.f  {destroy .t}
56
    update
57
    destroy .t.f
58
} {}
59
test window-2.2 {Tk_DestroyWindow procedure, destroy handler deletes parent} {
60
    toplevel .t -width 300 -height 200
61
    wm geometry .t +0+0
62
    frame .t.f  -width 200 -height 200 -relief raised -bd 2
63
    place .t.f -x 0 -y 0
64
    frame .t.f.f -width 100 -height 100 -relief raised -bd 2
65
    place .t.f.f -relx 1 -rely 1 -anchor se
66
    bind .t.f.f  {destroy .t}
67
    update
68
    destroy .t.f
69
} {}
70
test window-2.3 {Tk_DestroyWindow procedure, destroy handler deletes parent} {
71
    frame .f -width 80 -height 120 -relief raised -bd 2
72
    place .f -relx 0.5 -rely 0.5 -anchor center
73
    toplevel .f.t -width 300 -height 200
74
    wm geometry .f.t +0+0
75
    frame .f.t.f  -width 200 -height 200 -relief raised -bd 2
76
    place .f.t.f -x 0 -y 0
77
    frame .f.t.f.f -width 100 -height 100 -relief raised -bd 2
78
    place .f.t.f.f -relx 1 -rely 1 -anchor se
79
    update
80
    destroy .f
81
} {}
82
 
83
if {[string compare testmenubar [info commands testmenubar]] != 0} {
84
    puts "This application hasn't been compiled with the testmenubar command,"
85
    puts "therefore I am skipping all of these tests."
86
    return
87
}
88
 
89
test window-3.1 {Tk_MakeWindowExist procedure, stacking order and menubars} unixOnly {
90
    catch {destroy .t}
91
    toplevel .t -width 300 -height 200
92
    wm geometry .t +0+0
93
    pack [entry .t.e]
94
    frame .t.f -bd 2 -relief raised
95
    testmenubar window .t .t.f
96
    update
97
    # If stacking order isn't handle properly, generates an X error.
98
} {}
99
test window-3.2 {Tk_MakeWindowExist procedure, stacking order and menubars} unixOnly {
100
    catch {destroy .t}
101
    toplevel .t -width 300 -height 200
102
    wm geometry .t +0+0
103
    pack [entry .t.e]
104
    pack [entry .t.e2]
105
    update
106
    frame .t.f -bd 2 -relief raised
107
    raise .t.f .t.e
108
    testmenubar window .t .t.f
109
    update
110
    # If stacking order isn't handled properly, generates an X error.
111
} {}
112
 
113
test window-4.1 {Tk_NameToWindow procedure} {
114
    catch {destroy .t}
115
    list [catch {winfo geometry .t} msg] $msg
116
} {1 {bad window path name ".t"}}
117
test window-4.2 {Tk_NameToWindow procedure} {
118
    catch {destroy .t}
119
    frame .t -width 100 -height 50
120
    place .t -x 10 -y 10
121
    update
122
    list [catch {winfo geometry .t} msg] $msg
123
} {0 100x50+10+10}
124
 
125
test window-5.1 {Tk_MakeWindowExist procedure, stacking order and menubars} unixOnly {
126
    catch {destroy .t}
127
    toplevel .t -width 300 -height 200
128
    wm geometry .t +0+0
129
    pack [entry .t.e]
130
    pack [entry .t.e2]
131
    frame .t.f -bd 2 -relief raised
132
    testmenubar window .t .t.f
133
    update
134
    lower .t.e2 .t.f
135
    update
136
    # If stacking order isn't handled properly, generates an X error.
137
} {}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.