# HG changeset patch # User Nicholas R. Jankowski # Date 1714055537 14400 # Node ID c224e1a810d6e29741444c9b27c07895a4154350 # Parent 2a0cdc52220b185bc2fbac31731b7ec64c2f6a85 view.m: add orientation BISTs and check for invalid calling form (bug #65641) * view.m: Add input check and error for simultaneously attempting to set and return the viewpoint. Add BIST for matlab compatible viewpoint change from bug #57800. Add xfail BIST for related and currently failing viewpoint change detailed in bug #65641. Add error BIST for get and set input check. diff -r 2a0cdc52220b -r c224e1a810d6 scripts/plot/appearance/view.m --- a/scripts/plot/appearance/view.m Wed Apr 24 17:29:17 2024 -0400 +++ b/scripts/plot/appearance/view.m Thu Apr 25 10:32:17 2024 -0400 @@ -66,6 +66,8 @@ vw = get (hax, "view"); az = vw(1); el = vw(2); + elseif (nargout > 0) + error ("view: cannot simultaneously get and set viewpoint"); elseif (numel (varargin) == 1) x = varargin{1}; if (numel (x) == 2) @@ -135,5 +137,38 @@ %! close (hf); %! end_unwind_protect +%!test <*57800> +%! hf = figure ("visible", "off"); +%! unwind_protect +%! plot3 ([0,1], [0,1], [0,1]); +%! view (3); +%! view ([0, 0, 1]); +%! [az, el] = view (); +%! assert ([az, el], [0, 90], eps); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + +%!test <65641> +%! hf = figure ("visible", "off"); +%! unwind_protect +%! plot3 ([0,1], [0,1], [0,1]); +%! view (3); +%! view ([0, -1, 0]); +%! [az, el] = view (); +%! assert ([az, el], [0, 0], eps); +%! view (3); +%! view ([1, 0, 0]); +%! [az, el] = view (); +%! assert ([az, el], [90, 0], eps); +%! view (3); +%! view ([1, 0.001, 0]); +%! [az, el] = view (); +%! assert ([az, el], [0, 90 + 0.001*180/pi], eps); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect + ## Test input validation %!error view (0, 0, 1) +%!error [a, b] = view ([1, 1, 1])