changeset 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 fb5955171b0b
children a33ec41d0340
files scripts/plot/allchild.m scripts/plot/findall.m scripts/plot/graphics_toolkit.m scripts/plot/uimenu.m
diffstat 4 files changed, 39 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/allchild.m	Fri Dec 02 14:22:33 2011 -0800
+++ b/scripts/plot/allchild.m	Fri Dec 02 14:48:45 2011 -0800
@@ -35,25 +35,23 @@
   shh = get (0, "showhiddenhandles");
   unwind_protect
     set (0, "showhiddenhandles", "on");
-    if (isscalar (handles))
-      h = get (handles, "children");
-    else
-      h = cell (size (handles));
-      for i = 1:numel (handles)
-        h{i} = get (handles, "children");
-      endfor
-    endif
+    h = get (handles, "children");
   unwind_protect_cleanup
     set (0, "showhiddenhandles", shh);
   end_unwind_protect
 
 endfunction
 
-%!test
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("fltk");
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   l = line;
-%!   assert(get(allchild(hf),'type'),{'axes'; 'uimenu'; 'uimenu'; 'uimenu'})
+%!   assert(get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"});
 %! unwind_protect_cleanup
 %!   close (hf);
+%!   graphics_toolkit (toolkit);
 %! end_unwind_protect
+
--- a/scripts/plot/findall.m	Fri Dec 02 14:22:33 2011 -0800
+++ b/scripts/plot/findall.m	Fri Dec 02 14:48:45 2011 -0800
@@ -43,12 +43,18 @@
 
 endfunction
 
-%!test
+
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("fltk");
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   h = findall (hf);
-%!   all_handles = {"uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "figure"};
-%!   assert (get (h, 'type'), all_handles)
+%!   all_handles(1:13,1) = {"uimenu"};
+%!   all_handles(14) = {"figure"};
+%!   assert (get (h, "type"), all_handles);
 %! unwind_protect_cleanup
 %!   close (hf);
+%!   graphics_toolkit (toolkit);
 %! end_unwind_protect
+
--- a/scripts/plot/graphics_toolkit.m	Fri Dec 02 14:22:33 2011 -0800
+++ b/scripts/plot/graphics_toolkit.m	Fri Dec 02 14:48:45 2011 -0800
@@ -18,7 +18,7 @@
 
 ## -*- texinfo -*-
 ## @deftypefn  {Function File} {@var{name} =} graphics_toolkit ()
-## @deftypefn  {Function File} {@var{old_name} =} graphics_toolkit (@var{name})
+## @deftypefnx {Function File} {@var{old_name} =} graphics_toolkit (@var{name})
 ## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name})
 ## Query or set the default graphics toolkit to @var{name}.  If the
 ## toolkit is not already loaded, it is first initialized by calling the
--- a/scripts/plot/uimenu.m	Fri Dec 02 14:22:33 2011 -0800
+++ b/scripts/plot/uimenu.m	Fri Dec 02 14:48:45 2011 -0800
@@ -89,16 +89,19 @@
 
 endfunction
 
+
 %!demo
-%! surfl(peaks);
-%! colormap(copper);
-%! shading("interp");
-%! f = uimenu("label", "&File", "accelerator", "f");
-%! e = uimenu("label", "&Edit", "accelerator", "e");
-%! uimenu(f, "label", "Close", "accelerator", "q", "callback", "close (gcf)");
-%! uimenu(e, "label", "Toggle &Grid", "accelerator", "g", "callback", "grid (gca)");
+%! surfl (peaks);
+%! colormap (copper);
+%! shading ("interp");
+%! f = uimenu ("label", "&File", "accelerator", "f");
+%! e = uimenu ("label", "&Edit", "accelerator", "e");
+%! uimenu (f, "label", "Close", "accelerator", "q", "callback", "close (gcf)");
+%! uimenu (e, "label", "Toggle &Grid", "accelerator", "g", "callback", "grid (gca)");
 
-%!test
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("fltk");
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   ui = uimenu ("label", "mylabel");
@@ -110,10 +113,13 @@
 %!   assert (get (ui, "position"), 9);
 %! unwind_protect_cleanup
 %!   close (hf);
+%!   graphics_toolkit (toolkit);
 %! end_unwind_protect
 
 %% check for top level menus file, edit, and help
-%!test
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("fltk");
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   uif = findall (hf, "label", "&file");
@@ -124,9 +130,12 @@
 %!   assert (ishghandle (uih))
 %! unwind_protect_cleanup
 %!   close (hf);
+%!   graphics_toolkit (toolkit);
 %! end_unwind_protect
 
-%!test
+%!testif HAVE_FLTK
+%! toolkit = graphics_toolkit ();
+%! graphics_toolkit ("fltk");
 %! hf = figure ("visible", "off");
 %! unwind_protect
 %!   uie = findall (hf, "label", "&edit");
@@ -134,4 +143,6 @@
 %!   assert (ancestor (myui, "uimenu", "toplevel"), uie)
 %! unwind_protect_cleanup
 %!   close (hf);
+%!   graphics_toolkit (toolkit);
 %! end_unwind_protect
+