comparison scripts/plot/uimenu.m @ 13977:08ae07e40d4f

Only run uimenu tests if FLTK toolkit is available (Bug #34908) * graphics_toolkit.m: Correct @deftypefn to @deftypefnx for Texinfo to build * allchild.m: Eliminate unnecessary for loop. Only run test if FLTK toolkit is available. * findall.m, uimenu.m: Only run test if FLTK toolkit is available.
author Rik <octave@nomad.inbox5.com>
date Fri, 02 Dec 2011 14:48:45 -0800
parents 22ce748da25f
children 22c50cbad2ce
comparison
equal deleted inserted replaced
13976:fb5955171b0b 13977:08ae07e40d4f
87 hui = tmp; 87 hui = tmp;
88 endif 88 endif
89 89
90 endfunction 90 endfunction
91 91
92
92 %!demo 93 %!demo
93 %! surfl(peaks); 94 %! surfl (peaks);
94 %! colormap(copper); 95 %! colormap (copper);
95 %! shading("interp"); 96 %! shading ("interp");
96 %! f = uimenu("label", "&File", "accelerator", "f"); 97 %! f = uimenu ("label", "&File", "accelerator", "f");
97 %! e = uimenu("label", "&Edit", "accelerator", "e"); 98 %! e = uimenu ("label", "&Edit", "accelerator", "e");
98 %! uimenu(f, "label", "Close", "accelerator", "q", "callback", "close (gcf)"); 99 %! uimenu (f, "label", "Close", "accelerator", "q", "callback", "close (gcf)");
99 %! uimenu(e, "label", "Toggle &Grid", "accelerator", "g", "callback", "grid (gca)"); 100 %! uimenu (e, "label", "Toggle &Grid", "accelerator", "g", "callback", "grid (gca)");
100 101
101 %!test 102 %!testif HAVE_FLTK
103 %! toolkit = graphics_toolkit ();
104 %! graphics_toolkit ("fltk");
102 %! hf = figure ("visible", "off"); 105 %! hf = figure ("visible", "off");
103 %! unwind_protect 106 %! unwind_protect
104 %! ui = uimenu ("label", "mylabel"); 107 %! ui = uimenu ("label", "mylabel");
105 %! assert (findobj (hf, "type", "uimenu"), ui); 108 %! assert (findobj (hf, "type", "uimenu"), ui);
106 %! assert (get (ui, "label"), "mylabel"); 109 %! assert (get (ui, "label"), "mylabel");
108 %! assert (get (ui, "separator"), "off"); 111 %! assert (get (ui, "separator"), "off");
109 %! assert (get (ui, "enable"), "on"); 112 %! assert (get (ui, "enable"), "on");
110 %! assert (get (ui, "position"), 9); 113 %! assert (get (ui, "position"), 9);
111 %! unwind_protect_cleanup 114 %! unwind_protect_cleanup
112 %! close (hf); 115 %! close (hf);
116 %! graphics_toolkit (toolkit);
113 %! end_unwind_protect 117 %! end_unwind_protect
114 118
115 %% check for top level menus file, edit, and help 119 %% check for top level menus file, edit, and help
116 %!test 120 %!testif HAVE_FLTK
121 %! toolkit = graphics_toolkit ();
122 %! graphics_toolkit ("fltk");
117 %! hf = figure ("visible", "off"); 123 %! hf = figure ("visible", "off");
118 %! unwind_protect 124 %! unwind_protect
119 %! uif = findall (hf, "label", "&file"); 125 %! uif = findall (hf, "label", "&file");
120 %! assert (ishghandle (uif)) 126 %! assert (ishghandle (uif))
121 %! uie = findall (hf, "label", "&edit"); 127 %! uie = findall (hf, "label", "&edit");
122 %! assert (ishghandle (uie)) 128 %! assert (ishghandle (uie))
123 %! uih = findall (hf, "label", "&help"); 129 %! uih = findall (hf, "label", "&help");
124 %! assert (ishghandle (uih)) 130 %! assert (ishghandle (uih))
125 %! unwind_protect_cleanup 131 %! unwind_protect_cleanup
126 %! close (hf); 132 %! close (hf);
133 %! graphics_toolkit (toolkit);
127 %! end_unwind_protect 134 %! end_unwind_protect
128 135
129 %!test 136 %!testif HAVE_FLTK
137 %! toolkit = graphics_toolkit ();
138 %! graphics_toolkit ("fltk");
130 %! hf = figure ("visible", "off"); 139 %! hf = figure ("visible", "off");
131 %! unwind_protect 140 %! unwind_protect
132 %! uie = findall (hf, "label", "&edit"); 141 %! uie = findall (hf, "label", "&edit");
133 %! myui = uimenu (uie, "label", "mylabel"); 142 %! myui = uimenu (uie, "label", "mylabel");
134 %! assert (ancestor (myui, "uimenu", "toplevel"), uie) 143 %! assert (ancestor (myui, "uimenu", "toplevel"), uie)
135 %! unwind_protect_cleanup 144 %! unwind_protect_cleanup
136 %! close (hf); 145 %! close (hf);
146 %! graphics_toolkit (toolkit);
137 %! end_unwind_protect 147 %! end_unwind_protect
148