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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [tests/] [canvWind.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 out the procedures in tkCanvWind.c,
2
# which implement canvas "window" items.  It is organized in the standard
3
# fashion for Tcl tests.
4
#
5
# Copyright (c) 1997 Sun Microsystems, Inc.
6
#
7
# See the file "license.terms" for information on usage and redistribution
8
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
#
10
# RCS: @(#) $Id: canvWind.test,v 1.1.1.1 2002-01-16 10:25:58 markom Exp $
11
 
12
if {"[info procs test]" != "test"} {
13
    source defs
14
}
15
 
16
foreach i [winfo children .] {
17
    destroy $i
18
}
19
wm geometry . {}
20
raise .
21
 
22
test canvWind-1.1 {DisplayWinItem, windows off-screen vertically} {
23
    catch {destroy .t}
24
    toplevel .t
25
    canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
26
            -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
27
            -highlightthickness 1
28
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
29
    wm geometry .t +0+0
30
    set f .t.f
31
    frame $f -width 80 -height 50 -bg red
32
    .t.c create window 300 400 -window $f -anchor nw
33
    .t.c xview moveto .3
34
    .t.c yview moveto .50
35
    update
36
    set x [list [list [winfo ismapped $f] [winfo y $f]]]
37
    .t.c yview scroll 52 units
38
    update
39
    lappend x [list [winfo ismapped $f] [winfo y $f]]
40
    .t.c yview scroll 1 units
41
    update
42
    lappend x [list [winfo ismapped $f] [winfo y $f]]
43
    .t.c yview scroll -255 units
44
    update
45
    lappend x [list [winfo ismapped $f] [winfo y $f]]
46
    .t.c yview scroll -1 units
47
    update
48
    lappend x [list [winfo ismapped $f] [winfo y $f]]
49
} {{1 23} {1 -29} {0 -29} {1 225} {0 225}}
50
test canvWind-1.2 {DisplayWinItem, windows off-screen vertically} {
51
    catch {destroy .t}
52
    toplevel .t
53
    canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
54
            -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
55
            -highlightthickness 1
56
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
57
    wm geometry .t +0+0
58
    set f .t.c.f
59
    frame $f -width 80 -height 50 -bg red
60
    .t.c create window 300 400 -window $f -anchor nw
61
    .t.c xview moveto .3
62
    .t.c yview moveto .50
63
    update
64
    set x [list [list [winfo ismapped $f] [winfo y $f]]]
65
    .t.c yview scroll 52 units
66
    update
67
    lappend x [list [winfo ismapped $f] [winfo y $f]]
68
    .t.c yview scroll 1 units
69
    update
70
    lappend x [list [winfo ismapped $f] [winfo y $f]]
71
    .t.c yview scroll -255 units
72
    update
73
    lappend x [list [winfo ismapped $f] [winfo y $f]]
74
    .t.c yview scroll -1 units
75
    update
76
    lappend x [list [winfo ismapped $f] [winfo y $f]]
77
} {{1 3} {1 -49} {0 -49} {1 205} {0 205}}
78
test canvWind-1.3 {DisplayWinItem, windows off-screen horizontally} {
79
    catch {destroy .t}
80
    toplevel .t
81
    canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
82
            -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
83
            -highlightthickness 1
84
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
85
    wm geometry .t +0+0
86
    set f .t.f
87
    frame $f -width 80 -height 50 -bg red
88
    .t.c create window 300 400 -window $f -anchor nw
89
    .t.c xview moveto .3
90
    .t.c yview moveto .50
91
    update
92
    set x [list [list [winfo ismapped $f] [winfo x $f]]]
93
    .t.c xview scroll 82 units
94
    update
95
    lappend x [list [winfo ismapped $f] [winfo x $f]]
96
    .t.c xview scroll 1 units
97
    update
98
    lappend x [list [winfo ismapped $f] [winfo x $f]]
99
    .t.c xview scroll -335 units
100
    update
101
    lappend x [list [winfo ismapped $f] [winfo x $f]]
102
    .t.c xview scroll -1 units
103
    update
104
    lappend x [list [winfo ismapped $f] [winfo x $f]]
105
} {{1 23} {1 -59} {0 -59} {1 275} {0 275}}
106
test canvWind-1.4 {DisplayWinItem, windows off-screen horizontally} {
107
    catch {destroy .t}
108
    toplevel .t
109
    canvas .t.c -scrollregion {0 0 1000 800} -width 250 -height 200 -bd 2 \
110
            -relief sunken -xscrollincrement 1 -yscrollincrement 1 \
111
            -highlightthickness 1
112
    pack .t.c -fill both -expand 1 -padx 20 -pady 20
113
    wm geometry .t +0+0
114
    set f .t.c.f
115
    frame $f -width 80 -height 50 -bg red
116
    .t.c create window 300 400 -window $f -anchor nw
117
    .t.c xview moveto .3
118
    .t.c yview moveto .50
119
    update
120
    set x [list [list [winfo ismapped $f] [winfo x $f]]]
121
    .t.c xview scroll 82 units
122
    update
123
    lappend x [list [winfo ismapped $f] [winfo x $f]]
124
    .t.c xview scroll 1 units
125
    update
126
    lappend x [list [winfo ismapped $f] [winfo x $f]]
127
    .t.c xview scroll -335 units
128
    update
129
    lappend x [list [winfo ismapped $f] [winfo x $f]]
130
    .t.c xview scroll -1 units
131
    update
132
    lappend x [list [winfo ismapped $f] [winfo x $f]]
133
} {{1 3} {1 -79} {0 -79} {1 255} {0 255}}

powered by: WebSVN 2.1.0

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