comparison libinterp/corefcn/graphics.cc @ 17222:8e196132bbea

Tests for for updating axes properties when figure position changes. * libinterp/corefcn/graphics.cc: Add tests (bug # 39650). After enlarging figure and returning it to its original position, verify the position, outerposition, looseinset, and tightinset are the same.
author Ben Abbott <bpabbott@mac.com>
date Mon, 12 Aug 2013 17:46:23 -0400
parents 283422a219a2
children d9ca0f44f1e7
comparison
equal deleted inserted replaced
17221:a594e0d980eb 17222:8e196132bbea
4089 %! hax = findall (gcf (), "type", "axes"); 4089 %! hax = findall (gcf (), "type", "axes");
4090 %! assert (cell2mat (get (hax, "position")), positions, 1e-4); 4090 %! assert (cell2mat (get (hax, "position")), positions, 1e-4);
4091 %! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4); 4091 %! assert (cell2mat (get (hax, "outerposition")), outerpositions, 1e-4);
4092 %! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4); 4092 %! assert (cell2mat (get (hax, "looseinset")), looseinsets, 1e-4);
4093 %! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4); 4093 %! assert (cell2mat (get (hax, "tightinset")), tightinsets, 1e-4);
4094 %! unwind_protect_cleanup
4095 %! close (hf);
4096 %! end_unwind_protect
4097 %!test
4098 %! hf = figure ("visible", "off");
4099 %! graphics_toolkit (hf, "fltk");
4100 %! fpos = get (hf, "position");
4101 %! unwind_protect
4102 %! plot (rand (3))
4103 %! position = get (gca, "position");
4104 %! outerposition = get (gca, "outerposition");
4105 %! looseinset = get (gca, "looseinset");
4106 %! tightinset = get (gca, "tightinset");
4107 %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)])
4108 %! set (hf, "position", fpos);
4109 %! assert (get (gca, "outerposition"), outerposition, 0.001)
4110 %! assert (get (gca, "position"), position, 0.001)
4111 %! assert (get (gca, "looseinset"), looseinset, 0.001)
4112 %! assert (get (gca, "tightinset"), tightinset, 0.001)
4113 %! unwind_protect_cleanup
4114 %! close (hf);
4115 %! end_unwind_protect
4116 %!test
4117 %! hf = figure ("visible", "off");
4118 %! graphics_toolkit (hf, "fltk");
4119 %! fpos = get (hf, "position");
4120 %! set (gca, "activepositionproperty", "position")
4121 %! unwind_protect
4122 %! plot (rand (3))
4123 %! position = get (gca, "position");
4124 %! outerposition = get (gca, "outerposition");
4125 %! looseinset = get (gca, "looseinset");
4126 %! tightinset = get (gca, "tightinset");
4127 %! set (hf, "position", [fpos(1:2), 2*fpos(3:4)])
4128 %! set (hf, "position", fpos);
4129 %! assert (get (gca, "position"), position, 0.001)
4130 %! assert (get (gca, "outerposition"), outerposition, 0.001)
4131 %! assert (get (gca, "looseinset"), looseinset, 0.001)
4132 %! assert (get (gca, "tightinset"), tightinset, 0.001)
4094 %! unwind_protect_cleanup 4133 %! unwind_protect_cleanup
4095 %! close (hf); 4134 %! close (hf);
4096 %! end_unwind_protect 4135 %! end_unwind_protect
4097 */ 4136 */
4098 4137