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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# cmderror.tcl --
2
#
3
#       This program tests whether command handler errors are processed
4
#       properly by the Tix toolkit.
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 command handler errors are processed properly"
14
}
15
 
16
proc Test {} {
17
    global cmdHandlerCalled
18
 
19
    if {![string compare [info command tixCmdErrorHandler] ""]} {
20
        if ![auto_load tixCmdErrorHandler] {
21
            TestAbort "toolkit error: procedure \"tixCmdErrorHandler\" not implemented"
22
        }
23
    }
24
    rename tixCmdErrorHandler _default_tixCmdErrorHandler
25
    proc tixCmdErrorHandler {msg} {
26
        global cmdHandlerCalled
27
        set cmdHandlerCalled 1
28
    }
29
 
30
    # We cause an error to occur in the -command handler of the combobox
31
    # widget. Such an error shouldn't cause the operation to fail.
32
    # See the programmer's documentation of tixCmdErrorHandler for details.
33
    #
34
    catch {
35
        tixComboBox .c -command CmdNotFound
36
        .c invoke
37
        set cmdNotFailed 1
38
    }
39
    Assert {[info exists cmdNotFailed]}
40
    Assert {[info exists cmdHandlerCalled]}
41
 
42
    # Clean up
43
    #
44
    destroy .c
45
    rename tixCmdErrorHandler ""
46
    rename _default_tixCmdErrorHandler tixCmdErrorHandler
47
    unset cmdHandlerCalled
48
 
49
}

powered by: WebSVN 2.1.0

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