• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/perl
2#  Copyright 1999-2021 ImageMagick Studio LLC, a non-profit organization
3#  dedicated to making software imaging solutions freely available.
4#
5#  You may not use this file except in compliance with the License.  You may
6#  obtain a copy of the License at
7#
8#    https://imagemagick.org/script/license.php
9#
10#  Unless required by applicable law or agreed to in writing, software
11#  distributed under the License is distributed on an "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13#  See the License for the specific language governing permissions and
14#  limitations under the License.
15#
16# Test montage method.
17#
18BEGIN { $| = 1; $test=1, print "1..19\n"; }
19END {print "not ok 1\n" unless $loaded;}
20use Image::Magick;
21$loaded=1;
22
23require 't/subroutines.pl';
24
25chdir 't' || die 'Cd failed';
26
27#
28# 1) Test montage defaults (except no label that requires an exact font)
29#
30testMontage( q//,
31  q/background=>'#696e7e'/,
32  '6f8304c88f6dae4ade2a09fb7b4562cf2c09978cb30b025afaf9bd5805a4e75e');
33
34#
35# 2) Test Center gravity
36#    Image should be centered in frame
37#
38++$test;
39testMontage( q//,
40  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'Center'/,
41  '4fa94e68dc41fa0fda3469e6b8ebc4c07be6ef656405a1ea8f9ed8b00aa07552');
42
43#
44# 3) Test NorthWest gravity
45#    Image should be at top-left in frame
46#
47++$test;
48testMontage( q//,
49  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'NorthWest'/,
50  '24adcfa00f2c69d10fda815c9572bd7f621adb93a58a9c3c85657060929da4d0');
51
52#
53# 4) Test North gravity
54#    Image should be at top-center of frame
55#
56++$test;
57testMontage( q//,
58  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'North'/,
59  '70bb1be5bad21d5dd545ffe62eeb90052a037fcc1613aaa3f3b3c4d4c6138e8a');
60
61#
62# 5) Test NorthEast gravity
63#    Image should be at top-right of frame
64#
65++$test;
66testMontage( q//,
67  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'NorthEast'/,
68  '116668aedcc616527dabac2c07ea597d5cc26e3aaf33db14d8ce796892bc1f1c');
69
70#
71# 6) Test West gravity
72#    Image should be at left-center of frame
73#
74++$test;
75testMontage( q//,
76  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'West'/,
77  'abb3104224d07ba50235e750c8009b231a0e6aaa596fb2ec3703b2061a59abc3');
78
79#
80# 7) Test East gravity
81#    Image should be at right-center of frame.
82#
83++$test;
84testMontage( q//,
85  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'East'/,
86  '8723423ac9151136571b6e8f053fc60b09a8ec18d94e4fbc29c492de032c9a7d');
87
88#
89# 8) Test SouthWest gravity
90#    Image should be at bottom-left of frame
91#
92++$test;
93testMontage( q//,
94  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'SouthWest'/,
95  'abc713cef6d9923859854c164b83ed7b92f6c15ae6924207bb8a38063395650b');
96
97#
98# 9) Test South gravity
99#    Image should be at bottom of frame
100#
101++$test;
102testMontage( q//,
103  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'South'/,
104  '9992d5631703aa64d4fb87c71881df39aeff1cc821320d0a43f00897e7cd6a17');
105
106#
107# 10) Test SouthEast gravity
108#     Image should be at bottom-right of frame.
109#
110++$test;
111testMontage( q//,
112  q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'SouthEast'/,
113  'ae4322daebfbd3fe448afffe33aa599be518eaebb3515793e1efe6dc33939383');
114
115#
116# 11) Test Framed Montage
117#
118# Image border color 'bordercolor' controls frame background color
119# Image matte color 'mattecolor' controls frame color
120# Image pen color 'pen' controls label text foreground color
121++$test;
122testMontage( q/bordercolor=>'blue', mattecolor=>'red'/,
123  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+3+3>', frame=>'8x10',
124  borderwidth=>'0', gravity=>'Center', background=>'gray'/,
125  '40835871b13232243ba4d2bcb244d06958556a24a9624e793f5c4c291d64f322',
126  '531d0d485d55a5b585cab3f64b37da81a109fbaa91aa44a038fa916421780f14',
127  '40835871b13232243ba4d2bcb244d06958556a24a9624e793f5c4c291d64f322');
128
129#
130# 12) Test Framed Montage with drop-shadows
131#
132++$test;
133testMontage( q/bordercolor=>'blue', mattecolor=>'red'/,
134  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', frame=>'8x10',
135  borderwidth=>'0', gravity=>'Center', shadow=>'True',background=>'gray'/,
136  'c11aad0132d57f84ec42aad600f2c9f3fdb9ad5a64235cb08a296c0f1a509f6d',
137  '51b8db221299cea2bea84b11247bfa4b41a0cc3a9af27ff4c20f9c23ee7f2117',
138  '7b8d2dbf3ee22440fd5df36090922bb599ab6b4df216282cc51bb4328d03a211');
139
140#
141# 13) Test Framed Montage with drop-shadows and background texture
142#
143++$test;
144testMontage( q/bordercolor=>'blue', mattecolor=>'red'/,
145  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', frame=>'8x10',
146  borderwidth=>'0', gravity=>'Center', shadow=>'True', texture=>'granite:'/,
147  '292b115e08fcef4888ee3f386c6c3aff1c0ed008e34697435c1e4116a75149ed',
148  'e2fe0b56decf6fd791813e99d7b0f40646a479589e7519d97e2f92969dd17a1e',
149  '2c6bc96010beb38d123cc712ded96ecbbef40265a80e9638e9ea9034d64227f3');
150
151#
152# 14) Test Un-bordered, Un-framed Montage
153#
154++$test;
155testMontage( q//,
156  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', mode=>'Unframe',
157  borderwidth=>'0', gravity=>'Center', background=>'gray'/,
158  'b9df49be9b056ed8fd4c4eb7621aa073df65740e4aaebc038c294cb3731f334f');
159
160#
161# 15) Test Bordered, Un-framed Montage (mode=>'Unframe')
162#
163++$test;
164testMontage( q/bordercolor=>'red'/,
165  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', mode=>'Unframe',
166  borderwidth=>'5', gravity=>'Center', background=>'gray'/,
167  '9d7d0f1886ef8d48f680567163d3a4583897d114c7abbb9da6a98f96fb629ebb');
168
169#
170# 16) Test Bordered, Un-framed Montage (mode=>'UnFrame')
171#
172++$test;
173testMontage( q/bordercolor=>'red'/,
174  q/ tile=>'4x4', geometry=>'90x80+6+6>', mode=>'UnFrame',
175  borderwidth=>'5', gravity=>'Center', background=>'gray'/,
176  '9d7d0f1886ef8d48f680567163d3a4583897d114c7abbb9da6a98f96fb629ebb');
177
178#
179# 17) Test Un-bordered, Un-framed Montage with 16x1 tile
180#
181++$test;
182testMontage( q//,
183  q/background=>'#696e7e',  tile=>'16x1', geometry=>'90x80+0+0>', mode=>'Unframe',
184  borderwidth=>'0', gravity=>'Center', background=>'gray'/,
185  '9f6f0c7ff76283b0f8747c1e12bd810bda0c47ab8cf78a4ae584556a64c88213');
186
187#
188# 18) Test concatenated thumbnail Montage (concatenated via special Concatenate mode)
189#     Thumbnails should be compacted tightly together in a grid
190#
191++$test;
192testMontage( q//,
193  q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80>', mode=>'Concatenate'/,
194  'dfede51035a4ce942e3ba9909f85eb497c134a60bb8363afded0ae81f73f0e46');
195#
196# 19) Test concatenated thumbnail Montage (concatentated by setting params to zero)
197#     Thumbnails should be compacted tightly together in a grid
198#
199++$test;
200testMontage( q//,
201  q/background=>'#696e7e',  tile=>'4x4', geometry=>'+0+0', mode=>'Unframe', shadow=>'False',
202  borderwidth=>'0', background=>'gray'/,
203  'dfede51035a4ce942e3ba9909f85eb497c134a60bb8363afded0ae81f73f0e46');
204