diff scripts/plot/contour.m @ 16911:5ea6a6d2b83f

Fix contour() listeners. scripts/plot/contour.m: Add tests. scripts/plot/private/__contour__.m: Modify update_data() to set the mode for levellist and levelstep. When levelstep is manually changed, set the corrsponding levellist, but keep the levellistmode set to "auto". Fix recursion.
author Ben Abbott <bpabbott@mac.com>
date Sat, 06 Jul 2013 14:17:30 -0400
parents 64e7bb01fce2
children 9ff7d4849f03
line wrap: on
line diff
--- a/scripts/plot/contour.m
+++ b/scripts/plot/contour.m
@@ -94,3 +94,33 @@
 %! contourf (x, y, z, [0.4, 0.4]);
 %! title ('The hole should be filled with the background color');
 
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levellist = (-6):6;
+%!   set (h, "levellist", levellist);
+%!   assert (get (h, "levellist"), levellist)
+%!   assert (get (h, "levellistmode"), "manual")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+
+%!test
+%! hf = figure ("visible", "off");
+%! clf (hf);
+%! unwind_protect
+%!   [x, y, z] = peaks ();
+%!   [c, h] = contour (x, y, z);
+%!   levelstep = 3;
+%!   set (h, "levelstep", levelstep);
+%!   assert (get (h, "levelstep"), levelstep)
+%!   assert (get (h, "levelstepmode"), "manual")
+%!   assert (get (h, "levellist"), (-6):levelstep:6)
+%!   assert (get (h, "levellistmode"), "auto")
+%! unwind_protect_cleanup
+%!   close (hf);
+%! end_unwind_protect
+