summaryrefslogtreecommitdiffstats
path: root/tests/canvMoveto.test
blob: 255df99db584ed23db8a05765b0e1500f950360b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This file is a Tcl script to test out the canvas "moveto" command.
#
# this file is derived from canvRect.test, which contains the
# following copyright notices:
#
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
# RCS: @(#) $Id: canvMoveto.test,v 1.1 2008/09/30 23:54:46 dkf Exp $

package require tcltest 2.1
eval tcltest::configure $argv
tcltest::loadTestedCommands

canvas .c -width 400 -height 300 -bd 2 -relief sunken
pack .c
bind .c <1> {
    puts "button down at (%x,%y)"
}
update

.c create rectangle 20 20 80 80 -tag {test rect1}
.c create rectangle 40 40 90 100 -tag {test rect2}

test canvMoveto-1.1 {Bad args handling for "moveto" command} {
    list [catch {.c moveto test} msg] $msg
} {1 {wrong # args: should be ".c moveto tagOrId x y"}}
test canvMoveto-1.2 {Bad args handling for "moveto" command} {
    list [catch {.c moveto rect} msg] $msg
} {1 {wrong # args: should be ".c moveto tagOrId x y"}}
test canvMoveto-1.3 {Bad args handling for "moveto" command} {
    list [catch {.c moveto test 12} msg] $msg
} {1 {wrong # args: should be ".c moveto tagOrId x y"}}
test canvMoveto-1.4 {Bad args handling for "moveto" command} {
    list [catch {.c moveto test 12 y} msg] $msg
} {1 {bad screen distance "y"}}
test canvMoveto-1.5 {Bad args handling for "moveto" command} {
    list [catch {.c moveto test 12 20 -anchor} msg] $msg
} {1 {wrong # args: should be ".c moveto tagOrId x y"}}

test canvMoveto-2.1 {Canvas "moveto" command coordinates} {
    .c moveto test 200 150
    .c bbox test
} {200 150 272 232} 


test canvMoveto-3.1 {Canvas "moveto" command blank y coordinate} {
    .c moveto test 200 150
    .c moveto test 150 {}
    .c bbox test
} {150 150 222 232}

test canvMoveto-3.2 {Canvas "moveto" command blank x coordinate} {
    .c moveto test 200 150
    .c moveto test {} 200
    .c bbox test
} {200 200 272 282}

.c delete withtag all

# cleanup
cleanupTests
return