Mercurial > hg > octave-nkf
annotate scripts/plot/appearance/orient.m @ 19840:c5270263d466 gui-release
close gui-release branch
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 30 Jan 2015 17:41:50 -0500 |
parents | 446c46af4b42 |
children | 4197fc428c7d |
rev | line source |
---|---|
17744
d63878346099
maint: Update copyright notices for release.
John W. Eaton <jwe@octave.org>
parents:
17687
diff
changeset
|
1 ## Copyright (C) 2001-2013 Paul Kienzle |
5364 | 2 ## |
5365 | 3 ## This file is part of Octave. |
5364 | 4 ## |
5365 | 5 ## Octave is free software; you can redistribute it and/or modify it |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5365 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
5364 | 14 ## |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5364 | 18 |
5365 | 19 ## -*- texinfo -*- |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
20 ## @deftypefn {Function File} {} orient (@var{orientation}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
21 ## @deftypefnx {Function File} {} orient (@var{hfig}, @var{orientation}) |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
22 ## @deftypefnx {Function File} {@var{orientation} =} orient () |
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
23 ## @deftypefnx {Function File} {@var{orientation} =} orient (@var{hfig}) |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
24 ## Query or set the print orientation for figure @var{hfig}. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
25 ## |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
26 ## Valid values for @var{orientation} are @qcode{"portrait"}, |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
27 ## @qcode{"landscape"}, and @qcode{"tall"}. |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
28 ## |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
29 ## The @qcode{"landscape"} option changes the orientation so the plot width |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
30 ## is larger than the plot height. The @qcode{"paperposition"} is also |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
31 ## modified so that the plot fills the page, while leaving a 0.25 inch border. |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
32 ## |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
33 ## The @qcode{"tall"} option sets the orientation to @qcode{"portrait"} and |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
34 ## fills the page with the plot, while leaving a 0.25 inch border. |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
35 ## |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
36 ## The @qcode{"portrait"} option (default) changes the orientation so the plot |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
37 ## height is larger than the plot width. It also restores the default |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
38 ## @qcode{"paperposition"} property. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
39 ## |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
40 ## When called with no arguments, return the current print orientation. |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
41 ## |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
42 ## If the argument @var{hfig} is omitted, then operate on the current figure |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
43 ## returned by @code{gcf}. |
17122
eaab03308c0b
doc: Rewrite docstrings for most plot functions.
Rik <rik@octave.org>
parents:
14363
diff
changeset
|
44 ## @seealso{print, saveas} |
5365 | 45 ## @end deftypefn |
5364 | 46 |
5365 | 47 ## Author: Paul Kienzle |
48 ## Adapted-By: jwe | |
5364 | 49 |
6257 | 50 function retval = orient (varargin) |
5365 | 51 |
6257 | 52 nargs = nargin; |
5364 | 53 |
8248 | 54 if (nargs > 0 && numel (varargin{1}) == 1 && isfigure (varargin{1})) |
6257 | 55 cf = varargin{1}; |
56 varargin(1) = []; | |
57 nargs--; | |
58 else | |
59 cf = gcf (); | |
60 endif | |
61 | |
17678
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
62 if (nargs > 1) |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
63 print_usage (); |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
64 endif |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
65 |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
66 paperunits = get (cf, "paperunits"); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
67 unwind_protect |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
68 set (cf, "paperunits", "inches"); # All Matlab calculations assume inches. |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
69 |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
70 if (nargs == 0) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
71 retval = get (cf, "paperorientation"); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
72 if (strcmp (retval, "portrait")) |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
73 papersize = get (cf, "papersize"); |
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
74 paperposition = get (cf, "paperposition"); |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
75 if (paperposition == [0.25 0.25 (papersize - 0.5)]) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
76 retval = "tall"; |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
77 endif |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
78 endif |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
79 else |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
80 orientation = varargin{1}; |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
81 if (strcmpi (orientation, "landscape") |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
82 || strcmpi (orientation, "portrait")) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
83 if (! strcmpi (get (cf, "paperorientation"), orientation)) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
84 ## FIXME: with the proper listeners in place there won't be a need to |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
85 ## set the papersize and paperposition here. |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
86 papersize = get (cf, "papersize"); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
87 paperposition = get (cf, "paperposition"); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
88 set (cf, "paperorientation", orientation); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
89 set (cf, "papersize", papersize([2, 1])); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
90 set (cf, "paperposition", paperposition([2, 1, 4, 3])); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
91 endif |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
92 if (strcmpi (orientation, "portrait")) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
93 ## portrait restores the default |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
94 ## FIXME: Should use "default" here, but Octave complains |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
95 ## that "paperposition" is not a default property. |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
96 set (cf, "paperposition", "factory"); |
19790
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
97 else |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
98 ## landscape also sets the plot to occupy the entire page |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
99 papersize = get (cf, "papersize"); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
100 set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
101 endif |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
102 elseif (strcmpi (varargin{1}, "tall")) |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
103 orient ("portrait"); |
17672
36917b3db6b2
orient.m: Setting 'landscape' orientation also sets plot to take up full page.
Rik <rik@octave.org>
parents:
17572
diff
changeset
|
104 papersize = get (cf, "papersize"); |
36917b3db6b2
orient.m: Setting 'landscape' orientation also sets plot to take up full page.
Rik <rik@octave.org>
parents:
17572
diff
changeset
|
105 set (cf, "paperposition", [0.25, 0.25, (papersize - 0.5)]); |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
106 else |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
107 error ("orient: unknown ORIENTATION"); |
17672
36917b3db6b2
orient.m: Setting 'landscape' orientation also sets plot to take up full page.
Rik <rik@octave.org>
parents:
17572
diff
changeset
|
108 endif |
5364 | 109 endif |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
110 |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
111 unwind_protect_cleanup |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
112 set (cf, "paperunits", paperunits); |
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
113 end_unwind_protect |
5364 | 114 |
115 endfunction | |
116 | |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
117 |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
118 %!shared papersize, paperposition, fullpaperposition, hfig |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %! papersize = [8.5, 11]; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %! paperposition = [0.25, 2.5, 8, 6]; |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
121 %! fullpaperposition = [0.25, 0.25, (papersize-0.5)]; |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
122 %! hfig = figure ("visible", "off"); |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
123 %! set (hfig, "paperunits", "inches"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
124 %! set (hfig, "paperorientation", "portrait"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
125 %! set (hfig, "papersize", papersize); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
126 %! set (hfig, "paperposition", paperposition); |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
127 |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
128 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
129 %! orient portrait; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
130 %! assert (orient, "portrait") # default |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
131 %! assert (get (hfig, "papersize"), papersize); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
132 %! assert (get (hfig, "paperposition"), paperposition); |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
133 |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
134 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
135 %! orient landscape; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
136 %! assert (orient,"landscape") # change to landscape |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
137 %! assert (get (hfig, "papersize"), papersize([2, 1])); |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
138 %! assert (get (hfig, "paperposition"), fullpaperposition([1, 2, 4, 3])); |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
139 |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
140 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
141 %! orient portrait # change back to portrait |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
142 %! assert (orient, "portrait"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
143 %! assert (get (hfig, "papersize"), papersize); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
144 %! assert (get (hfig, "paperposition"), paperposition); |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
145 |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
146 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
147 %! orient landscape; |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
148 %! orient tall; |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
149 %! assert (orient, "tall"); |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
150 %! assert (get (hfig, "papersize"), papersize); |
17687
cf43cc342bfa
orient.m: Return "tall" as a possible orientation. Save/restore paperunits property.
Rik <rik@octave.org>
parents:
17678
diff
changeset
|
151 %! assert (get (hfig, "paperposition"), fullpaperposition); |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
152 |
9832
cd0c4a5a12c8
orient.m: Flip papersize and paperposition when orientation changes. Add support for 'tall' option. Add tests.
Ben Abbott <bpabbott@mac.com>
parents:
8920
diff
changeset
|
153 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
154 %! orient portrait # errors don't change the state |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
155 %! assert (orient, "portrait"); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
156 %! assert (get (hfig, "papersize"), papersize); |
17678
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
157 %! assert (get (hfig, "paperposition"), paperposition); |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
158 |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
159 %% Test input validation |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
160 %!error orient (1.73, 2.5) |
26bd7d18a50c
orient.m: Overhaul function for Matlab compatibility.
Rik <rik@octave.org>
parents:
17672
diff
changeset
|
161 %!error <unknown ORIENTATION> orient ("nobody") |
17150
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
162 |
e7723410ec32
Recode some %!tests which pop up figures with new figure() behavior.
Rik <rik@octave.org>
parents:
17122
diff
changeset
|
163 %!test |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
164 %! close (hfig); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
165 |