diff options
author | rjohnson <rjohnson> | 1998-04-01 09:51:44 (GMT) |
---|---|---|
committer | rjohnson <rjohnson> | 1998-04-01 09:51:44 (GMT) |
commit | 066ea7fd88d49cb456f74da71dbe875e4fc0aabb (patch) | |
tree | 8fb30cb152c4dc191be47fa043d2e6f5ea38c7ba /tests/macMenu.test | |
parent | 13242623d2ff3ea02ab6a62bfb48a7dbb5c27e22 (diff) | |
download | tk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.zip tk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.tar.gz tk-066ea7fd88d49cb456f74da71dbe875e4fc0aabb.tar.bz2 |
Initial revision
Diffstat (limited to 'tests/macMenu.test')
-rw-r--r-- | tests/macMenu.test | 1565 |
1 files changed, 1565 insertions, 0 deletions
diff --git a/tests/macMenu.test b/tests/macMenu.test new file mode 100644 index 0000000..2c10e86 --- /dev/null +++ b/tests/macMenu.test @@ -0,0 +1,1565 @@ +# This file is a Tcl script to test menus in Tk. It is +# organized in the standard fashion for Tcl tests. This +# file tests the Macintosh-specific features of the menu +# system. +# +# Copyright (c) 1995-1997 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# SCCS: @(#) macMenu.test 1.23 97/07/10 13:35:52 + +if {$tcl_platform(platform) != "macintosh"} { + return +} + +if {[lsearch [image types] test] < 0} { + puts "This application hasn't been compiled with the \"test\" image" + puts "type, so I can't run this test. Are you sure you're using" + puts "tktest instead of wish?" + return +} + +if {[info procs test] != "test"} { + source defs +} + +proc deleteWindows {} { + foreach i [winfo children .] { + catch [destroy $i] + } +} + +deleteWindows +wm geometry . {} +raise . + +test macMenu-1.0 {TkMacUseMenuID} {} { + # Can't really test TkMacUseMenuID; it's only called on startup. +} {} + +test macMenu-2.1 {GetNewID} { + catch {destroy .m1} + list [catch {menu .m1} msg] $msg [destroy .m1] +} {0 .m1 {}} +test macMenu-2.2 {GetNewID - cascade menu} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m2 + list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2] +} {0 .m2 {} {}} +test macMenu-2.3 {GetNewID - running out of ids} { + deleteWindows + menu .menu + for {set i 0} {$i < 230} {incr i} { + menu .m$i + .menu add cascade -label ".m$i" -menu .m$i + } + menu .breaker + list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows] +} {1 {No more menus can be allocated.} {}} + +test macMenu-3.1 {FreeID} { + catch {destroy .m1} + menu .m1 + list [catch {destroy .m1} msg] $msg +} {0 {}} + +# No way to test running out of ids in TkpNewPlatformMenu +test macMenu-4.1 {TkpNewMenu} { + catch {destroy .m1} + list [catch {menu .m1} msg] $msg [catch {destroy .m1} msg2] $msg2 +} {0 .m1 0 {}} +test macMenu-4.2 {TkpNewMenu - checking for help menu when one is there} { + catch {destroy .m1} + catch {destroy .m2} + menu .m1 + menu .m1.help -tearoff 0 + .m1.help add command -label Test + . configure -menu .m1 + raise . + update + list [catch {menu .m2} msg] $msg [destroy .m1] [destroy .m2] [. configure -menu ""] +} {0 .m2 {} {} {}} +test macMenu-4.3 {TkpNewMenu - menubar set but different interp} { + catch {interp delete testinterp} + catch {destroy .m1} + interp create testinterp + load {} Tk testinterp + interp eval testinterp {raise .} + interp eval testinterp {menu .m1} + interp eval testinterp {. configure -menu .m1} + interp eval testinterp {update} + list [catch {menu .m1} msg] $msg [destroy .m1] [interp delete testinterp] +} {0 .m1 {} {}} +test macMenu-4.4 {TkpNewMenu - menubar set but new menu has different parent} { + catch {destroy .m1} + catch {destroy .m2} + menu .m1 -tearoff 0 + .m1 add cascade -menu .m1.help + menu .m2 + .m2 add cascade -menu .m2.help + . configure -menu .m1 + raise . + update + list [catch {menu .m2.help} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2] +} {0 .m2.help {} {} {}} +test macMenu-4.5 {TkpNewMenu - menubar set, same parent, not .help} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add cascade -menu .m1.help + . configure -menu .m1 + raise . + update + list [catch {menu .m1.foo} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 .m1.foo {} {}} +test macMenu-4.6 {TkpNewMenu - creating the help menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add cascade -menu .m1.help + . configure -menu .m1 + raise . + update + list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 .m1.help {} {}} + +test macMenu-5.1 {TkpDestroyMenu} { + catch {destroy .m1} + menu .m1 + list [catch {destroy .m1} msg] $msg +} {0 {}} +test macMenu-5.2 {TkpDestroyMenu - help menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add cascade -menu .m1.help + . configure -menu .m1 + menu .m1.help + raise . + update + list [catch {destroy .m1.help} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-5.3 {TkpDestroyMenu - idle handler pending} { + catch {destroy .m1} + menu .m1 + .m1 add command -label test + list [catch {destroy .m1} msg] $msg +} {0 {}} +test macMenu-5.4 {TkpDestroyMenu - idle handler not pending} { + catch {destroy .m1} + menu .m1 + .m1 add command -label test + update idletasks + list [catch {destroy .m1} msg] $msg +} {0 {}} + +test macMenu-6.1 {SetMenuCascade} { + catch {destroy .m1} + catch {destroy .m2} + menu .m1 + menu .m2 + list [catch {.m2 add cascade -menu .m1} msg] $msg [destroy .m1 .m2] +} {0 {} {}} +test macMenu-6.2 {SetMenuCascade - running out of ids} { + deleteWindows + menu .menu + for {set i 0} {$i < 230} {incr i} { + menu .m$i + .menu add cascade -label ".m$i" -menu .m$i + } + menu .breaker + list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows] +} {1 {No more menus can be allocated.} {}} + +test macMenu-7.1 {TkpDestroyMenuEntry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" + list [catch {.m1 delete 1} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-7.2 {TkpDestroyMenuEntry - help menu} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + menu .m1.help -tearoff 0 + .m1.help add command -label "test" + . configure -menu .m1 + raise . + update + list [catch {.m1.help delete test} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} + +test macMenu-8.1 {GetEntryText} { + catch {destroy .m1} + list [catch {menu .m1} msg] $msg [destroy .m1] +} {0 .m1 {}} +test macMenu-8.2 {GetEntryText} { + catch {destroy .m1} + catch {image delete image1} + menu .m1 + image create test image1 + list [catch {.m1 add command -image image1} msg] $msg [destroy .m1] [image delete image1] +} {0 {} {} {}} +test macMenu-8.3 {GetEntryText} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -bitmap questhead} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.4 {GetEntryText} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.5 {GetEntryText} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "foo" + list [catch {.m1 add command -label "foo"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.6 {GetEntryText} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "This is a very long string. 9012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890"} \ + msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.7 {GetEntryText - elipses character} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "foo..."} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.8 {GetEntryText - false elipses character} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "foo."} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.9 {GetEntryText - false elipses character} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "foo.."} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.10 {GetEntryText - false elipses character} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "foo.b"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-8.11 {GetEntryText - false elipses character} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label "foo..b"} msg] $msg [destroy .m1] +} {0 {} {}} + + +# test macMenu-9.1 - assumes some fonts +test macMenu-9.1 {FindMarkCharacter} { + catch {destroy .m1} + menu .m1 -font "Helvetica 12" -tearoff 0 + .m1 add checkbutton -label test + .m1 invoke test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +# All standard fonts have "¥" defined. We can't test further. + +test macMenu-10.1 {SetMenuIndicator - cascade entry} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add cascade -label foo} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-10.2 {SetMenuIndicator - not radio or checkbutton} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label foo} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-10.3 {SetMenuIndicator - indiatorOn false} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add checkbutton -label foo -indicatoron 0} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-10.4 {SetMenuIndicator - entry not selected} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add checkbutton -label foo} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-10.5 {SetMenuIndicator - checkbutton} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo + list [catch {.m1 invoke foo} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-10.6 {SetMenuIndicator - radio button} { + catch {destroy .m1} + menu .m1 + .m1 add radiobutton -label foo + list [catch {.m1 invoke foo} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-11.1 {SetMenuTitle} { + catch {destroy .m1} + catch {destroy .container} + menu .container + menu .m1 +#previous title is .m1 + .container add cascade -label "File" -menu .m1 + list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1] +} {0 {} {} {}} +test macMenu-11.2 {SetMenuTitle} { + menu .container + menu .m1 + . configure -menu "" +#previous title is .m1 + .container add cascade -label "F" -menu .m1 + list [catch {. configure -menu .container} msg] $msg [. configure -menu ""] [destroy .container .m1] +} {0 {} {} {}} + +test macMenu-12.1 {TkpConfigureMenuEntry} { + catch {destroy .m1} + . configure -menu "" + menu .m1 + .m1 add cascade -menu .m3 + list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.2 {TkpConfigureMenuEntry} { + catch {destroy .m1} + catch {destroy .m2} + . configure -menu "" + menu .m1 + .m1 add cascade -menu .m3 + menu .m2 + list [catch {.m1 entryconfigure 1 -menu .m2} msg] $msg [destroy .m1 .m2] +} {0 {} {}} +test macMenu-12.3 {TkpConfigureMenuEntry - running out of ids} { + deleteWindows + menu .menu + for {set i 0} {$i < 230} {incr i} { + menu .m$i + .menu add cascade -label ".m$i" -menu .m$i + } + menu .breaker + list [catch {.menu add cascade -menu .breaker} msg] $msg [deleteWindows] +} {1 {No more menus can be allocated.} {}} +test macMenu-12.4 {TkpConfigureMenuEntry - Control} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Control+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.5 {TkpConfigureMenuEntry - Ctrl} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Ctrl+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.6 {TkpConfigureMenuEntry - Shift} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Shift+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.7 {TkpConfigureMenuEntry - Option} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Opt+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.8 {TkpConfigureMenuEntry - Command} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Command+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.9 {TkpConfigureMenuEntry - Cmd} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Cmd+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.10 {TkpConfigureMenuEntry - Alt} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Alt+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.11 {TkpConfigureMenuEntry - Meta} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Meta+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.12 {TkpConfigureMenuEntry - Two modifiers} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Cmd+Shift+S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.13 {TkpConfigureMenuEntry - dash instead of plus} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -accel "Command-S"} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.14 {TkpConfigureMenuEntry - idler pending} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-12.15 {TkpConfigureMenuEntry - idler not pending} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + update idletasks + list [catch {.m1 entryconfigure test -label test2} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-13.1 {ReconfigureIndividualMenu - getting rid of zero items} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.2 {ReconfigureIndividualMenu - getting rid of one item} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + update idletasks + .m1 delete test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.3 {ReconfigureIndividualMenu - getting rid of more than one} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + .m1 add command -label test2 + update idletasks + .m1 entryconfigure test2 -label "test two" + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.4 {ReconfigureIndividualMenu - separator} { + catch {destroy .m1} + menu .m1 + .m1 add separator + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.5 {ReconfigureIndividualMenu - disabled} { + catch {destroy .m1} + menu .m1 + .m1 add command + .m1 entryconfigure 1 -state disabled + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.6 {ReconfigureIndividualMenu - active} { + catch {destroy .m1} + menu .m1 + .m1 add command + .m1 entryconfigure 1 -state active + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.7 {ReconfigureIndividualMenu - checkbutton not checked} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.8 {ReconfigureIndividualMenu - checkbutton - indicator off} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label test -indicatoron 0 + .m1 invoke test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.9 {ReconfigureIndividualMenu - checkbutton on} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label test + .m1 invoke test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.10 {ReconfigureIndividualMenu - radiobutton not checked} { + catch {destroy .m1} + menu .m1 + .m1 add radiobutton -label test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.11 {ReconfigureIndividualMenu - radiobutton - indicator off} { + catch {destroy .m1} + menu .m1 + .m1 add radiobutton -label test -indicatoron 0 + .m1 invoke test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.12 {ReconfigureIndividualMenu - radiobutton on} { + catch {destroy .m1} + menu .m1 + .m1 add radiobutton -label test + .m1 invoke test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.13 {ReconfigureIndividualMenu} { + catch {destroy .m1} + . configure -menu "" + menu .m1 + .m1 add cascade -menu .m3 + .m1 entryconfigure 1 -menu .m2 + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.14 {ReconfigureIndividualMenu} { + catch {destroy .m1} + catch {destroy .m2} + . configure -menu "" + menu .m1 + .m1 add cascade -menu .m3 + menu .m2 + .m1 entryconfigure 1 -menu .m2 + list [catch {update idletasks} msg] $msg [destroy .m1 .m2] +} {0 {} {}} +test macMenu-13.15 {ReconfigureIndividualMenu - accelerator} { + catch {destroy .m1} + menu .m1 + .m1 add command -accel "Command-S" + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.16 {ReconfigureIndividualMenu - parent is disabled} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label .m1.edit -label "Edit" -state disabled + menu .m1.edit + .m1.edit add command -label foo + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-13.17 {ReconfigureIndividualMenu - disabling parent} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label .m1.edit -label Edit + menu .m1.edit + .m1.edit add command -label foo + .m1 entryconfigure Edit -state disabled + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-14.1 {ReconfigureMacintoshMenu - normal menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label test + list [catch {update idletasks} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-14.2 {ReconfigureMacintoshMenu - apple menu} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + menu .m1.apple -tearoff 0 + .m1.apple add command -label test + . configure -menu .m1 + raise . + list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-14.3 {ReconfigureMacintoshMenu - help menu} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + menu .m1.help -tearoff 0 + .m1.help add command -label test + . configure -menu .m1 + raise . + list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-14.4 {ReconfigureMacintoshMenu - menubar} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.file -label "foo" + menu .m1.file + . configure -menu .m1 + raise . + .m1 entryconfigure foo -label "File" + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} + +test macMenu-15.1 {CompleteIdlers - no idle pending} { + catch {destroy .m1} + menu .m1 + .m1 add command -label test + update idletasks + list [catch {.m1 post 40 40} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-15.2 {CompleteIdlers - idle pending} { + catch {destroy .m1} + menu .m1 + .m1 add command -label test + list [catch {.m1 post 40 40} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-15.3 {CompleteIdlers - recursive} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.m2 -label test + menu .m1.m2 + .m1.m2 add command -label test + list [catch {.m1 post 40 40} msg] $msg [destroy .m1] +} {0 {} {}} + +#Don't know how to generate nested post menus +test macMenu-16.1 {TkpPostMenu} { + catch {destroy .m1} + menu .m1 -postcommand "destroy .m1" + list [catch {.m1 post 40 40} msg] $msg +} {0 {}} +test macMenu-16.2 {TkpPostMenu} { + catch {destroy .m1} + menu .m1 -postcommand "blork" + list [catch {.m1 post 40 40} msg] $msg [destroy .m1] +} {1 {invalid command name "blork"} {}} +# We need to write the interactive test for menu posting. + +test macMenu-17.1 {TkpMenuNewEntry - no idle pending} { + catch {destroy .m1} + menu .m1 + list [catch {.m1 add command -label test} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-17.2 {TkpMenuNewEntry - idle pending} { + catch {destroy .m1} + menu .m1 + .m1 add command -label test + list [catch {.m1 add command -label test2} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-18.1 {DrawMenuBarWhenIdle} { + catch {destroy .m1} + . configure -menu "" + menu .m1 + . configure -menu .m1 + list [catch {update idletasks} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.2 {DrawMenuBarWhenIdle - clearing old apple menu out} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + menu .m1.apple + .m1.apple add command -label test + . configure -menu .m1 + raise . + update + . configure -menu "" + raise . + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-18.3 {DrawMenuBarWhenIdle - clearing out old help menu} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + menu .m1.help + .m1.help add command -label test + . configure -menu .m1 + raise . + update + . configure -menu "" + raise . + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-18.4 {DrawMenuBarWhenIdle - menu not there} { + catch {destroy .m1} + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] +} {0 {} {}} +test macMenu-18.5 {DrawMenuBarWhenIdle - menu there} { + catch {destroy .m1} + menu .m1 + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.6 {DrawMenuBarWhenIdle - no apple menu} { + catch {destroy .m1} + menu .m1 + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.7 {DrawMenuBarWhenIdle - apple menu references but not there} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.8 {DrawMenuBarWhenIdle - apple menu there} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + menu .m1.apple + .m1.apple add command -label test + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.9 {DrawMenuBarWhenIdle - apple menu there; no idle handler} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + menu .m1.apple + .m1.apple add command -label test + . configure -menu .m1 + raise . + update idletasks + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.10 {DrawMenuBarWhenIdle - no help menu} { + catch {destroy .m1} + menu .m1 + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.11 {DrawMenuBarWhenIdle - help menu referenced but not there} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.12 {DrawMenuBarWhenIdle - help menu there} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + menu .m1.help + .m1.help add command -label test + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.13 {DrawMenuBarWhenIdle - help menu there - no idlers} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.help + menu .m1.help + .m1.help add command -label test + . configure -menu .m1 + raise . + update idletasks + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +# Can't generate no menubar clone +test macMenu-18.14 {DrawMenuBarWhenIdle - apple and help menus in tearoff menubar} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -menu .m1.apple + .m1 add cascade -menu .m1.help + menu .m1.apple + menu .m1.help + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.15 {DrawMenuBarWhenIdle - apple and help menus in non-tearoff menubar} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add cascade -menu .m1.apple + .m1 add cascade -menu .m1.help + menu .m1.apple + menu .m1.help + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.16 {DrawMenuBarWhenIdle - no apple menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.17 {DrawMenuBarWhenIdle - apple menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + . configure -menu .m1 + .m1 add cascade -menu .m1.apple + menu .m1.apple + .m1.apple add cascade -label test -menu .m1.apple.test + menu .m1.apple.test + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.18 {DrawMenuBarWhenIdle - big for loop} { + catch {destroy .m1} + menu .m1 -tearoff 0 + menu .m1.apple -tearoff 0 + menu .m1.help -tearoff 0 + menu .m1.foo -tearoff 0 + .m1 add cascade -menu .m1.apple + .m1 add cascade -menu .m1.help + .m1 add cascade -label Foo -menu .m1.foo + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-18.19 {DrawMenuBarWhenIdle = disabled menu} { + catch {destroy .m1} + menu .m1 -tearoff 0 + menu .m1.edit -tearoff 0 + .m1 add cascade -menu .m1.edit -label Edit + . configure -menu .m1 + raise . + .m1 entryconfigure Edit -state disabled + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} + +test macMenu-19.1 {RecursivelyInsertMenu} { + catch {destroy .m1} + catch {destroy .m2} + catch {destroy .main} + catch {destroy .t2} + toplevel .t2 -menu .main + wm geometry .t2 +0+0 + menu .main + .main add cascade -menu .m1 -label ".m1" + menu .m1 + .m1 add command -label "Test 2" + .m1 add cascade -label ".m2" -menu .m2 + menu .m2 + .m2 add command -label "Test 3" + list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2] +} {0 {} {}} +test macMenu-19.2 {RecursivelyInsertMenu} { + catch {destroy .m1} + catch {destroy .m2} + catch {destroy .main} + catch {destroy .t2} + toplevel .t2 -menu .main + wm geometry .t2 +0+0 + menu .main + .main add cascade -menu .m1 -label ".m1" + menu .m1 + .m1 add command -label "Test 2" + .m1 add cascade -label ".m2" -menu .m2 + menu .m2 + .m2 add command -label "Test 3" + list [catch {raise .t2} msg] $msg [destroy .t2 .main .m1 .m2] +} {0 {} {}} + +test macMenu-20.1 {SetDefaultMenuBar} { + . configure -menu "" + raise . + list [catch {update} msg] $msg +} {0 {}} + +test macMenu-21.1 {TkpSetMainMenubar - not front window} { + catch {destroy .m1} + catch {destroy .t2} + toplevel .t2 + wm geometry .t2 +50+50 + menu .m1 + raise . + update + list [catch {.t2 configure -menu .m1} msg] $msg [destroy .t2] [destroy .m1] +} {0 {} {} {}} +test macMenu-21.2 {TkpSetMainMenubar - menu null} { + . configure -menu "" + raise . + list [catch {update} msg] $msg +} {0 {}} +test macMenu-21.3 {TkpSetMainMenubar - different interps} { + catch {destroy .m1} + catch {interp delete testinterp} + interp create testinterp + load {} tk testinterp + menu .m1 + . configure -menu .m1 + raise . + update + interp eval testinterp {menu .m1} + interp eval testinterp {. configure -menu .m1} + interp eval testinterp {raise .} + list [catch {interp eval testinterp {update}} msg] $msg [interp delete testinterp] [. configure -menu ""] [destroy .m1] +} {0 {} {} {} {}} +test macMenu-21.4 {TkpSetMainMenubar - different windows} { + catch {destroy .m1} + catch {destroy .t2} + menu .m1 + . configure -menu .m1 + toplevel .t2 + wm geometry .t2 +50+50 + .t2 configure -menu .m1 + raise . + update + raise .t2 + list [catch {update} msg] $msg [destroy .t2] [. configure -menu ""] [destroy .m1] +} {0 {} {} {} {}} +test macMenu-21.5 {TkpSetMainMenubar - old menu was null} { + catch {destroy .m1} + . configure -menu "" + update + menu .m1 + . configure -menu .m1 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} +test macMenu-21.6 {TkpSetMainMenubar - old menu different} { + catch {destroy .m1} + catch {destroy .m2} + menu .m1 + menu .m2 + . configure -menu .m1 + raise . + update + . configure -menu .m2 + raise . + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .m2] +} {0 {} {} {} {}} +test macMenu-21.7 {TkpSetMainMenubar - child window NULL - parent window now} { + catch {destroy .m1} + catch {destroy .t2} + toplevel .t2 + menu .m1 + .m1 add cascade -label Foo -menu .m1.foo + menu .m1.foo + .m1.foo add command -label foo + . configure -menu .m1 + raise .t2 + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .t2] +} {0 {} {} {} {}} +test macMenu-21.8 {TkpSetMainMenubar - tearoff window} { + catch {destroy .t2} + toplevel .t2 -menu .t2.m1 + menu .t2.m1 + .t2.m1 add cascade -label File -menu .t2.m1.foo + menu .t2.m1.foo + .t2.m1.foo add command -label foo + raise .t2 + tkTearOffMenu .t2.m1.foo 100 100 + list [catch {update} msg] $msg [destroy .t2] +} {0 {} {}} + +test macMenu-22.1 {TkSetWindowMenuBar} { +} {} + +test macMenu-23.1 {TkMacDispatchMenuEvent} { + # needs to be interactive. +} {} + +test macMenu-24.1 {GetMenuIndicatorGeometry} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo + .m1 invoke foo + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} + +test macMenu-25.1 {GetMenuAccelGeometry - cascade entry} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label foo + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.2 {GetMenuAccelGeometry - no accel} { + catch {destroy .m1} + menu .m1 + .m1 add command + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.3 {GetMenuAccelGeometry - no special chars - arbitrary string} { + catch {destroy .m1} + menu .m1 + .m1 add command -accel "Test" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.4 {GetMenuAccelGeometry - Command} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Cmd+S" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.5 {GetMenuAccelGeometry - Control} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Ctrl+S" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.6 {GetMenuAccelGeometry - Shift} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Shift+S" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.7 {GetMenuAccelGeometry - Option} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Opt+S" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.8 {GetMenuAccelGeometry - Combination} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Cmd+Shift+S" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} +test macMenu-25.9 {GetMenuAccelGeometry - extra text} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Command+Delete" + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} + +test macMenu-26.1 {GetTearoffEntryGeometry} { + # can't call this on power mac. +} {} + +test macMenu-27.1 {GetMenuSeparatorGeometry} { + catch {destroy .m1} + menu .m1 + .m1 add separator + list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] +} {0 {}} + +test macMenu-28.1 {DrawMenuEntryIndicator - non-checkbutton} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-28.2 {DrawMenuEntryIndicator - indicator off} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo -indicatoron 0 + .m1 invoke foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-28.3 {DrawMenuEntryIndicator - not selected} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-28.4 {DrawMenuEntryIndicator - checkbutton} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo + .m1 invoke foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-28.5 {DrawMenuEntryIndicator - radiobutton} { + catch {destroy .m1} + menu .m1 + .m1 add radiobutton -label foo + .m1 invoke foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} + +# Cannot reproduce resources missing or color allocation failing easily. +test macMenu-29.1 {DrawSICN} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Cmd+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} + +# Cannot reproduce resources missing +test macMenu-30.1 {DrawMenuEntryAccelerator - cascade entry} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.2 {DrawMenuEntryAccelerator - no accel string} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.3 {DrawMenuEntryAccelerator - random accel string} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.4 {DrawMenuEntryAccelerator - Command} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Cmd+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.5 {DrawMenuEntryAccelerator - Option} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Opt+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.6 {DrawMenuEntryAccelerator - Shift} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Shift+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.7 {DrawMenuEntryAccelerator - Control} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Ctrl+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} +test macMenu-30.8 {DrawMenuEntryAccelerator - combination} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -accel "Cmd+Shift+S" + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-31.1 {DrawMenuSeparator} { + catch {destroy .m1} + menu .m1 + .m1 add separator + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-32.1 {TkpDrawMenuEntryLabel} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [catch {update} msg] $msg [destroy .m1] +} {0 {} {}} + +test macMenu-33.1 {MenuDefProc - No way to test automatically.} {} {} +test macMenu-34.1 {TkMacHandleTearoffMenu - no way to test automatically} {} {} +test macMenu-35.1 {TkpInitializeMenuBindings - nothing to do} {} {} + +test macMenu-36.1 {TkpComputeMenubarGeometry} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label foo + . configure -menu .m1 + list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1] +} {0 {} {} {}} + +test macMenu-37.1 {DrawTearoffEntry - can't do automatically} {} {} +test macMenu-38.1 {TkMacSetHelpMenuItemCount - called at boot time} {} {} +test macMenu-39.1 {TkMacMenuClick - can't do automatically} {} {} + +test macMenu-40.1 {TkpDrawMenuEntry - gc for active and not strict motif} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -activeforeground red + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.3 {TkpDrawMenuEntry - gc for active and strict motif} { + catch {destroy .m1} + menu .m1 + set tk_strictMotif 1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] [set tk_strictMotif 0] +} {{} {} 0} +test macMenu-40.4 {TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} { + catch {destroy .m1} + menu .m1 -disabledforeground blue + .m1 add command -label foo -state disabled -background red + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} { + catch {destroy .m1} + menu .m1 -disabledforeground blue + .m1 add command -label foo -state disabled + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} { + catch {destroy .m1} + menu .m1 -disabledforeground "" + .m1 add command -label foo -state disabled + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.7 {TkpDrawMenuEntry - gc for normal - custom entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -foreground red + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.8 {TkpDrawMenuEntry - gc for normal} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.9 {TkpDrawMenuEntry - gc for indicator - custom entry} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo -selectcolor orange + .m1 invoke 1 + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.10 {TkpDrawMenuEntry - gc for indicator} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label foo + .m1 invoke 1 + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.11 {TkpDrawMenuEntry - border - custom entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -activebackground green + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.12 {TkpDrawMenuEntry - border} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.13 {TkpDrawMenuEntry - active border - strict motif} { + catch {destroy .m1} + set tk_strictMotif 1 + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] [set tk_strictMotif 0] +} {{} {} 0} +test macMenu-40.14 {TkpDrawMenuEntry - active border - custom entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -activeforeground yellow + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.15 {TkpDrawMenuEntry - active border} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + .m1 entryconfigure 1 -state active + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.16 {TkpDrawMenuEntry - font - custom entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo -font "Helvectica 72" + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.17 {TkpDrawMenuEntry - font} { + catch {destroy .m1} + menu .m1 -font "Courier 72" + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.18 {TkpDrawMenuEntry - separator} { + catch {destroy .m1} + menu .m1 + .m1 add separator + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.19 {TkpDrawMenuEntry - standard} { + catch {destroy .mb} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.20 {TkpDrawMenuEntry - disabled cascade item} { + catch {destroy .m1} + menu .m1 + .m1 add cascade -label File -menu .m1.file + menu .m1.file + .m1.file add command -label foo + .m1 entryconfigure File -state disabled + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.21 {TkpDrawMenuEntry - indicator} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label macMenu-40.20 + .m1 invoke 0 + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-40.22 {TkpDrawMenuEntry - indicator - hideMargin} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label macMenu-40.21 -hidemargin 1 + .m1 invoke 0 + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} + +test macMenu-41.1 {TkpComputeStandardMenuGeometry - no entries} { + catch {destroy .m1} + menu .m1 + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.2 {TkpComputeStandardMenuGeometry - one entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "one" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.3 {TkpComputeStandardMenuGeometry - more than one entry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "one" + .m1 add command -label "two" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.4 {TkpComputeStandardMenuGeometry - separator} { + catch {destroy .m1} + menu .m1 + .m1 add separator + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.5 {TkpComputeStandardMenuGeometry - standard label geometry} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.6 {TkpComputeStandardMenuGeometry - different font for entry} { + catch {destroy .m1} + menu .m1 -font "Helvetica 12" + .m1 add command -label "test" -font "Courier 12" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.7 {TkpComputeStandardMenuGeometry - second entry larger} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" + .m1 add command -label "test test" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.8 {TkpComputeStandardMenuGeometry - first entry larger} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test test" + .m1 add command -label "test" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.9 {TkpComputeStandardMenuGeometry - accelerator} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" -accel "Ctrl+S" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.10 {TkpComputeStandardMenuGeometry - second accel larger} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" -accel "1" + .m1 add command -label "test" -accel "1 1" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.11 {TkpComputeStandardMenuGeometry - second accel smaller} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "test" -accel "1 1" + .m1 add command -label "test" -accel "1" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.12 {TkpComputeStandardMenuGeometry - indicator} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label test + .m1 invoke 1 + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.13 {TkpComputeStandardMenuGeometry - second indicator less or equal } { + catch {destroy .m1} + catch {image delete image1} + image create test image1 + menu .m1 + .m1 add checkbutton -image image1 + .m1 invoke 1 + .m1 add checkbutton -label test + .m1 invoke 2 + list [update idletasks] [destroy .m1] [image delete image1] +} {{} {} {}} +test macMenu-41.14 {TkpComputeStandardMenuGeometry - hidden margin} { + catch {destroy .m1} + menu .m1 + .m1 add checkbutton -label macMenu-41.15 -hidemargin 1 + .m1 invoke macMenu-41.15 + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.15 {TkpComputeStandardMenuGeometry - zero sized menus} { + catch {destroy .m1} + menu .m1 -tearoff 0 + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.16 {TkpComputeStandardMenuGeometry - first column bigger} { + catch {destroy .m1} + menu .m1 + .m1 add command -label one + .m1 add command -label two + .m1 add command -label three -columnbreak 1 + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.17 {TkpComputeStandardMenuGeometry - second column bigger} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label one + .m1 add command -label two -columnbreak 1 + .m1 add command -label three + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.18 {TkpComputeStandardMenuGeometry - three columns} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label one + .m1 add command -label two -columnbreak 1 + .m1 add command -label three + .m1 add command -label four + .m1 add command -label five -columnbreak 1 + .m1 add command -label six + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.19 {TkpComputeStandardMenuGeometry - entry without accel long} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label "This is a long item with no accel." + .m1 add command -label foo -accel "Cmd+S" + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-41.20 {TkpComputeStandardMenuGeometry - entry with accel long} { + catch {destroy .m1} + menu .m1 -tearoff 0 + .m1 add command -label foo + .m1 add command -label "This is a long label with an accel." -accel "Cmd+W" + list [update idletasks] [destroy .m1] +} {{} {}} + +test macMenu-42.1 {DrawMenuEntryLabel - setting indicatorSpace} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "foo" + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-42.2 {DrawMenuEntryLabel - drawing image} { + catch {destroy .m1} + catch {image delete image1} + image create test image1 + menu .m1 + .m1 add command -image image1 + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] [image delete image1] +} {{} {} {}} +test macMenu-42.3 {DrawMenuEntryLabel - drawing select image} { + catch {destroy .m1} + catch {eval image delete [image names]} + image create test image1 + image create test image2 + menu .m1 + .m1 add checkbutton -image image1 -selectimage image2 + .m1 invoke 1 + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] [eval image delete [image names]] +} {{} {} {}} +test macMenu-42.4 {DrawMenuEntryLabel - drawing a bitmap} { + catch {destroy .m1} + menu .m1 + .m1 add command -bitmap questhead + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-42.5 {DrawMenuEntryLabel - drawing null label} { + catch {destroy .m1} + menu .m1 + .m1 add command + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-42.6 {DrawMenuEntryLabel - drawing real label} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "This is a long label" -underline 3 + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-42.7 {DrawMenuEntryLabel - drawing disabled label} { + catch {destroy .m1} + menu .m1 -disabledforeground "" + .m1 add command -label "This is a long label" -state disabled + set tearoff [tkTearOffMenu .m1] + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-42.8 {DrawMenuEntryLabel - disabled images} { + catch {destroy .m1} + catch {image delete image1} + image create test image1 + menu .m1 + .m1 add command -image image1 -state disabled + set tearoff [tkTearOffMenu .m1 100 100] + list [update idletasks] [destroy .m1] [image delete image1] +} {{} {} {}} + +test macMenu-43.1 {GetMenuLabelGeometry - image} { + catch {destroy .m1} + catch {image delete image1} + menu .m1 + image create test image1 + .m1 add command -image image1 + list [update idletasks] [destroy .m1] [image delete image1] +} {{} {} {}} +test macMenu-43.2 {GetMenuLabelGeometry - bitmap} { + catch {destroy .m1} + menu .m1 + .m1 add command -bitmap questhead + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-43.3 {GetMenuLabelGeometry - no text} { + catch {destroy .m1} + menu .m1 + .m1 add command + list [update idletasks] [destroy .m1] +} {{} {}} +test macMenu-43.4 {GetMenuLabelGeometry - text} { + catch {destroy .m1} + menu .m1 + .m1 add command -label "This is a test." + list [update idletasks] [destroy .m1] +} {{} {}} + +test macMenu-44.1 {DrawMenuEntryBackground} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + list [update] [destroy .m1] +} {{} {}} +test macMenu-44.2 {DrawMenuEntryBackground} { + catch {destroy .m1} + menu .m1 + .m1 add command -label foo + set tearoff [tkTearOffMenu .m1 40 40] + $tearoff activate 0 + list [update] [destroy .m1] +} {{} {}} + +test macMenu-45.1 {TkpMenuInit - called at boot time} {} {} + +deleteWindows + |