Mercurial > hg > octave-shane
changeset 13111:ebb42fb2da04
Various fixes for tests in scripts/plot
plot/cla.m: Use figure number 1232.
plot/clf.m: Split test into two.
plot/findall.m: Check only for graphic objects in figure 1232.
plot/findall.m: Ditto.
plot/gcf.m: Simplify test.
plot/line.m: Check against default values now.
plot/whitebg.m: Restore default values after tests.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Wed, 07 Sep 2011 20:13:18 +0200 |
parents | 2d5035847529 |
children | 969ed305dde5 |
files | scripts/plot/cla.m scripts/plot/clf.m scripts/plot/findall.m scripts/plot/findobj.m scripts/plot/gcf.m scripts/plot/line.m scripts/plot/whitebg.m |
diffstat | 7 files changed, 23 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/cla.m +++ b/scripts/plot/cla.m @@ -90,9 +90,8 @@ endfunction %!test -%! hf = figure (1, "visible", "off"); -%! unwind_protect -%! clf +%! hf = figure (1232, "visible", "off"); +%! unwind_protect %! plot (1:10) %! cla () %! kids = get (gca, "children");
--- a/scripts/plot/clf.m +++ b/scripts/plot/clf.m @@ -81,6 +81,13 @@ %! unwind_protect %! l = line; %! assert (!isempty (get (gcf, "children"))); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test +%! hf = figure (1232, "visible", "off"); +%! unwind_protect %! clf; %! assert (isempty (get (gcf, "children"))); %! unwind_protect_cleanup
--- a/scripts/plot/findall.m +++ b/scripts/plot/findall.m @@ -46,8 +46,8 @@ %!test %! hf = figure (1232, "visible", "off"); %! unwind_protect -%! h = findall; -%! all_handles = {"uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "uimenu"; "root"; "figure"}; +%! 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) %! unwind_protect_cleanup %! close (hf);
--- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -248,12 +248,11 @@ %! hf = figure (fign, "visible", "off"); %! unwind_protect %! l = line; -%! obj = findobj ("type", "line"); +%! obj = findobj (hf, "type", "line"); %! assert (l, obj); -%! assert (gca, findobj ("type", "axes")); -%! assert (fign, findobj ("type", "figure")); -%! assert (0, findobj ("type", "root")); -%! assert (isempty (findobj ("type", "xyzxyz"))); +%! assert (gca, findobj (hf, "type", "axes")); +%! assert (fign, findobj (hf, "type", "figure")); +%! assert (isempty (findobj (hf, "type", "xyzxyz"))); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/gcf.m +++ b/scripts/plot/gcf.m @@ -57,9 +57,7 @@ %!test %! hf = figure (1232, "visible", "off"); %! unwind_protect -%! line; -%! clf; -%! assert (isempty (get (gcf, "children"))); +%! assert (gcf, 1232); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/line.m +++ b/scripts/plot/line.m @@ -50,9 +50,9 @@ %! assert (get (h, "xdata"), [0 1], eps); %! assert (get (h, "ydata"), [0 1], eps); %! assert (get (h, "type"), "line"); -%! assert (get (h, "color"), [0 0 0]); -%! assert (get (h, "linestyle"), "-"); -%! assert (get (h, "linewidth"), 0.5, eps); +%! assert (get (h, "color"), get(0,'defaultlinecolor')); +%! assert (get (h, "linestyle"), get(0,'defaultlinelinestyle')); +%! assert (get (h, "linewidth"), get(0,'defaultlinelinewidth'), eps); %! unwind_protect_cleanup %! close (hf); %! end_unwind_protect
--- a/scripts/plot/whitebg.m +++ b/scripts/plot/whitebg.m @@ -145,6 +145,8 @@ endfunction %!test +%! dac = get (0, "defaultaxescolor"); +%! dfc = get (0, "defaultfigurecolor"); %! set (0, "defaultaxescolor", [1 1 1]); %! set (0, "defaultfigurecolor", [1 1 1]); %! hf = figure (1232, "visible", "off"); @@ -160,4 +162,6 @@ %! assert (get (gca, "color"), [0.2 0.2 0.2]); %! unwind_protect_cleanup %! close (hf); +%! set (0, "defaultaxescolor", dac); +%! set (0, "defaultfigurecolor", dfc); %! end_unwind_protect