summaryrefslogtreecommitdiffstats
path: root/tests/cursor.test
diff options
context:
space:
mode:
authordas <das>2002-08-20 20:26:57 (GMT)
committerdas <das>2002-08-20 20:26:57 (GMT)
commitb413674fbf9849df30cd853ce97badcda6f1d280 (patch)
treede8cb5a22c114d8af225c72aaf14047d4f3a007d /tests/cursor.test
parente013f51d592a99ad0cfebbb510c182070270c32e (diff)
downloadtk-b413674fbf9849df30cd853ce97badcda6f1d280.zip
tk-b413674fbf9849df30cd853ce97badcda6f1d280.tar.gz
tk-b413674fbf9849df30cd853ce97badcda6f1d280.tar.bz2
merged with trunk at tag macosx-8-4-merge-2002-08-20-trunkmacosx_8_4_merge_2002_08_20_branch
Diffstat (limited to 'tests/cursor.test')
-rw-r--r--tests/cursor.test87
1 files changed, 55 insertions, 32 deletions
diff --git a/tests/cursor.test b/tests/cursor.test
index e0802fd..5d98752 100644
--- a/tests/cursor.test
+++ b/tests/cursor.test
@@ -6,23 +6,18 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
#
-# RCS: @(#) $Id: cursor.test,v 1.3.2.1 2001/10/15 09:22:00 wolfsuit Exp $
+# RCS: @(#) $Id: cursor.test,v 1.3.2.2 2002/08/20 20:27:13 das Exp $
-if {[lsearch [namespace children] ::tcltest] == -1} {
- source [file join [pwd] [file dirname [info script]] defs.tcl]
-}
-
-if {[info commands testcursor] != "testcursor"} {
- puts "testcursor command not available; skipping tests"
- ::tcltest::cleanupTests
- return
-}
+package require tcltest 2.1
+namespace import -force tcltest::configure
+namespace import -force tcltest::testsDirectory
+configure -testdir [file join [pwd] [file dirname [info script]]]
+configure -loadfile [file join [testsDirectory] constraints.tcl]
+tcltest::loadTestedCommands
-eval destroy [winfo children .]
-wm geometry . {}
-raise .
+testConstraint testcursor [llength [info commands testcursor]]
-test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {
+test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {testcursor} {
set x watch
lindex $x 0
destroy .b1
@@ -30,7 +25,7 @@ test cursor-1.1 {Tk_AllocCursorFromObj - converting internal reps} {
lindex $x 0
testcursor watch
} {{1 0}}
-test cursor-1.2 {Tk_AllocCursorFromObj - discard stale cursor} {
+test cursor-1.2 {Tk_AllocCursorFromObj - discard stale cursor} {testcursor} {
set x watch
destroy .b1 .b2
button .b1 -cursor $x
@@ -40,7 +35,7 @@ test cursor-1.2 {Tk_AllocCursorFromObj - discard stale cursor} {
button .b2 -cursor $x
lappend result [testcursor watch]
} {{} {{1 1}}}
-test cursor-1.3 {Tk_AllocCursorFromObj - reuse existing cursor} {
+test cursor-1.3 {Tk_AllocCursorFromObj - reuse existing cursor} {testcursor} {
set x watch
destroy .b1 .b2
button .b1 -cursor $x
@@ -59,9 +54,50 @@ test cursor-2.2 {Tk_GetCursor procedure} {
destroy .b1
list [catch {button .b1 -cursor @xyzzy} msg] $msg
} {1 {bad cursor spec "@xyzzy"}}
+# Next two tests need a helper file with a very specific name and
+# controlled format.
+set wincur(data_octal) {
+ 000 000 002 000 001 000 040 040 000 000 007 000 007 000 060 001
+ 000 000 026 000 000 000 050 000 000 000 040 000 000 000 100 000
+ 000 000 001 000 001 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 377 377 377 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000
+ 000 000 000 000 000 000 000 000 000 000 160 016 000 000 170 036
+ 000 000 174 076 000 000 076 174 000 000 037 370 000 000 017 360
+ 000 000 007 340 000 000 007 340 000 000 017 360 000 000 037 370
+ 000 000 076 174 000 000 174 076 000 000 170 036 000 000 160 016
+ 000 000 000 000 000 000 377 377 377 377 377 377 377 377 377 377
+ 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
+ 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
+ 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377 377
+ 377 377 377 377 377 377 017 360 377 377 007 340 377 377 003 300
+ 377 377 001 200 377 377 200 001 377 377 300 003 377 377 340 007
+ 377 377 360 017 377 377 360 017 377 377 340 007 377 377 300 003
+ 377 377 200 001 377 377 001 200 377 377 003 300 377 377 007 340
+ 377 377 017 360 377 377
+}
+set wincur(data_binary) {}
+foreach wincur(num) $wincur(data_octal) {
+ append wincur(data_binary) [binary format c 0$wincur(num)]
+}
+set wincur(dir) [::tcltest::makeDirectory {dir with spaces}]
+set wincur(file) [::tcltest::makeFile $wincur(data_binary) "test file.cur" $wincur(dir)]
+test cursor-2.3 {Tk_GetCursor procedure: cursor specs are lists} {pcOnly} {
+ destroy .b1
+ button .b1 -cursor [list @$wincur(file)]
+} {.b1}
+test cursor-2.4 {Tk_GetCursor procedure: cursor specs are lists} {pcOnly} {
+ destroy .b1
+ button .b1 -cursor @[regsub -all {[][ \\{}""$#]} $wincur(file) {\\&}]
+} {.b1}
+::tcltest::removeDirectory $wincur(dir)
+unset wincur
-test cursor-3.1 {Tk_FreeCursorFromObj - reference counts} {
- set x arrow
+test cursor-3.1 {Tk_FreeCursorFromObj - reference counts} {testcursor} {
+ set x heart
destroy .b1 .b2 .b3
button .b1 -cursor $x
button .b3 -cursor $x
@@ -76,7 +112,7 @@ test cursor-3.1 {Tk_FreeCursorFromObj - reference counts} {
lappend result [testcursor arrow]
} {{{3 1}} {{2 1}} {{1 1}} {}}
-test cursor-4.1 {FreeCursorObjProc} {
+test cursor-4.1 {FreeCursorObjProc} {testcursor} {
destroy .b
set x [format arrow]
button .b -cursor $x
@@ -101,16 +137,3 @@ destroy .t
# cleanup
::tcltest::cleanupTests
return
-
-
-
-
-
-
-
-
-
-
-
-
-