⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imgbmap.test

📁 linux系统下的音频通信
💻 TEST
📖 第 1 页 / 共 2 页
字号:
# This file is a Tcl script to test out images of type "bitmap" (i.e.,# the procedures in the file tkImgBmap.c).  It is organized in the# standard fashion for Tcl tests.## Copyright (c) 1994 The Regents of the University of California.# Copyright (c) 1994-1995 Sun Microsystems, Inc.## See the file "license.terms" for information on usage and redistribution# of this file, and for a DISCLAIMER OF ALL WARRANTIES.## SCCS: @(#) imgBmap.test 1.15 97/03/10 14:12:38if {[info procs test] != "test"} {    source defs}foreach i [winfo children .] {    destroy $i}wm geometry . {}raise .set data1 {#define foo_width 16#define foo_height 16#define foo_x_hot 3#define foo_y_hot 3static unsigned char foo_bits[] = {   0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,   0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,   0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xff, 0xff};}set data2 {    #define foo2_width 16    #define foo2_height 16    static char foo2_bits[] = {       0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,       0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,       0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0xff};}makeFile $data1 foo.bmmakeFile $data2 foo2.bmeval image delete [image names]canvas .cpack .cupdateimage create bitmap i1.c create image 200 100 -image i1updateproc bgerror msg {    global errMsg    set errMsg $msg}test imageBmap-1.1 {options for bitmap images} {    image create bitmap i1 -background #123456    lindex [i1 configure -background] 4} {#123456}test imageBmap-1.2 {options for bitmap images} {    set errMsg {}    image create bitmap i1 -background lousy    update    list $errMsg $errorInfo} {{unknown color name "lousy"} {unknown color name "lousy"    (while configuring image "i1")}}test imageBmap-1.3 {options for bitmap images} {    image create bitmap i1 -data $data1    lindex [i1 configure -data] 4} $data1test imageBmap-1.4 {options for bitmap images} {    list [catch {image create bitmap i1 -data bogus} msg] $msg} {1 {format error in bitmap data}}test imageBmap-1.5 {options for bitmap images} {    image create bitmap i1 -file foo.bm    lindex [i1 configure -file] 4} foo.bmtest imageBmap-1.6 {options for bitmap images} {    list [catch {image create bitmap i1 -file bogus} msg] [string tolower $msg]} {1 {couldn't read bitmap file "bogus": no such file or directory}}test imageBmap-1.7 {options for bitmap images} {    image create bitmap i1 -foreground #00ff00    lindex [i1 configure -foreground] 4} {#00ff00}test imageBmap-1.8 {options for bitmap images} {    set errMsg {}    image create bitmap i1 -foreground bad_color    update    list $errMsg $errorInfo} {{unknown color name "bad_color"} {unknown color name "bad_color"    (while configuring image "i1")}}test imageBmap-1.9 {options for bitmap images} {    image create bitmap i1 -data $data1 -maskdata $data2    lindex [i1 configure -maskdata] 4} $data2test imageBmap-1.10 {options for bitmap images} {    list [catch {image create bitmap i1 -data $data1 -maskdata bogus} msg] $msg} {1 {format error in bitmap data}}test imageBmap-1.11 {options for bitmap images} {    image create bitmap i1 -file foo.bm -maskfile foo2.bm    lindex [i1 configure -maskfile] 4} foo2.bmtest imageBmap-1.12 {options for bitmap images} {    list [catch {image create bitmap i1 -data $data1 -maskfile bogus} msg] \	    [string tolower $msg]} {1 {couldn't read bitmap file "bogus": no such file or directory}}rename bgerror {}test imageBmap-2.1 {ImgBmapCreate procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -gorp dum} msg] $msg [image names]} {1 {unknown option "-gorp"} {}}test imageBmap-2.2 {ImgBmapCreate procedure} {    eval image delete [image names]    .c delete all    image create bitmap image1    list [info commands image1] [image names] \	    [image width image1] [image height image1] \	    [lindex [image1 configure -foreground] 4] \	    [lindex [image1 configure -background] 4]} {image1 image1 0 0 #000000 {}}test imageBmap-3.1 {ImgBmapConfigureMaster procedure, memory de-allocation} {    image create bitmap i1 -data $data1    i1 configure -data $data1} {}test imageBmap-3.2 {ImgBmapConfigureMaster procedure} {    image create bitmap i1 -data $data1    list [catch {i1 configure -data bogus} msg] $msg [image width i1] \	    [image height i1]} {1 {format error in bitmap data} 16 16}test imageBmap-3.3 {ImgBmapConfigureMaster procedure, memory de-allocation} {    image create bitmap i1 -data $data1 -maskdata $data2    i1 configure -maskdata $data2} {}test imageBmap-3.4 {ImgBmapConfigureMaster procedure} {    image create bitmap i1    list [catch {i1 configure -maskdata $data2} msg] $msg} {1 {can't have mask without bitmap}}test imageBmap-3.5 {ImgBmapConfigureMaster procedure} {    list [catch {image create bitmap i1 -data $data1 -maskdata {	#define foo_width 8	#define foo_height 16	static char foo_bits[] = {	   0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,	   0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};	}    } msg] $msg} {1 {bitmap and mask have different sizes}}test imageBmap-3.6 {ImgBmapConfigureMaster procedure} {    list [catch {image create bitmap i1 -data $data1 -maskdata {	#define foo_width 16	#define foo_height 8	static char foo_bits[] = {	   0xff, 0xff, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81,	   0x81, 0x81, 0xff, 0xff, 0xff, 0xff, 0x81, 0x81};	}    } msg] $msg} {1 {bitmap and mask have different sizes}}test imageBmap-3.7 {ImgBmapConfigureMaster procedure} {    image create bitmap i1 -data $data1    .c create image 100 100 -image i1 -tags i1.1 -anchor nw    .c create image 200 100 -image i1 -tags i1.2 -anchor nw    update    i1 configure -data {	#define foo2_height 14	#define foo2_width 15	static char foo2_bits[] = {	   0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,	   0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,	   0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,	   0xff, 0xff};    }    update    list [image width i1] [image height i1] [.c bbox i1.1] [.c bbox i1.2]} {15 14 {100 100 115 114} {200 100 215 114}}test imageBmap-4.1 {ImgBmapConfigureInstance procedure: check error handling} {    proc bgerror args {}    .c delete all    image create bitmap i1 -file foo.bm    .c create image 100 100 -image i1    update    i1 configure -foreground bogus    update} {}test imageBmap-5.1 {GetBitmapData procedure} {    list [catch {image create bitmap -file ~bad_user/a/b} msg] \	    [string tolower $msg]} {1 {user "bad_user" doesn't exist}}test imageBmap-5.2 {GetBitmapData procedure} {    list [catch {image create bitmap -file bad_name} msg] [string tolower $msg]} {1 {couldn't read bitmap file "bad_name": no such file or directory}}test imageBmap-5.3 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data { }} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.4 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_width}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.5 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_width gorp}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.6 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_width 1.4}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.7 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_height}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.8 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_height gorp}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.9 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    list [catch {image create bitmap -data {#define foo2_height 1.4}} msg] $msg} {1 {format error in bitmap data}}test imageBmap-5.10 {GetBitmapData procedure} {    eval image delete [image names]    .c delete all    image create bitmap i1 -data {	#define foo2_height 14	#define foo2_width 15 xx _widtg 18 xwidth 18 _heighz 18 xheight 18	static char foo2_bits[] = {	   0xff, 0xff, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,	   0xff, 0x81, 0xff, 0x81, 0xff, 0xff, 0xff, 0xff, 0xff, 0x81,	   0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81, 0xff, 0x81,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -