Mercurial > octave
changeset 33455:c224e1a810d6
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.
author | Nicholas R. Jankowski <jankowski.nicholas@gmail.com> |
---|---|
date | Thu, 25 Apr 2024 10:32:17 -0400 |
parents | 2a0cdc52220b |
children | f3376b536969 9d0dfb038536 |
files | scripts/plot/appearance/view.m |
diffstat | 1 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 <Invalid call> view (0, 0, 1) +%!error <cannot simultaneously get and set> [a, b] = view ([1, 1, 1])