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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tests/] [general/] [var1.tcl] - Blame information for rev 1771

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

Line No. Rev Author Line
1 578 markom
proc About {} {
2
    return "Testing -variable option with Tix widgets"
3
}
4
 
5
proc Test {} {
6
    global foo bar arr
7
 
8
    set classes {tixControl tixComboBox}
9
    set value 1234
10
 
11
    foreach class $classes {
12
        set w [$class .foo]
13
        pack $w
14
        update idletasks
15
 
16
        TestBlock var1-1.1 {$class: config -variable with initialized value} {
17
            set bar $value
18
            $w config -variable bar
19
            update idletasks
20
            Assert {[$w cget -value] == $value}
21
        }
22
 
23
        TestBlock var1-1.2 {$class: config -variable w/ uninitialized value} {
24
            destroy $w
25
            set w [$class .foo]
26
            $w config -variable bar
27
            Assert {[$w cget -value] == $bar}
28
        }
29
 
30
        TestBlock var1-1.2 {$class: config -variable} {
31
            set foo 111
32
            $w config -variable foo
33
            update idletasks
34
            Assert {[$w cget -value] == $foo}
35
        }
36
 
37
        TestBlock var1-1.2 {$class: config -value} {
38
            $w config -value 123
39
            Assert {[$w cget -value] == 123}
40
            Assert {[set [$w cget -variable]] == 123}
41
        }
42
 
43
        TestBlock var1-1.2 {$class: config -variable on array variable} {
44
            set arr(12) 1234
45
            $w config -variable arr(12)
46
            Assert {[$w cget -value] == $arr(12)}
47
        }
48
 
49
        TestBlock var1-1.2 {$class: config -value on array variable} {
50
            $w config -value 12
51
            Assert {[$w cget -value] == 12}
52
            Assert {[set [$w cget -variable]] == 12}
53
        }
54
 
55
        catch {
56
            destroy $w
57
        }
58
    }
59
}

powered by: WebSVN 2.1.0

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