📄 unixmenu.test
字号:
# 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-1996 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: @(#) unixMenu.test 1.9 97/06/24 13:52:38if {$tcl_platform(platform) != "unix"} { 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] }}deleteWindowswm geometry . {}raise .test unixMenu-1.1 {TkpNewMenu - normal menu} { catch {destroy .m1} list [catch {menu .m1} msg] $msg [destroy .m1]} {0 .m1 {}}test unixMenu-1.2 {TkpNewMenu - help menu} { catch {destroy .m1} menu .m1 -tearoff 0 . configure -menu .m1 .m1 add cascade -label Help -menu .m1.help list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]} {0 .m1.help {} {}}test unixMenu-2.1 {TkpDestroyMenu - nothing to do} {} {}test unixMenu-3.1 {TkpDestroymenuEntry - nothing to do} {} {}test unixMenu-4.1 {TkpConfigureMenuEntry - non-cascade entry} { catch {destroy .m1} menu .m1 -tearoff 0 .m1 add command -label test list [catch {.m1 entryconfigure test -label foo} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-4.2 {TkpConfigureMenuEntry - cascade entry} { catch {destroy .m1} menu .m1 -tearoff 0 .m1 add cascade -menu .m2 -label test menu .m1.foo -tearoff 0 list [catch {.m1 entryconfigure test -menu .m1.foo} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-5.1 {TkpMenuNewEntry - nothing to do} {} {}test unixMenu-6.1 {TkpSetWindowMenuBar - null menu} { catch {destroy .m1} menu .m1 .m1 add cascade -label foo . configure -menu .m1 list [catch {. configure -menu ""} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-6.2 {TkpSetWindowMenuBar - menu} { catch {destroy .m1} menu .m1 .m1 add cascade -label foo list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]} {0 {} {} {}}test unixMenu-7.1 {TkpSetMainMenubar - nothing to do} {} {}test unixMenu-8.1 {GetMenuIndicatorGeometry - indicator off} { catch {destroy .m1} menu .m1 .m1 add checkbutton -label foo -indicatoron 0 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.2 {GetMenuIndicatorGeometry - not checkbutton or radio} { catch {destroy .m1} menu .m1 .m1 add command -label foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.3 {GetMenuIndicatorGeometry - checkbutton image} { catch {destroy .m1} catch {image delete image1} menu .m1 image create test image1 .m1 add checkbutton -image image1 -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] [image delete image1]} {0 {} {}}test unixMenu-8.4 {GetMenuIndicatorGeometry - checkbutton bitmap} { catch {destroy .m1} menu .m1 .m1 add checkbutton -bitmap questhead -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.5 {GetMenuIndicatorGeometry - checkbutton} { catch {destroy .m1} menu .m1 .m1 add checkbutton -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.6 {GetMenuIndicatorGeometry - radiobutton image} { catch {destroy .m1} catch {image delete image1} menu .m1 image create test image1 .m1 add radiobutton -image image1 -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] [image delete image1]} {0 {} {}}test unixMenu-8.7 {GetMenuIndicatorGeometry - radiobutton bitmap} { catch {destroy .m1} menu .m1 .m1 add radiobutton -bitmap questhead -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.8 {GetMenuIndicatorGeometry - radiobutton} { catch {destroy .m1} menu .m1 .m1 add radiobutton -label foo .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-8.9 {GetMenuIndicatorGeometry - hideMargin} { catch {destroy .m1} menu .m1 .m1 add radiobutton -label foo -hidemargin 1 .m1 invoke foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-9.1 {GetMenuAccelGeometry - cascade entry} { catch {destroy .m1} menu .m1 .m1 add cascade -label foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-9.2 {GetMenuAccelGeometry - non-null label} { catch {destroy .m1} menu .m1 .m1 add command -label foo -accel "Ctrl+S" list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-9.3 {GetMenuAccelGeometry - null label} { catch {destroy .m1} menu .m1 .m1 add command -label foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-10.1 {DrawMenuEntryBackground - active menubar} { catch {destroy .m1} menu .m1 .m1 add cascade -label foo . configure -menu .m1 .m1 activate 1 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]} {0 {} {} {}}test unixMenu-10.2 {DrawMenuEntryBackground - active} { catch {destroy .m1} menu .m1 .m1 add command -label foo set tearoff [tkTearOffMenu .m1 40 40] $tearoff activate 0 list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-10.3 {DrawMenuEntryBackground - non-active} { 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 unixMenu-11.1 {DrawMenuEntryAccelerator - menubar} { catch {destroy .m1} menu .m1 .m1 add command -label foo -accel "Ctrl+U" . configure -menu .m1 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]} {0 {} {} {}}# drawArrow parameter is never false under Unixtest unixMenu-11.2 {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 unixMenu-11.3 {DrawMenuEntryAccelerator - normal entry} { catch {destroy .m1} menu .m1 .m1 add command -label foo -accel "Ctrl+U" set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-11.4 {DrawMenuEntryAccelerator - null entry} { 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 unixMenu-12.1 {DrawMenuEntryIndicator - non-check or radio} { 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 unixMenu-12.2 {DrawMenuEntryIndicator - checkbutton - indicator off} { catch {destroy .m1} menu .m1 .m1 add checkbutton -label foo -indicatoron 0 set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-12.3 {DrawMenuEntryIndicator - checkbutton - 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 unixMenu-12.4 {DrawMenuEntryIndicator - checkbutton - selected} { catch {destroy .m1} menu .m1 .m1 add checkbutton -label foo .m1 invoke 1 set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-12.5 {DrawMenuEntryIndicator - radiobutton - indicator off} { catch {destroy .m1} menu .m1 .m1 add radiobutton -label foo -indicatoron 0 set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-12.6 {DrawMenuEntryIndicator - radiobutton - not selected} { catch {destroy .m1} menu .m1 .m1 add radiobutton -label foo set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-12.7 {DrawMenuEntryIndicator - radiobutton - selected} { catch {destroy .m1} menu .m1 .m1 add radiobutton -label foo .m1 invoke 1 set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-13.1 {DrawMenuSeparator - menubar case} { catch {destroy .m1} menu .m1 .m1 add separator . configure -menu .m1 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]} {0 {} {} {}}test unixMenu-13.2 {DrawMenuSepartor - normal menu} { catch {destroy .m1} menu .m1 .m1 add separator set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-14.1 {DrawMenuEntryLabel} { 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 unixMenu-15.1 {DrawMenuUnderline - menubar} { catch {destroy .m1} menu .m1 .m1 add command -label foo -underline 0 . configure -menu .m1 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]} {0 {} {} {}}test unixMenu-15.2 {DrawMenuUnderline - no menubar} { catch {destroy .m1} menu .m1 .m1 add command -label foo -underline 0 set tearoff [tkTearOffMenu .m1 40 40] list [catch {update} msg] $msg [destroy .m1]} {0 {} {}}test unixMenu-16.1 {TkpPostMenu} { catch {destroy .m1} menu .m1 .m1 add command -label foo list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]} {0 {}}test unixMenu-17.1 {GetMenuSeparatorGeometry} { catch {destroy .m1} menu .m1 .m1 add separator
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -