Home | History | Annotate | Download | only in t
      1 #!/usr/bin/perl
      2 #  Copyright 1999-2016 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 #    http://www.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 #
     18 BEGIN { $| = 1; $test=1, print "1..19\n"; }
     19 END {print "not ok 1\n" unless $loaded;}
     20 use Image::Magick;
     21 $loaded=1;
     22 
     23 require 't/subroutines.pl';
     24 
     25 chdir 't' || die 'Cd failed';
     26 
     27 #
     28 # 1) Test montage defaults (except no label that requires an exact font)
     29 #
     30 testMontage( q//,
     31   q/background=>'#696e7e'/,
     32   'd29f905749426e5491bbd8c4f58b7c14dc1a72250632b7e7b542910e0cbb7c77');
     33 
     34 #
     35 # 2) Test Center gravity
     36 #    Image should be centered in frame
     37 #
     38 ++$test;
     39 testMontage( q//,
     40   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'Center'/,
     41   '21ab4077722e45db67c945b2364cfc1365d3f939d57fc6fb2c7b77f161381c2e');
     42 
     43 #
     44 # 3) Test NorthWest gravity
     45 #    Image should be at top-left in frame
     46 #
     47 ++$test;
     48 testMontage( q//,
     49   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'NorthWest'/,
     50   'a518ad6aa1c3ad2b117864525d610481c1b3b9ead2c624c773fb427f85ef897b');
     51 
     52 #
     53 # 4) Test North gravity
     54 #    Image should be at top-center of frame
     55 #
     56 ++$test;
     57 testMontage( q//,
     58   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'North'/,
     59   '4126725283eb699545d755a6b30c5fc6cee9ac16a1e8310cdbbedcbd054bebf6');
     60 
     61 #
     62 # 5) Test NorthEast gravity
     63 #    Image should be at top-right of frame
     64 #
     65 ++$test;
     66 testMontage( q//,
     67   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'NorthEast'/,
     68   'e144c8d0da144864063753903838a286d46da56ca9ea0ce0b6080f84c6feac6c');
     69 
     70 #
     71 # 6) Test West gravity
     72 #    Image should be at left-center of frame
     73 #
     74 ++$test;
     75 testMontage( q//,
     76   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'West'/,
     77   '67286cf1ed572e836f6b67c5d733a039bba9e6a7ef18d25397e46c17223b206f');
     78 
     79 #
     80 # 7) Test East gravity
     81 #    Image should be at right-center of frame.
     82 #
     83 ++$test;
     84 testMontage( q//,
     85   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'East'/,
     86   'decf855bf26dfc3f7401769a09e302d8bac53cba6c27fd456cdfbc35e494be01');
     87 
     88 #
     89 # 8) Test SouthWest gravity
     90 #    Image should be at bottom-left of frame
     91 #
     92 ++$test;
     93 testMontage( q//,
     94   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'SouthWest'/,
     95   '848fda241866b1a191ab4794b42272b5756dbeacac5b58ef5227a34a8c72817d');
     96 
     97 #
     98 # 9) Test South gravity
     99 #    Image should be at bottom of frame
    100 #
    101 ++$test;
    102 testMontage( q//,
    103   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'South'/,
    104   'f5cccb291b3bea8cb62e5cd7a6c8e154eedfd8e12c20409a8e663231e62411c4');
    105 
    106 #
    107 # 10) Test SouthEast gravity
    108 #     Image should be at bottom-right of frame.
    109 #
    110 ++$test;
    111 testMontage( q//,
    112   q/background=>'#696e7e',  geometry=>'90x80+5+5>', gravity=>'SouthEast'/,
    113   'a19748d933fefe536b29b8ba98ce0024e3f2dc98102a1f56307a229bc3042f1c');
    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;
    122 testMontage( 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   'be7fa3545e2d1b3966bcf145680460593c4aae665e58bcffba7cbe5c189998b5',
    126   'be7fa3545e2d1b3966bcf145680460593c4aae665e58bcffba7cbe5c189998b5',
    127   '72a7587a058c71cd62226e59b64c335190a37d7dd990d68534cf05df61084783');
    128 
    129 #
    130 # 12) Test Framed Montage with drop-shadows
    131 #
    132 ++$test;
    133 testMontage( 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   '9fe18e11ac759d3a86362f16d0bdee4b6952d617daa3ad2c3511e19050dda71d',
    137   '45bfd268dba4385157f76e347b968181a9fc1e0ae64d49d61f53a0171eb80d54',
    138   '9fe18e11ac759d3a86362f16d0bdee4b6952d617daa3ad2c3511e19050dda71d');
    139 
    140 #
    141 # 13) Test Framed Montage with drop-shadows and background texture
    142 #
    143 ++$test;
    144 testMontage( 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   '6d8b83a9e9bd385a8267e3a0205d4972b3fbb4d59bf922fdbc060d3f4cefdbf8');
    148 
    149 #
    150 # 14) Test Un-bordered, Un-framed Montage
    151 #
    152 ++$test;
    153 testMontage( q//,
    154   q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', mode=>'Unframe',
    155   borderwidth=>'0', gravity=>'Center', background=>'gray'/,
    156   '245f9fbee901f99e08458aad797ade92ea17e68b230212510ad2eca96e169e39',
    157   '245f9fbee901f99e08458aad797ade92ea17e68b230212510ad2eca96e169e39',
    158   'ab07c5591848f1aa8bfffc46c094be40cf662e18f68b19229f1f7e9d9eec4692');
    159 
    160 #
    161 # 15) Test Bordered, Un-framed Montage (mode=>'Unframe')
    162 #
    163 ++$test;
    164 testMontage( q/bordercolor=>'red'/, 
    165   q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80+6+6>', mode=>'Unframe',
    166   borderwidth=>'5', gravity=>'Center', background=>'gray'/,
    167   '611833bd0e13681a82d34c4c40b2a263bf245ac879de240114df874f9eaca7f0',
    168   '611833bd0e13681a82d34c4c40b2a263bf245ac879de240114df874f9eaca7f0',
    169   '65bb1cd11a0dbbd90ca46b07ce58b2ba5fcfadc0869356e5a08eda53510e0126');
    170 
    171 #
    172 # 16) Test Bordered, Un-framed Montage (mode=>'UnFrame')
    173 #
    174 ++$test;
    175 testMontage( q/bordercolor=>'red'/, 
    176   q/ tile=>'4x4', geometry=>'90x80+6+6>', mode=>'UnFrame',
    177   borderwidth=>'5', gravity=>'Center', background=>'gray'/,
    178   '611833bd0e13681a82d34c4c40b2a263bf245ac879de240114df874f9eaca7f0',
    179   '611833bd0e13681a82d34c4c40b2a263bf245ac879de240114df874f9eaca7f0',
    180   '65bb1cd11a0dbbd90ca46b07ce58b2ba5fcfadc0869356e5a08eda53510e0126');
    181 
    182 #
    183 # 17) Test Un-bordered, Un-framed Montage with 16x1 tile
    184 #
    185 ++$test;
    186 testMontage( q//,
    187   q/background=>'#696e7e',  tile=>'16x1', geometry=>'90x80+0+0>', mode=>'Unframe',
    188   borderwidth=>'0', gravity=>'Center', background=>'gray'/,
    189   '49bf08b9ae34c7c8acee15b123c29e414ae6fb9bdf2a15dbdd3a33a753b8e7ff',
    190   '49bf08b9ae34c7c8acee15b123c29e414ae6fb9bdf2a15dbdd3a33a753b8e7ff',
    191   'c42d5f2bef5f30167f02d6ba85504ee82e06c16d9404bc6fc0f6e75c0f8f53e9');
    192 
    193 #
    194 # 18) Test concatenated thumbnail Montage (concatenated via special Concatenate mode)
    195 #     Thumbnails should be compacted tightly together in a grid
    196 #
    197 ++$test;
    198 testMontage( q//,
    199   q/background=>'#696e7e',  tile=>'4x4', geometry=>'90x80>', mode=>'Concatenate'/,
    200   'b46f6d6c6305ab1d5f05f89030e775fca2f01dd5d40a8340372bd31dafaa4e83');
    201 #
    202 # 19) Test concatenated thumbnail Montage (concatentated by setting params to zero)
    203 #     Thumbnails should be compacted tightly together in a grid
    204 #
    205 ++$test;
    206 testMontage( q//, 
    207   q/background=>'#696e7e',  tile=>'4x4', geometry=>'+0+0', mode=>'Unframe', shadow=>'False',
    208   borderwidth=>'0', background=>'gray'/,
    209   'b46f6d6c6305ab1d5f05f89030e775fca2f01dd5d40a8340372bd31dafaa4e83',
    210   'b46f6d6c6305ab1d5f05f89030e775fca2f01dd5d40a8340372bd31dafaa4e83',
    211   '6c61a8ad7be5f8c368dcb591f766349e648b623cbc41e6699ba3ea53ef182510');
    212