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

📄 grid.test

📁 linux系统下的音频通信
💻 TEST
📖 第 1 页 / 共 3 页
字号:
# This file is a Tcl script to test out the *NEW* "grid" command# of Tk.  It is (almost) organized in the standard fashion for Tcl tests.## Copyright (c) 1996 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: @(#) grid.test 1.22 97/10/10 10:07:31if {[string compare test [info procs test]] == 1} then \  {source ../tests/defs}# Test Arguments:# name -                Name of test, in the form foo-1.2.# description -         Short textual description of the test, to#                       help humans understand what it does.# constraints -         A list of one or more keywords, each of#                       which must be the name of an element in#                       the array "testConfig".  If any of these#                       elements is zero, the test is skipped.#                       This argument may be omitted.# script -              Script to run to carry out the test.  It must#                       return a result that can be checked for#                       correctness.# answer -              Expected result from script.# helper routine to return "." to a sane state after a test# The variable GRID_VERBOSE can be used to "look" at the result# of one or all of the testsproc grid_reset {{test ?} {top .}} {    global GRID_VERBOSE    if {[info exists GRID_VERBOSE]} {	if {$GRID_VERBOSE=="" || $GRID_VERBOSE==$test} {	    puts -nonewline "grid test $test: "	    flush stdout	    gets stdin	}    }    eval destroy [winfo children $top]    update    foreach {cols rows} [grid size .] {}    for {set i 0} {$i <= $cols} {incr i} {    	grid columnconfigure . $i -weight 0 -minsize 0 -pad 0    }    for {set i 0} {$i <= $rows} {incr i} {    	grid rowconfigure . $i -weight 0 -minsize 0 -pad 0    }    grid propagate . 1    update}grid_reset 0.0wm geometry . {}test grid-1.1 {basic argument checking} {	list [catch grid msg] $msg} {1 {wrong # args: should be "grid option arg ?arg ...?"}}test grid-1.2 {basic argument checking} {	list [catch {grid foo bar} msg] $msg} {1 {bad option "foo":  must be bbox, columnconfigure, configure, forget, info, location, propagate, remove, rowconfigure, size, or slaves.}}test grid-1.3 {basic argument checking} {	button .b	list [catch {grid .b -row 0 -column} msg] $msg} {1 {extra option or option with no value}}grid_reset 1.3test grid-1.4 {basic argument checking} {	button .b	list [catch {grid configure .b - foo} msg] $msg} {1 {unexpected parameter, "foo", in configure list. Should be window name or option}}grid_reset 1.4test grid-1.5 {basic argument checking} {	list [catch {grid .} msg] $msg} {1 {can't manage ".": it's a top-level window}}test grid-1.6 {basic argument checking} {	list [catch {grid x} msg] $msg} {1 {can't determine master window}}test grid-2.1 {bbox} {	list [catch {grid bbox .} msg] $msg} {0 {0 0 0 0}}test grid-2.2 {bbox} {	button .b	grid .b	destroy .b	update	list [catch {grid bbox .} msg] $msg} {0 {0 0 0 0}}test grid-2.3 {bbox: argument checking} {	list [catch {grid bbox . 0 0 5} msg] $msg} {1 {wrong number of arguments: must be "grid bbox master ?column row ?column row??"}}test grid-2.4 {bbox} {	list [catch {grid bbox .bad 0 0} msg] $msg} {1 {bad window path name ".bad"}}test grid-2.5 {bbox} {	list [catch {grid bbox . x 0} msg] $msg} {1 {expected integer but got "x"}}test grid-2.6 {bbox} {	list [catch {grid bbox . 0 x} msg] $msg} {1 {expected integer but got "x"}}test grid-2.7 {bbox} {	list [catch {grid bbox . 0 0 x 0} msg] $msg} {1 {expected integer but got "x"}}test grid-2.8 {bbox} {	list [catch {grid bbox . 0 0 0 x} msg] $msg} {1 {expected integer but got "x"}}test grid-2.9 {bbox} {    frame .1 -width 75 -height 75 -bg red    frame .2 -width 90 -height 90 -bg red    grid .1 -row 0 -column 0    grid .2 -row 1 -column 1    update    set a ""    lappend a [grid bbox .]    lappend a [grid bbox . 0 0]    lappend a [grid bbox . 0 0 1 1]    lappend a [grid bbox . 1 1]    set a} {{0 0 165 165} {0 0 75 75} {0 0 165 165} {75 75 90 90}}grid_reset 2.9test grid-2.10 {bbox} {    frame .1 -width 75 -height 75 -bg red    frame .2 -width 90 -height 90 -bg red    grid .1 -row 0 -column 0    grid .2 -row 1 -column 1    update    set a ""    lappend a [grid bbox . 10 10 0 0]    lappend a [grid bbox . -2 -2 -1 -1]    lappend a [grid bbox . 10 10 12 12]    set a} {{0 0 165 165} {0 0 0 0} {165 165 0 0}}grid_reset 2.10test grid-3.1 {configure: basic argument checking} {    list [catch {grid configure foo} msg] $msg} {1 {bad argument "foo": must be name of window}}test grid-3.2 {configure: basic argument checking} {    button .b    grid configure .b    grid slaves .} {.b}grid_reset 3.2test grid-3.3 {configure: basic argument checking} {    button .b    list [catch {grid .b -row -1} msg] $msg} {1 {bad grid value "-1": must be a non-negative integer}}grid_reset 3.3test grid-3.4 {configure: basic argument checking} {    button .b    list [catch {grid .b -column -1} msg] $msg} {1 {bad column value "-1": must be a non-negative integer}}grid_reset 3.4test grid-3.5 {configure: basic argument checking} {    button .b    list [catch {grid .b -rowspan 0} msg] $msg} {1 {bad rowspan value "0": must be a positive integer}}grid_reset 3.5test grid-3.6 {configure: basic argument checking} {    button .b    list [catch {grid .b -columnspan 0} msg] $msg} {1 {bad columnspan value "0": must be a positive integer}}grid_reset 3.6test grid-3.7 {configure: basic argument checking} {    frame .f    button .f.b    list [catch {grid .f .f.b} msg] $msg} {1 {can't put .f.b inside .}}grid_reset 3.7test grid-4.1 {forget: basic argument checking} {    list [catch {grid forget foo} msg] $msg} {1 {bad window path name "foo"}}test grid-4.2 {forget} {    button .c    grid [button .b]    set a [grid slaves .]    grid forget .b .c    lappend a [grid slaves .]    set a} {.b {}}grid_reset 4.2test grid-4.3 {forget} {    button .c    grid .c -row 2 -column 2 -rowspan 2 -columnspan 2 -padx 3 -pady 4 -sticky ns    grid forget .c    grid .c -row 0 -column 0    grid info .c} {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}grid_reset 4.3test grid-4.4 {forget, calling Tk_UnmaintainGeometry} {    frame .f -bd 2 -relief raised    place .f -x 10 -y 20 -width 200 -height 100    frame .f2 -width 50 -height 30 -bg red    grid .f2 -in .f    update    set x [winfo ismapped .f2]    grid forget .f2    place .f -x 30    update    lappend x [winfo ismapped .f2]} {1 0}grid_reset 4.4test grid-5.1 {info: basic argument checking} {	list [catch {grid info a b} msg] $msg} {1 {wrong # args: should be "grid info window"}}test grid-5.2 {info} {    frame .1 -width 75 -height 75 -bg red    grid .1 -row 0 -column 0    update    list [catch {grid info .x} msg] $msg} {1 {bad window path name ".x"}}grid_reset 5.2test grid-5.3 {info} {    frame .1 -width 75 -height 75 -bg red    grid .1 -row 0 -column 0    update    list [catch {grid info .1} msg] $msg} {0 {-in . -column 0 -row 0 -columnspan 1 -rowspan 1 -ipadx 0 -ipady 0 -padx 0 -pady 0 -sticky {}}}grid_reset 5.3test grid-5.4 {info} {    frame .1 -width 75 -height 75 -bg red    update    list [catch {grid info .1} msg] $msg} {0 {}}grid_reset 5.4test grid-6.1 {location: basic argument checking} {	list [catch "grid location ." msg] $msg} {1 {wrong # args: should be "grid location master x y"}}test grid-6.2 {location: basic argument checking} {	list [catch "grid location .bad 0 0" msg] $msg} {1 {bad window path name ".bad"}}test grid-6.3 {location: basic argument checking} {	list [catch "grid location . x y" msg] $msg} {1 {bad screen distance "x"}}test grid-6.4 {location: basic argument checking} {	list [catch "grid location . 1c y" msg] $msg} {1 {bad screen distance "y"}}test grid-6.5 {location: basic argument checking} {	frame .f	grid location .f 10 10} {-1 -1}grid_reset 6.5test grid-6.6 {location (x)} {    frame .f -width 200 -height 100 -highlightthickness 0 -bg red    grid .f    update    set got ""    set result ""    for {set x -10} { $x < 220} { incr x} {	set a [grid location . $x 0]	if {$a != $got} {	    lappend result $x->$a	    set got $a	}    }    set result} {{-10->-1 0} {0->0 0} {201->1 0}}grid_reset 6.6test grid-6.7 {location (y)} {    frame .f -width 200 -height 100 -highlightthickness 0 -bg red    grid .f    update    set got ""    set result ""    for {set y -10} { $y < 110} { incr y} {	set a [grid location . 0 $y]	if {$a != $got} {	    lappend result $y->$a	    set got $a	}    }    set result} {{-10->0 -1} {0->0 0} {101->0 1}}grid_reset 6.7test grid-6.8 {location (weights)} {    frame .f -width 200 -height 100 -highlightthickness 0 -bg red    frame .a    grid .a    grid .f -in .a    grid rowconfigure .f 0 -weight 1    grid columnconfigure .f 0 -weight 1    grid propagate .a 0    .a configure -width 110 -height 15    update    set got ""    set result ""    for {set y -10} { $y < 120} { incr y} {	set a [grid location . $y $y]	if {$a != $got} {	    lappend result $y->$a	    set got $a	}    }    set result} {{-10->-1 -1} {0->0 0} {16->0 1} {111->1 1}}grid_reset 6.8test grid-6.9 {location: check updates pending} {	set a ""	foreach i {0 1 2} {	    frame .$i -width 120 -height 75 -bg red	    lappend a [grid location . 150 90]	    grid .$i -row $i -column $i	}	set a} {{0 0} {1 1} {1 1}}grid_reset 6.9test grid-7.1 {propagate} {    list [catch {grid propagate . 1 xxx} msg] $msg} {1 {wrong # args: should be "grid propagate window ?boolean?"}}grid_reset 7.1test grid-7.2 {propagate} {    list [catch {grid propagate .} msg] $msg} {0 1}grid_reset 7.2test grid-7.3 {propagate} {    list [catch {grid propagate . 0;grid propagate .} msg] $msg} {0 0}grid_reset 7.3test grid-7.4 {propagate} {    list [catch {grid propagate .x} msg] $msg} {1 {bad window path name ".x"}}grid_reset 7.4test grid-7.5 {propagate} {    list [catch {grid propagate . x} msg] $msg} {1 {expected boolean value but got "x"}}grid_reset 7.5test grid-7.6 {propagate} {    frame .f -width 100 -height 100 -bg red    grid .f -row 0 -column 0    update    set a [winfo width .f]x[winfo height .f]    grid propagate .f 0    frame .g -width 75 -height 85 -bg green    grid .g -in .f -row 0 -column 0    update    lappend a [winfo width .f]x[winfo height .f]    grid propagate .f 1    update    lappend a [winfo width .f]x[winfo height .f]    set a} {100x100 100x100 75x85}grid_reset 7.6test grid-8.1 {size} {    list [catch {grid size . foo} msg] $msg} {1 {wrong # args: should be "grid size window"}}grid_reset 8.1test grid-8.2 {size} {    list [catch {grid size .x} msg] $msg} {1 {bad window path name ".x"}}grid_reset 8.2test grid-8.3 {size} {    frame .f    list [catch {grid size .f} msg] $msg} {0 {0 0}}

⌨️ 快捷键说明

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