summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2024-06-09 12:29:09 (GMT)
committerfvogel <fvogelnew1@free.fr>2024-06-09 12:29:09 (GMT)
commit349a69f9287ebf1e15f32de11cca27f67713ade7 (patch)
tree22941bb5b94f32b0712106c738691f4c54015336
parent620f58a044a9b25a3b58df35d4eb16cbfb05b7ff (diff)
downloadtk-349a69f9287ebf1e15f32de11cca27f67713ade7.zip
tk-349a69f9287ebf1e15f32de11cca27f67713ade7.tar.gz
tk-349a69f9287ebf1e15f32de11cca27f67713ade7.tar.bz2
Remove constraints hasEarthPhoto and hasOusterPhoto, the image files used in the tests are distributed in the tests directory so these constraints are always satisfied.
-rw-r--r--tests/constraints.tcl6
-rw-r--r--tests/imgPhoto.test16
-rw-r--r--tests/menu.test68
3 files changed, 33 insertions, 57 deletions
diff --git a/tests/constraints.tcl b/tests/constraints.tcl
index 1087d25..ad0ca85 100644
--- a/tests/constraints.tcl
+++ b/tests/constraints.tcl
@@ -296,12 +296,6 @@ testConstraint testtext [llength [info commands testtext]]
testConstraint testwinevent [llength [info commands testwinevent]]
testConstraint testwrapper [llength [info commands testwrapper]]
-# Some graphic files used in some tests
-set earthPhotoFile [file join [file dirname [info script]] earth.gif]
-testConstraint hasEarthPhoto [file exists $earthPhotoFile]
-set ousterPhotoFile [file join [file dirname [info script]] ouster.png]
-testConstraint hasOusterPhoto [file exists $ousterPhotoFile]
-
# constraints about what sort of fonts are available
testConstraint fonts 1
destroy .e
diff --git a/tests/imgPhoto.test b/tests/imgPhoto.test
index 78ddcd7..f6ed988 100644
--- a/tests/imgPhoto.test
+++ b/tests/imgPhoto.test
@@ -1425,35 +1425,43 @@ test imgPhoto-18.12 {Valid GIF (file)} -setup {
catch {image delete gif1}
} -result gif1
-test imgPhoto-19.1 {Read GIF file with -from option - Bug [1576528]} -constraints hasEarthPhoto -body {
+test imgPhoto-19.1 {Read GIF file with -from option - Bug [1576528]} -body {
+ set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1
gif1 read $earthPhotoFile -from 152 62 185 97
lindex [lindex [gif1 data] 0] 0
} -cleanup {
catch {image delete gif1}
+ unset earthPhotoFile
} -result {#d8c8b8}
-test imgPhoto-19.2 {Read GIF file, copy with -from option} -constraints hasEarthPhoto -body {
+test imgPhoto-19.2 {Read GIF file, copy with -from option} -body {
+ set earthPhotoFile [file join [file dirname [info script]] earth.gif]
image create photo gif1 -file $earthPhotoFile
image create photo gif2
gif2 copy gif1 -from 152 62 185 97
lindex [lindex [gif2 data] 0] 0
} -cleanup {
catch {image delete gif1 ; image delete gif2}
+ unset earthPhotoFile
} -result {#d8c8b8}
-test imgPhoto-19.3 {Read PNG file with -from option - Bug [1576528]} -constraints hasOusterPhoto -body {
+test imgPhoto-19.3 {Read PNG file with -from option - Bug [1576528]} -body {
+ set ousterPhotoFile [file join [file dirname [info script]] ouster.png]
image create photo png1
png1 read $ousterPhotoFile -from 102 62 135 97
lindex [lindex [png1 data] 0] 0
} -cleanup {
catch {image delete png1}
+ unset ousterPhotoFile
} -result {#c97962}
-test imgPhoto-19.4 {Read PNG file, copy with -from option} -constraints hasOusterPhoto -body {
+test imgPhoto-19.4 {Read PNG file, copy with -from option} -body {
+ set ousterPhotoFile [file join [file dirname [info script]] ouster.png]
image create photo png1 -file $ousterPhotoFile
image create photo png2
png2 copy png1 -from 102 62 135 97
lindex [lindex [png2 data] 0] 0
} -cleanup {
catch {image delete png1 ; image delete png2}
+ unset ousterPhotoFile
} -result {#c97962}
catch {rename foreachPixel {}}
diff --git a/tests/menu.test b/tests/menu.test
index 8b3b556..b345e26 100644
--- a/tests/menu.test
+++ b/tests/menu.test
@@ -287,9 +287,8 @@ menu .m2 -tearoff 1
.m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
.m1 add radiobutton -label "radiobutton" -variable radio
-if {[testConstraint hasEarthPhoto]} {
- image create photo image1 -file $earthPhotoFile
-}
+set earthPhotoFile [file join [file dirname [info script]] earth.gif]
+image create photo image1 -file $earthPhotoFile
test menu-2.31 {entry configuration options 0 -activebackground #012345 tearoff} -body {
.m1 entryconfigure 0 -activebackground #012345
@@ -689,15 +688,11 @@ test menu-2.120 {entry configuration options 5 -foreground non-existent radiobut
.m1 entryconfigure 5 -foreground non-existent
} -returnCodes error -result {unknown color name "non-existent"}
-test menu-2.121 {entry configuration options 0 -image image1 tearoff} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.121 {entry configuration options 0 -image image1 tearoff} -body {
.m1 entryconfigure 0 -image image1
} -returnCodes error -result {unknown option "-image"}
-test menu-2.122 {entry configuration options 1 -image image1 command} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.122 {entry configuration options 1 -image image1 command} -setup {
.m1 entryconfigure 1 -image {}
} -body {
.m1 entryconfigure 1 -image image1
@@ -706,9 +701,7 @@ test menu-2.122 {entry configuration options 1 -image image1 command} -constrain
.m1 entryconfigure 1 -image {}
} -result {image1}
-test menu-2.123 {entry configuration options 2 -image image1 cascade} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.123 {entry configuration options 2 -image image1 cascade} -setup {
.m1 entryconfigure 2 -image {}
} -body {
.m1 entryconfigure 2 -image image1
@@ -717,15 +710,11 @@ test menu-2.123 {entry configuration options 2 -image image1 cascade} -constrain
.m1 entryconfigure 2 -image {}
} -result {image1}
-test menu-2.124 {entry configuration options 3 -image image1 separator} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.124 {entry configuration options 3 -image image1 separator} -body {
.m1 entryconfigure 3 -image image1
} -returnCodes error -result {unknown option "-image"}
-test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -setup {
.m1 entryconfigure 4 -image {}
} -body {
.m1 entryconfigure 4 -image image1
@@ -734,9 +723,7 @@ test menu-2.125 {entry configuration options 4 -image image1 checkbutton} -const
.m1 entryconfigure 4 -image {}
} -result {image1}
-test menu-2.126 {entry configuration options 5 -image image1 radiobutton} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.126 {entry configuration options 5 -image image1 radiobutton} -setup {
.m1 entryconfigure 5 -image {}
} -body {
.m1 entryconfigure 5 -image image1
@@ -980,33 +967,23 @@ test menu-2.180 {entry configuration options 5 -selectcolor non-existent radiobu
.m1 entryconfigure 5 -selectcolor non-existent
} -returnCodes error -result {unknown color name "non-existent"}
-test menu-2.181 {entry configuration options 0 -selectimage image1 tearoff} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.181 {entry configuration options 0 -selectimage image1 tearoff} -body {
.m1 entryconfigure 0 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
-test menu-2.182 {entry configuration options 1 -selectimage image1 command} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.182 {entry configuration options 1 -selectimage image1 command} -body {
.m1 entryconfigure 1 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
-test menu-2.183 {entry configuration options 2 -selectimage image1 cascade} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.183 {entry configuration options 2 -selectimage image1 cascade} -body {
.m1 entryconfigure 2 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
-test menu-2.184 {entry configuration options 3 -selectimage image1 separator} -constraints {
- hasEarthPhoto
-} -body {
+test menu-2.184 {entry configuration options 3 -selectimage image1 separator} -body {
.m1 entryconfigure 3 -selectimage image1
} -returnCodes error -result {unknown option "-selectimage"}
-test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton} -setup {
.m1 entryconfigure 4 -selectimage {}
} -body {
.m1 entryconfigure 4 -selectimage image1
@@ -1015,9 +992,7 @@ test menu-2.185 {entry configuration options 4 -selectimage image1 checkbutton}
.m1 entryconfigure 4 -selectimage {}
} -result {image1}
-test menu-2.186 {entry configuration options 5 -selectimage image1 radiobutton} -constraints {
- hasEarthPhoto
-} -setup {
+test menu-2.186 {entry configuration options 5 -selectimage image1 radiobutton} -setup {
.m1 entryconfigure 5 -selectimage {}
} -body {
.m1 entryconfigure 5 -selectimage image1
@@ -1209,10 +1184,7 @@ test menu-2.228 {entry configuration options 5 -underline 3p radiobutton} -body
} -returnCodes error -result {expected integer but got "3p"}
deleteWindows
-if {[testConstraint hasEarthPhoto]} {
- image delete image1
-}
-
+image delete image1
test menu-3.1 {MenuWidgetCmd procedure} -setup {
@@ -2328,7 +2300,7 @@ test menu-8.1 {DestroyMenuEntry} -setup {
.m1 add cascade -menu .m2
list [.m1 delete 1] [destroy .m1 .m2]
} -result {{} {}}
-test menu-8.2 {DestroyMenuEntry} -constraints hasEarthPhoto -setup {
+test menu-8.2 {DestroyMenuEntry} -setup {
deleteWindows
catch {image delete image1a}
} -body {
@@ -2669,7 +2641,7 @@ test menu-11.18 {ConfigureMenuEntry} -constraints testImageType -setup {
imageCleanup
} -result {}
test menu-11.19 {ConfigureMenuEntry} -constraints {
- testImageType hasEarthPhoto
+ testImageType
} -setup {
deleteWindows
imageCleanup
@@ -2684,7 +2656,7 @@ test menu-11.19 {ConfigureMenuEntry} -constraints {
imageCleanup
} -result {}
test menu-11.20 {ConfigureMenuEntry} -constraints {
- testImageType hasEarthPhoto
+ testImageType
} -setup {
deleteWindows
imageCleanup
@@ -2699,7 +2671,7 @@ test menu-11.20 {ConfigureMenuEntry} -constraints {
imageCleanup
} -result {}
test menu-11.21 {ConfigureMenuEntry} -constraints {
- testImageType hasEarthPhoto
+ testImageType
} -setup {
deleteWindows
imageCleanup
@@ -2715,6 +2687,8 @@ test menu-11.21 {ConfigureMenuEntry} -constraints {
imageCleanup
} -result {}
+unset earthPhotoFile
+
test menu-12.1 {ConfigureMenuCloneEntries} -setup {
deleteWindows