Mercurial > hg > octave-lyh
changeset 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 | 054905bfc306 |
children | dda211391bf7 |
files | 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 |
diffstat | 6 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/allchild.m +++ b/scripts/plot/allchild.m @@ -44,9 +44,8 @@ %!testif HAVE_FLTK -%! toolkit = graphics_toolkit (); -%! graphics_toolkit ("fltk"); -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("fltk"); +%! hf = figure ("visible", "off") %! unwind_protect %! l = line; %! assert (get (allchild (hf),"type"),{"axes"; "uimenu"; "uimenu"; "uimenu"});
--- a/scripts/plot/findall.m +++ b/scripts/plot/findall.m @@ -45,9 +45,8 @@ %!testif HAVE_FLTK -%! toolkit = graphics_toolkit (); -%! graphics_toolkit ("fltk"); -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("fltk"); +%! hf = figure ("visible", "off") %! unwind_protect %! h = findall (hf); %! all_handles(1:13,1) = {"uimenu"};
--- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -316,8 +316,8 @@ %! assert (h2, h1) %!test -%! graphics_toolkit gnuplot; -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("gnuplot"); +%! hf = figure ("visible", "off") %! unwind_protect %! h1 = subplot (2, 2, 1); %! h2 = subplot (2, 2, 2); @@ -328,12 +328,13 @@ %! h = findobj (hf, "userdata", userdata); %! unwind_protect_cleanup %! close (hf); +%! graphics_toolkit (toolkit); %! end_unwind_protect %! assert (h, h3) %!test -%! graphics_toolkit gnuplot; -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("gnuplot"); +%! hf = figure ("visible", "off") %! unwind_protect %! h1 = subplot (2, 2, 1); %! set (h1, 'tag', '1') @@ -346,6 +347,7 @@ %! h = findobj (hf, 'type', 'axes', '-not', 'tag', '1'); %! unwind_protect_cleanup %! close (hf); +%! graphics_toolkit (toolkit); %! end_unwind_protect %! assert (h, [h2; h3; h4])
--- a/scripts/plot/graphics_toolkit.m +++ b/scripts/plot/graphics_toolkit.m @@ -90,10 +90,10 @@ %!testif HAVE_FLTK %! unwind_protect -%! hf = figure ("visible", "off"); +%! hf = figure ("visible", "off"); %! toolkit = graphics_toolkit (); %! assert (get (0, "defaultfigure__graphics_toolkit__"), toolkit); -%! graphics_toolkit (hf, "fltk"); +%! graphics_toolkit (hf, "fltk"); %! assert (graphics_toolkit (hf), "fltk"); %! unwind_protect_cleanup %! close (hf);
--- a/scripts/plot/legend.m +++ b/scripts/plot/legend.m @@ -1547,8 +1547,8 @@ %! legend (option); %!test -%! graphics_toolkit ("gnuplot"); -%! h = figure ("visible", "off", "__graphics_toolkit__", "gnuplot"); +%! toolkit = graphics_toolkit ("gnuplot"); +%! h = figure ("visible", "off") %! unwind_protect %! position = get (h, "position"); %! plot (rand (3)); @@ -1559,5 +1559,6 @@ %! assert (get (h, "position"), position); %! unwind_protect_cleanup %! close (h); +%! graphics_toolkit (toolkit); %! end_unwind_protect
--- a/scripts/plot/uimenu.m +++ b/scripts/plot/uimenu.m @@ -101,9 +101,8 @@ %! uimenu (e, 'label', 'Toggle &Grid', 'accelerator', 'g', 'callback', 'grid (gca)'); %!testif HAVE_FLTK -%! toolkit = graphics_toolkit (); -%! graphics_toolkit ("fltk"); -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("fltk"); +%! hf = figure ("visible", "off") %! unwind_protect %! ui = uimenu ("label", "mylabel"); %! assert (findobj (hf, "type", "uimenu"), ui); @@ -119,9 +118,8 @@ %% check for top level menus file, edit, and help %!testif HAVE_FLTK -%! toolkit = graphics_toolkit (); -%! graphics_toolkit ("fltk"); -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("fltk"); +%! hf = figure ("visible", "off") %! unwind_protect %! uif = findall (hf, "label", "&file"); %! assert (ishghandle (uif)); @@ -135,9 +133,8 @@ %! end_unwind_protect %!testif HAVE_FLTK -%! toolkit = graphics_toolkit (); -%! graphics_toolkit ("fltk"); -%! hf = figure ("visible", "off"); +%! toolkit = graphics_toolkit ("fltk"); +%! hf = figure ("visible", "off") %! unwind_protect %! uie = findall (hf, "label", "&edit"); %! myui = uimenu (uie, "label", "mylabel");