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

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [iwidgets3.0.0/] [tests/] [pushbutton.test] - Blame information for rev 578

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 [incr Widgets] Pushbutton class.
2
# It is organized in the standard fashion for Tcl tests with the following
3
# notation for test case labels:
4
#
5
#   1.x - Construction/Destruction tests
6
#   2.x - Configuration option tests
7
#   3.x - Method tests
8
#
9
# Copyright (c) 1995 DSC Technologies Corporation
10
#
11
# See the file "license.terms" for information on usage and redistribution
12
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
#
14
# @(#) $Id: pushbutton.test,v 1.1.1.1 2002-01-16 10:24:51 markom Exp $
15
 
16
package require Iwidgets 3.0
17
 
18
if {[string compare test [info procs test]] == 1} {
19
    source defs
20
}
21
 
22
wm geometry . {}
23
raise .
24
 
25
set c 1
26
set o 1
27
set m 1
28
 
29
#
30
# Initial construction test
31
#
32
test Pushbutton-1.$c {Pushbutton construction} {
33
    iwidgets::Pushbutton .pb
34
    pack .pb -padx 10 -pady 10
35
    image create bitmap flagup -file $tk_library/demos/images/flagup.bmp
36
    update
37
} {}
38
 
39
incr c
40
 
41
#
42
# Option tests which are successful.
43
#
44
test Pushbutton-2.$o {configuration option} {
45
    llength [.pb configure]
46
} {27}
47
 
48
incr o
49
 
50
foreach test {
51
        {-activebackground #ececec #ececec}
52
        {-activeforeground Black Black}
53
        {-background #d9d9d9 #d9d9d9}
54
        {-borderwidth 2 2}
55
        {-command {.pb configure -background Red} {.pb configure -background Red}}
56
        {-defaultring 1 1}
57
        {-text Hello Hello}
58
        {-width 100 100}
59
        {-bitmap error error}
60
        {-image flagup flagup}
61
        {-defaultring 0 0}
62
        {-padx 10 10}
63
        {-padx 8 8}
64
        {-pady 8 8}
65
        {-pady 4 4}
66
        {-image {} {}}
67
        {-cursor gumby gumby}
68
        {-bitmap {} {}}
69
        {-font 6x13 6x13}
70
        {-foreground Black Black}
71
        {-height 70 70}
72
        {-width 100 100}
73
        {-underline 0 0}
74
        {-highlightthickness 3 3}
75
        {-highlightcolor blue blue}
76
        {-highlightcolor black black}
77
        {-highlightthickness 2 2}
78
        {-state disabled disabled}
79
        {-state normal normal}
80
        {-defaultringpad 6 6}
81
        {-width 120 120}} {
82
        set option [lindex $test 0]
83
        test Pushbutton-2.$o "configuration options, $option" {
84
            .pb configure $option [lindex $test 1]
85
            lindex [.pb configure $option] 4
86
        } [lindex $test 2]
87
        update
88
        incr o
89
}
90
 
91
#
92
# Method tests which are successful.
93
#
94
foreach test {
95
    {{.pb flash} {}}
96
    {{.pb invoke} {}}} {
97
        set method [lindex [lindex $test 0] 1]
98
        test Pushbutton-3.$m "object methods, $method" {
99
            list [catch {eval [lindex $test 0]} msg] $msg
100
        } [list 0 [lindex $test 1]]
101
        update
102
        incr m
103
}
104
 
105
#
106
# Conclusion of constrcution/destruction tests
107
#
108
test Pushbutton-1.$c {Pushbutton destruction} {
109
    destroy .pb
110
    update
111
    image delete flagup
112
} {}
113
 
114
incr c
115
 
116
test Pushbutton-1.$c {Pushbutton construction} {
117
    iwidgets::pushbutton .pb -text "Push Button" -defaultring yes
118
    pack .pb -padx 10 -pady 10
119
    update
120
} {}
121
 
122
incr c
123
 
124
test Pushbutton-1.$c {Pushbutton destruction} {
125
    destroy .pb
126
    update
127
} {}
128
 
129
incr c
130
 
131
test Pushbutton-1.$c {Pushbutton destruction} {
132
    iwidgets::pushbutton .pb
133
    pack .pb
134
    destroy .pb
135
    update
136
} {}

powered by: WebSVN 2.1.0

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