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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tests/] [general/] [event0.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 the event emulation routines in the test suite"
3
}
4
 
5
proc TestEntry_Invoke {w} {
6
    global testEntry_Invoked testEntry_value1
7
 
8
    set testEntry_Invoked 1
9
    set testEntry_value1 [$w get]
10
}
11
 
12
proc Test {} {
13
    global foo
14
    set foo 0
15
 
16
    TestBlock event0-1.1 {Typing return in an entry widget} {
17
        global testEntry_Invoked testEntry_value0 testEntry_value1
18
 
19
        set testEntry_Invoked 0
20
        entry .e -textvariable testEntry_value0
21
        set testEntry_value0 "Entering some text ..."
22
        bind .e <Return> "TestEntry_Invoke .e"
23
        pack .e
24
        update
25
 
26
        KeyboardEvent .e <Return>
27
        update
28
        Assert {$testEntry_Invoked == 1}
29
        Assert {$testEntry_value0 == $testEntry_value1}
30
    }
31
 
32
    TestBlock event0-1.2 {Typing characters in an entry widget} {
33
        set testEntry_value0 ""
34
        set val "Typing the keyboard ..."
35
 
36
        focus .e
37
        .e delete 0 end
38
        update
39
        KeyboardString .e $val
40
        update
41
        Assert {[tixStrEq "$testEntry_value0" "$val"]}
42
    }
43
 
44
    TestBlock event0-1.3 {Typing characters and slashes in an entry widget} {
45
        set testEntry_value0 ""
46
        set val "Typing the \\ keyboard ..."
47
 
48
        focus .e
49
        .e delete 0 end
50
        KeyboardString .e $val
51
        update
52
        Assert {[tixStrEq "$testEntry_value0" "$val"]}
53
 
54
        destroy .e
55
    }
56
 
57
    TestBlock event0-1.4 {Testing ClickListboxEntry} {
58
        listbox .l -selectmode single
59
        .l insert end "index 0"
60
        .l insert end "index 1"
61
        .l insert end "index 2"
62
 
63
        pack .l; update
64
 
65
        for {set x 0} {$x <= 2} {incr x} {
66
            ClickListboxEntry .l $x single
67
            update
68
            Assert {[.l index active] == $x}
69
            Assert {[.l curselection] == $x}
70
        }
71
 
72
        destroy .l
73
        update
74
    }
75
 
76
    TestBlock event0-1.5 {Clicking a button} {
77
        button .b -command "set foo 1"
78
        pack .b; update
79
 
80
        Click .b
81
        Assert {$foo == 1}
82
    }
83
 
84
    TestBlock event0-1.6 {Drag and selecting a combobox} {
85
        tixComboBox .c
86
        .c insert end 10
87
        .c insert end 10
88
        .c insert end 10
89
        .c insert end 10
90
        .c insert end 10
91
        pack .c; update
92
 
93
        HoldDown [.c subwidget arrow]
94
        Drag [.c subwidget listbox] 10 10
95
        Release [.c subwidget listbox] 10 10
96
        Release [.c subwidget arrow] -30 30
97
 
98
        Assert {[.c cget -value] == "10"}
99
    }
100
}

powered by: WebSVN 2.1.0

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