diff options
Diffstat (limited to 'tests/textImage.test')
-rw-r--r-- | tests/textImage.test | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/tests/textImage.test b/tests/textImage.test index e6bdda2..bb5909c 100644 --- a/tests/textImage.test +++ b/tests/textImage.test @@ -8,10 +8,7 @@ # All rights reserved. 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] +eval tcltest::configure $argv tcltest::loadTestedCommands # One time setup. Create a font to insure the tests are font metric invariant. @@ -33,7 +30,7 @@ test textImage-1.2 {basic argument checking} { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t list [catch {.t image c} msg] $msg -} {1 {bad image option "c": must be cget, configure, create, or names}} +} {1 {ambiguous option "c": must be cget, configure, create, or names}} test textImage-1.3 {cget argument checking} { catch {destroy .t} @@ -133,7 +130,7 @@ test textImage-1.14 {basic argument checking} { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t list [catch {.t image huh} msg] $msg -} {1 {bad image option "huh": must be cget, configure, create, or names}} +} {1 {bad option "huh": must be cget, configure, create, or names}} test textImage-1.15 {align argument checking} { catch { @@ -144,7 +141,7 @@ test textImage-1.15 {align argument checking} { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t list [catch {.t image create end -image small -align wrong} msg] $msg -} {1 {bad alignment "wrong": must be baseline, bottom, center, or top}} +} {1 {bad align "wrong": must be baseline, bottom, center, or top}} test textImage-1.16 {configure} { catch { @@ -303,7 +300,9 @@ test textImage-4.2 {alignment checking - baseline} { .t image create end -image small -align baseline .t insert end test set result "" - foreach size {10 15 20 30} { + # Sizes larger than 25 can be too big and lead to a negative 'norm', + # at least on Windows XP with certain settings. + foreach size {10 15 20 25} { font configure test_font2 -size $size array set Metrics [font metrics test_font2] update @@ -317,7 +316,7 @@ test textImage-4.2 {alignment checking - baseline} { font delete test_font2 unset Metrics set result -} {{10 0} {15 0} {20 0} {30 0}} +} {{10 0} {15 0} {20 0} {25 0}} test textImage-4.3 {alignment and padding checking} {fonts} { catch { @@ -342,25 +341,30 @@ test textImage-4.3 {alignment and padding checking} {fonts} { } set result } {{default:55 22 5 5} {top:55 10 5 5} {bottom:55 35 5 5} {center:55 22 5 5} {baseline:55 22 5 5}} -# cleanup +test textImage-5.0 {peer widget images} { + catch { + image create photo small -width 5 -height 5 + small put red -to 0 0 4 4 + image create photo large -width 50 -height 50 + large put green -to 0 0 50 50 + } + catch {destroy .t .tt} + pack [text .t] + toplevel .tt + pack [.t peer create .tt.t] + .t image create end -image large + .t image create end -image small -padx 5 -pady 10 + .t insert end test + update + destroy .t .tt +} {} + +# cleanup catch {destroy .t} foreach image [image names] {image delete $image} font delete test_font # cleanup -::tcltest::cleanupTests +cleanupTests return - - - - - - - - - - - - - |