Mercurial > hg > octave-lyh
diff scripts/plot/text.m @ 13136:79b9a7669bb8
Tests added for scripts/plot
(plot/ishghandle.m, plot/text.m, plot/title.m, plot/xlabel.m, plot/ylabel.m,
plot/zlabel.m): Tests added for plot functions.
plot/whitebg.m: Fix typo. Change colors only for figure under test
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Wed, 14 Sep 2011 21:03:39 +0200 |
parents | e65d1488ff6a |
children | 52c5799130c2 |
line wrap: on
line diff
--- a/scripts/plot/text.m +++ b/scripts/plot/text.m @@ -218,3 +218,33 @@ %! ylabel (1:2) %! title (1:2) +%!test +%! hf = figure ("visible", "off"); +%! unwind_protect +%! h = text (0.5, 0.3, "char"); +%! assert ("char", class (get (h, "string"))) +%! h = text (0.5, 0.4, ["char row 1"; "char row 2"]); +%! assert ("char", class (get (h, "string"))) +%! h = text (0.5, 0.6, {"cell2str (1,1)", "cell2str (1,2)"; "cell2str (2,1)", "cell2str (2,2)"}); +%! assert ("cell", class (get (h, "string"))) +%! h = text (0.5, 0.8, "foobar"); +%! set (h, "string", 1:3) +%! h = text ([0.1, 0.1], [0.3, 0.4], "one string & two objects"); +%! assert ("char", class (get (h(1), "string"))) +%! assert ("char", class (get (h(2), "string"))) +%! h = text ([0.1, 0.1], [0.5, 0.6], {"one cellstr & two objects"}); +%! assert ("cell", class (get (h(1), "string"))) +%! assert ("cell", class (get (h(2), "string"))) +%! h = text ([0.1, 0.1], [0.7, 0.8], {"cellstr 1 object 1", "cellstr 2 object 2"}); +%! assert ("char", class (get (h(1), "string"))) +%! assert ("char", class (get (h(2), "string"))) +%! h = text ([0.1, 0.1], [0.1, 0.2], ["1st string & 1st object"; "2nd string & 2nd object"]); +%! assert ("char", class (get (h(1), "string"))) +%! assert ("char", class (get (h(2), "string"))) +%! h = text (0.7, 0.6, "single string"); +%! assert ("char", class (get (h, "string"))) +%! h = text (0.7, 0.5, {"single cell-string"}); +%! assert ("cell", class (get (h, "string"))) +%! unwind_protect_cleanup +%! close (hf); +%! end_unwind_protect