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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# samples.tcl --
2
#
3
#       Tests all the sample programs in the demo/samples directory.
4
#
5
#
6
# Copyright (c) 1996, Expert Interface Technologies
7
#
8
# See the file "license.terms" for information on usage and redistribution
9
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
#
11
 
12
proc About {} {
13
    return "Testing all the sample programs in the demo/samples directory"
14
}
15
 
16
proc Test {} {
17
    global samples_dir demo_dir tix_library
18
 
19
    TestBlock samples-1.0 "Finding the demo directory" {
20
        foreach dir "$tix_library/demos $tix_library/../demos ../../demos ../demos demos" {
21
            if {[file exists $dir] && [file isdir $dir]} {
22
                set pwd [pwd]
23
                cd $dir
24
                set demo_dir    [pwd]
25
                set samples_dir [pwd]/samples
26
                cd $pwd
27
                break
28
            }
29
        }
30
    }
31
 
32
    if ![info exists samples_dir] {
33
        puts "Cannot find demos directory. Sample tests are skipped"
34
        return
35
    } else {
36
        puts "loading demos from $demo_dir"
37
    }
38
 
39
    TestBlock samples-1.1 "Running widget demo" {
40
        if [file exists $demo_dir/widget] {
41
            uplevel #0 source [list $demo_dir/widget]
42
            Widget:SelfTest
43
        }
44
    }
45
    if ![file exists $samples_dir/AllSampl.tcl] {
46
        return
47
    }
48
    uplevel #0 source [list $samples_dir/AllSampl.tcl]
49
 
50
    ForAllSamples root "" Test_Sample
51
}
52
 
53
 
54
proc Test_Sample {token type text dest} {
55
    global samples_dir tix_demo_running
56
 
57
    set tix_demo_running 1
58
 
59
    if {$type == "f"} {
60
        set w .sampl_top
61
        TestBlock samples-2-$dest "Loading sample $dest" {
62
            uplevel #0 source [list $samples_dir/$dest]
63
            toplevel $w
64
            wm geometry $w +100+100
65
            wm title $w $text
66
            RunSample $w
67
            update
68
        }
69
        catch {
70
            destroy $w
71
        }
72
    }
73
}

powered by: WebSVN 2.1.0

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