Mercurial > octave-nkf
changeset 16673:092d0a685546
Fix bug # 38885.
* scripts/plot/findobj.m: The logical operations "-and", "-or", etc, should be
backward looking. Add tests.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Tue, 07 May 2013 22:56:42 +0800 |
parents | fd43631f09c2 |
children | bc79ac595a05 |
files | scripts/plot/findobj.m |
diffstat | 1 files changed, 31 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/findobj.m Sun May 12 16:46:56 2013 -0400 +++ b/scripts/plot/findobj.m Tue May 07 22:56:42 2013 +0800 @@ -185,6 +185,9 @@ endwhile numpairs = np - 1; + if (~ isempty (logicaloperator)) + logicaloperator = shift (logicaloperator, 1); + endif ## Load all objects which qualify for being searched. idepth = 0; @@ -243,6 +246,16 @@ h = reshape (h, [numel(h), 1]); endfunction +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! h = plot (1:10); +%! set (h, "tag", "foobar") +%! g = findobj (gcf (), "tag", "foobar", "type", "line", "color", [0 0 1]); +%! assert (g, h) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect %!test %! hf = figure ("visible", "off"); @@ -257,3 +270,21 @@ %! close (hf); %! end_unwind_protect +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! subplot (2, 2, 1) +%! imagesc (rand (10)) +%! subplot (2, 2, 2) +%! surf (peaks) +%! subplot (2, 2, 3) +%! contour (peaks) +%! subplot (2, 2, 4) +%! plot (peaks) +%! h1 = findobj (gcf (), "-regexp", "Type", "image|surface|hggroup"); +%! h2 = findobj (gcf (), "Type", "image", "-or", "Type", "surface", "-or", "Type", "hggroup"); +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect +%! assert (h2, h1) +