Mercurial > octave-nkf
diff scripts/plot/hold.m @ 13204:be7bfd59300a
Add tests for scripts/plot
(plot/figure.m, plot/ishold.m, plot/ishold.m, plot/newplot.m): Add tests.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Fri, 23 Sep 2011 22:18:05 +0200 |
parents | c792872f8942 |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/plot/hold.m Fri Sep 23 15:03:29 2011 -0400 +++ b/scripts/plot/hold.m Fri Sep 23 22:18:05 2011 +0200 @@ -139,3 +139,35 @@ %! colorbar ("SouthOutside"); %! title ("Test script for some plot functions"); +##hold on +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! p = plot ([0 1]); +%! assert (!ishold); +%! hold on; +%! assert (ishold); +%! p1 = fill ([0 1 1], [0 0 1],"black"); +%! p2 = fill ([0 1 0], [0 1 1], "red"); +%! assert (length (get (hf, "children")), 1); +%! assert (length (get (gca, "children")), 3); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +##hold off +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! p = plot ([0 1]); +%! assert (!ishold); +%! hold on; +%! assert (ishold); +%! p1 = fill ([0 1 1], [0 0 1],"black"); +%! hold off +%! p2 = fill ([0 1 0], [0 1 1], "red"); +%! assert (length (get (hf, "children")), 1); +%! assert (length (get (gca, "children")), 1); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect