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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [tests/] [hlist/] [HList.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# HList.tcl --
2
#
3
#       General HList test.
4
#
5
# Copyright (c) 1996, Expert Interface Technologies
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
 
11
proc About {} {
12
    return "General tests for the HList widget"
13
}
14
 
15
 
16
proc Test {} {
17
    set h [tixHList .h -selectmode single]
18
    pack $h -expand yes -fill both
19
 
20
    #
21
    PutP "Testing the selection command"
22
    #
23
 
24
    for {set x 0} {$x < 40} {incr x} {
25
        $h add foo$x -text Foo$x
26
    }
27
    update
28
 
29
    test {$h selection set} {arg}
30
    test {$h selection set foo1}
31
 
32
    test {$h selection get foo} {arg}
33
    Assert {[tixStrEq [$h selection get] "foo1"]}
34
    Assert {[tixStrEq [$h selection get] [$h info selection]]}
35
 
36
    #
37
    PutP "Testing the info bbox command"
38
    #
39
    $h config -browsecmd "HLTest_BrowseCmd $h"
40
    global hlTest_selected
41
    for {set x 0} {$x <= 3} {incr x} {
42
        set ent foo[expr $x * 8]
43
        $h see $ent
44
        update
45
 
46
        set bbox [$h info bbox $ent]
47
        Assert {![tixStrEq "$bbox" ""]}
48
 
49
        set hlTest_selected ""
50
        Click $h [lindex $bbox 0] [lindex $bbox 1]
51
        update
52
        Assert {[tixStrEq "$hlTest_selected" "$ent"]}
53
 
54
        set hlTest_selected ""
55
        Click $h [lindex $bbox 2] [lindex $bbox 3]
56
        update
57
        Assert {[tixStrEq "$hlTest_selected" "$ent"]}
58
    }
59
 
60
    #
61
    PutP "Testing the ClickHListEntry test function"
62
    #
63
    for {set x 0} {$x <= 3} {incr x} {
64
        set hlTest_selected ""
65
        set ent foo[expr $x * 8]
66
        ClickHListEntry $h $ent
67
        update
68
        Assert {[tixStrEq "$hlTest_selected" "$ent"]}
69
    }
70
}
71
 
72
proc HLTest_BrowseCmd {w args} {
73
    global hlTest_selected
74
 
75
    set hlTest_selected [tixEvent value]
76
}

powered by: WebSVN 2.1.0

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