Mercurial > hg > octave-shane
changeset 13124:2ea1658ad049
Don't use explicit figure number for tests to avoid interference with any figures opened by user.
(plot/allchild.m, plot/ancestor.m, plot/cla.m, plot/clf.m, plot/close.m,
plot/findall.m, plot/findobj.m, plot/gca.m, plot/gcf.m, plot/hggroup.m,
plot/isfigure.m, plot/line.m, plot/loglog.m, plot/patch.m, plot/semilogx.m,
plot/semilogy.m, plot/surface.m, plot/view.m, plot/whitebg.m, plot/xlim.m,
plot/ylim.m, plot/zlim.m): Don't use explicit figure numer 1232 any more.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Sun, 11 Sep 2011 18:48:06 +0200 |
parents | 6efa1a691713 |
children | e39c76eb5fbd |
files | scripts/plot/allchild.m scripts/plot/ancestor.m scripts/plot/cla.m scripts/plot/clf.m scripts/plot/close.m scripts/plot/findall.m scripts/plot/findobj.m scripts/plot/gca.m scripts/plot/gcf.m scripts/plot/hggroup.m scripts/plot/isfigure.m scripts/plot/line.m scripts/plot/loglog.m scripts/plot/patch.m scripts/plot/semilogx.m scripts/plot/semilogy.m scripts/plot/surface.m scripts/plot/view.m scripts/plot/whitebg.m scripts/plot/xlim.m scripts/plot/ylim.m scripts/plot/zlim.m |
diffstat | 22 files changed, 37 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/allchild.m +++ b/scripts/plot/allchild.m @@ -50,7 +50,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! l = line; %! assert(get(allchild(hf),'type'),{'axes'; 'uimenu'; 'uimenu'; 'uimenu'})
--- a/scripts/plot/ancestor.m +++ b/scripts/plot/ancestor.m @@ -76,7 +76,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! l = line; %! assert (ancestor (l, "axes"), gca);
--- a/scripts/plot/cla.m +++ b/scripts/plot/cla.m @@ -90,7 +90,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! plot (1:10) %! cla ()
--- a/scripts/plot/clf.m +++ b/scripts/plot/clf.m @@ -77,7 +77,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! l = line; %! assert (!isempty (get (gcf, "children"))); @@ -86,7 +86,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! clf; %! assert (isempty (get (gcf, "children")));
--- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -81,13 +81,13 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect -%! close (1232); +%! close (hf); %! objs = findobj ("type", "figure"); -%! assert (isempty (intersect (objs, 1232))); +%! assert (isempty (intersect (objs, hf))); %! unwind_protect_cleanup -%! if (isfigure (1232)) +%! if (isfigure (hf)) %! close (hf); %! endif %! end_unwind_protect
--- a/scripts/plot/findall.m +++ b/scripts/plot/findall.m @@ -44,7 +44,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! 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"};
--- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -244,14 +244,13 @@ endfunction %!test -%! fign = 1232; -%! hf = figure (fign, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! l = line; %! obj = findobj (hf, "type", "line"); %! assert (l, obj); %! assert (gca, findobj (hf, "type", "axes")); -%! assert (fign, findobj (hf, "type", "figure")); +%! assert (hf, findobj (hf, "type", "figure")); %! assert (isempty (findobj (hf, "type", "xyzxyz"))); %! unwind_protect_cleanup %! close (hf);
--- a/scripts/plot/gca.m +++ b/scripts/plot/gca.m @@ -51,7 +51,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! ax = axes; %! unwind_protect %! assert (gca, ax);
--- a/scripts/plot/gcf.m +++ b/scripts/plot/gcf.m @@ -55,9 +55,9 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect -%! assert (gcf, 1232); +%! assert (gcf, hf); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/hggroup.m +++ b/scripts/plot/hggroup.m @@ -43,7 +43,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! h = hggroup; %! assert (findobj (hf, "type", "hggroup"), h);
--- a/scripts/plot/isfigure.m +++ b/scripts/plot/isfigure.m @@ -36,10 +36,10 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect -%! assert (isfigure (1232)); -%! assert (!isfigure (-1232)); +%! assert (isfigure (hf)); +%! assert (!isfigure (-hf)); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/line.m +++ b/scripts/plot/line.m @@ -44,7 +44,7 @@ endfunction %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! h = line; %! assert (findobj (hf, "type", "line"), h);
--- a/scripts/plot/loglog.m +++ b/scripts/plot/loglog.m @@ -82,7 +82,7 @@ %! xlabel ('loglog (a, abs (b))') %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b = logspace (-5, 1, 10); @@ -94,7 +94,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b =-logspace (-5, 1, 10);
--- a/scripts/plot/patch.m +++ b/scripts/plot/patch.m @@ -153,7 +153,7 @@ %! view (-37.5, 30) %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! h = patch; %! assert (findobj (hf, "type", "patch"), h);
--- a/scripts/plot/semilogx.m +++ b/scripts/plot/semilogx.m @@ -80,7 +80,7 @@ %! xlabel ('semilogx (a, abs (b))') %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b = logspace (-5, 1, 10); @@ -92,7 +92,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b =-logspace (-5, 1, 10); @@ -102,5 +102,3 @@ %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect - -
--- a/scripts/plot/semilogy.m +++ b/scripts/plot/semilogy.m @@ -81,7 +81,7 @@ %! xlabel ('semilogy (a, abs (b))') %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b = logspace (-5, 1, 10); @@ -93,7 +93,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! a = logspace (-5, 1, 10); %! b =-logspace (-5, 1, 10);
--- a/scripts/plot/surface.m +++ b/scripts/plot/surface.m @@ -164,7 +164,7 @@ ## surf.m, surfc.m, surfl.m, and pcolor.m %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! h = surface; %! assert (findobj (hf, "type", "surface"), h);
--- a/scripts/plot/view.m +++ b/scripts/plot/view.m @@ -95,8 +95,7 @@ endfunction %!test -%! fign = 1232; -%! hf = figure (fign, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! plot3 ([0,1], [0,1], [0,1]); %! [az, el] = view; @@ -112,8 +111,7 @@ %! end_unwind_protect %!test -%! fign = 1232; -%! hf = figure (fign, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! line; %! [az, el] = view;
--- a/scripts/plot/whitebg.m +++ b/scripts/plot/whitebg.m @@ -147,7 +147,7 @@ %!test %! dac = get (0, "defaultaxescolor"); %! dfc = get (0, "defaultfigurecolor"); -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! l = line; %! assert (get (hf, "color"), dfc);
--- a/scripts/plot/xlim.m +++ b/scripts/plot/xlim.m @@ -75,7 +75,7 @@ %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! plot3 ([0,1], [0,1], [0,1]); %! xlim ([0, 1.1]); @@ -86,7 +86,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! h = plot3 ([0,1.1], [0,1], [0, 1]); %! assert (get (gca, "xlim"), [0, 1.4], eps);
--- a/scripts/plot/ylim.m +++ b/scripts/plot/ylim.m @@ -74,7 +74,7 @@ %! assert (ylim ("mode"), "auto"); %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! limy = [0, 1.1]; %! plot3 ([0,1], [0,1], [0,1]); @@ -86,7 +86,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! plot3 ([0,1], [0,1.1], [0, 1]); %! assert (get (gca, "ylim"), [0, 1.4], eps);
--- a/scripts/plot/zlim.m +++ b/scripts/plot/zlim.m @@ -74,7 +74,7 @@ %! assert (zlim ("mode"), "auto"); %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! limz = [0, 1.1]; %! plot3 ([0,1], [0,1], [0,1]); @@ -86,7 +86,7 @@ %! end_unwind_protect %!test -%! hf = figure (1232, "visible", "off"); +%! hf = figure ("visible", "off"); %! unwind_protect %! plot3 ([0,1], [0,1], [0, 1.1]); %! assert (get (gca, "zlim"), [0, 1.4], eps);