Mercurial > octave-nkf
changeset 18659:ee125c82e01e
struct2hdl.m: handle properly objects with non-empy "tag" (bug #42047).
* struct2hdl.m: don't exclude object properties with non-empty "tag".
* copyobj.m: add a test for bug #42047.
author | Pantxo Diribarne <pantxo.diribarne@gmail.com> |
---|---|
date | Fri, 04 Apr 2014 20:49:52 +0200 |
parents | 37d5a2bb4160 |
children | cb37b17b6091 |
files | scripts/plot/util/copyobj.m scripts/plot/util/struct2hdl.m |
diffstat | 2 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/util/copyobj.m Fri Apr 04 11:50:14 2014 -0700 +++ b/scripts/plot/util/copyobj.m Fri Apr 04 20:49:52 2014 +0200 @@ -168,3 +168,17 @@ %! graphics_toolkit (toolkit); %! end_unwind_protect +%!test +%! unwind_protect +%! tag = "foo"; +%! hf = figure ("visible", "off"); +%! hax = axes ("tag", tag); +%! hpa = patch (); +%! set (hpa, "facecolor", [.5 .5 .5], "tag", tag) +%! hax2 = copyobj (hax, hf); +%! assert (get (hax2, "tag"), tag) +%! hpa2 = get (hax2, "children"); +%! assert (get (hpa2, "facecolor"), [.5 .5 .5]) +%! unwind_protect_cleanup +%! close (hf) +%! end_unwind_protect
--- a/scripts/plot/util/struct2hdl.m Fri Apr 04 11:50:14 2014 -0700 +++ b/scripts/plot/util/struct2hdl.m Fri Apr 04 20:49:52 2014 +0200 @@ -177,7 +177,7 @@ function [h, sout] = createaxes (s, p, par) ## regular axes - if (strcmp (s.properties.tag, "")) + if (! any (strcmpi (s.properties.tag, {"colorbar", "legend"}))) propval = {"position", s.properties.position}; hid = {"autopos_tag", "looseinset"}; for ii = 1:numel (hid) @@ -551,8 +551,7 @@ endfunction function setprops (s, h, p, hilev) - more off; - if (strcmpi (s.properties.tag, "")) + if (! any (strcmpi (s.properties.tag, {"colorbar", "legend"}))) specs = s.children(s.special); if (isempty (specs)) hdls = []; @@ -617,8 +616,7 @@ endif endif - elseif (strcmpi (s.properties.tag, "legend") - || strcmpi (s.properties.tag, "colorbar")) + else set (h, s.properties); endif