1# This file is a Tcl script to test out the procedures in the file 2# tkUtil.c. It is organized in the standard fashion for Tcl tests. 3# 4# Copyright (c) 1994 The Regents of the University of California. 5# Copyright (c) 1994 Sun Microsystems, Inc. 6# Copyright (c) 1998-1999 by Scriptics Corporation. 7# All rights reserved. 8# 9# RCS: @(#) $Id$ 10 11package require tcltest 2.1 12eval tcltest::configure $argv 13tcltest::loadTestedCommands 14 15listbox .l -width 20 -height 5 -relief sunken -bd 2 16pack .l 17.l insert 0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 18update 19test util-1.1 {Tk_GetScrollInfo procedure} { 20 list [catch {.l yview moveto a b} msg] $msg 21} {1 {wrong # args: should be ".l yview moveto fraction"}} 22test util-1.2 {Tk_GetScrollInfo procedure} { 23 list [catch {.l yview moveto xyz} msg] $msg 24} {1 {expected floating-point number but got "xyz"}} 25test util-1.3 {Tk_GetScrollInfo procedure} { 26 .l yview 0 27 .l yview moveto .5 28 .l yview 29} {0.5 0.75} 30test util-1.4 {Tk_GetScrollInfo procedure} { 31 list [catch {.l yview scroll a} msg] $msg 32} {1 {wrong # args: should be ".l yview scroll number units|pages"}} 33test util-1.5 {Tk_GetScrollInfo procedure} { 34 list [catch {.l yview scroll a b c} msg] $msg 35} {1 {wrong # args: should be ".l yview scroll number units|pages"}} 36test util-1.6 {Tk_GetScrollInfo procedure} { 37 list [catch {.l yview scroll xyz units} msg] $msg 38} {1 {expected integer but got "xyz"}} 39test util-1.7 {Tk_GetScrollInfo procedure} { 40 .l yview 0 41 .l yview scroll 2 pages 42 .l nearest 0 43} {6} 44test util-1.8 {Tk_GetScrollInfo procedure} { 45 .l yview 15 46 .l yview scroll -2 pages 47 .l nearest 0 48} {9} 49test util-1.9 {Tk_GetScrollInfo procedure} { 50 .l yview 0 51 .l yview scroll 2 units 52 .l nearest 0 53} {2} 54test util-1.10 {Tk_GetScrollInfo procedure} { 55 .l yview 15 56 .l yview scroll -2 units 57 .l nearest 0 58} {13} 59test util-1.11 {Tk_GetScrollInfo procedure} { 60 list [catch {.l yview scroll 3 zips} msg] $msg 61} {1 {bad argument "zips": must be units or pages}} 62test util-1.12 {Tk_GetScrollInfo procedure} { 63 list [catch {.l yview dropdead 3 times} msg] $msg 64} {1 {unknown option "dropdead": must be moveto or scroll}} 65 66# cleanup 67cleanupTests 68return 69