# HG changeset patch # User Markus Mützel # Date 1637849126 -3600 # Node ID 512f3d68bb49e7f9aebd96dc444667fd123107a0 # Parent 157180e55070ca42a48eafae4c6ad83abaf1d088 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. diff -r 157180e55070 -r 512f3d68bb49 scripts/plot/util/print.m --- 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 +%! 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 diff -r 157180e55070 -r 512f3d68bb49 scripts/plot/util/private/__print_parse_opts__.m --- 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))