1 # This file is a Tcl script to test menus in Tk. It is
2 # organized in the standard fashion for Tcl tests.
4 # Copyright (c) 1995-1997 Sun Microsystems, Inc.
5 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 package require tcltest 2.1
11 namespace import -force tcltest::configure
12 namespace import -force tcltest::testsDirectory
13 configure -testdir [file join [pwd] [file dirname [info script]]]
14 configure -loadfile [file join [testsDirectory] constraints.tcl]
15 tcltest::loadTestedCommands
17 test menu-1.1 {Tk_MenuCmd procedure} {
18 list [catch menu msg] $msg
19 } {1 {wrong # args: should be "menu pathName ?options?"}}
20 test menu-1.2 {Tk_MenuCmd procedure} {
21 list [catch "menu bogus" msg] $msg
22 } {1 {bad window path name "bogus"}}
23 test menu-1.3 {Tk_MenuCmd procedure} {
24 list [catch "menu .m1 foo" msg] $msg
25 } {1 {unknown option "foo"}}
26 test menu-1.4 {Tk_MenuCmd procedure} {
28 list [catch {menu .m1} msg] $msg [destroy .m1]
30 test menu-1.5 {Tk_MenuCmd - creating menubar} {
33 .m1 add cascade -label Test -menu ""
34 list [. configure -menu .m1] [. configure -menu ""] [destroy .m1]
36 test menu-1.6 {Tk_MenuCmd procedure menu ref no cascade} {
39 toplevel .t2 -menu .m1
41 list [catch {menu .m1} msg] $msg [destroy .m1 .t2]
43 test menu-1.7 {Tk_MenuCmd procedure one clone cascade} {
47 toplevel .t2 -menu .m1
50 .m1 add cascade -menu .m2
51 list [catch {menu .m2} msg] $msg [destroy .t2 .m1 .m2]
53 test menu-1.8 {Tk_MenuCmd procedure two clone cascades} {
59 .m1 add cascade -menu .m2
60 toplevel .t2 -menu .m1
62 toplevel .t3 -menu .m1
64 list [catch {menu .m2} msg] $msg [destroy .t2 .t3 .m1 .m2]
66 test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} {
71 toplevel .t2 -menu .m1
74 .m1 add cascade -menu .m2
75 toplevel .t3 -menu .m1
77 list [catch {menu .m2} msg] $msg [destroy .t2 .t3 .m1 .m2]
79 test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} {
84 toplevel .t2 -menu .m1
86 toplevel .t3 -menu .m1
89 .m1 add cascade -menu .m2
90 list [catch {menu .m2} msg] $msg [destroy .t2 .t3 .m1 .m2]
92 test menu-1.11 {Tk_MenuCmd procedure three clones cascades} {
98 toplevel .t2 -menu .m1
100 toplevel .t3 -menu .m1
102 toplevel .t4 -menu .m1
105 .m1 add cascade -menu .m2
106 list [catch {menu .m2} msg] $msg [destroy .t2 .t3 .t4 .m1 .m2]
108 test menu-1.12 {Tk_MenuCmd procedure} {
111 toplevel .t2 -menu .m1
113 list [catch {menu .m1} msg] $msg [destroy .t2 .m1]
115 test menu-1.13 {Tk_MenuCmd procedure} {
119 toplevel .t2 -menu .m1
121 toplevel .t3 -menu .m1
123 list [catch {menu .m1} msg] $msg [destroy .t2 .t3 .m1]
125 test menu-1.14 {Tk_MenuCmd procedure} {
130 toplevel .t2 -menu .m1
132 toplevel .t3 -menu .m1
134 toplevel .t4 -menu .m1
136 list [catch {menu .m1} msg] $msg [destroy .t2 .t3 .t4 .m1]
143 {-activebackground #012345 #012345 non-existent
144 {unknown color name "non-existent"}}
145 {-activeborderwidth 1.3 1.3 badValue {bad screen distance "badValue"}}
146 {-activeforeground #ff0000 #ff0000 non-existent
147 {unknown color name "non-existent"}}
148 {-background #ff0000 #ff0000 non-existent
149 {unknown color name "non-existent"}}
150 {-bg #110022 #110022 bogus {unknown color name "bogus"}}
151 {-borderwidth 1.3 1.3 badValue {bad screen distance "badValue"}}
152 {-cursor arrow arrow badValue {bad cursor spec "badValue"}}
153 {-disabledforeground #00ff00 #00ff00 xyzzy {unknown color name "xyzzy"}}
154 {-fg #110022 #110022 bogus {unknown color name "bogus"}}
155 {-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
156 -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* {}
157 {font "" doesn't exist}}
158 {-foreground #110022 #110022 bogus {unknown color name "bogus"}}
159 {-postcommand "any old string" "any old string" {} {}}
160 {-relief groove groove 1.5 {bad relief "1.5": must be flat, groove, raised, ridge, solid, or sunken}}
161 {-selectcolor #110022 #110022 bogus {unknown color name "bogus"}}
162 {-takefocus "any string" "any string" {} {}}
165 {-tearoffcommand "any old string" "any old string" {} {}}
167 set name [lindex $configTest 0]
168 set value [lindex $configTest 1]
169 set result [lindex $configTest 2]
170 test menu-2.$i [list configuration options $name $value $result] {
171 .m1 configure $name $value
172 lindex [.m1 configure $name] 4
175 if {[lindex $configTest 3] != ""} {
176 set value [lindex $configTest 3]
177 set result [lindex $configTest 4]
178 test menu-2.$i [list configuration options $name $value $result] {
179 list [catch {.m1 configure $name $value} msg] $msg
182 .m1 configure $name [lindex [.m1 configure $name] 3]
187 # We need to test all of the options with all of the different types of
188 # menu entries. The following code sets up .m1 with 6 items. It then
189 # runs through the big table below it.
190 # index 0 is tearoff, 1 command, 2 cascade, 3 separator, 4 checkbutton,
194 .m1 add command -label "command"
196 .m2 add command -label "test"
197 .m1 add cascade -label "cascade" -menu .m2
199 .m1 add checkbutton -label "checkbutton" -variable check -onvalue on -offvalue off
200 .m1 add radiobutton -label "radiobutton" -variable radio
201 image create photo image1 -file [file join $tk_library demos images earth.gif]
206 {{unknown option "-activebackground"} #012345 #012345
207 {unknown option "-activebackground"} #012345 #012345
211 {{unknown option "-activebackground"}
212 {unknown color name "non-existent"}
213 {unknown color name "non-existent"}
214 {unknown option "-activebackground"}
215 {unknown color name "non-existent"}
216 {unknown color name "non-existent"}
222 {{unknown option "-activeforeground"}
223 #ff0000 #ff0000 {unknown option "-activeforeground"} #ff0000 #ff0000
227 {{unknown option "-activeforeground"}
228 {unknown color name "non-existent"}
229 {unknown color name "non-existent"}
230 {unknown option "-activeforeground"}
231 {unknown color name "non-existent"}
232 {unknown color name "non-existent"}
238 {{unknown option "-accelerator"}
239 "Ctrl+S" "Ctrl+S" {unknown option "-accelerator"}
246 {#ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000
250 {{unknown color name "non-existent"}
251 {unknown color name "non-existent"}
252 {unknown color name "non-existent"}
253 {unknown color name "non-existent"}
254 {unknown color name "non-existent"}
255 {unknown color name "non-existent"}
261 {{unknown option "-bitmap"} questhead questhead
262 {unknown option "-bitmap"} questhead questhead
266 {{unknown option "-bitmap"}
267 {bitmap "badValue" not defined}
268 {bitmap "badValue" not defined}
269 {unknown option "-bitmap"}
270 {bitmap "badValue" not defined}
271 {bitmap "badValue" not defined}
277 {{unknown option "-columnbreak"} 1 1
278 {unknown option "-columnbreak"} 1 1}
283 {{unknown option "-command"} beep beep
284 {unknown option "-command"} beep beep
289 {{-Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
290 {{unknown option "-font"}
291 -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
292 -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
293 {unknown option "-font"}
294 -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
295 -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*
299 {{unknown option "-font"}
300 {expected integer but got "rock"}
301 {expected integer but got "rock"}
302 {unknown option "-font"}
303 {expected integer but got "rock"}
304 {expected integer but got "rock"}
310 {{unknown option "-foreground"} #110022 #110022
311 {unknown option "-foreground"} #110022 #110022
315 {{unknown option "-foreground"}
316 {unknown color name "non-existent"}
317 {unknown color name "non-existent"}
318 {unknown option "-foreground"}
319 {unknown color name "non-existent"}
320 {unknown color name "non-existent"}
326 {{unknown option "-image"} image1 image1
327 {unknown option "-image"} image1 image1
331 {{unknown option "-image"}
332 {image "bogus" doesn't exist}
333 {image "bogus" doesn't exist}
334 {unknown option "-image"}
335 {image "bogus" doesn't exist}
336 {image "bogus" doesn't exist}
340 {{unknown option "-image"}
343 {unknown option "-image"}
351 {{unknown option "-indicatoron"}
352 {unknown option "-indicatoron"}
353 {unknown option "-indicatoron"}
354 {unknown option "-indicatoron"} 1 1
360 {{unknown option "-label"} test test
361 {unknown option "-label"} test test
367 {{unknown option "-menu"}
368 {unknown option "-menu"} .m2
369 {unknown option "-menu"}
370 {unknown option "-menu"}
371 {unknown option "-menu"}
377 {{unknown option "-offvalue"}
378 {unknown option "-offvalue"}
379 {unknown option "-offvalue"}
380 {unknown option "-offvalue"}
382 {unknown option "-offvalue"}
388 {{unknown option "-onvalue"}
389 {unknown option "-onvalue"}
390 {unknown option "-onvalue"}
391 {unknown option "-onvalue"}
393 {unknown option "-onvalue"}
399 {{unknown option "-selectcolor"}
400 {unknown option "-selectcolor"}
401 {unknown option "-selectcolor"}
402 {unknown option "-selectcolor"}
408 {{unknown option "-selectcolor"}
409 {unknown option "-selectcolor"}
410 {unknown option "-selectcolor"}
411 {unknown option "-selectcolor"}
412 {unknown color name "non-existent"}
413 {unknown color name "non-existent"}
419 {{unknown option "-selectimage"}
420 {unknown option "-selectimage"}
421 {unknown option "-selectimage"}
422 {unknown option "-selectimage"} image1 image1
426 {{unknown option "-selectimage"}
427 {unknown option "-selectimage"}
428 {unknown option "-selectimage"}
429 {unknown option "-selectimage"}
430 {image "bogus" doesn't exist}
431 {image "bogus" doesn't exist}
435 {{unknown option "-selectimage"}
436 {unknown option "-selectimage"}
437 {unknown option "-selectimage"}
438 {unknown option "-selectimage"}
446 {normal normal normal {unknown option "-state"} normal normal
452 {{unknown option "-value"}
453 {unknown option "-value"}
454 {unknown option "-value"}
455 {unknown option "-value"}
456 {unknown option "-value"} "any string"
462 {{unknown option "-variable"}
463 {unknown option "-variable"}
464 {unknown option "-variable"}
465 {unknown option "-variable"}
473 {{unknown option "-underline"} 0 0
474 {unknown option "-underline"} 0 0
478 {{unknown option "-underline"}
479 {expected integer but got "3p"}
480 {expected integer but got "3p"}
481 {unknown option "-underline"}
482 {expected integer but got "3p"}
483 {expected integer but got "3p"}
488 set name [lindex $configTest 0]
489 foreach attempt [lindex $configTest 1] {
490 set value [lindex $attempt 0]
491 set options [lindex $attempt 1]
492 foreach item {0 1 2 3 4 5} {
494 test menu-2.$i [list entry configuration options $name $item $value [.m1 type $item]] {
495 set result [catch {.m1 entryconfigure $item $name $value} msg]
499 lindex [.m1 entryconfigure $item $name] 4
501 } [lindex $options $item]
511 test menu-3.1 {MenuWidgetCmd procedure} {
514 list [catch {.m1} msg] $msg [destroy .m1]
515 } {1 {wrong # args: should be ".m1 option ?arg arg ...?"} {}}
516 test menu-3.2 {MenuWidgetCmd, Tcl_Preserve and Tcl_Release} {nonUnixUserInteraction } {
518 menu .m1 -postcommand "destroy .m1"
519 .m1 add command -label "menu-3.2: Hit Escape"
520 list [catch {.m1 post 40 40} msg] $msg
522 test menu-3.3 {MenuWidgetCmd procedure, "activate" option} {
525 .m1 add command -label "test"
526 list [catch {.m1 activate} msg] $msg [destroy .m1]
527 } {1 {wrong # args: should be ".m1 activate index"} {}}
528 test menu-3.4 {MenuWidgetCmd procedure, "activate" option} {
531 list [catch {.m1 activate "foo"} msg] $msg [destroy .m1]
532 } {1 {bad menu entry index "foo"} {}}
533 test menu-3.5 {MenuWidgetCmd procedure, "activate" option} {
536 .m1 add command -label "test"
538 list [catch {.m1 activate 2} msg] $msg [destroy .m1]
540 test menu-3.6 {MenuWidgetCmd procedure, "activate" option} {
543 .m1 add command -label "test"
544 .m1 entryconfigure 1 -state disabled
545 list [catch {.m1 activate 1} msg] $msg [destroy .m1]
547 test menu-3.7 {MenuWidgetCmd procedure, "activate" option} {
550 .m1 add command -label "test"
551 list [catch {.m1 activate 1} msg] $msg [destroy .m1]
553 test menu-3.8 {MenuWidgetCmd procedure, "add" option} {
556 list [catch {.m1 add} msg] $msg [destroy .m1]
557 } {1 {wrong # args: should be ".m1 add type ?options?"} {}}
558 test menu-3.9 {MenuWidgetCmd procedure, "add" option} {
561 list [catch {.m1 add foo} msg] $msg [destroy .m1]
562 } {1 {bad menu entry type "foo": must be cascade, checkbutton, command, radiobutton, or separator} {}}
563 test menu-3.10 {MenuWidgetCmd procedure, "add" option} {
566 list [catch {.m1 add separator} msg] $msg [destroy .m1]
568 test menu-3.11 {MenuWidgetCmd procedure, "cget" option} {
571 list [catch {.m1 cget} msg] $msg [destroy .m1]
572 } {1 {wrong # args: should be ".m1 cget option"} {}}
573 test menu-3.12 {MenuWidgetCmd procedure, "cget" option} {
576 list [catch {.m1 cget -gorp} msg] $msg [destroy .m1]
577 } {1 {unknown option "-gorp"} {}}
578 test menu-3.13 {MenuWidgetCmd procedure, "cget" option} {
581 .m1 configure -postcommand "Some string"
582 list [catch {.m1 cget -postcommand} msg] $msg [destroy .m1]
583 } {0 {Some string} {}}
584 test menu-3.14 {MenuWidgetCmd procedure, "clone" option} {
587 list [catch {.m1 clone} msg] $msg [destroy .m1]
588 } {1 {wrong # args: should be ".m1 clone newMenuName ?menuType?"} {}}
589 test menu-3.15 {MenuWidgetCmd procedure, "clone" option} {
592 list [catch {.m1 clone a b c d} msg] $msg [destroy .m1]
593 } {1 {wrong # args: should be ".m1 clone newMenuName ?menuType?"} {}}
594 test menu-3.16 {MenuWidgetCmd procedure, "clone" option} {
597 list [catch {.m1 clone .m1.clone1} msg] $msg [destroy .m1]
599 test menu-3.17 {MenuWidgetCmd procedure, "clone" option} {
602 list [catch {.m1 clone .m1.clone1 tearoff} msg] $msg [destroy .m1]
604 test menu-3.18 {MenuWidgetCmd procedure, "configure" option} {
607 list [catch {llength [.m1 configure]} msg] $msg [destroy .m1]
609 test menu-3.19 {MenuWidgetCmd procedure, "configure" option} {
612 list [catch {.m1 configure -gorp} msg] $msg [destroy .m1]
613 } {1 {unknown option "-gorp"} {}}
614 test menu-3.20 {MenuWidgetCmd procedure, "configure" option} {
617 list [catch {.m1 configure -postcommand "A random String"} msg] $msg [destroy .m1]
619 test menu-3.21 {MenuWidgetCmd procedure, "configure" option} {
622 .m1 configure -postcommand "Another string"
623 list [catch {lindex [.m1 configure -postcommand] 4} msg] $msg [destroy .m1]
624 } {0 {Another string} {}}
625 test menu-3.22 {MenuWidgetCmd procedure, "delete" option} {
628 list [catch {.m1 delete} msg] $msg [destroy .m1]
629 } {1 {wrong # args: should be ".m1 delete first ?last?"} {}}
630 test menu-3.23 {MenuWidgetCmd procedure, "delete" option} {
633 list [catch {.m1 delete foo} msg] $msg [destroy .m1]
634 } {1 {bad menu entry index "foo"} {}}
635 test menu-3.24 {MenuWidgetCmd procedure, "delete" option} {
638 list [catch {.m1 delete 0 "foo"} msg] $msg [destroy .m1]
639 } {1 {bad menu entry index "foo"} {}}
640 test menu-3.25 {MenuWidgetCmd procedure, "delete" option} {
643 list [catch {.m1 delete 0} msg] $msg [destroy .m1]
645 test menu-3.26 {MenuWidgetCmd procedure, "delete" option} {
648 .m1 add command -label "foo"
649 list [catch {.m1 delete 1 0} msg] $msg [destroy .m1]
651 test menu-3.27 {MenuWidgetCmd procedure, "delete" option} {
654 .m1 add command -label "1"
655 .m1 add command -label "2"
656 .m1 add command -label "3"
657 list [catch {.m1 delete 1 3} msg] $msg [destroy .m1]
659 test menu-3.28 {MenuWidgetCmd procedure, "delete" option} {
662 .m1 add command -label "1"
663 .m1 add command -label "2"
664 .m1 add command -label "3"
666 list [catch {.m1 delete 1 3} msg] $msg [destroy .m1]
668 test menu-3.29 {MenuWidgetCmd procedure, "delete" option} {
671 .m1 add command -label "1"
672 .m1 add command -label "2"
673 .m1 add command -label "3"
675 list [catch {.m1 delete 1} msg] $msg [destroy .m1]
677 test menu-3.30 {MenuWidgetCmd procedure, "entrycget" option} {
680 list [catch {.m1 entrycget} msg] $msg [destroy .m1]
681 } {1 {wrong # args: should be ".m1 entrycget index option"} {}}
682 test menu-3.31 {MenuWidgetCmd procedure, "entrycget" option} {
685 list [catch {.m1 entrycget index option foo} msg] $msg [destroy .m1]
686 } {1 {wrong # args: should be ".m1 entrycget index option"} {}}
687 test menu-3.32 {MenuWidgetCmd procedure, "entrycget" option} {
690 list [catch {.m1 entrycget foo -label} msg] $msg [destroy .m1]
691 } {1 {bad menu entry index "foo"} {}}
692 test menu-3.33 {MenuWidgetCmd procedure, "entrycget" option} {
695 .m1 add command -label "test"
696 list [catch {.m1 entrycget 1 -label} msg] $msg [destroy .m1]
698 test menu-3.34 {MenuWidgetCmd procedure, "entryconfigure" option} {
701 list [catch {.m1 entryconfigure} msg] $msg [destroy .m1]
702 } {1 {wrong # args: should be ".m1 entryconfigure index ?option value ...?"} {}}
703 test menu-3.35 {MenuWidgetCmd procedure, "entryconfigure" option} {
706 list [catch {.m1 entryconfigure foo} msg] $msg [destroy .m1]
707 } {1 {bad menu entry index "foo"} {}}
708 test menu-3.36 {MenuWidgetCmd procedure, "entryconfigure" option} {
711 .m1 add command -label "test"
712 list [catch {llength [.m1 entryconfigure 1]} msg] $msg [destroy .m1]
714 test menu-3.37 {MenuWidgetCmd procedure, "entryconfigure" option} {
717 .m1 add command -label "test"
718 list [catch {lindex [.m1 entryconfigure 1 -label] 4} msg] $msg [destroy .m1]
720 test menu-3.38 {MenuWidgetCmd procedure, "entryconfigure" option} {
723 .m1 add command -label "test"
724 .m1 entryconfigure 1 -label "changed"
725 list [catch {lindex [.m1 entryconfigure 1 -label] 4} msg] $msg [destroy .m1]
727 test menu-3.39 {MenuWidgetCmd procedure, "index" option} {
730 list [catch {.m1 index} msg] $msg [destroy .m1]
731 } {1 {wrong # args: should be ".m1 index string"} {}}
732 test menu-3.40 {MenuWidgetCmd procedure, "index" option} {
735 list [catch {.m1 index foo} msg] $msg [destroy .m1]
736 } {1 {bad menu entry index "foo"} {}}
737 test menu-3.41 {MenuWidgetCmd procedure, "index" option} {
740 .m1 add command -label "test"
741 list [catch {.m1 index "test"} msg] $msg [destroy .m1]
743 test menu-3.42 {MenuWidgetCmd procedure, "insert" option} {
746 list [catch {.m1 insert} msg] $msg [destroy .m1]
747 } {1 {wrong # args: should be ".m1 insert index type ?options?"} {}}
748 test menu-3.43 {MenuWidgetCmd procedure, "insert" option} {
751 .m1 insert 1 command -label "test"
752 list [catch {.m1 entrycget 1 -label} msg] $msg [destroy .m1]
754 test menu-3.44 {MenuWidgetCmd procedure, "invoke" option} {
757 list [catch {.m1 invoke} msg] $msg [destroy .m1]
758 } {1 {wrong # args: should be ".m1 invoke index"} {}}
759 test menu-3.45 {MenuWidgetCmd procedure, "invoke" option} {
762 list [catch {.m1 invoke foo} msg] $msg [destroy .m1]
763 } {1 {bad menu entry index "foo"} {}}
764 test menu-3.46 {MenuWidgetCmd procedure, "invoke" option} {
768 .m1 add command -label "set foo" -command "set foo hello"
769 list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
770 } {0 hello 0 hello 0 {} {}}
771 test menu-3.47 {MenuWidgetCmd procedure, "post" option} {
774 .m1 add command -label "On Windows, hit Escape to get this menu to go away"
775 list [catch {.m1 post} msg] $msg [destroy .m1]
776 } {1 {wrong # args: should be ".m1 post x y"} {}}
777 test menu-3.48 {MenuWidgetCmd procedure, "post" option} {
780 list [catch {.m1 post foo 40} msg] $msg [destroy .m1]
781 } {1 {expected integer but got "foo"} {}}
782 test menu-3.49 {MenuWidgetCmd procedure, "post" option} {
785 list [catch {.m1 post 40 bar} msg] $msg [destroy .m1]
786 } {1 {expected integer but got "bar"} {}}
787 test menu-3.50 {MenuWidgetCmd procedure, "post" option} {nonUnixUserInteraction } {
790 .m1 add command -label "menu-3.53: hit Escape" -command "puts hello"
791 list [catch {.m1 post 40 40} msg] $msg [destroy .m1]
793 test menu-3.51 {MenuWidgetCmd procedure, "postcascade" option} {
796 list [catch {.m1 postcascade} msg] $msg [destroy .m1]
797 } {1 {wrong # args: should be ".m1 postcascade index"} {}}
798 test menu-3.52 {MenuWidgetCmd procedure, "postcascade" option} {
801 list [catch {.m1 postcascade foo} msg] $msg [destroy .m1]
802 } {1 {bad menu entry index "foo"} {}}
803 test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} {nonUnixUserInteraction } {
807 .m1 add command -label "menu-3.56 - hit Escape"
810 .m1 add cascade -menu .m2
811 list [catch {.m1 postcascade 1} msg] $msg [destroy .m1 .m2]
813 test menu-3.54 {MenuWidgetCmd procedure, "postcascade" option} {
818 .m1 add cascade -menu .m2 -label "menu-3.57 - hit Escape"
820 list [catch {.m1 postcascade none} msg] $msg [destroy .m1 .m2]
822 test menu-3.55 {MenuWidgetCmd procedure, "type" option} {
825 list [catch {.m1 type} msg] $msg [destroy .m1]
826 } {1 {wrong # args: should be ".m1 type index"} {}}
827 test menu-3.56 {MenuWidgetCmd procedure, "type" option} {
830 list [catch {.m1 type foo} msg] $msg [destroy .m1]
831 } {1 {bad menu entry index "foo"} {}}
832 test menu-3.57 {MenuWidgetCmd procedure, "type" option} {
835 .m1 add command -label "test"
836 list [catch {.m1 type 1} msg] $msg [destroy .m1]
838 test menu-3.58 {MenuWidgetCmd procedure, "type" option} {
842 list [catch {.m1 type 1} msg] $msg [destroy .m1]
844 test menu-3.59 {MenuWidgetCmd procedure, "type" option} {
847 .m1 add checkbutton -label "test"
848 list [catch {.m1 type 1} msg] $msg [destroy .m1]
850 test menu-3.60 {MenuWidgetCmd procedure, "type" option} {
853 .m1 add radiobutton -label "test"
854 list [catch {.m1 type 1} msg] $msg [destroy .m1]
856 test menu-3.61 {MenuWidgetCmd procedure, "type" option} {
859 .m1 add cascade -label "test"
860 list [catch {.m1 type 1} msg] $msg [destroy .m1]
862 test menu-3.62 {MenuWidgetCmd procedure, "type" option} {
865 list [catch {.m1 type 0} msg] $msg [destroy .m1]
867 test menu-3.63 {MenuWidgetCmd procedure, "unpost" option} {
870 list [catch {.m1 unpost foo} msg] $msg [destroy .m1]
871 } {1 {wrong # args: should be ".m1 unpost"} {}}
872 test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} {nonUnixUserInteraction } {
875 .m1 add command -label "menu-3.68 - hit Escape"
877 list [catch {.m1 unpost} msg] $msg [destroy .m1]
879 test menu-3.65 {MenuWidgetCmd procedure, "yposition" option} {
882 list [catch {.m1 yposition} msg] $msg [destroy .m1]
883 } {1 {wrong # args: should be ".m1 yposition index"} {}}
884 test menu-3.66 {MenuWidgetCmd procedure, "yposition" option} {
887 list [catch {.m1 yposition 1}] [destroy .m1]
889 test menu-3.67 {MenuWidgetCmd procedure, bad option} {
892 list [catch {.m1 foo} msg] $msg [destroy .m1]
893 } {1 {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, or yposition} {}}
894 test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} {
902 $c1 add command -label c1
904 $c2 add command -label c2
905 $m1 add cascade -label c1 -menu $c1
906 $t configure -menu $m1
907 $m1 entryconfigure 1 -menu $c2 -label c2
908 $t configure -menu ""
909 set l [list [winfo exists $c1] [winfo exists $c2]]
914 test menu-4.1 {TkInvokeMenu: disabled} {
918 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off \
920 list [catch {.m1 invoke 1} msg] [destroy .m1] $foo
922 test menu-4.2 {TkInvokeMenu: tearoff} {
925 list [catch {.m1 invoke 0} msg] [destroy .m1]
927 test menu-4.3 {TkInvokeMenu: checkbutton -on} {
931 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off
932 list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
933 } {0 {} 0 on 0 {} {}}
934 test menu-4.4 {TkInvokeMenu: checkbutton -off} {
938 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off
940 list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
941 } {0 {} 0 off 0 {} {}}
942 test menu-4.5 {TkInvokeMenu: checkbutton array element} {
946 .m1 add checkbutton -label "test" -variable foo(1) -onvalue on
947 list [catch {.m1 invoke 1} msg] $msg [catch {set foo(1)} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
948 } {0 {} 0 on 0 {} {}}
949 test menu-4.6 {TkInvokeMenu: radiobutton} {
953 .m1 add radiobutton -label "1" -variable foo -value one
954 .m1 add radiobutton -label "2" -variable foo -value two
955 .m1 add radiobutton -label "3" -variable foo -value three
956 list [catch {.m1 invoke 1} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
957 } {0 {} 0 one 0 {} {}}
958 test menu-4.7 {TkInvokeMenu: radiobutton} {
962 .m1 add radiobutton -label "1" -variable foo -value one
963 .m1 add radiobutton -label "2" -variable foo -value two
964 .m1 add radiobutton -label "3" -variable foo -value three
965 list [catch {.m1 invoke 2} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
966 } {0 {} 0 two 0 {} {}}
967 test menu-4.8 {TkInvokeMenu: radiobutton} {
971 .m1 add radiobutton -label "1" -variable foo -value one
972 .m1 add radiobutton -label "2" -variable foo -value two
973 .m1 add radiobutton -label "3" -variable foo -value three
974 list [catch {.m1 invoke 3} msg] $msg [catch {set foo} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
975 } {0 {} 0 three 0 {} {}}
976 test menu-4.9 {TkInvokeMenu: radiobutton array element} {
980 .m1 add radiobutton -label "1" -variable foo(2) -value one
981 .m1 add radiobutton -label "2" -variable foo(2) -value two
982 .m1 add radiobutton -label "3" -variable foo(2) -value three
983 list [catch {.m1 invoke 3} msg] $msg [catch {set foo(2)} msg2] $msg2 [catch {unset foo} msg3] $msg3 [destroy .m1]
984 } {0 {} 0 three 0 {} {}}
985 test menu-4.10 {TkInvokeMenu} {
987 catch {unset menu_test}
989 .m1 add command -label "test" -command "set menu_test menu-4.8"
990 list [catch {.m1 invoke 1} msg] $msg [catch {set menu_test} msg2] $msg2 [catch {unset menu_test} msg3] $msg3 [destroy .m1]
991 } {0 menu-4.8 0 menu-4.8 0 {} {}}
992 test menu-4.11 {TkInvokeMenu} {
995 .m1 add cascade -label "test" -menu .m1.m2
996 list [catch {.m1 invoke 1} msg] $msg [destroy .m1]
998 test menu-4.12 {TkInvokeMenu} {
1001 .m1 add command -label "test" -command ".m1 delete 1"
1002 list [catch {.m1 invoke 1} msg] $msg [catch {.m1 type "test"} msg2] $msg2 [destroy .m1]
1003 } {0 {} 1 {bad menu entry index "test"} {}}
1005 test menu-5.1 {DestroyMenuInstance} {
1008 list [catch {destroy .m1} msg] $msg
1010 test menu-5.2 {DestroyMenuInstance - cascade menu} {
1014 .m1 add cascade -menu .m2
1016 list [catch {destroy .m2} msg] $msg [destroy .m1]
1018 test menu-5.3 {DestroyMenuInstance - multiple cascade parents} {
1023 .m1 add cascade -menu .m3
1025 .m2 add cascade -menu .m3
1027 list [catch {destroy .m3} msg] $msg [destroy .m1 .m2]
1029 test menu-5.4 {DestroyMenuInstance - multiple cascade parents} {
1035 .m1 add cascade -menu .m4
1037 .m2 add cascade -menu .m4
1039 .m3 add cascade -menu .m4
1041 list [catch {destroy .m4} msg] $msg [destroy .m1 .m2 .m3]
1043 test menu-5.5 {DestroyMenuInstance - cascades of cloned menus} {
1048 .m1 add cascade -menu .m2
1049 . configure -menu .m1
1050 list [catch {destroy .m2} msg] $msg [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1]
1052 test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} {
1057 .m1 add cascade -menu .m2
1059 . configure -menu .m1
1061 wm geometry .t2 +0+0
1062 .t2 configure -menu .m1
1063 list [catch {destroy .m2} msg] $msg [. configure -menu ""] [destroy .t2 .m1]
1065 test menu-5.7 {DestroyMenuInstance - basic clones} {
1068 set tearoff [tk::TearOffMenu .m1]
1069 list [catch {destroy $tearoff} msg] $msg [destroy .m1]
1071 test menu-5.8 {DestroyMenuInstance - multiple clones} {
1074 set tearoff1 [tk::TearOffMenu .m1]
1075 set tearoff2 [tk::TearOffMenu .m1]
1076 list [catch {destroy $tearoff1} msg] $msg [destroy .m1]
1078 test menu-5.9 {DestroyMenuInstace - master menu} {
1082 list [catch {destroy .m1} msg] $msg
1084 test menu-5.10 {DestroyMenuInstance - freeing entries} {
1087 .m1 add command -label "foo"
1088 list [catch {destroy .m1} msg] $msg
1090 test menu-5.11 {DestroyMenuInstace - no entries} {
1093 .m1 configure -tearoff 0
1094 list [catch {destroy .m1} msg] $msg
1096 test menu-5.12 {DestroyMenuInstance - platform data} {
1099 list [catch {destroy .m1} msg] $msg
1101 test menu-5.13 {DestroyMenuInstance - clones when mismatched tearoffs} {
1106 .m1 add cascade -menu .m2
1107 set tearoff [tk::TearOffMenu .m1 40 40]
1108 list [destroy .m2] [destroy .m1]
1111 test menu-6.1 {TkDestroyMenu} {
1114 list [catch {destroy .m1} msg] $msg
1116 test menu-6.2 {TkDestroyMenu - reentrancy} {
1120 bind .m1 <Destroy> {destroy .m1}
1122 bind .m2 <Destroy> {destroy .m2}
1123 list [catch {destroy .m1} msg] $msg [destroy .m2]
1125 test menu-6.3 {TkDestroyMenu - reentrancy} {
1130 bind .m1 <Destroy> {destroy .m2}
1133 list [catch {destroy .m1} msg] $msg [winfo exists .m2]
1135 test menu-6.4 {TkDestroyMenu - reentrancy - clones} {
1141 list [catch {destroy .m1} msg] $msg
1143 test menu-6.5 {TkDestroyMenu} {
1151 test menu-6.6 {TkDestroyMenu} {
1155 .m1 clone .m2 tearoff
1156 list [catch {destroy .m1} msg] $msg
1158 test menu-6.7 {TkDestroyMenu} {
1164 list [catch {destroy .m1} msg] $msg
1166 test menu-6.8 {TkDestroyMenu} {
1174 list [winfo exists .m2] [winfo exists .m3]
1176 test menu-6.9 {TkDestroyMenu} {
1183 list [catch {destroy .m2} msg] $msg [catch {destroy .m3} msg2] $msg2 [catch {destroy .m1} msg3] $msg3
1185 test menu-6.10 {TkDestroyMenu} {
1192 list [catch {destroy .m3} msg] $msg [catch {destroy .m1} msg2] $msg2
1194 test menu-6.11 {TkDestroyMenu} {
1203 list [catch {destroy .m2} msg1] $msg1 [catch {destroy .m1} msg2] $msg2
1205 test menu-6.12 {TkDestroyMenu} {
1214 list [catch {destroy .m3} msg1] $msg1 [catch {destroy .m1} msg2] $msg2
1216 test menu-6.13 {TkDestroyMenu} {
1225 list [catch {destroy .m4} msg1] $msg1 [catch {destroy .m1} msg2] $msg2
1227 test menu-6.14 {TkDestroyMenu} {
1230 . configure -menu .m1
1231 list [catch {destroy .m1} msg] $msg [. configure -menu ""]
1233 test menu-6.15 {TkDestroyMenu} {
1238 wm geometry .t2 +0+0
1239 . configure -menu .m1
1240 .t2 configure -menu .m1
1241 list [catch {destroy .m1} msg] $msg [destroy .t2] [. configure -menu ""]
1243 test menu-6.16 {TkDestroyMenu} {
1249 wm geometry .t2 +0+0
1251 wm geometry .t3 +0+0
1252 . configure -menu .m1
1253 .t2 configure -menu .m1
1254 .t3 configure -menu .m1
1255 list [catch {destroy .m1} msg] $msg [destroy .t2] [destroy .t3] [. configure -menu ""]
1258 test menu-7.1 {UnhookCascadeEntry} {
1261 .m1 add command -label "test"
1262 list [catch {destroy .m1} msg] $msg
1264 test menu-7.2 {UnhookCascadeEntry} {
1267 .m1 add cascade -menu .m2
1268 list [catch {destroy .m1} msg] $msg
1270 test menu-7.3 {UnhookCascadeEntry} {
1275 .m2 add cascade -menu .cascade
1276 .m1 add cascade -menu .cascade
1277 list [catch {destroy .m1} msg] $msg [destroy .m2]
1279 test menu-7.4 {UnhookCascadeEntry} {
1284 .m1 add cascade -menu .cascade
1285 .m2 add cascade -menu .cascade
1286 list [catch {destroy .m1} msg] $msg [destroy .m2]
1288 test menu-7.5 {UnhookCascadeEntry} {
1295 .m1 add cascade -menu .cascade
1296 .m2 add cascade -menu .cascade
1297 .m3 add cascade -menu .cascade
1298 list [catch {destroy .m1} msg] $msg [destroy .m2 .m3]
1300 test menu-7.6 {UnhookCascadeEntry} {
1307 .m1 add cascade -menu .cascade
1308 .m2 add cascade -menu .cascade
1309 .m3 add cascade -menu .cascade
1310 list [catch {destroy .m2} msg] $msg [destroy .m1 .m3]
1312 test menu-7.7 {UnhookCascadeEntry} {
1319 .m1 add cascade -menu .cascade
1320 .m2 add cascade -menu .cascade
1321 .m3 add cascade -menu .cascade
1322 list [catch {destroy .m3} msg] $msg [destroy .m1 .m2]
1324 test menu-7.8 {UnhookCascadeEntry} {
1329 .m1 add cascade -menu .m2
1330 list [catch {destroy .m1} msg] $msg [destroy .m2]
1332 test menu-7.9 {UnhookCascadeEntry} {
1337 .m1 add cascade -menu .m2
1339 list [catch {destroy .m2} msg] $msg
1342 test menu-8.1 {DestroyMenuEntry} {
1347 .m1 add cascade -menu .m2
1348 list [catch {.m1 delete 1} msg] $msg [destroy .m1 .m2]
1350 test menu-8.2 {DestroyMenuEntry} {
1351 catch {image delete image1a}
1353 image create photo image1a -file [file join $tk_library demos images earth.gif]
1355 .m1 add command -image image1a
1356 list [catch {.m1 delete 1} msg] $msg [destroy .m1] [image delete image1a]
1358 test menu-8.3 {DestroyMenuEntry} testImageType {
1359 catch {eval image delete [image names]}
1361 image create test image1
1362 image create test image2
1364 .m1 add checkbutton -image image1 -selectimage image2
1366 list [catch {.m1 delete 1} msg] $msg [destroy .m1] [eval image delete [image names]]
1368 test menu-8.4 {DestroyMenuEntry} {
1371 .m1 add checkbutton -variable foo
1372 list [catch {.m1 delete 1} msg] $msg [destroy .m1]
1374 test menu-8.5 {DestroyMenuEntry} {
1377 .m1 add command -label "test"
1378 list [catch {.m1 delete 1} msg] $msg [destroy .m1]
1380 test menu-8.6 {DestroyMenuEntry} {
1383 .m1 add command -label "one"
1384 .m1 add command -label "two"
1385 list [catch {.m1 delete 1} msg] $msg [.m1 entrycget 1 -label] [destroy .m1]
1387 test menu-8.7 {DestroyMenuEntry} {
1391 .m1 add command -label "one"
1392 .m1 clone .m2 tearoff
1393 list [catch {.m2 delete 0} msg] $msg [destroy .m1]
1396 # test menu-9 - Can only change when fonts change on system, which cannot
1399 test menu-9.1 {ConfigureMenu} {
1402 list [catch {.m1 configure -postcommand "beep"} msg] $msg [.m1 cget -postcommand] [destroy .m1]
1404 test menu-9.2 {ConfigureMenu} {
1407 .m1 add command -label "test"
1408 list [catch {.m1 configure -tearoff 0} msg] $msg [.m1 entrycget 1 -label] [destroy .m1]
1410 test menu-9.3 {ConfigureMenu} {
1413 list [catch {.m1 configure -postcommand "beep"} msg] $msg [.m1 cget -postcommand] [destroy .m1]
1415 test menu-9.4 {ConfigureMenu} {
1418 .m1 add command -label "test"
1419 list [catch {.m1 configure -fg red} msg] $msg [destroy .m1]
1421 test menu-9.5 {ConfigureMenu} {
1424 .m1 add command -label "test"
1425 .m1 add command -label "two"
1426 list [catch {.m1 configure -fg red} msg] $msg [destroy .m1]
1428 test menu-9.6 {ConfigureMenu} {
1431 .m1 add command -label "test"
1432 .m1 add command -label "two"
1433 .m1 add command -label "three"
1434 list [catch {.m1 configure -fg red} msg] $msg [destroy .m1]
1436 test menu-9.7 {ConfigureMenu} {
1440 .m1 clone .m2 tearoff
1441 list [catch {.m1 configure -fg red} msg] $msg [.m2 cget -fg] [destroy .m1]
1443 test menu-9.8 {ConfigureMenu} {
1447 .m1 clone .m2 tearoff
1448 list [catch {.m2 configure -fg red} msg] $msg [.m1 cget -fg] [destroy .m1]
1450 test menu-9.9 {ConfigureMenu} {
1453 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
1456 test menu-10.1 {PostProcessEntry: array variable} {
1461 .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
1462 list [catch {set foo(1)} msg] $msg [destroy .m1]
1464 test menu-10.2 {PostProcessEntry: array variable} {
1468 .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense"
1469 list [catch {set foo(1)} msg] $msg [destroy .m1]
1472 test menu-11.1 {ConfigureMenuEntry} {
1476 .m1 add checkbutton -variable foo -onvalue on -offvalue off -label "Nonsense"
1477 list [catch {.m1 entryconfigure 1 -variable bar} msg] $msg [.m1 entrycget 1 -variable] [destroy .m1]
1479 test menu-11.2 {ConfigureMenuEntry} {
1482 .m1 add command -label "test"
1483 list [catch {.m1 entryconfigure 1 -label ""} msg] $msg [.m1 entrycget 1 -label] [destroy .m1]
1485 test menu-11.3 {ConfigureMenuEntry} {
1489 list [catch {.m1 entryconfigure 1 -label "test"} cmd] $cmd [.m1 entrycget 1 -label] [destroy .m1]
1491 test menu-11.4 {ConfigureMenuEntry} {
1495 list [catch {.m1 entryconfigure 1 -accel "S"} msg] $msg [.m1 entrycget 1 -accel] [destroy .m1]
1497 test menu-11.5 {ConfigureMenuEntry} {
1501 list [catch {.m1 entryconfigure 1 -label "test"} msg] $msg [.m1 entrycget 1 -label] [destroy .m1]
1503 test menu-11.6 {ConfigureMenuEntry} {
1507 list [catch {.m1 entryconfigure 1 -label "test"} msg] $msg [destroy .m1]
1509 test menu-11.7 {ConfigureMenuEntry} {
1515 list [catch {.m1 entryconfigure 1 -label "test" -menu .m2} msg] $msg [destroy .m1 .m2]
1517 test menu-11.8 {ConfigureMenuEntry} {
1521 list [catch {.m1 entryconfigure 1 -label "test" -menu .m2} msg] $msg [destroy .m1]
1523 test menu-11.9 {ConfigureMenuEntry} {
1526 .m1 add cascade -menu .m3
1527 list [catch {.m1 entryconfigure 1 -label "test" -menu .m2} msg] $msg [destroy .m1]
1529 test menu-11.10 {ConfigureMenuEntry} {
1533 list [catch {.m1 entryconfigure 1 -label "test" -menu .m2} msg] $msg [destroy .m1]
1535 test menu-11.11 {ConfigureMenuEntry} {
1538 .m1 add cascade -menu .m2
1539 list [catch {.m1 entryconfigure 1 -label "test" -menu .m2} msg] $msg [destroy .m1]
1541 test menu-11.12 {ConfigureMenuEntry} {
1549 .m2 add cascade -menu .m1
1551 .m3 add cascade -menu .m1
1553 .m4 add cascade -menu .m1
1556 list [catch {.m5 entryconfigure 1 -label "test" -menu .m1} msg] $msg [destroy .m1 .m2 .m3 .m4 .m5]
1558 test menu-11.13 {ConfigureMenuEntry} {
1565 .m2 add cascade -menu .m1
1567 .m3 add cascade -menu .m1
1569 .m4 add cascade -menu .m1
1570 list [catch {.m3 entryconfigure 1 -label "test" -menu .m1} msg] $msg [destroy .m1 .m2 .m3 .m4]
1572 test menu-11.14 {ConfigureMenuEntry} {
1576 list [catch {.m1 entryconfigure 1 -variable "test"} msg] $msg [.m1 entrycget 1 -variable] [destroy .m1]
1578 test menu-11.15 {ConfigureMenuEntry} {
1581 list [catch {.m1 add checkbutton -label "test"} msg] $msg [.m1 entrycget 1 -variable] [destroy .m1]
1583 test menu-11.16 {ConfigureMenuEntry} {
1586 list [catch {.m1 add radiobutton -label "test"} msg] $msg [destroy .m1]
1588 test menu-11.17 {ConfigureMenuEntry} {
1592 list [catch {.m1 entryconfigure 1 -onvalue "test"} msg] $msg [.m1 entrycget 1 -onvalue] [destroy .m1]
1594 test menu-11.18 {ConfigureMenuEntry} testImageType {
1596 catch {image delete image1}
1599 image create test image1
1600 list [catch {.m1 entryconfigure 1 -image image1} msg] $msg [destroy .m1] [image delete image1]
1602 test menu-11.19 {ConfigureMenuEntry} testImageType {
1604 catch {image delete image1}
1605 catch {image delete image2}
1606 image create test image1
1607 image create photo image2 -file [file join $tk_library demos images earth.gif]
1609 .m1 add command -image image1
1610 list [catch {.m1 entryconfigure 1 -image image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
1612 test menu-11.20 {ConfigureMenuEntry} testImageType {
1614 catch {image delete image1}
1615 catch {image delete image2}
1616 image create photo image1 -file [file join $tk_library demos images earth.gif]
1617 image create test image2
1619 .m1 add checkbutton -image image1
1620 list [catch {.m1 entryconfigure 1 -selectimage image2} msg] $msg [destroy .m1] [image delete image1] [image delete image2]
1622 test menu-11.21 {ConfigureMenuEntry} testImageType {
1624 catch {image delete image1}
1625 catch {image delete image2}
1626 catch {image delete image3}
1627 image create photo image1 -file [file join $tk_library demos images earth.gif]
1628 image create test image2
1629 image create test image3
1631 .m1 add checkbutton -image image1 -selectimage image2
1632 list [catch {.m1 entryconfigure 1 -selectimage image3} msg] $msg [destroy .m1] [image delete image1] [image delete image2] [image delete image3]
1633 } {0 {} {} {} {} {}}
1635 test menu-12.1 {ConfigureMenuCloneEntries} {
1641 .m2 configure -tearoff 0
1643 .m1 add command -label "test"
1644 .m1 add command -label "test2"
1645 list [list [catch {.m1 entryconfigure 1 -gork "foo"} msg] $msg] [destroy .m1]
1646 } {{1 {unknown option "-gork"}} {}}
1647 test menu-12.2 {ConfigureMenuCloneEntries} {
1655 .m1 add cascade -menu .m3
1657 list [catch {.m1 entryconfigure 1 -menu .m4} msg] $msg [destroy .m1] [destroy .m3] [destroy .m4]
1659 test menu-12.3 {ConfigureMenuCloneEntries} {
1664 .m1 add cascade -label dummy
1665 list [catch {.m1 entryconfigure dummy -menu .m3} msg] $msg [destroy .m1]
1668 test menu-12.4 {ConfigureMenuCloneEntries} {
1672 .m1 add cascade -label File -menu .m1.foo
1674 .m1.foo add command -label bar
1676 list [catch {.m1 entryconfigure File -state disabled} msg1] $msg1 [destroy .m1]
1679 test menu-13.1 {TkGetMenuIndex} {
1682 .m1 add command -label "active"
1683 .m1 add command -label "test2"
1684 .m1 add command -label "test3"
1686 list [catch {.m1 entrycget active -label} msg] $msg [destroy .m1]
1688 test menu-13.2 {TkGetMenuIndex} {
1691 .m1 add command -label "last"
1692 .m1 add command -label "test2"
1693 .m1 add command -label "test3"
1695 list [catch {.m1 entrycget last -label} msg] $msg [destroy .m1]
1697 test menu-13.3 {TkGetMenuIndex} {
1700 .m1 add command -label "last"
1701 .m1 add command -label "test2"
1702 .m1 add command -label "test3"
1704 list [catch {.m1 entrycget end -label} msg] $msg [destroy .m1]
1706 test menu-13.4 {TkGetMenuIndex} {
1709 .m1 add command -label "test"
1710 list [catch {.m1 insert last command -label "test2"} msg] $msg [.m1 entrycget last -label] [destroy .m1]
1712 test menu-13.5 {TkGetMenuIndex} {
1715 .m1 add command -label "test"
1716 list [catch {.m1 insert end command -label "test2"} msg] $msg [.m1 entrycget end -label] [destroy .m1]
1718 test menu-13.6 {TkGetMenuIndex} {
1721 .m1 add command -label "active"
1722 .m1 add command -label "test2"
1723 .m1 add command -label "test3"
1725 list [catch {.m1 entrycget none -label} msg] $msg [destroy .m1]
1727 #test menu-13.7 - Need to add @test here.
1728 test menu-13.7 {TkGetMenuIndex} {
1731 .m1 add command -label "active"
1732 .m1 add command -label "test2"
1733 .m1 add command -label "test3"
1734 list [catch {.m1 entrycget 1 -label} msg] $msg [destroy .m1]
1736 test menu-13.8 {TkGetMenuIndex} {
1739 .m1 add command -label "active"
1740 list [catch {.m1 entrycget -1 -label} msg] $msg [destroy .m1]
1741 } {1 {bad menu entry index "-1"} {}}
1742 test menu-13.9 {TkGetMenuIndex} {
1745 .m1 add command -label "test"
1746 .m1 add command -label "test2"
1747 list [catch {.m1 entrycget 999 -label} msg] $msg [destroy .m1]
1749 test menu-13.10 {TkGetMenuIndex} {
1752 .m1 insert 999 command -label "test"
1753 list [catch {.m1 entrycget 1 -label} msg] $msg [destroy .m1]
1755 test menu-13.11 {TkGetMenuIndex} {
1758 .m1 add command -label "1test"
1759 list [catch {.m1 entrycget 1test -label} msg] $msg [destroy .m1]
1761 test menu-13.12 {TkGetMenuIndex} {
1764 .m1 add command -label "test"
1765 .m1 add command -label "test2" -command "beep"
1766 .m1 add command -label "test3"
1767 list [catch {.m1 entrycget test2 -command} msg] $msg [destroy .m1]
1770 test menu-14.1 {MenuCmdDeletedProc} {
1773 list [catch {destroy .m1} msg] $msg
1775 test menu-14.2 {MenuCmdDeletedProc} {
1779 list [catch {destroy .m1} msg] $msg
1782 test menu-15.1 {MenuNewEntry} {
1785 list [catch {.m1 add command -label "test"} msg] $msg [destroy .m1]
1787 test menu-15.2 {MenuNewEntry} {
1790 .m1 add command -label "test"
1791 .m1 add command -label "test3"
1792 list [catch {.m1 insert 2 command -label "test2"} msg] $msg [destroy .m1]
1794 test menu-15.3 {MenuNewEntry} {
1797 .m1 add command -label "test"
1798 list [catch {.m1 add command -label "test2"} msg] $msg [destroy .m1]
1800 test menu-15.4 {MenuNewEntry} {
1803 list [catch {.m1 add command -label "test"} msg] $msg [destroy .m1]
1806 test menu-16.1 {MenuAddOrInsert} {
1809 list [catch {.m1 insert foo command -label "test"} msg] $msg [destroy .m1]
1810 } {1 {bad menu entry index "foo"} {}}
1811 test menu-16.2 {MenuAddOrInsert} {
1814 .m1 add command -label "test"
1815 list [catch {.m1 insert test command -label "foo"} msg] $msg [destroy .m1]
1817 test menu-16.3 {MenuAddOrInsert} {
1820 list [catch {.m1 insert -1 command -label "test"} msg] $msg [destroy .m1]
1821 } {1 {bad menu entry index "-1"} {}}
1822 test menu-16.4 {MenuAddOrInsert} {
1825 .m1 add command -label "test"
1826 .m1 insert 0 command -label "test2"
1827 list [catch {.m1 entrycget 1 -label} msg] $msg [destroy .m1]
1829 test menu-16.5 {MenuAddOrInsert} {
1832 list [catch {.m1 add cascade} msg] $msg [destroy .m1]
1834 test menu-16.6 {MenuAddOrInsert} {
1837 list [catch {.m1 add checkbutton} msg] $msg [destroy .m1]
1839 test menu-16.7 {MenuAddOrInsert} {
1842 list [catch {.m1 add command} msg] $msg [destroy .m1]
1844 test menu-16.8 {MenuAddOrInsert} {
1847 list [catch {.m1 add radiobutton} msg] $msg [destroy .m1]
1849 test menu-16.9 {MenuAddOrInsert} {
1852 list [catch {.m1 add separator} msg] $msg [destroy .m1]
1854 test menu-16.10 {MenuAddOrInsert} {
1857 list [catch {.m1 add blork} msg] $msg [destroy .m1]
1858 } {1 {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator} {}}
1859 test menu-16.11 {MenuAddOrInsert} {
1862 list [catch {.m1 add command} msg] $msg [destroy .m1]
1864 test menu-16.12 {MenuAddOrInsert} {
1871 list [catch {.m2 add command -label "test"} msg1] $msg1 [catch {.m1 entrycget 1 -label} msg2] $msg2 [catch {.m3 entrycget 1 -label} msg3] $msg3 [destroy .m1]
1872 } {0 {} 0 test 0 test {}}
1873 test menu-16.13 {MenuAddOrInsert} {
1880 list [catch {.m3 add command -label "test"} msg1] $msg1 [catch {.m1 entrycget 1 -label} msg2] $msg2 [catch {.m2 entrycget 1 -label} msg3] $msg3 [destroy .m1]
1881 } {0 {} 0 test 0 test {}}
1882 test menu-16.14 {MenuAddOrInsert} {
1885 list [catch {.m1 add command -blork} msg] $msg [destroy .m1]
1886 } {1 {unknown option "-blork"} {}}
1887 test menu-16.15 {MenuAddOrInsert} {
1889 catch {destroy .container}
1891 .m1 add command -label "File"
1893 . configure -menu .container
1894 list [catch {.container add cascade -label "File" -menu .m1} msg] $msg [. configure -menu ""] [destroy .container .m1]
1896 test menu-16.16 {MenuAddOrInsert} {
1901 set tearoff [tk::TearOffMenu .m2]
1902 list [catch {.m2 add cascade -menu .m1} msg] $msg [$tearoff unpost] [catch {destroy .m1} msg2] $msg2 [catch {destroy .m2} msg3] $msg3
1903 } {0 {} {} 0 {} 0 {}}
1904 test menu-16.17 {MenuAddOrInsert} {
1906 catch {destroy .container}
1909 . configure -menu .container
1910 set tearoff [tk::TearOffMenu .container]
1911 list [catch {.container add cascade -label "File" -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1 .container]
1913 test menu-16.18 {MenuAddOrInsert} {
1915 catch {destroy .container}
1918 .container add cascade -menu .m1
1919 . configure -menu .container
1920 list [catch {.container add cascade -label "File" -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1 .container]
1922 test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} {
1923 catch {destroy .menubar}
1925 menu .menubar.test -tearoff 0
1926 .menubar add cascade -label Test -underline 0 -menu .menubar.test
1927 menu .menubar.test.cascade -tearoff 0
1928 .menubar.test.cascade add command -label SubItem -command "puts SubItemSelected"
1929 . configure -menu .menubar
1930 list [catch {.menubar.test add cascade -label SubMenu \
1931 -menu .menubar.test.cascade} msg] \
1932 [info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \
1933 [. configure -menu ""] [destroy .menubar]
1934 } {0 .#menubar.#menubar#test.#menubar#test#cascade {} {}}
1936 test menu-17.1 {MenuVarProc} {
1941 list [catch {.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye} msg] $msg [catch {unset foo} msg2] $msg2 [destroy .m1]
1943 # menu-17.2 - Don't know how to generate the flags in the if
1944 test menu-17.2 {MenuVarProc} {
1948 list [catch {.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye} msg] $msg [set foo ""] [destroy .m1]
1950 test menu-17.3 {MenuVarProc} {
1955 list [catch {.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye} msg] $msg [set foo "hello"] [destroy .m1] [catch {unset foo} msg2] $msg2
1956 } {0 {} hello {} 0 {}}
1957 test menu-17.4 {MenuVarProc} {
1961 list [catch {.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye} msg] $msg [set foo "hello"] [destroy .m1] [catch {unset foo} msg2] $msg2
1962 } {0 {} hello {} 0 {}}
1963 test menu-17.5 {MenuVarProc} {
1967 list [catch {.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye} msg] $msg [set foo "goodbye"] [destroy .m1] [catch {unset foo} msg2] $msg2
1968 } {0 {} goodbye {} 0 {}}
1970 test menu-18.1 {TkActivateMenuEntry} {
1973 .m1 add command -label "test"
1974 list [catch {.m1 activate 1} msg] $msg [destroy .m1]
1976 test menu-18.2 {TkActivateMenuEntry} {
1979 .m1 add command -label "test"
1980 list [catch {.m1 activate 0} msg] $msg [destroy .m1]
1982 test menu-18.3 {TkActivateMenuEntry} {
1985 .m1 add command -label "test"
1986 .m1 add command -label "test2"
1988 list [catch {.m1 activate 2} msg] $msg [destroy .m1]
1990 test menu-18.4 {TkActivateMenuEntry} {
1993 .m1 add command -label "test"
1994 .m1 add command -label "test2"
1996 list [catch {.m1 activate 1} msg] $msg [destroy .m1]
1999 test menu-19.1 {TkPostCommand} {nonUnixUserInteraction } {
2001 menu .m1 -postcommand "set menu_test menu-19.1"
2002 .m1 add command -label "menu-19.1 - hit Escape"
2003 list [catch {.m1 post 40 40} msg] $msg [.m1 unpost] [set menu_test] [destroy .m1]
2004 } {0 menu-19.1 {} menu-19.1 {}}
2005 test menu-19.2 {TkPostCommand} {nonUnixUserInteraction } {
2008 .m1 add command -label "menu-19.2 - hit Escape"
2009 list [catch {.m1 post 40 40} msg] $msg [.m1 unpost] [destroy .m1]
2012 test menu-20.1 {CloneMenu} {
2016 list [catch {.m1 clone .m2} msg1] $msg1 [destroy .m1]
2018 test menu-20.2 {CloneMenu} {
2022 list [catch {.m1 clone .m2 normal} msg1] $msg1 [destroy .m1]
2024 test menu-20.3 {CloneMenu} {
2028 list [catch {.m1 clone .m2 tearoff} msg1] $msg1 [destroy .m1]
2030 test menu-20.4 {CloneMenu} {
2034 list [catch {.m1 clone .m2 menubar} msg1] $msg1 [destroy .m1]
2036 test menu-20.5 {CloneMenu} {
2040 list [catch {.m1 clone .m2 foo} msg1] $msg1 [destroy .m1]
2041 } {1 {bad menu type "foo": must be normal, tearoff, or menubar} {}}
2042 test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} {
2046 list [catch {.m1 clone .m2} msg] $msg [destroy .m1]
2048 test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} {
2054 list [catch {.m1 clone .m3} msg] $msg [destroy .m1]
2056 test menu-20.8 {CloneMenu - cascade entries} {
2058 catch {destroy .foo}
2060 .m1 add cascade -menu .m2
2061 list [catch {.m1 clone .foo} msg] $msg [destroy .m1]
2063 test menu-20.9 {CloneMenu - cascades entries} {
2066 catch {destroy .foo}
2068 .m1 add cascade -menu .m2
2070 list [catch {.m1 clone .foo} msg] $msg [destroy .m1 .m2]
2072 test menu-20.10 {CloneMenu - tearoff fields} {
2076 list [catch {.m1 clone .m2 normal} msg1] $msg1 [catch {.m2 cget -tearoff} msg2] $msg2 [destroy .m1]
2078 test menu-20.11 {CloneMenu} {
2083 list [catch {.m1 clone .m2} msg] $msg [destroy .m1 .m2]
2084 } {1 {window name "m2" already exists in parent} {}}
2086 test menu-21.1 {MenuDoYPosition} {
2089 list [catch {.m1 yposition glorp} msg] $msg [destroy .m1]
2090 } {1 {bad menu entry index "glorp"} {}}
2091 test menu-21.2 {MenuDoYPosition} {
2094 .m1 add command -label "Test"
2095 list [catch {.m1 yposition 1}] [destroy .m1]
2098 test menu-22.1 {GetIndexFromCoords} {
2101 .m1 add command -label "test"
2102 .m1 configure -tearoff 0
2103 list [catch {.m1 index @5} msg] $msg [destroy .m1]
2105 test menu-22.2 {GetIndexFromCoords} {
2108 .m1 add command -label "test"
2109 .m1 configure -tearoff 0
2110 list [catch {.m1 index @5,5} msg] $msg [destroy .m1]
2113 test menu-23.1 {RecursivelyDeleteMenu} {
2116 . configure -menu .m1
2117 list [catch {. configure -menu ""} msg] $msg [destroy .m1]
2119 test menu-23.2 {RecursivelyDeleteMenu} {
2123 .m2 add command -label "test2"
2125 .m1 add cascade -label "test1" -menu .m2
2126 . configure -menu .m1
2127 list [catch {. configure -menu ""} msg] $msg [destroy .m1 .m2]
2130 test menu-24.1 {TkNewMenuName} {
2133 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2135 test menu-24.2 {TkNewMenuName} {
2137 catch {destroy .m1\#0}
2140 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2142 test menu-24.3 {TkNewMenuName} {
2146 list [catch {. configure -menu [menu .m]} $msg] [. configure -menu ""] [destroy .#m] [destroy .m] [destroy hideme]
2149 test menu-25.1 {TkSetWindowMenuBar} {
2150 . configure -menu ""
2151 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""]
2153 test menu-25.2 {TkSetWindowMenuBar} {
2154 . configure -menu ""
2155 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""]
2157 test menu-25.3 {TkSetWindowMenuBar} {
2158 . configure -menu ""
2161 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2163 test menu-25.4 {TkSetWindowMenuBar} {
2166 . configure -menu ""
2168 . configure -menu .m1
2170 list [catch {. configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .m1 .m2]
2172 test menu-25.5 {TkSetWindowMenuBar} {
2176 . configure -menu ""
2178 . configure -menu .m1
2181 list [catch {. configure -menu .m3} msg] $msg [. configure -menu ""] [destroy .m1 .m3]
2183 test menu-25.6 {TkSetWindowMenuBar} {
2187 . configure -menu ""
2190 . configure -menu .m2
2192 list [catch {. configure -menu .m3} msg] $msg [. configure -menu ""] [destroy .m1 .m3]
2194 test menu-25.7 {TkSetWindowMenuBar} {
2197 . configure -menu ""
2200 . configure -menu .m1
2202 .t2 configure -menu .m1
2203 list [catch {.t2 configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .t2 .m1 .m2]
2205 test menu-25.8 {TkSetWindowMenuBar} {
2209 . configure -menu ""
2212 . configure -menu .m1
2214 wm geometry .t2 +0+0
2215 .t2 configure -menu .m1
2216 list [catch {. configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .t2 .m1 .m2]
2218 test menu-25.9 {TkSetWindowMenuBar} {
2223 . configure -menu ""
2226 . configure -menu .m1
2227 toplevel .t2 -menu .m1
2228 wm geometry .t2 +0+0
2229 toplevel .t3 -menu .m1
2230 wm geometry .t3 +0+0
2231 list [catch {.t3 configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .t2 .t3 .m1 .m2]
2233 test menu-25.10 {TkSetWindowMenuBar} {
2238 . configure -menu ""
2241 . configure -menu .m1
2242 toplevel .t2 -menu .m1
2243 wm geometry .t2 +0+0
2244 toplevel .t3 -menu .m1
2245 wm geometry .t3 +0+0
2246 list [catch {.t2 configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .t2 .t3 .m1 .m2]
2248 test menu-25.11 {TkSetWindowMenuBar} {
2253 . configure -menu ""
2256 . configure -menu .m1
2257 toplevel .t2 -menu .m1
2258 wm geometry .t2 +0+0
2259 toplevel .t3 -menu .m1
2260 wm geometry .t3 +0+0
2261 list [catch {. configure -menu .m2} msg] $msg [. configure -menu ""] [destroy .t2 .t3 .m1 .m2]
2263 test menu-25.12 {TkSetWindowMenuBar} {
2265 . configure -menu ""
2267 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2269 test menu-25.13 {TkSetWindowMenuBar} {
2270 . configure -menu ""
2271 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""]
2273 test menu-25.14 {TkSetWindowMenuBar} {
2275 . configure -menu ""
2277 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2279 test menu-25.15 {TkSetWindowMenuBar} {
2280 . configure -menu ""
2281 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""]
2283 test menu-25.16 {TkSetWindowMenuBar} {
2285 . configure -menu ""
2287 . configure -menu .m1
2288 list [catch {toplevel .t2 -menu m1} msg] $msg [. configure -menu ""] [destroy .t2 .m1]
2291 test menu-26.1 {DestroyMenuHashTable} {
2292 catch {interp destroy testinterp}
2293 interp create testinterp
2294 load {} Tk testinterp
2295 interp eval testinterp {menu .m1}
2296 list [catch {interp delete testinterp} msg] $msg
2299 test menu-27.1 {GetMenuHashTable} {
2300 catch {interp destroy testinterp}
2301 interp create testinterp
2302 load {} Tk testinterp
2303 list [catch {interp eval testinterp {menu .m1}} msg] $msg [interp delete testinterp]
2306 test menu-28.1 {TkCreateMenuReferences - not there before} {
2308 list [catch {menu .m1} msg] $msg [destroy .m1]
2310 test menu-28.2 {TkCreateMenuReferences - there already} {
2314 .m1 add cascade -menu .m2
2315 list [catch {menu .m2} msg] $msg [destroy .m1 .m2]
2318 test menu-29.1 {TkFindMenuReferences - not there} {
2320 . configure -menu ""
2322 .m1 add cascade -menu .m2
2323 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
2325 test menu-30.1 {TkFindMenuReferences - there already} {
2328 . configure -menu ""
2331 .m1 add cascade -menu .m2
2332 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1 .m2]
2335 test menu-31.1 {TkFreeMenuReferences - menuPtr} {
2338 list [catch {destroy .m1} msg] $msg
2340 test menu-31.2 {TkFreeMenuReferences - cascadePtr} {
2342 . configure -menu ""
2344 .m1 add cascade -menu .m2
2345 list [catch {.m1 entryconfigure 1 -menu .m3} msg] $msg [destroy .m1]
2347 test menu-31.3 {TkFreeMenuReferences - topLevelListPtr} {
2348 . configure -menu .m1
2349 list [catch {. configure -menu ""} msg] $msg
2351 test menu-31.4 {TkFreeMenuReferences - not empty} {
2355 .m1 add cascade -menu .m3
2357 .m2 add cascade -menu .m3
2358 list [catch {.m2 entryconfigure 1 -menu ".foo"} msg] $msg [destroy .m1 .m2]
2361 test menu-32.1 {DeleteMenuCloneEntries} {
2365 .m1 add command -label foo
2367 list [catch {.m1 delete 1} msg] $msg [destroy .m1]
2369 test menu-32.2 {DeleteMenuCloneEntries} {
2373 .m1 add command -label one
2374 .m1 add command -label two
2375 .m1 add command -label three
2376 .m1 add command -label four
2378 list [catch {.m1 delete 2 3} msg] $msg [destroy .m1]
2380 test menu-32.3 {DeleteMenuCloneEntries} {
2384 .m1 add command -label one
2385 .m1 add command -label two
2386 .m1 add command -label three
2387 .m1 add command -label four
2389 .m2 configure -tearoff 1
2390 list [catch {.m1 delete 1 2} msg] $msg [destroy .m1]
2392 test menu-32.4 {DeleteMenuCloneEntries} {
2396 .m1 add command -label one
2397 .m1 add command -label two
2398 .m1 add command -label three
2399 .m1 add command -label four
2401 .m2 configure -tearoff 0
2402 list [catch {.m1 delete 2 3} msg] $msg [destroy .m1]
2404 test menu-32.5 {DeleteMenuCloneEntries} {
2408 .m1 add command -label one
2409 .m1 add command -label two
2412 list [catch {.m1 delete one} msg] $msg [destroy .m1]
2414 test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} {
2417 .m1 add command -label test -command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test"
2418 list [catch {.m1 invoke test} msg] $msg [destroy .m1]
2420 test menu-32.7 {DeleteMenuCloneEntries - one entry} {
2423 .m1 add command -label Hello
2424 list [catch {.m1 delete Hello} msg] $msg [destroy .m1]
2426 test menu-32.8 {Ensure all menu clone commands are deleted} {knownBug} {
2428 catch {destroy .menubar}
2429 catch {destroy .menubar.test}
2431 . configure -menu .menubar
2433 .menubar.test add command -label "hi"
2434 for {set i 0} {$i < 10} {incr i} {
2435 .menubar add cascade -menu .menubar.test -label "Test"
2436 .menubar delete Test
2439 info commands .#menubar*test*
2441 test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} {
2442 catch {destroy .menubar}
2443 catch {destroy .menubar.test}
2446 . configure -menu .menubar
2448 .menubar add cascade -menu .menubar.test -label "Test"
2449 menu .menubar.cascade
2451 .menubar.test add cascade -menu .menubar.cascade -label "Cascade"
2453 lappend res [.menubar.test entrycget 1 -menu]
2454 lappend res [.#menubar.#menubar#test entrycget 1 -menu]
2455 destroy .menubar.test
2457 .menubar.test add cascade -menu .menubar.cascade -label "Cascade"
2458 lappend res [.menubar.test entrycget 1 -menu]
2459 lappend res [.#menubar.#menubar#test entrycget 1 -menu]
2461 } {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade}
2463 set l [interp hidden]
2466 test menu-33.1 {menu vs command hiding} {
2471 list [winfo children .] [interp hidden]
2474 # menu-34 MenuInit only called at boot time
2476 # creating menus on two different screens then deleting the
2477 # menu from the first screen crashes Tk8.3.1
2479 test menu-35.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} \
2483 toplevel .two -screen $::env(TK_ALT_DISPLAY)
2491 ::tcltest::cleanupTests