diff options
Diffstat (limited to 'tests/wm.test')
-rw-r--r-- | tests/wm.test | 182 |
1 files changed, 161 insertions, 21 deletions
diff --git a/tests/wm.test b/tests/wm.test index 6f6dc80..d913006 100644 --- a/tests/wm.test +++ b/tests/wm.test @@ -2,9 +2,9 @@ # manager, including the "wm" command. It is organized in the standard fashion # for Tcl tests. # -# Copyright (c) 1992-1994 The Regents of the University of California. -# Copyright (c) 1994-1997 Sun Microsystems, Inc. -# Copyright (c) 1998-1999 by Scriptics Corporation. +# Copyright © 1992-1994 The Regents of the University of California. +# Copyright © 1994-1997 Sun Microsystems, Inc. +# Copyright © 1998-1999 Scriptics Corporation. # All rights reserved. # This file tests window manager interactions that work across platforms. @@ -15,6 +15,71 @@ package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands +image create photo icon -data { + iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAA + CBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/w + D/AP+gvaeTAAAACXBIWXMAArQNAAK0DQEdFIm+AAAJQElEQVRYw+WXW2xdV5nHf/ty7lc + f2/FxYsdOnMSNC0HTpDiRKJWAQjWCEQNUSEAFfUOiQqrEC2+IxwpemDLSzNBBCCQeQEKq + RJgBSikiuGlN22TqhsR27OPL8eWc43Pdt7X22osHHydOm4FBPM6Slr69paX9/32Xtb614 + f/7MP6vC3O5f8L3G7HJyZPHBwfz5wrF7HQ6nRwxLTOhQuU4PW+z3eq9Xa+33rq9cms7k8 + pHjvfS3w8wOfk52u1u8oHpiUff897JJ8+dO/nI6LHho6OjQ3ahkMYwTTZ2O2zXutS3G/7 + ayubq7Vtr/7Ve2f7RytLam4ViXq1t/vRvB0ilPsjzz3+LZ5/9j7MzM5Nf/8hj5//5H97/ + YNbK5hkfTFLMxAEQQvD766v0yBGIEBEEuPUGi9dv7lx77cb3Vm9vfqc0WNi9evUKWr/xL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HRJVhWHXUrd2pmLXr7tDr + VpcMP838w/F+wxxxyprsgB2ALclAxtRAbaBirRdB4f5mHoTeuJlUxYoly8nRRxHW4HahO + 30SvmI5Y+CCBF4dPhzg0CYwOLs45GdKfG+sKhBuy2H4xUlM1i76+BhcBwwirLj/bAlJqj + XXzP9UyxmuHzp8feiknLPW6Q/H9moy3yK1oqvROUE2yH99suX45PwEyf2MTOoCNrQAAAB + l0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABWdEVYdFNvdXJjZQBodHR + wczovL29wZW5jbGlwYXJ0Lm9yZy9kZXRhaWwvMzUyMzMvdGFuZ28taW5ldHJuZXQtd2Vi + LWJyb3dzZXItYnktd2Fyc3phd2lhbmth5nAuRgAAACB0RVh0VGl0bGUAdGFuZ28gaW5ld + HJuZXQgd2ViIGJyb3dzZXLyr62TAAAAAElFTkSuQmCC +} + wm deiconify . if {![winfo ismapped .]} { tkwait visibility . @@ -59,7 +124,7 @@ test wm-1.1 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -bo # Next test will fail every time set of subcommands is changed test wm-1.2 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm foo -} -result {bad option "foo": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw} +} -result {bad option "foo": must be aspect, attributes, client, colormapwindows, command, deiconify, focusmodel, forget, frame, geometry, grid, group, iconbadge, iconbitmap, iconify, iconmask, iconname, iconphoto, iconposition, iconwindow, manage, maxsize, minsize, overrideredirect, positionfrom, protocol, resizable, sizefrom, stackorder, state, title, transient, or withdraw} test wm-1.3 {Tk_WmObjCmd procedure, miscellaneous errors} -returnCodes error -body { wm command } -result {wrong # args: should be "wm option window ?arg ...?"} @@ -129,20 +194,22 @@ test wm-attributes-1.1 {usage} -returnCodes error -body { } -result {wrong # args: should be "wm option window ?arg ...?"} test wm-attributes-1.2.1 {usage} -constraints win -returnCodes error -body { wm attributes . _ -} -result {bad attribute "_": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost} +} -result {bad attribute "_": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor} test wm-attributes-1.2.2 {usage} -constraints win -returnCodes error -body { wm attributes . -alpha 1.0 -disabled } -result {wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"} test wm-attributes-1.2.3 {usage} -constraints win -returnCodes error -body { wm attributes . -to -} -result {bad attribute "-to": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost} +} -result {bad attribute "-to": must be -alpha, -disabled, -fullscreen, -toolwindow, -topmost, or -transparentcolor} test wm-attributes-1.2.4 {usage} -constraints {unix notAqua} -returnCodes error -body { wm attributes . _ -} -result {bad attribute "_": must be -alpha, -topmost, -zoomed, -fullscreen, or -type} +} -result {bad attribute "_": must be -alpha, -fullscreen, -topmost, -type, or -zoomed} +if {[tk windowingsystem] eq "aqua"} { + set result_1_2_5 {bad attribute "_": must be -alpha, -appearance, -buttons, -fullscreen, -isdark, -modified, -notify, -titlepath, -topmost, -transparent, -stylemask, -class, -tabbingid, -tabbingmode, or -type} +} else {set result_1_2_5 {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type}} test wm-attributes-1.2.5 {usage} -constraints aqua -returnCodes error -body { wm attributes . _ -} -result {bad attribute "_": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type} - +} -result $result_1_2_5 ### wm client ### test wm-client-1.1 {usage} -returnCodes error -body { @@ -725,6 +792,79 @@ test wm-group-2.1 {setting and reading values} -setup { } -result [list {} . {}] +### wm iconbadge ### +test wm-iconbadge-1.1 {usage} -body { + wm iconbadge +} -returnCodes error -result {wrong # args: should be "wm option window ?arg ...?"} +test wm-iconbadge-1.2 {usage} -body { + frame .f + set ::tk::icons::base_icon(.f) icon + wm iconbadge .f icon +} -cleanup { + destroy .f + unset ::tk::icons::base_icon(.f) +} -returnCodes error -result {window ".f" isn't a top-level window} +test wm-iconbadge-1.3 {::tk::icons::base_icon($win) must be set on X11} -constraints { + x11 +} -setup { + unset -nocomplain ::tk::icons::base_icon(.) +} -body { + wm iconbadge . ! +} -returnCodes error -result {::tk::icons::base_icon(.) must be set on X11} +test wm-iconbadge-1.4 {::tk::icons::base_icon($win) must be a Tk photo on X11} -constraints { + x11 +} -setup { + catch {image delete book} +} -body { + set ::tk::icons::base_icon(.) book + wm iconbadge . 27 +} -returnCodes error -result {can't use "book" as iconphoto: not a photo image} +test wm-iconbadge-1.5 {illegal badge number} -body { + image create photo book -data { + R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC + wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM + QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc + 0yv+DVSEUuFxIAOw== + } + set ::tk::icons::base_icon(.) book + wm iconbadge . illegal +} -cleanup { + image delete book +} -returnCodes error -result {can't use "illegal" as icon badge} +test wm-iconbadge-1.6 {non-integer badge number} -body { + image create photo book -data { + R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC + wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM + QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc + 0yv+DVSEUuFxIAOw== + } + set ::tk::icons::base_icon(.) book + wm iconbadge . 3.2 +} -cleanup { + image delete book +} -returnCodes error -result {can't use "3.2" as icon badge} +test wm-iconbadge-1.7 {negative or zero badge number} -body { + image create photo book -data { + R0lGODlhDwAPAKIAAP//////AP8AAMDAwICAgAAAAAAAAAAAAC + wAAAAADwAPAAADSQhA2u5ksPeKABKSCaya29d4WKgERFF0l1IM + QCAKatvBJ0OTdzzXI1xMB3TBZAvATtB6NSLKleXi3OBoLqrVgc + 0yv+DVSEUuFxIAOw== + } + set ::tk::icons::base_icon(.) book + wm iconbadge . 0 +} -cleanup { + image delete book +} -returnCodes error -result {can't use "0" as icon badge} +test wm-iconbadge-1.8 {usage, no need to call iconphoto on aqua or win32} -constraints { + aquaOrWin32 +} -body { + wm iconbadge . 3 + wm iconbadge . 5000 + wm iconbadge . ! + wm iconbadge . "" +} -result {} + + ### wm iconbitmap ### test wm-iconbitmap-1.1 {usage} -returnCodes error -body { wm iconbitmap @@ -784,7 +924,7 @@ test wm-iconify-2.3 {Misc errors} -body { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 -} -result {can't iconify .t2: it is an icon for .t} +} -result {can't iconify ".t2": it is an icon for ".t"} # test embedded window for Windows test wm-iconify-2.4.1 {Misc errors} -constraints win -setup { destroy .t2 @@ -794,7 +934,7 @@ test wm-iconify-2.4.1 {Misc errors} -constraints win -setup { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f -} -result {can't iconify .t2: the container does not support the request} +} -result {can't iconify ".t2": the container does not support the request} # test embedded window for other platforms test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { destroy .t2 @@ -804,7 +944,7 @@ test wm-iconify-2.4.2 {Misc errors} -constraints !win -setup { wm iconify .t2 } -returnCodes error -cleanup { destroy .t2 .r.f -} -result {can't iconify .t2: it is an embedded window} +} -result {can't iconify ".t2": it is an embedded window} test wm-iconify-3.1 {iconify behavior} -constraints {failsOnUbuntu failsOnXQuarz} -body { toplevel .t2 @@ -969,10 +1109,10 @@ test wm-maxsize-1.3 {usage} -returnCodes error -body { } -result {wrong # args: should be "wm maxsize window ?width height?"} test wm-maxsize-1.4 {usage} -returnCodes error -body { wm maxsize . x 100 -} -result {expected integer but got "x"} +} -result {expected screen distance but got "x"} test wm-maxsize-1.5 {usage} -returnCodes error -body { wm maxsize . 100 bogus -} -result {expected integer but got "bogus"} +} -result {expected screen distance but got "bogus"} test wm-maxsize-1.6 {usage} -setup { destroy .t2 } -body { @@ -1069,10 +1209,10 @@ test wm-minsize-1.3 {usage} -returnCodes error -body { } -result {wrong # args: should be "wm minsize window ?width height?"} test wm-minsize-1.4 {usage} -returnCodes error -body { wm minsize . x 100 -} -result {expected integer but got "x"} +} -result {expected screen distance but got "x"} test wm-minsize-1.5 {usage} -returnCodes error -body { wm minsize . 100 bogus -} -result {expected integer but got "bogus"} +} -result {expected screen distance but got "bogus"} test wm-minsize-1.6 {usage} -setup { destroy .t2 } -body { @@ -1609,7 +1749,7 @@ test wm-title-2.1 {setting and reading values} -setup { test wm-transient-1.1 {usage} -returnCodes error -body { catch {destroy .t} ; toplevel .t wm transient .t 1 2 -} -result {wrong # args: should be "wm transient window ?master?"} +} -result {wrong # args: should be "wm transient window ?window?"} test wm-transient-1.2 {usage} -returnCodes error -body { catch {destroy .t} ; toplevel .t wm transient .t foo @@ -1644,13 +1784,13 @@ test wm-transient-1.6 {usage} -returnCodes error -body { wm transient .dummy .icon } -cleanup { deleteWindows -} -result {can't make ".icon" a master: it is an icon for .top} +} -result {can't make ".icon" a container: it is an icon for .top} test wm-transient-1.7 {usage} -returnCodes error -body { toplevel .top wm transient .top .top } -cleanup { deleteWindows -} -result {setting ".top" as master creates a transient/master cycle} +} -result {can't set ".top" as container: would cause management loop} test wm-transient-1.8 {usage} -returnCodes error -body { toplevel .t1 toplevel .t2 @@ -1660,14 +1800,14 @@ test wm-transient-1.8 {usage} -returnCodes error -body { wm transient .t1 .t3 } -cleanup { deleteWindows -} -result {setting ".t3" as master creates a transient/master cycle} +} -result {can't set ".t3" as container: would cause management loop} test wm-transient-1.9 {usage} -returnCodes error -body { toplevel .top frame .top.f wm transient .top .top.f } -cleanup { deleteWindows -} -result {setting ".top" as master creates a transient/master cycle} +} -result {can't set ".top" as container: would cause management loop} test wm-transient-2.1 {basic get/set of toplevel} -setup { set results [list] |