1 # This file is a Tcl script to test out the procedures in the file
2 # tkBitmap.c. It is organized in the standard white-box fashion for
5 # Copyright (c) 1998 Sun Microsystems, Inc.
6 # Copyright (c) 1998-1999 by Scriptics Corporation.
11 package require tcltest 2.1
12 namespace import -force tcltest::configure
13 namespace import -force tcltest::testsDirectory
14 configure -testdir [file join [pwd] [file dirname [info script]]]
15 configure -loadfile [file join [testsDirectory] constraints.tcl]
16 tcltest::loadTestedCommands
18 testConstraint testbitmap [llength [info commands testbitmap]]
20 test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} testbitmap {
28 test bitmap-1.2 {Tk_AllocBitmapFromObj - discard stale bitmap} testbitmap {
34 lappend result [testbitmap gray25]
36 lappend result [testbitmap gray25]
38 test bitmap-1.3 {Tk_AllocBitmapFromObj - reuse existing bitmap} testbitmap {
43 lappend result [testbitmap gray25]
45 pack .b1 .b2 -side top
46 lappend result [testbitmap gray25]
49 test bitmap-2.1 {Tk_GetBitmap procedure} {
51 list [catch {button .b1 -bitmap bad_name} msg] $msg
52 } {1 {bitmap "bad_name" not defined}}
53 test bitmap-2.2 {Tk_GetBitmap procedure} {
55 list [catch {button .b1 -bitmap @xyzzy} msg] $msg
56 } {1 {error reading bitmap file "xyzzy"}}
58 test bitmap-3.1 {Tk_FreeBitmapFromObj - reference counts} testbitmap {
65 lappend result [testbitmap questhead]
67 lappend result [testbitmap questhead]
69 lappend result [testbitmap questhead]
71 lappend result [testbitmap questhead]
72 } {{{3 1}} {{2 1}} {{1 1}} {}}
74 test bitmap-4.1 {FreeBitmapObjProc} testbitmap {
76 set x [format questhead]
78 set y [format questhead]
79 .b configure -bitmap $y
80 set z [format questhead]
81 .b configure -bitmap $z
83 lappend result [testbitmap questhead]
85 lappend result [testbitmap questhead]
87 lappend result [testbitmap questhead]
89 lappend result [testbitmap questhead]
92 } {{{1 3}} {{1 2}} {{1 1}} {}}
97 ::tcltest::cleanupTests