Mercurial > hg > octave-lyh
comparison scripts/plot/uimenu.m @ 17111:dbd64c9a16da
Restore graphics toolkit after %!tests that alter it.
* scripts/plot/allchild.m, scripts/plot/findall.m, scripts/plot/findobj.m,
scripts/plot/graphics_toolkit.m, scripts/plot/legend.m, scripts/plot/uimenu.m:
Restore graphics toolkit after %!tests that alter it.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 29 Jul 2013 12:23:10 -0700 |
parents | ce2b59a6d0e5 |
children | bd50e0660545 |
comparison
equal
deleted
inserted
replaced
17110:054905bfc306 | 17111:dbd64c9a16da |
---|---|
99 %! e = uimenu ('label', '&Edit', 'accelerator', 'e'); | 99 %! e = uimenu ('label', '&Edit', 'accelerator', 'e'); |
100 %! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)'); | 100 %! uimenu (f, 'label', 'Close', 'accelerator', 'q', 'callback', 'close (gcf)'); |
101 %! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)'); | 101 %! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)'); |
102 | 102 |
103 %!testif HAVE_FLTK | 103 %!testif HAVE_FLTK |
104 %! toolkit = graphics_toolkit (); | 104 %! toolkit = graphics_toolkit ("fltk"); |
105 %! graphics_toolkit ("fltk"); | 105 %! hf = figure ("visible", "off") |
106 %! hf = figure ("visible", "off"); | |
107 %! unwind_protect | 106 %! unwind_protect |
108 %! ui = uimenu ("label", "mylabel"); | 107 %! ui = uimenu ("label", "mylabel"); |
109 %! assert (findobj (hf, "type", "uimenu"), ui); | 108 %! assert (findobj (hf, "type", "uimenu"), ui); |
110 %! assert (get (ui, "label"), "mylabel"); | 109 %! assert (get (ui, "label"), "mylabel"); |
111 %! assert (get (ui, "checked"), "off"); | 110 %! assert (get (ui, "checked"), "off"); |
117 %! graphics_toolkit (toolkit); | 116 %! graphics_toolkit (toolkit); |
118 %! end_unwind_protect | 117 %! end_unwind_protect |
119 | 118 |
120 %% check for top level menus file, edit, and help | 119 %% check for top level menus file, edit, and help |
121 %!testif HAVE_FLTK | 120 %!testif HAVE_FLTK |
122 %! toolkit = graphics_toolkit (); | 121 %! toolkit = graphics_toolkit ("fltk"); |
123 %! graphics_toolkit ("fltk"); | 122 %! hf = figure ("visible", "off") |
124 %! hf = figure ("visible", "off"); | |
125 %! unwind_protect | 123 %! unwind_protect |
126 %! uif = findall (hf, "label", "&file"); | 124 %! uif = findall (hf, "label", "&file"); |
127 %! assert (ishghandle (uif)); | 125 %! assert (ishghandle (uif)); |
128 %! uie = findall (hf, "label", "&edit"); | 126 %! uie = findall (hf, "label", "&edit"); |
129 %! assert (ishghandle (uie)); | 127 %! assert (ishghandle (uie)); |
133 %! close (hf); | 131 %! close (hf); |
134 %! graphics_toolkit (toolkit); | 132 %! graphics_toolkit (toolkit); |
135 %! end_unwind_protect | 133 %! end_unwind_protect |
136 | 134 |
137 %!testif HAVE_FLTK | 135 %!testif HAVE_FLTK |
138 %! toolkit = graphics_toolkit (); | 136 %! toolkit = graphics_toolkit ("fltk"); |
139 %! graphics_toolkit ("fltk"); | 137 %! hf = figure ("visible", "off") |
140 %! hf = figure ("visible", "off"); | |
141 %! unwind_protect | 138 %! unwind_protect |
142 %! uie = findall (hf, "label", "&edit"); | 139 %! uie = findall (hf, "label", "&edit"); |
143 %! myui = uimenu (uie, "label", "mylabel"); | 140 %! myui = uimenu (uie, "label", "mylabel"); |
144 %! assert (ancestor (myui, "uimenu", "toplevel"), uie); | 141 %! assert (ancestor (myui, "uimenu", "toplevel"), uie); |
145 %! unwind_protect_cleanup | 142 %! unwind_protect_cleanup |