1 # This file is a Tcl script to test menus in Tk. It is
2 # organized in the standard fashion for Tcl tests. This
3 # file tests the Macintosh-specific features of the menu
6 # Copyright (c) 1995-1996 Sun Microsystems, Inc.
7 # Copyright (c) 1998-1999 by Scriptics Corporation.
12 if {[lsearch [namespace children] ::tcltest] == -1} {
13 source [file join [pwd] [file dirname [info script]] defs.tcl]
16 if {$tcl_platform(platform) != "unix"} {
17 puts "skipping: Unix only tests..."
18 ::tcltest::cleanupTests
22 if {[lsearch [image types] test] < 0} {
23 puts "This application hasn't been compiled with the \"test\" image"
24 puts "type, so I can't run this test. Are you sure you're using"
25 puts "tktest instead of wish?"
26 ::tcltest::cleanupTests
30 proc deleteWindows {} {
31 foreach i [winfo children .] {
40 test unixMenu-1.1 {TkpNewMenu - normal menu} {
42 list [catch {menu .m1} msg] $msg [destroy .m1]
44 test unixMenu-1.2 {TkpNewMenu - help menu} {
48 .m1 add cascade -label Help -menu .m1.help
49 list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
52 test unixMenu-2.1 {TkpDestroyMenu - nothing to do} {} {}
53 test unixMenu-3.1 {TkpDestroymenuEntry - nothing to do} {} {}
55 test unixMenu-4.1 {TkpConfigureMenuEntry - non-cascade entry} {
58 .m1 add command -label test
59 list [catch {.m1 entryconfigure test -label foo} msg] $msg [destroy .m1]
61 test unixMenu-4.2 {TkpConfigureMenuEntry - cascade entry} {
64 .m1 add cascade -menu .m2 -label test
65 menu .m1.foo -tearoff 0
66 list [catch {.m1 entryconfigure test -menu .m1.foo} msg] $msg [destroy .m1]
69 test unixMenu-5.1 {TkpMenuNewEntry - nothing to do} {} {}
71 test unixMenu-6.1 {TkpSetWindowMenuBar - null menu} {
74 .m1 add cascade -label foo
76 list [catch {. configure -menu ""} msg] $msg [destroy .m1]
78 test unixMenu-6.2 {TkpSetWindowMenuBar - menu} {
81 .m1 add cascade -label foo
82 list [catch {. configure -menu .m1} msg] $msg [. configure -menu ""] [destroy .m1]
85 test unixMenu-7.1 {TkpSetMainMenubar - nothing to do} {} {}
87 test unixMenu-8.1 {GetMenuIndicatorGeometry - indicator off} {
90 .m1 add checkbutton -label foo -indicatoron 0
91 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
93 test unixMenu-8.2 {GetMenuIndicatorGeometry - not checkbutton or radio} {
96 .m1 add command -label foo
97 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
99 test unixMenu-8.3 {GetMenuIndicatorGeometry - checkbutton image} {
101 catch {image delete image1}
103 image create test image1
104 .m1 add checkbutton -image image1 -label foo
106 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] [image delete image1]
108 test unixMenu-8.4 {GetMenuIndicatorGeometry - checkbutton bitmap} {
111 .m1 add checkbutton -bitmap questhead -label foo
113 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
115 test unixMenu-8.5 {GetMenuIndicatorGeometry - checkbutton} {
118 .m1 add checkbutton -label foo
120 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
122 test unixMenu-8.6 {GetMenuIndicatorGeometry - radiobutton image} {
124 catch {image delete image1}
126 image create test image1
127 .m1 add radiobutton -image image1 -label foo
129 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1] [image delete image1]
131 test unixMenu-8.7 {GetMenuIndicatorGeometry - radiobutton bitmap} {
134 .m1 add radiobutton -bitmap questhead -label foo
136 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
138 test unixMenu-8.8 {GetMenuIndicatorGeometry - radiobutton} {
141 .m1 add radiobutton -label foo
143 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
145 test unixMenu-8.9 {GetMenuIndicatorGeometry - hideMargin} {
148 .m1 add radiobutton -label foo -hidemargin 1
150 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
153 test unixMenu-9.1 {GetMenuAccelGeometry - cascade entry} {
156 .m1 add cascade -label foo
157 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
159 test unixMenu-9.2 {GetMenuAccelGeometry - non-null label} {
162 .m1 add command -label foo -accel "Ctrl+S"
163 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
165 test unixMenu-9.3 {GetMenuAccelGeometry - null label} {
168 .m1 add command -label foo
169 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
172 test unixMenu-10.1 {DrawMenuEntryBackground - active menubar} {
175 .m1 add cascade -label foo
176 . configure -menu .m1
178 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
180 test unixMenu-10.2 {DrawMenuEntryBackground - active} {
183 .m1 add command -label foo
184 set tearoff [tkTearOffMenu .m1 40 40]
186 list [catch {update} msg] $msg [destroy .m1]
188 test unixMenu-10.3 {DrawMenuEntryBackground - non-active} {
191 .m1 add command -label foo
192 set tearoff [tkTearOffMenu .m1 40 40]
193 list [catch {update} msg] $msg [destroy .m1]
196 test unixMenu-11.1 {DrawMenuEntryAccelerator - menubar} {
199 .m1 add command -label foo -accel "Ctrl+U"
200 . configure -menu .m1
201 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
203 # drawArrow parameter is never false under Unix
204 test unixMenu-11.2 {DrawMenuEntryAccelerator - cascade entry} {
207 .m1 add cascade -label foo
208 set tearoff [tkTearOffMenu .m1 40 40]
209 list [catch {update} msg] $msg [destroy .m1]
211 test unixMenu-11.3 {DrawMenuEntryAccelerator - normal entry} {
214 .m1 add command -label foo -accel "Ctrl+U"
215 set tearoff [tkTearOffMenu .m1 40 40]
216 list [catch {update} msg] $msg [destroy .m1]
218 test unixMenu-11.4 {DrawMenuEntryAccelerator - null entry} {
221 .m1 add command -label foo
222 set tearoff [tkTearOffMenu .m1 40 40]
223 list [catch {update} msg] $msg [destroy .m1]
226 test unixMenu-12.1 {DrawMenuEntryIndicator - non-check or radio} {
229 .m1 add command -label foo
230 set tearoff [tkTearOffMenu .m1 40 40]
231 list [catch {update} msg] $msg [destroy .m1]
233 test unixMenu-12.2 {DrawMenuEntryIndicator - checkbutton - indicator off} {
236 .m1 add checkbutton -label foo -indicatoron 0
237 set tearoff [tkTearOffMenu .m1 40 40]
238 list [catch {update} msg] $msg [destroy .m1]
240 test unixMenu-12.3 {DrawMenuEntryIndicator - checkbutton - not selected} {
243 .m1 add checkbutton -label foo
244 set tearoff [tkTearOffMenu .m1 40 40]
245 list [catch {update} msg] $msg [destroy .m1]
247 test unixMenu-12.4 {DrawMenuEntryIndicator - checkbutton - selected} {
250 .m1 add checkbutton -label foo
252 set tearoff [tkTearOffMenu .m1 40 40]
253 list [catch {update} msg] $msg [destroy .m1]
255 test unixMenu-12.5 {DrawMenuEntryIndicator - radiobutton - indicator off} {
258 .m1 add radiobutton -label foo -indicatoron 0
259 set tearoff [tkTearOffMenu .m1 40 40]
260 list [catch {update} msg] $msg [destroy .m1]
262 test unixMenu-12.6 {DrawMenuEntryIndicator - radiobutton - not selected} {
265 .m1 add radiobutton -label foo
266 set tearoff [tkTearOffMenu .m1 40 40]
267 list [catch {update} msg] $msg [destroy .m1]
269 test unixMenu-12.7 {DrawMenuEntryIndicator - radiobutton - selected} {
272 .m1 add radiobutton -label foo
274 set tearoff [tkTearOffMenu .m1 40 40]
275 list [catch {update} msg] $msg [destroy .m1]
278 test unixMenu-13.1 {DrawMenuSeparator - menubar case} {
282 . configure -menu .m1
283 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
285 test unixMenu-13.2 {DrawMenuSepartor - normal menu} {
289 set tearoff [tkTearOffMenu .m1 40 40]
290 list [catch {update} msg] $msg [destroy .m1]
293 test unixMenu-14.1 {DrawMenuEntryLabel} {
296 .m1 add command -label foo
297 set tearoff [tkTearOffMenu .m1 40 40]
298 list [catch {update} msg] $msg [destroy .m1]
301 test unixMenu-15.1 {DrawMenuUnderline - menubar} {
304 .m1 add command -label foo -underline 0
305 . configure -menu .m1
306 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
308 test unixMenu-15.2 {DrawMenuUnderline - no menubar} {
311 .m1 add command -label foo -underline 0
312 set tearoff [tkTearOffMenu .m1 40 40]
313 list [catch {update} msg] $msg [destroy .m1]
316 test unixMenu-16.1 {TkpPostMenu} {
319 .m1 add command -label foo
320 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
323 test unixMenu-17.1 {GetMenuSeparatorGeometry} {
327 list [catch {tkTearOffMenu .m1 40 40}] [destroy .m1]
330 test unixMenu-18.1 {GetTearoffEntryGeometry} {
332 menubutton .mb -text "test" -menu .mb.m
334 .mb.m add command -label test
337 list [catch {tkMbPost .mb} msg] $msg [tkMenuUnpost .mb.m] [destroy .mb]
340 # Don't know how to reproduce the case where the tkwin has been deleted.
341 test unixMenu-19.1 {TkpComputeMenubarGeometry - zero entries} {
344 . configure -menu .m1
345 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
347 # Don't know how to generate one width windows
348 test unixMenu-19.2 {TkpComputeMenubarGeometry - one entry} {
351 .m1 add cascade -label File
352 . configure -menu .m1
353 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
355 test unixMenu-19.3 {TkpComputeMenubarGeometry - entry with different font} {
357 menu .m1 -font "Courier 24"
358 .m1 add cascade -label File -font "Helvetica 18"
359 . configure -menu .m1
360 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
362 test unixMenu-19.4 {TkpComputeMenubarGeometry - separator} {
366 . configure -menu .m1
367 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
369 test unixMenu-19.5 {TkpComputeMenubarGeometry - First entry} {
372 .m1 add cascade -label File
373 . configure -menu .m1
374 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
376 test unixMenu-19.6 {TkpComputeMenubarGeometry - First entry too wide} {
379 .m1 add cascade -label File -font "Times 72"
380 . configure -menu .m1
382 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
384 test unixMenu-19.7 {TkpComputeMenubarGeometry - two entries fit} {
387 .m1 add cascade -label File
388 .m1 add cascade -label Edit
389 . configure -menu .m1
390 wm geometry . 200x200
391 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
393 test unixMenu-19.8 {TkpComputeMenubarGeometry - two entries; 2nd don't fit} {
396 .m1 add cascade -label File
397 .m1 add cascade -label Edit -font "Times 72"
398 . configure -menu .m1
399 wm geometry . 100x100
400 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
402 test unixMenu-19.9 {TkpComputeMenubarGeometry - two entries; 1st dont fit} {
405 .m1 add cascade -label File -font "Times 72"
406 .m1 add cascade -label Edit
407 . configure -menu .m1
408 wm geometry . 100x100
409 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
411 test unixMenu-19.10 {TkpComputeMenubarGeometry - two entries; neither fit} {
413 menu .m1 -tearoff 0 -font "Times 72"
414 .m1 add cascade -label File
415 .m1 add cascade -label Edit
416 . configure -menu .m1
418 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
420 # ABC notation; capital A means first window fits, small a means it
421 # does not. capital B menu means second window fist, etc.
422 test unixMenu-19.11 {TkpComputeMenubarGeometry - abc} {
424 menu .m1 -tearoff 0 -font "Times 72"
425 .m1 add cascade -label "aaaaa"
426 .m1 add cascade -label "bbbbb"
427 .m1 add cascade -label "ccccc"
428 . configure -menu .m1
430 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
432 test unixMenu-19.12 {TkpComputeMenubarGeometry - abC} {
435 .m1 add cascade -label "aaaaa" -font "Times 72"
436 .m1 add cascade -label "bbbbb" -font "Times 72"
437 .m1 add cascade -label "C"
438 . configure -menu .m1
440 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
442 test unixMenu-19.13 {TkpComputeMenubarGeometry - aBc} {
445 .m1 add cascade -label "aaaaa" -font "Times 72"
446 .m1 add cascade -label "B"
447 .m1 add cascade -label "ccccc" -font "Times 72"
448 . configure -menu .m1
450 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
452 test unixMenu-19.14 {TkpComputeMenubarGeometry - aBC} {
455 .m1 add cascade -label "aaaaa" -font "Times 72"
456 .m1 add cascade -label "B"
457 .m1 add cascade -label "C"
458 . configure -menu .m1
460 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
462 test unixMenu-19.15 {TkpComputeMenubarGeometry - Abc} {
465 .m1 add cascade -label "A"
466 .m1 add cascade -label "bbbbb" -font "Times 72"
467 .m1 add cascade -label "ccccc" -font "Times 72"
468 . configure -menu .m1
470 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
472 test unixMenu-19.16 {TkpComputeMenubarGeometry - AbC} {
475 .m1 add cascade -label "A"
476 .m1 add cascade -label "bbbbb" -font "Times 72"
477 .m1 add cascade -label "C"
478 . configure -menu .m1
480 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
482 test unixMenu-19.17 {TkpComputeMenubarGeometry - ABc} {
485 .m1 add cascade -label "A"
486 .m1 add cascade -label "B"
487 .m1 add cascade -label "ccccc" -font "Times 72"
488 . configure -menu .m1
490 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
492 test unixMenu-19.18 {TkpComputeMenubarGeometry - ABC} {
495 .m1 add cascade -label "A"
496 .m1 add cascade -label "B"
497 .m1 add cascade -label "C"
498 . configure -menu .m1
500 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
502 test unixMenu-19.19 {TkpComputeMenubarGeometry - help menu in first position} {
505 .m1 add cascade -label Help -menu .m1.help
506 menu .m1.help -tearoff 0
507 .m1 add cascade -label File -menu .m1.file
508 menu .m1.file -tearoff 0
509 .m1 add cascade -label Edit -menu .m1.edit
510 menu .m1.edit -tearoff 0
511 . configure -menu .m1
513 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
515 test unixMenu-19.20 {TkpComputeMenubarGeometry - help menu in middle} {
518 .m1 add cascade -label Edit -menu .m1.edit
519 menu .m1.edit -tearoff 0
520 .m1 add cascade -label Help -menu .m1.help
521 menu .m1.help -tearoff 0
522 .m1 add cascade -label File -menu .m1.file
523 menu .m1.file -tearoff 0
524 . configure -menu .m1
526 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
528 test unixMenu-19.21 {TkpComputeMenubarGeometry - help menu in first position} {
531 .m1 add cascade -label File -menu .m1.file
532 menu .m1.file -tearoff 0
533 .m1 add cascade -label Edit -menu .m1.edit
534 menu .m1.edit -tearoff 0
535 .m1 add cascade -label Help -menu .m1.help
536 menu .m1.help -tearoff 0
537 . configure -menu .m1
539 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
541 test unixMenu-19.22 {TkpComputeMenubarGeometry - help item fits} {
544 .m1 add cascade -label File -menu .m1.file
545 menu .m1.file -tearoff 0
546 .m1 add cascade -label Help -menu .m1.help
547 menu .m1.help -tearoff 0
548 . configure -menu .m1
550 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
552 test unixMenu-19.23 {TkpComputeMenubarGeometry - help item does not fit} {
555 .m1 add cascade -label File -menu .m1.file
556 menu .m1.file -tearoff 0
557 .m1 add cascade -label Help -menu .m1.help -font "Helvetica 72"
558 menu .m1.help -tearoff 0
559 . configure -menu .m1
561 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
563 test unixMenu-19.24 {TkpComputeMenubarGeometry - help item only one} {
566 .m1 add cascade -label Help -menu .m1.help
567 menu .m1.help -tearoff 0
568 . configure -menu .m1
570 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
573 test unixMenu-20.1 {DrawTearoffEntry - menubar} {
576 .m1 add cascade -label File
577 . configure -menu .m1
578 list [catch {update} msg] $msg [. configure -menu ""] [destroy .m1]
580 test unixMenu-20.2 {DrawTearoffEntry - non-menubar} {
583 .m1 add command -label foo
585 list [catch {update} msg] $msg [destroy .m1]
588 test unixMenu-21.1 {TkpInitializeMenuBindings - nothing to do} {} {}
590 test unixMenu-22.1 {SetHelpMenu - no menubars} {
593 .m1 add cascade -label test -menu .m1.test
594 list [catch {menu .m1.test} msg] $msg [destroy .m1]
596 # Don't know how to automate missing tkwins
597 test unixMenu-22.2 {SetHelpMenu - menubar but no help menu} {
600 . configure -menu .m1
601 .m1 add cascade -label .m1.file
602 list [catch {menu .m1.file} msg] $msg [. configure -menu ""] [destroy .m1]
604 test unixMenu-22.3 {SetHelpMenu - menubar with help menu} {
607 . configure -menu .m1
608 .m1 add cascade -label .m1.help
609 list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1]
611 test unixMenu-22.4 {SetHelpMenu - multiple menubars with same help menu} {
615 wm geometry .t2 +40+40
617 . configure -menu .m1
618 .t2 configure -menu .m1
619 .m1 add cascade -label .m1.help
620 list [catch {menu .m1.help} msg] $msg [. configure -menu ""] [destroy .m1] [destroy .t2]
621 } {0 .m1.help {} {} {}}
623 test unixMenu-23.1 {TkpDrawMenuEntry - gc for active and not strict motif} {
626 .m1 add command -label foo
627 set tearoff [tkTearOffMenu .m1 40 40]
628 .m1 entryconfigure 1 -state active
629 list [update] [destroy .m1]
631 test unixMenu-23.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} {
634 .m1 add command -label foo -activeforeground red
635 set tearoff [tkTearOffMenu .m1 40 40]
636 .m1 entryconfigure 1 -state active
637 list [update] [destroy .m1]
639 test unixMenu-23.3 {TkpDrawMenuEntry - gc for active and strict motif} {
643 .m1 add command -label foo
644 set tearoff [tkTearOffMenu .m1 40 40]
645 .m1 entryconfigure 1 -state active
646 list [update] [destroy .m1] [set tk_strictMotif 0]
648 test unixMenu-23.4 {TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} {
650 menu .m1 -disabledforeground blue
651 .m1 add command -label foo -state disabled -background red
652 set tearoff [tkTearOffMenu .m1 40 40]
653 list [update] [destroy .m1]
655 test unixMenu-23.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} {
657 menu .m1 -disabledforeground blue
658 .m1 add command -label foo -state disabled
659 set tearoff [tkTearOffMenu .m1 40 40]
660 list [update] [destroy .m1]
662 test unixMenu-23.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} {
664 menu .m1 -disabledforeground ""
665 .m1 add command -label foo -state disabled
666 set tearoff [tkTearOffMenu .m1 40 40]
667 list [update] [destroy .m1]
669 test unixMenu-23.7 {TkpDrawMenuEntry - gc for normal - custom entry} {
672 .m1 add command -label foo -foreground red
673 set tearoff [tkTearOffMenu .m1 40 40]
674 list [update] [destroy .m1]
676 test unixMenu-23.8 {TkpDrawMenuEntry - gc for normal} {
679 .m1 add command -label foo
680 set tearoff [tkTearOffMenu .m1 40 40]
681 list [update] [destroy .m1]
683 test unixMenu-23.9 {TkpDrawMenuEntry - gc for indicator - custom entry} {
686 .m1 add checkbutton -label foo -selectcolor orange
688 set tearoff [tkTearOffMenu .m1 40 40]
689 list [update] [destroy .m1]
691 test unixMenu-23.10 {TkpDrawMenuEntry - gc for indicator} {
694 .m1 add checkbutton -label foo
696 set tearoff [tkTearOffMenu .m1 40 40]
697 list [update] [destroy .m1]
699 test unixMenu-23.11 {TkpDrawMenuEntry - border - custom entry} {
702 .m1 add command -label foo -activebackground green
703 set tearoff [tkTearOffMenu .m1 40 40]
704 .m1 entryconfigure 1 -state active
705 list [update] [destroy .m1]
707 test unixMenu-23.12 {TkpDrawMenuEntry - border} {
710 .m1 add command -label foo
711 set tearoff [tkTearOffMenu .m1 40 40]
712 .m1 entryconfigure 1 -state active
713 list [update] [destroy .m1]
715 test unixMenu-23.13 {TkpDrawMenuEntry - active border - strict motif} {
719 .m1 add command -label foo
720 set tearoff [tkTearOffMenu .m1 40 40]
721 .m1 entryconfigure 1 -state active
722 list [update] [destroy .m1] [set tk_strictMotif 0]
724 test unixMenu-23.14 {TkpDrawMenuEntry - active border - custom entry} {
727 .m1 add command -label foo -activeforeground yellow
728 set tearoff [tkTearOffMenu .m1 40 40]
729 .m1 entryconfigure 1 -state active
730 list [update] [destroy .m1]
732 test unixMenu-23.15 {TkpDrawMenuEntry - active border} {
735 .m1 add command -label foo
736 set tearoff [tkTearOffMenu .m1 40 40]
737 .m1 entryconfigure 1 -state active
738 list [update] [destroy .m1]
740 test unixMenu-23.16 {TkpDrawMenuEntry - font - custom entry} {
743 .m1 add command -label foo -font "Helvectica 72"
744 set tearoff [tkTearOffMenu .m1 40 40]
745 list [update] [destroy .m1]
747 test unixMenu-23.17 {TkpDrawMenuEntry - font} {
749 menu .m1 -font "Courier 72"
750 .m1 add command -label foo
751 set tearoff [tkTearOffMenu .m1 40 40]
752 list [update] [destroy .m1]
754 test unixMenu-23.18 {TkpDrawMenuEntry - separator} {
758 set tearoff [tkTearOffMenu .m1 40 40]
759 list [update] [destroy .m1]
761 test unixMenu-23.19 {TkpDrawMenuEntry - standard} {
764 .m1 add command -label foo
765 set tearoff [tkTearOffMenu .m1 40 40]
766 list [update] [destroy .m1]
768 test unixMenu-23.20 {TkpDrawMenuEntry - disabled cascade item} {
771 .m1 add cascade -label File -menu .m1.file
773 .m1.file add command -label foo
774 .m1 entryconfigure File -state disabled
775 set tearoff [tkTearOffMenu .m1 40 40]
776 list [update] [destroy .m1]
778 test unixMenu-23.21 {TkpDrawMenuEntry - indicator} {
781 .m1 add checkbutton -label Foo
783 set tearoff [tkTearOffMenu .m1 40 40]
784 list [update] [destroy .m1]
786 test unixMenu-23.22 {TkpDrawMenuEntry - hide margin} {
789 .m1 add checkbutton -label Foo -hidemargin 1
791 set tearoff [tkTearOffMenu .m1 40 40]
792 list [update] [destroy .m1]
795 test unixMenu-24.1 {GetMenuLabelGeometry - image} {
797 catch {image delete image1}
799 image create test image1
800 .m1 add command -image image1
801 list [update idletasks] [destroy .m1] [image delete image1]
803 test unixMenu-24.2 {GetMenuLabelGeometry - bitmap} {
806 .m1 add command -bitmap questhead
807 list [update idletasks] [destroy .m1]
809 test unixMenu-24.3 {GetMenuLabelGeometry - no text} {
813 list [update idletasks] [destroy .m1]
815 test unixMenu-24.4 {GetMenuLabelGeometry - text} {
818 .m1 add command -label "This is a test."
819 list [update idletasks] [destroy .m1]
822 test unixMenu-25.1 {TkpComputeStandardMenuGeometry - no entries} {
825 list [update idletasks] [destroy .m1]
827 test unixMenu-25.2 {TkpComputeStandardMenuGeometry - one entry} {
830 .m1 add command -label "one"
831 list [update idletasks] [destroy .m1]
833 test unixMenu-25.3 {TkpComputeStandardMenuGeometry - more than one entry} {
836 .m1 add command -label "one"
837 .m1 add command -label "two"
838 list [update idletasks] [destroy .m1]
840 test unixMenu-25.4 {TkpComputeStandardMenuGeometry - separator} {
844 list [update idletasks] [destroy .m1]
846 test unixMenu-25.5 {TkpComputeStandardMenuGeometry - tearoff entry} {unixOnly} {
848 menubutton .mb -text "test" -menu .mb.m
850 .mb.m add command -label test
853 list [update] [tkMenuUnpost .mb.m] [destroy .mb]
855 test unixMenu-25.6 {TkpComputeStandardMenuGeometry - standard label geometry} {
858 .m1 add command -label "test"
859 list [update idletasks] [destroy .m1]
861 test unixMenu-25.7 {TkpComputeStandardMenuGeometry - different font for entry} {
863 menu .m1 -font "Helvetica 12"
864 .m1 add command -label "test" -font "Courier 12"
865 list [update idletasks] [destroy .m1]
867 test unixMenu-25.8 {TkpComputeStandardMenuGeometry - second entry larger} {
870 .m1 add command -label "test"
871 .m1 add command -label "test test"
872 list [update idletasks] [destroy .m1]
874 test unixMenu-25.9 {TkpComputeStandardMenuGeometry - first entry larger} {
877 .m1 add command -label "test test"
878 .m1 add command -label "test"
879 list [update idletasks] [destroy .m1]
881 test unixMenu-25.10 {TkpComputeStandardMenuGeometry - accelerator} {
884 .m1 add command -label "test" -accel "Ctrl+S"
885 list [update idletasks] [destroy .m1]
887 test unixMenu-25.11 {TkpComputeStandardMenuGeometry - second accel larger} {
890 .m1 add command -label "test" -accel "1"
891 .m1 add command -label "test" -accel "1 1"
892 list [update idletasks] [destroy .m1]
894 test unixMenu-25.12 {TkpComputeStandardMenuGeometry - second accel smaller} {
897 .m1 add command -label "test" -accel "1 1"
898 .m1 add command -label "test" -accel "1"
899 list [update idletasks] [destroy .m1]
901 test unixMenu-25.13 {TkpComputeStandardMenuGeometry - indicator} {
904 .m1 add checkbutton -label test
906 list [update idletasks] [destroy .m1]
908 test unixMenu-25.14 {TkpComputeStandardMenuGeometry - second indicator less or equal } {
910 catch {image delete image1}
911 image create test image1
913 .m1 add checkbutton -image image1
915 .m1 add checkbutton -label test
917 list [update idletasks] [destroy .m1] [image delete image1]
919 test unixMenu-25.15 {TkpComputeStandardMenuGeometry - second indicator larger } {unixOnly} {
921 catch {image delete image1}
922 image create test image1
924 .m1 add checkbutton -image image1
926 .m1 add checkbutton -label test
928 list [update idletasks] [destroy .m1] [image delete image1]
930 test unixMenu-25.16 {TkpComputeStandardMenuGeometry - zero sized menus} {
933 list [update idletasks] [destroy .m1]
935 test unixMenu-25.17 {TkpComputeStandardMenuGeometry - first column bigger} {
938 .m1 add command -label one
939 .m1 add command -label two
940 .m1 add command -label three -columnbreak 1
941 list [update idletasks] [destroy .m1]
943 test unixMenu-25.18 {TkpComputeStandardMenuGeometry - second column bigger} {
946 .m1 add command -label one
947 .m1 add command -label two -columnbreak 1
948 .m1 add command -label three
949 list [update idletasks] [destroy .m1]
951 test unixMenu-25.19 {TkpComputeStandardMenuGeometry - three columns} {
954 .m1 add command -label one
955 .m1 add command -label two -columnbreak 1
956 .m1 add command -label three
957 .m1 add command -label four
958 .m1 add command -label five -columnbreak 1
959 .m1 add command -label six
960 list [update idletasks] [destroy .m1]
962 test unixMenu-25.20 {TkpComputeStandardMenuGeometry - hide margin} {
965 .m1 add checkbutton -label one -hidemargin 1
966 list [update idletasks] [destroy .m1]
969 test unixMenu-26.1 {TkpMenuInit - nothing to do} {} {}
973 ::tcltest::cleanupTests