# HG changeset patch # User Pantxo Diribarne # Date 1396637392 -7200 # Node ID ee125c82e01e9c78187b20053b7cacfc102f69d6 # Parent 37d5a2bb4160304e20446d762adc74f3caf8556b 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. diff -r 37d5a2bb4160 -r ee125c82e01e scripts/plot/util/copyobj.m --- 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 diff -r 37d5a2bb4160 -r ee125c82e01e scripts/plot/util/struct2hdl.m --- 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