Mercurial > octave
changeset 30362:512f3d68bb49 stable
print: Use clearer error message on invalid input (bug #61557).
* scripts/plot/util/private/__print_parse_opts__.m: Use clearer error message
on invalid input.
* scripts/plot/util/print.m: Add BIST.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 25 Nov 2021 15:05:26 +0100 |
parents | 157180e55070 |
children | 1b14241560fa ff5ceee2de29 |
files | scripts/plot/util/print.m scripts/plot/util/private/__print_parse_opts__.m |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/print.m Thu Nov 25 15:03:10 2021 +0100 +++ b/scripts/plot/util/print.m Thu Nov 25 15:05:26 2021 +0100 @@ -808,6 +808,18 @@ endfunction +%!error <a graphics handle> +%! hf = figure ("visible", "off"); +%! unwind_protect +%! x = 0:0.1:1; +%! y1 = x; +%! y2 = 2*x; +%! ax = plotyy (x, y1, x, y2); +%! saveas (ax, [tempname(), ".png"]); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + function cmd = epstool (opts, filein, fileout) ## As epstool does not work with pipes, a subshell is used to ## permit piping. Since this solution does not work with the DOS
--- a/scripts/plot/util/private/__print_parse_opts__.m Thu Nov 25 15:03:10 2021 +0100 +++ b/scripts/plot/util/private/__print_parse_opts__.m Thu Nov 25 15:05:26 2021 +0100 @@ -89,6 +89,9 @@ endif for i = 1:numel (varargin) + if (! ischar (varargin{i}) && ! iscellstr (varargin{i})) + error ("print: input arguments must be a graphics handle or strings."); + endif arg = strtrim (varargin{i}); if (ischar (arg)) if (isempty (arg))