File: rand_image.t

package info (click to toggle)
libdata-random-perl 0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 688 kB
  • sloc: perl: 406; sh: 11; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More;
use Data::Random qw( rand_image );
use File::Temp;

# Try to load GD
eval q{ use GD };

SKIP: {

    # If the module cannot be loaded, skip tests
    skip('GD not installed', 1) if $@;

    my ($fh, $imagefile) = File::Temp::tempfile();

    # Test writing an image to a file
    {
        binmode($fh);
        print $fh rand_image( bgcolor => [ 0, 0, 0 ] );
        close($fh);

        ok( !( -z $imagefile ) );
    }
}

done_testing;