diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 12:58:33 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-03-02 12:58:33 (GMT) |
commit | bb096f3cd77b4f603783bda15ad76eca335f185d (patch) | |
tree | 10abf14f24e070c989c3d5b02ebe914bbf464655 /tests | |
parent | ab53264f81aa19db3d154d1a21b4d233c71634ef (diff) | |
parent | e09be91bbab4de3be2f23c5ba57fbdd242942313 (diff) | |
download | tk-bb096f3cd77b4f603783bda15ad76eca335f185d.zip tk-bb096f3cd77b4f603783bda15ad76eca335f185d.tar.gz tk-bb096f3cd77b4f603783bda15ad76eca335f185d.tar.bz2 |
Merge 8.7
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bind.test | 1 | ||||
-rw-r--r-- | tests/button.test | 12 | ||||
-rw-r--r-- | tests/config.test | 31 | ||||
-rw-r--r-- | tests/constraints.tcl | 1 | ||||
-rw-r--r-- | tests/event.test | 54 | ||||
-rw-r--r-- | tests/filebox.test | 19 | ||||
-rw-r--r-- | tests/panedwindow.test | 4 | ||||
-rw-r--r-- | tests/place.test | 4 | ||||
-rw-r--r-- | tests/textBTree.test | 62 | ||||
-rw-r--r-- | tests/textTag.test | 8 | ||||
-rw-r--r-- | tests/textWind.test | 18 | ||||
-rw-r--r-- | tests/ttk/combobox.test | 5 |
12 files changed, 169 insertions, 50 deletions
diff --git a/tests/bind.test b/tests/bind.test index 741915a..116405a 100644 --- a/tests/bind.test +++ b/tests/bind.test @@ -13,7 +13,6 @@ eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 -testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-] testConstraint failsOnWindows [expr {![info exists ::env(CI)] || [tk windowingsystem] ne "win32"}] diff --git a/tests/button.test b/tests/button.test index 8a2df22..b15614f 100644 --- a/tests/button.test +++ b/tests/button.test @@ -1744,7 +1744,7 @@ test button-1.177 {configuration option: "overrelief" for button} -setup { } -cleanup { destroy .b } -result {} -test button-1.178 {configuration option: "overrelief" for button} -setup { +test button-1.178 {configuration option: "overrelief" for button} -constraints needsTcl87 -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update @@ -1752,7 +1752,7 @@ test button-1.178 {configuration option: "overrelief" for button} -setup { .b configure -overrelief 1.5 } -cleanup { destroy .b -} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} +} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.179 {configuration option: "overrelief" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c @@ -1763,7 +1763,7 @@ test button-1.179 {configuration option: "overrelief" for checkbutton} -setup { } -cleanup { destroy .c } -result {} -test button-1.180 {configuration option: "overrelief" for checkbutton} -setup { +test button-1.180 {configuration option: "overrelief" for checkbutton} -constraints needsTcl87 -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update @@ -1771,7 +1771,7 @@ test button-1.180 {configuration option: "overrelief" for checkbutton} -setup { .c configure -overrelief 1.5 } -cleanup { destroy .c -} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} +} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.181 {configuration option: "overrelief" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r @@ -1782,7 +1782,7 @@ test button-1.181 {configuration option: "overrelief" for radiobutton} -setup { } -cleanup { destroy .r } -result {} -test button-1.182 {configuration option: "overrelief" for radiobutton} -setup { +test button-1.182 {configuration option: "overrelief" for radiobutton} -constraints needsTcl87 -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update @@ -1790,7 +1790,7 @@ test button-1.182 {configuration option: "overrelief" for radiobutton} -setup { .r configure -overrelief 1.5 } -cleanup { destroy .r -} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} +} -returnCodes {error} -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test button-1.183 {configuration option: "padx" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} diff --git a/tests/config.test b/tests/config.test index 82a342e..f6a4449 100644 --- a/tests/config.test +++ b/tests/config.test @@ -210,13 +210,13 @@ test config-3.8 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { testobjconfig configerror -} -returnCodes error -result {expected integer but got "bogus"} +} -returnCodes error -result {expected integer or "" but got "bogus"} test config-3.9 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { catch {testobjconfig configerror} return $errorInfo -} -result {expected integer but got "bogus" +} -result {expected integer or "" but got "bogus" (default value for "-int") invoked from within "testobjconfig configerror"} @@ -274,10 +274,10 @@ test config-4.7 {DoObjConfig - invalid boolean} -constraints { } -setup { catch {rename .foo {}} } -body { - testobjconfig alltypes .foo -boolean {} + testobjconfig alltypes .foo -boolean foo } -cleanup { killTables -} -returnCodes error -result {expected boolean value but got ""} +} -returnCodes error -result {expected boolean value or "" but got "foo"} test config-4.8 {DoObjConfig - boolean internal value} -constraints { testobjconfig } -setup { @@ -458,19 +458,20 @@ test config-4.28 {DoObjConfig - string table} -constraints testobjconfig -body { killTables } -returnCodes ok test config-4.29 {DoObjConfig - invalid string table} -constraints { - testobjconfig + testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -stringtable foo } -cleanup { killTables -} -returnCodes error -result {bad stringtable "foo": must be one, two, three, or four} +} -returnCodes error -result {bad stringtable "foo": must be one, two, three, four, or ""} test config-4.29a {DoObjConfig - invalid string table} -constraints { - testobjconfig + testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -stringtable2 foo } -cleanup { killTables -} -returnCodes error -result {bad stringtable2 "foo": must be one or two} +} -returnCodes error -result {bad stringtable2 "foo": must be one, two, or ""} + test config-4.30 {DoObjConfig - new string table} -constraints { testobjconfig } -body { @@ -780,12 +781,12 @@ test config-4.70 {DoObjConfig - relief} -constraints testobjconfig -body { killTables } -returnCodes ok -result flat test config-4.71 {DoObjConfig - invalid relief} -constraints { - testobjconfig + testobjconfig needsTcl87 } -body { testobjconfig alltypes .foo -relief foo } -cleanup { killTables -} -returnCodes error -result {bad relief "foo": must be flat, groove, raised, ridge, solid, or sunken} +} -returnCodes error -result {bad relief "foo": must be flat, groove, raised, ridge, solid, sunken, or ""} test config-4.72 {DoObjConfig - relief internal value} -constraints testobjconfig -setup { catch {rename .foo {}} } -body { @@ -874,11 +875,11 @@ test config-4.84 {DoObjConfig - justify} -constraints testobjconfig -body { } -cleanup { killTables } -returnCodes ok -result center -test config-4.85 {DoObjConfig - invalid justify} -constraints testobjconfig -body { +test config-4.85 {DoObjConfig - invalid justify} -constraints {testobjconfig needsTcl87} -body { testobjconfig alltypes .foo -justify foo } -cleanup { killTables -} -returnCodes error -result {bad justification "foo": must be left, right, or center} +} -returnCodes error -result {bad justification "foo": must be left, right, center, or ""} test config-4.86 {DoObjConfig - new justify} -constraints testobjconfig -body { testobjconfig alltypes .foo -justify left .foo configure -justify right @@ -916,9 +917,9 @@ test config-4.90 {DoObjConfig - anchor} -constraints testobjconfig -body { } -returnCodes ok -result center test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor foo -} -cleanup { +} -constraints needsTcl87 -cleanup { killTables -} -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, or center} +} -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, center, or ""} test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n @@ -1587,7 +1588,7 @@ test config-10.3 {Tk_GetOptionInfo - all items} -constraints { .foo configure } -cleanup { destroy .foo -} -result {{-boolean boolean Boolean 1 1} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-stringtable2 StringTable2 stringTable2 two two} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief {} {}} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor center center} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} +} -result {{-boolean boolean Boolean {} {}} {-integer integer Integer 7 13563} {-double double Double 3.14159 3.14159} {-string string String foo foo} {-stringtable StringTable stringTable one one} {-stringtable2 StringTable2 stringTable2 two two} {-color color Color red red} {-font font Font {Helvetica 12} {Helvetica 18}} {-bitmap bitmap Bitmap gray50 gray50} {-border border Border blue blue} {-relief relief Relief {} {}} {-cursor cursor Cursor xterm xterm} {-justify {} {} left left} {-anchor anchor Anchor center center} {-pixel pixel Pixel 1 1} {-custom {} {} {} {}} {-synonym -color}} test config-10.4 {Tk_GetOptionInfo - chaining through tables} -constraints testobjconfig -body { testobjconfig chain2 .foo -one asdf -three xyzzy .foo configure diff --git a/tests/constraints.tcl b/tests/constraints.tcl index e7ff2bc..6fa9024 100644 --- a/tests/constraints.tcl +++ b/tests/constraints.tcl @@ -257,6 +257,7 @@ testConstraint noExceed [expr { ![testConstraint unix] || [catch {font actual "\{xyz"}] }] testConstraint deprecated [expr {![package vsatisfies [package provide Tcl] 8.7-] || ![::tk::build-info no-deprecate]}] +testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7-] # constraints for testing facilities defined in the tktest executable... testConstraint testImageType [expr {"test" in [image types]}] diff --git a/tests/event.test b/tests/event.test index fe23743..50f2cf7 100644 --- a/tests/event.test +++ b/tests/event.test @@ -846,6 +846,60 @@ test event-9 {no <Enter> event is generated for the container window when its } } -result {.top .top.f} +test event-9.1 {enter . window by destroying a toplevel - bug b1d115fa60} -setup { + set EnterBind [bind . <Enter>] +} -body { + wm geometry . 200x200+300+300 + wm deiconify . + _pause 200 + toplevel .top2 -width 200 -height 200 + wm geometry .top2 +[expr {[winfo rootx .]+50}]+[expr {[winfo rooty .]+50}] + wm deiconify .top2 + raise .top2 + _pause 400 + event generate .top2 <Motion> -warp 1 -x 50 -y 50 + _pause 100 + bind . <Enter> {lappend res %W} + set res [list ] + destroy .top2 + _pause 200 + set res +} -cleanup { + deleteWindows + bind . <Enter> $EnterBind +} -result {.} +test event-9.2 {enter toplevel window by destroying a toplevel - bug b1d115fa60} -setup { + set iconified false + if {[winfo ismapped .]} { + wm iconify . + update + set iconified true + } +} -body { + toplevel .top1 + wm geometry .top1 200x200+300+300 + wm deiconify .top1 + _pause 200 + toplevel .top2 -width 200 -height 200 + wm geometry .top2 +[expr {[winfo rootx .top1]+50}]+[expr {[winfo rooty .top1]+50}] + wm deiconify .top2 + raise .top2 + _pause 400 + event generate .top2 <Motion> -warp 1 -x 50 -y 50 + _pause 100 + bind .top1 <Enter> {lappend res %W} + set res [list ] + destroy .top2 + _pause 200 + set res +} -cleanup { + deleteWindows ; # destroy all children of ".", this already includes .top1 + if {$iconified} { + wm deiconify . + update + } +} -result {.top1} + # cleanup update unset -nocomplain keypress_lookup diff --git a/tests/filebox.test b/tests/filebox.test index d7d051e..cdf3224 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -74,7 +74,6 @@ proc EnterFileByKey {parent fileName fileDir} { } proc SendButtonPress {parent btn type} { - global tk_strictMotif if {$parent == "."} { set w .__tk_filedialog } else { @@ -210,7 +209,6 @@ foreach mode $modes { # set verylongstring $verylongstring$verylongstring # set verylongstring $verylongstring$verylongstring - set color #404040 test filebox-2.1-$mode "tk_getOpenFile command" nonUnixUserInteraction { ToPressButton $parent cancel tk_getOpenFile -title "Press Cancel ($verylongstring)" -parent $parent @@ -281,9 +279,6 @@ foreach mode $modes { catch {unset tv} catch {unset typeName} ToPressButton $parent ok - if {[info exists tv]} { - } else { - } set choice [tk_getOpenFile -title "Press Ok" \ -filetypes $filters($x) -parent $parent \ -initialfile $fileName -initialdir $fileDir \ @@ -337,20 +332,6 @@ foreach mode $modes { [info commands ::tk::dialog::file::] eq "" }] - set parent . - - set verylongstring longstring: - set verylongstring $verylongstring$verylongstring - set verylongstring $verylongstring$verylongstring - set verylongstring $verylongstring$verylongstring - set verylongstring $verylongstring$verylongstring - # set verylongstring $verylongstring$verylongstring - # set verylongstring $verylongstring$verylongstring - # set verylongstring $verylongstring$verylongstring - # set verylongstring $verylongstring$verylongstring - # set verylongstring $verylongstring$verylongstring - - set color #404040 test filebox-5.1-$mode "tk_getSaveFile command" nonUnixUserInteraction { ToPressButton $parent cancel tk_getSaveFile -title "Press Cancel ($verylongstring)" -parent $parent diff --git a/tests/panedwindow.test b/tests/panedwindow.test index f8fb3ae..e917b50 100644 --- a/tests/panedwindow.test +++ b/tests/panedwindow.test @@ -122,9 +122,9 @@ test panedwindow-1.23 {configuration options: -proxyrelief (good)} -body { } -cleanup { .p configure -proxyrelief [lindex [.p configure -proxyrelief] 3] } -result {groove groove} -test panedwindow-1.24 {configuration options: -proxyrelief (bad)} -body { +test panedwindow-1.24 {configuration options: -proxyrelief (bad)} -constraints needsTcl87 -body { .p configure -proxyrelief 1.5 -} -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken} +} -returnCodes error -result {bad relief "1.5": must be flat, groove, raised, ridge, solid, sunken, or ""} test panedwindow-1.25 {configuration options: -relief (good)} -body { .p configure -relief groove list [lindex [.p configure -relief] 4] [.p cget -relief] diff --git a/tests/place.test b/tests/place.test index f0dd513..49edeb0 100644 --- a/tests/place.test +++ b/tests/place.test @@ -79,7 +79,7 @@ test place-2.3 {ConfigureContent procedure, -height option} -setup { test place-3.1 {ConfigureContent procedure, -relheight option} -body { place .t.f2 -relheight abcd -} -returnCodes error -result {expected floating-point number but got "abcd"} +} -returnCodes error -result {expected floating-point number or "" but got "abcd"} test place-3.2 {ConfigureContent procedure, -relheight option} -setup { place forget .t.f2 } -body { @@ -144,7 +144,7 @@ test place-4.7 {prevent management loops} -setup { test place-5.1 {ConfigureContent procedure, -relwidth option} -body { place .t.f2 -relwidth abcd -} -returnCodes error -result {expected floating-point number but got "abcd"} +} -returnCodes error -result {expected floating-point number or "" but got "abcd"} test place-5.2 {ConfigureContent procedure, -relwidth option} -setup { place forget .t.f2 } -body { diff --git a/tests/textBTree.test b/tests/textBTree.test index 467e8dd..767e7a0 100644 --- a/tests/textBTree.test +++ b/tests/textBTree.test @@ -257,6 +257,68 @@ test btree-2.21 {deleting with negative range} -body { .t delete 3.2 3.2 .t get 1.0 1000000.0 } -result "Line 1\nLine 2\nLine 3\n" +test btree-2.22 {deleting into beginning of elided range} -setup { + .t delete 1.0 end +} -body { + for {set n 1} {$n <= 10} {incr n} { + .t insert end "Line $n\n" + } + .t tag configure Elided -elide 1 + .t tag add Elided 6.0 end + .t delete 5.0 "5.0 + 8 chars" + .t get 4.0 7.0 +} -cleanup { + .t tag delete Elided + .t delete 1.0 end +} -result "Line 4\nine 6\nLine 7\n" +test btree-2.23 {deleting from within elided range} -body { + for {set n 1} {$n <= 10} {incr n} { + .t insert end "Line $n\n" + } + .t tag configure Elided -elide 1 + .t tag add Elided 6.0 8.0 + .t delete 7.0 9.0 + .t get 6.0 8.0 +} -cleanup { + .t tag delete Elided + .t delete 1.0 end +} -result "Line 6\nLine 9\n" +test btree-2.24 {deleting whole elided range} -body { + for {set n 1} {$n <= 10} {incr n} { + .t insert end "Line $n\n" + } + .t tag configure Elided -elide 1 + .t tag add Elided 6.0 8.0 + .t delete 5.0 9.0 + .t get 4.0 6.0 +} -cleanup { + .t tag delete Elided + .t delete 1.0 end +} -result "Line 4\nLine 9\n" +test btree-2.25 {deleting several elided ranges} -body { + for {set n 1} {$n <= 10} {incr n} { + .t insert end "Line $n\n" + } + .t tag configure Elided -elide 1 + .t tag add Elided 6.0 6.2 6.4 6.5 7.2 7.6 + .t delete 5.0 9.0 + .t get 4.0 7.0 +} -cleanup { + .t tag delete Elided + .t delete 1.0 end +} -result "Line 4\nLine 9\nLine 10\n" +test btree-2.26 {deleting first char of elided range} -body { + for {set n 1} {$n <= 10} {incr n} { + .t insert end "Line $n\n" + } + .t tag configure Elided -elide 1 + .t tag add Elided 6.0 end + .t delete 6.0 6.1 + .t get 5.0 7.0 +} -cleanup { + .t tag delete Elided + .t delete 1.0 end +} -result "Line 5\nine 6\n" test btree-3.1 {inserting with tags} -body { diff --git a/tests/textTag.test b/tests/textTag.test index e88e47d..2e776d7 100644 --- a/tests/textTag.test +++ b/tests/textTag.test @@ -180,7 +180,7 @@ test textTag-1.21 {configuration options} -body { .t tag configure x -overstrike stupid } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] -} -returnCodes error -result {expected boolean value but got "stupid"} +} -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-1.21a {tag configuration options} -body { .t tag configure x -overstrikefg red .t tag cget x -overstrikefg @@ -301,7 +301,7 @@ test textTag-1.35 {configuration options} -body { .t tag configure x -underline stupid } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] -} -returnCodes error -result {expected boolean value but got "stupid"} +} -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-1.36 {tag configuration options} -body { .t tag configure x -underlinefg red .t tag cget x -underlinefg @@ -532,13 +532,13 @@ test textTag-5.6 {TkTextTagCmd - "configure" option} -body { .t tag configure x -overstrike foo } -cleanup { .t tag delete x -} -returnCodes error -result {expected boolean value but got "foo"} +} -returnCodes error -result {expected boolean value or "" but got "foo"} test textTag-5.7 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline stupid } -cleanup { .t tag delete x -} -returnCodes error -result {expected boolean value but got "stupid"} +} -returnCodes error -result {expected boolean value or "" but got "stupid"} test textTag-5.8 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify left diff --git a/tests/textWind.test b/tests/textWind.test index 881d847..7e1d797 100644 --- a/tests/textWind.test +++ b/tests/textWind.test @@ -1601,7 +1601,7 @@ test textWind-17.10 {peer widget window configuration} -setup { destroy .tt .t } -result {.t.f {} {} .t.f .tt.t.f {} .t.f .tt.t.f .t.f .tt.t.f} -test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -constraints knownBug -setup { +test textWind-18.1 {embedded window deletion triggered by a script bound to <Map>} -setup { catch {destroy .t .f .f2} } -body { pack [text .t] @@ -1613,11 +1613,27 @@ test textWind-18.1 {embedded window deletion triggered by a script bound to <Map # this shall not crash (bug 1501749) after 100 {.t yview end} tkwait visibility .f2 + after 200 updateText } -cleanup { destroy .t .f .f2 } -result {} +test textWind-18.2 {text widget deletion triggered by a script bound to embedded window mapping} -setup { + catch {destroy .t .f} +} -body { + pack [text .t] + for {set i 1} {$i < 100} {incr i} {.t insert end "Line $i\n"} + .t window create end -window [frame .f -background red -width 80 -height 80] + bind .f <Map> {destroy .t} + updateText + # this shall not crash (bug 1501749) + after 100 {.t yview end} + tkwait window .t +} -cleanup { + destroy .t .f +} -result {} + option clear # cleanup diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index bec5b25..d8d644d 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -60,6 +60,11 @@ test combobox-2.7 {current -- set to 0 index when empty [bug 924835c36d]} -body .cb current 0 } -returnCodes error -result {index "0" out of range} +test combobox-2.8 "current -- set to end index in an empty combobox" -body { + .cb configure -values {} + .cb current end +} -returnCodes error -result {index "end" out of range} + test combobox-2.end "Cleanup" -body { destroy .cb } test combobox-3 "Read postoffset value dynamically from current style" -body { |