1# This file is a Tcl script to test out the canvas "moveto" command. It is 2# derived from canvRect.test. 3# 4# Copyright (c) 1994-1996 Sun Microsystems, Inc. 5# Copyright (c) 1998-1999 by Scriptics Corporation. 6# Copyright (c) 2004 Neil McKay. 7# All rights reserved. 8 9package require tcltest 2.2 10eval tcltest::configure $argv 11tcltest::loadTestedCommands 12 13canvas .c -width 400 -height 300 -bd 2 -relief sunken 14.c create rectangle 20 20 80 80 -tag {test rect1} 15.c create rectangle 40 40 90 100 -tag {test rect2} 16 17test canvMoveto-1.1 {Bad args handling for "moveto" command} -body { 18 .c moveto test 19} -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} 20test canvMoveto-1.2 {Bad args handling for "moveto" command} -body { 21 .c moveto rect 22} -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} 23test canvMoveto-1.3 {Bad args handling for "moveto" command} -body { 24 .c moveto test 12 25} -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} 26test canvMoveto-1.4 {Bad args handling for "moveto" command} -body { 27 .c moveto test 12 y 28} -returnCodes error -result {bad screen distance "y"} 29test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { 30 .c moveto test 12 20 -anchor 31} -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} 32 33test canvMoveto-2.1 {Canvas "moveto" command coordinates} { 34 .c moveto test 200 150 35 .c bbox test 36} {200 150 272 232} 37test canvMoveto-2.2 {Canvas "moveto" command, blank y coordinate} { 38 .c moveto test 200 150 39 .c moveto test 150 {} 40 .c bbox test 41} {150 150 222 232} 42test canvMoveto-2.3 {Canvas "moveto" command, blank x coordinate} { 43 .c moveto test 200 150 44 .c moveto test {} 200 45 .c bbox test 46} {200 200 272 282} 47 48.c delete withtag all 49 50# cleanup 51cleanupTests 52return 53 54# Local Variables: 55# mode: tcl 56# End: 57