summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2003-02-09 07:48:22 (GMT)
committerhobbs <hobbs@noemail.net>2003-02-09 07:48:22 (GMT)
commitc157274ebe7c2fe80735f2ff206d1726f579254d (patch)
treec6933d15bed38ac3ee37519fe2b9700aeee30333 /tests
parent8c105df5911ecc6664635f778715b5d7cb06269a (diff)
downloadtk-c157274ebe7c2fe80735f2ff206d1726f579254d.zip
tk-c157274ebe7c2fe80735f2ff206d1726f579254d.tar.gz
tk-c157274ebe7c2fe80735f2ff206d1726f579254d.tar.bz2
* generic/tkCanvArc.c (CreateArc): Rework canvas create item
* generic/tkCanvBmap.c (CreateBitmap): type coords handling to be * generic/tkCanvImg.c (CreateImage): consistent across types * generic/tkCanvPoly.c (CreatePolygon): and not pass empty coords * generic/tkCanvLine.c (CreateLine): to item creation procs. * generic/tkCanvText.c (CreateText): * generic/tkCanvWind.c (CreateWinItem): * generic/tkCanvas.c (CanvasWidgetCmd CANV_CREATE): * generic/tkRectOval.c (CreateRectOval): * tests/canvRect.test: * tests/canvText.test: * tests/canvas.test: FossilOrigin-Name: 940279e11eb4e8a562733a47cb3345a14014e4c3
Diffstat (limited to 'tests')
-rw-r--r--tests/canvRect.test6
-rw-r--r--tests/canvText.test4
-rw-r--r--tests/canvas.test24
3 files changed, 28 insertions, 6 deletions
diff --git a/tests/canvRect.test b/tests/canvRect.test
index a08679d..fafbb17 100644
--- a/tests/canvRect.test
+++ b/tests/canvRect.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: canvRect.test,v 1.5 2002/07/14 05:48:46 dgp Exp $
+# RCS: @(#) $Id: canvRect.test,v 1.6 2003/02/09 07:48:22 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -51,10 +51,10 @@ test canvRect-1.$i {configuration options} {
test canvRect-2.1 {CreateRectOval procedure} {
list [catch {.c create rect} msg] $msg
-} {1 {wrong # args: should be ".c create rectangle x1 y1 x2 y2 ?options?"}}
+} {1 {wrong # args: should be ".c create rect coords ?arg arg ...?"}}
test canvRect-2.2 {CreateRectOval procedure} {
list [catch {.c create oval x y z} msg] $msg
-} {1 {wrong # args: should be ".c create oval x1 y1 x2 y2 ?options?"}}
+} {1 {wrong # coordinates: expected 0 or 4, got 3}}
test canvRect-2.3 {CreateRectOval procedure} {
list [catch {.c create rectangle x 2 3 4} msg] $msg
} {1 {bad screen distance "x"}}
diff --git a/tests/canvText.test b/tests/canvText.test
index c23f949..21f09a6 100644
--- a/tests/canvText.test
+++ b/tests/canvText.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: canvText.test,v 1.11 2002/07/14 05:48:46 dgp Exp $
+# RCS: @(#) $Id: canvText.test,v 1.12 2003/02/09 07:48:22 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -61,7 +61,7 @@ test canvText-1.$i {configuration options} {
test canvText-2.1 {CreateText procedure: args} {
list [catch {.c create text} msg] $msg
-} {1 {wrong # args: should be ".c create text x y ?options?"}}
+} {1 {wrong # args: should be ".c create text coords ?arg arg ...?"}}
test canvText-2.2 {CreateText procedure: args} {
list [catch {.c create text xyz 0} msg] $msg
} {1 {bad screen distance "xyz"}}
diff --git a/tests/canvas.test b/tests/canvas.test
index d8df53a..ed470f9 100644
--- a/tests/canvas.test
+++ b/tests/canvas.test
@@ -6,7 +6,7 @@
# Copyright (c) 1998-2000 Ajuba Solutions.
# All rights reserved.
#
-# RCS: @(#) $Id: canvas.test,v 1.15 2002/07/24 19:41:38 hobbs Exp $
+# RCS: @(#) $Id: canvas.test,v 1.16 2003/02/09 07:48:22 hobbs Exp $
package require tcltest 2.1
namespace import -force tcltest::configure
@@ -452,6 +452,28 @@ test canvas-14.6 {canvas scan} {
list [catch {.c scan dragto 10 10 5} msg] $msg
} {0 {}}
+set i 0
+proc create {w type args} {
+ eval [list $w create $type] $args
+}
+foreach type {arc bitmap image line oval polygon rect text window} {
+ test canvas-15.[incr i] "basic types check: $type" {
+ destroy .c; canvas .c
+ list [catch {.c create $type} msg] $msg
+ } [format {1 {wrong # args: should be ".c create %s coords ?arg arg ...?"}} $type]
+ test canvas-15.[incr i] "basic coords check: $type" {
+ destroy .c; canvas .c
+ list [catch {.c create $type 0} msg] \
+ [string match "wrong # coordinates: expected*" $msg]
+ } {1 1}
+}
+
+test canvas-16.1 {arc coords check} {
+ destroy .c; canvas .c
+ set id [.c create arc {0 10 20 30} -start 33]
+ .c itemcget $id -start
+} {33.0}
+
destroy .c
# cleanup