Mercurial > hg > octave-lojdl
changeset 14046:c3fab3891460 stable
Trivial bug fixes for graphics_toolkit().
* graphics_toolkit.m: Do not return output when used as a command.
Respect documented syntax: OLD_NAME = graphics_toolkit (NAME).
Add tests.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Wed, 14 Dec 2011 13:39:23 -0500 |
parents | db264e617a98 |
children | 8c327d185f5f |
files | scripts/plot/graphics_toolkit.m |
diffstat | 1 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/graphics_toolkit.m +++ b/scripts/plot/graphics_toolkit.m @@ -35,8 +35,11 @@ print_usage (); endif + if (nargout > 0 || nargin == 0) + retval = get (0, "defaultfigure__graphics_toolkit__"); + endif + if (nargin == 0) - retval = get (0, "defaultfigure__graphics_toolkit__"); return; elseif (nargin == 1) if (! ischar (name)) @@ -65,10 +68,6 @@ set (hlist, "__graphics_toolkit__", name); endif - if (isargout (1)) - retval = name; - endif - endfunction @@ -83,3 +82,14 @@ %! close (hf); %! end_unwind_protect +%!testif HAVE_FLTK +%! old_toolkit = graphics_toolkit (); +%! switch old_toolkit +%! case {"gnuplot"} +%! new_toolkit = "fltk"; +%! otherwise +%! new_toolkit = "gnuplot"; +%! endswitch +%! assert (graphics_toolkit (new_toolkit), old_toolkit) +%! assert (graphics_toolkit (old_toolkit), new_toolkit) +