# HG changeset patch # User Kai Habel # Date 1315419198 -7200 # Node ID ebb42fb2da04b484ae757171aa20936beafa26bb # Parent 2d5035847529971b1ccacda5715ffd83f1ba2b27 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. diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/cla.m --- a/scripts/plot/cla.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/cla.m Wed Sep 07 20:13:18 2011 +0200 @@ -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"); diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/clf.m --- a/scripts/plot/clf.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/clf.m Wed Sep 07 20:13:18 2011 +0200 @@ -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 diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/findall.m --- a/scripts/plot/findall.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/findall.m Wed Sep 07 20:13:18 2011 +0200 @@ -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); diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/findobj.m --- a/scripts/plot/findobj.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/findobj.m Wed Sep 07 20:13:18 2011 +0200 @@ -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 diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/gcf.m --- a/scripts/plot/gcf.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/gcf.m Wed Sep 07 20:13:18 2011 +0200 @@ -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 diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/line.m --- a/scripts/plot/line.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/line.m Wed Sep 07 20:13:18 2011 +0200 @@ -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 diff -r 2d5035847529 -r ebb42fb2da04 scripts/plot/whitebg.m --- a/scripts/plot/whitebg.m Wed Sep 07 09:38:38 2011 -0400 +++ b/scripts/plot/whitebg.m Wed Sep 07 20:13:18 2011 +0200 @@ -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