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

📄 option.test

📁 linux系统下的音频通信
💻 TEST
字号:
# This file is a Tcl script to test out the option-handling facilities# of Tk.  It is organized in the standard fashion for Tcl tests.## Copyright (c) 1991-1993 The Regents of the University of California.# Copyright (c) 1994 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: @(#) option.test 1.20 97/08/07 15:54:37if {[string compare test [info procs test]] == 1} then \  {source defs}catch {destroy .op1}catch {destroy .op2}set appName [winfo name .]# First, test basic retrievals, being sure to trigger all the various# types of NodeElements (EXACT_LEAF_NAME, WILDCARD_NODE_CLASS, and# everything in-between).frame .op1 -class Class1frame .op2 -class Class2frame .op1.op3 -class Class1frame .op1.op4 -class Class3frame .op2.op5 -class Class2frame .op1.op3.op6 -class Class4option clearoption add *Color1 redoption add *x blueoption add *Class1.x yellowoption add $appName.op1.x greenoption add *Class2.Color1 orangeoption add $appName.op2.op5.Color2 purpleoption add $appName.Class1.Class3.y brownoption add $appName*op6*Color2 blackoption add $appName*Class1.op1.Color2 greytest option-1.1 {basic option retrieval} {option get . x Color1} bluetest option-1.2 {basic option retrieval} {option get . y Color1} redtest option-1.3 {basic option retrieval} {option get . z Color1} redtest option-1.4 {basic option retrieval} {option get . x Color2} bluetest option-1.5 {basic option retrieval} {option get . y Color2} {}test option-1.6 {basic option retrieval} {option get . z Color2} {}test option-2.1 {basic option retrieval} {option get .op1 x Color1} greentest option-2.2 {basic option retrieval} {option get .op1 y Color1} redtest option-2.3 {basic option retrieval} {option get .op1 z Color1} redtest option-2.4 {basic option retrieval} {option get .op1 x Color2} greentest option-2.5 {basic option retrieval} {option get .op1 y Color2} {}test option-2.6 {basic option retrieval} {option get .op1 z Color2} {}test option-3.1 {basic option retrieval} {option get .op1.op3 x Color1} yellowtest option-3.2 {basic option retrieval} {option get .op1.op3 y Color1} redtest option-3.3 {basic option retrieval} {option get .op1.op3 z Color1} redtest option-3.4 {basic option retrieval} {option get .op1.op3 x Color2} yellowtest option-3.5 {basic option retrieval} {option get .op1.op3 y Color2} {}test option-3.6 {basic option retrieval} {option get .op1.op3 z Color2} {}test option-4.1 {basic option retrieval} {option get .op1.op3.op6 x Color1} bluetest option-4.2 {basic option retrieval} {option get .op1.op3.op6 y Color1} redtest option-4.3 {basic option retrieval} {option get .op1.op3.op6 z Color1} redtest option-4.4 {basic option retrieval} {option get .op1.op3.op6 x Color2} blacktest option-4.5 {basic option retrieval} {option get .op1.op3.op6 y Color2} blacktest option-4.6 {basic option retrieval} {option get .op1.op3.op6 z Color2} blacktest option-5.1 {basic option retrieval} {option get .op1.op4 x Color1} bluetest option-5.2 {basic option retrieval} {option get .op1.op4 y Color1} browntest option-5.3 {basic option retrieval} {option get .op1.op4 z Color1} redtest option-5.4 {basic option retrieval} {option get .op1.op4 x Color2} bluetest option-5.5 {basic option retrieval} {option get .op1.op4 y Color2} browntest option-5.6 {basic option retrieval} {option get .op1.op4 z Color2} {}test option-6.1 {basic option retrieval} {option get .op2 x Color1} orangetest option-6.2 {basic option retrieval} {option get .op2 y Color1} orangetest option-6.3 {basic option retrieval} {option get .op2 z Color1} orangetest option-6.4 {basic option retrieval} {option get .op2 x Color2} bluetest option-6.5 {basic option retrieval} {option get .op2 y Color2} {}test option-6.6 {basic option retrieval} {option get .op2 z Color2} {}test option-7.1 {basic option retrieval} {option get .op2.op5 x Color1} orangetest option-7.2 {basic option retrieval} {option get .op2.op5 y Color1} orangetest option-7.3 {basic option retrieval} {option get .op2.op5 z Color1} orangetest option-7.4 {basic option retrieval} {option get .op2.op5 x Color2} purpletest option-7.5 {basic option retrieval} {option get .op2.op5 y Color2} purpletest option-7.6 {basic option retrieval} {option get .op2.op5 z Color2} purple# Now try similar tests to above, except jump around non-hierarchically# between windows to make sure that the option stacks are pushed and# popped correctly.option get . foo Footest option-8.1 {stack pushing/popping} {option get .op2.op5 x Color1} orangetest option-8.2 {stack pushing/popping} {option get .op2.op5 y Color1} orangetest option-8.3 {stack pushing/popping} {option get .op2.op5 z Color1} orangetest option-8.4 {stack pushing/popping} {option get .op2.op5 x Color2} purpletest option-8.5 {stack pushing/popping} {option get .op2.op5 y Color2} purpletest option-8.6 {stack pushing/popping} {option get .op2.op5 z Color2} purpletest option-9.1 {stack pushing/popping} {option get . x Color1} bluetest option-9.2 {stack pushing/popping} {option get . y Color1} redtest option-9.3 {stack pushing/popping} {option get . z Color1} redtest option-9.4 {stack pushing/popping} {option get . x Color2} bluetest option-9.5 {stack pushing/popping} {option get . y Color2} {}test option-9.6 {stack pushing/popping} {option get . z Color2} {}test option-10.1 {stack pushing/popping} {option get .op1.op3.op6 x Color1} bluetest option-10.2 {stack pushing/popping} {option get .op1.op3.op6 y Color1} redtest option-10.3 {stack pushing/popping} {option get .op1.op3.op6 z Color1} redtest option-10.4 {stack pushing/popping} {option get .op1.op3.op6 x Color2} blacktest option-10.5 {stack pushing/popping} {option get .op1.op3.op6 y Color2} blacktest option-10.6 {stack pushing/popping} {option get .op1.op3.op6 z Color2} blacktest option-11.1 {stack pushing/popping} {option get .op1.op3 x Color1} yellowtest option-11.2 {stack pushing/popping} {option get .op1.op3 y Color1} redtest option-11.3 {stack pushing/popping} {option get .op1.op3 z Color1} redtest option-11.4 {stack pushing/popping} {option get .op1.op3 x Color2} yellowtest option-11.5 {stack pushing/popping} {option get .op1.op3 y Color2} {}test option-11.6 {stack pushing/popping} {option get .op1.op3 z Color2} {}test option-12.1 {stack pushing/popping} {option get .op1 x Color1} greentest option-12.2 {stack pushing/popping} {option get .op1 y Color1} redtest option-12.3 {stack pushing/popping} {option get .op1 z Color1} redtest option-12.4 {stack pushing/popping} {option get .op1 x Color2} greentest option-12.5 {stack pushing/popping} {option get .op1 y Color2} {}test option-12.6 {stack pushing/popping} {option get .op1 z Color2} {}# Test the major priority levels (widgetDefault, etc.)option add $appName.op1.a 100 100option add $appName.op1.A interactive interactiveoption add $appName.op1.b userDefault userDefaultoption add $appName.op1.B startupFile startupFileoption add $appName.op1.c widgetDefault widgetDefaultoption add $appName.op1.C 0 0test option-13.1 {priority levels} {option get .op1 a A} 100test option-13.2 {priority levels} {option get .op1 b A} interactivetest option-13.3 {priority levels} {option get .op1 b B} userDefaulttest option-13.4 {priority levels} {option get .op1 c B} startupFiletest option-13.5 {priority levels} {option get .op1 c C} widgetDefaultoption add $appName.op1.B file2 widgettest option-13.6 {priority levels} {option get .op1 c B} startupFileoption add $appName.op1.B file2 startupFiletest option-13.7 {priority levels} {option get .op1 c B} file2# Test various error conditionstest option-14.1 {error conditions} {    list [catch {option} msg] $msg} {1 {wrong # args: should be "option cmd arg ?arg ...?"}}test option-14.2 {error conditions} {    list [catch {option x} msg] $msg} {1 {bad option "x": must be add, clear, get, or readfile}}test option-14.3 {error conditions} {    list [catch {option foo 3} msg] $msg} {1 {bad option "foo": must be add, clear, get, or readfile}}test option-14.4 {error conditions} {    list [catch {option add 3} msg] $msg} {1 {wrong # args: should be "option add pattern value ?priority?"}}test option-14.5 {error conditions} {    list [catch {option add . a b c} msg] $msg} {1 {wrong # args: should be "option add pattern value ?priority?"}}test option-14.6 {error conditions} {    list [catch {option add . a -1} msg] $msg} {1 {bad priority level "-1": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}test option-14.7 {error conditions} {    list [catch {option add . a 101} msg] $msg} {1 {bad priority level "101": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}test option-14.8 {error conditions} {    list [catch {option add . a gorp} msg] $msg} {1 {bad priority level "gorp": must be widgetDefault, startupFile, userDefault, interactive, or a number between 0 and 100}}test option-14.9 {error conditions} {    list [catch {option get 3} msg] $msg} {1 {wrong # args: should be "option get window name class"}}test option-14.10 {error conditions} {    list [catch {option get 3 4} msg] $msg} {1 {wrong # args: should be "option get window name class"}}test option-14.11 {error conditions} {    list [catch {option get 3 4 5 6} msg] $msg} {1 {wrong # args: should be "option get window name class"}}test option-14.12 {error conditions} {    list [catch {option get .gorp.gorp a A} msg] $msg} {1 {bad window path name ".gorp.gorp"}}if {$tcl_platform(os) == "Win32s"} {    set option1 OPTION~2.FIL    set option2 OPTION~1.FIL    set option3 OPTION~3.FIL} else {    set option1 option.file1    set option2 option.file2    set option3 option.file3}test option-15.1 {database files} {    list [catch {option read non-existent} msg] $msg} {1 {couldn't open "non-existent": no such file or directory}}option read $option1test option-15.2 {database files} {option get . x1 color} blueif {$appName == "tktest"} {    test option-15.3 {database files} {option get . x2 color} green}test option-15.4 {database files} {option get . x3 color} purpletest option-15.5 {database files} {option get . {x 4} color} browntest option-15.6 {database files} {option get . x6 color} {}test option-15.7 {database files} {    list [catch {option read $option1 widget foo} msg] $msg} {1 {wrong # args: should be "option readfile fileName ?priority?"}}option add *x3 burgundycatch {option read $option1 userDefault}test option-15.8 {database files} {option get . x3 color} burgundytest option-15.9 {database files} {    list [catch {option read $option2} msg] $msg} {1 {missing colon on line 2}}test option-16.1 {ReadOptionFile} {    set file [open "$option3" w]    fconfigure $file -translation crlf    puts $file "*x7: true\n*x8: false"    close $file    option read $option3 userDefault    set result [list [option get . x7 color] [option get . x8 color]]    removeFile $option3    set result} {true false}catch {destroy .op1}catch {destroy .op2}concat {}

⌨️ 快捷键说明

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