### ----------------------------------------------------
### -- Image::Resize
### -- Licenses: Artistic-2.0
### -- Authors: Dagur Valberg Johannsson, Raku Community
### -- File: t/02-more.rakutest
### ----------------------------------------------------
use Test;
use Image::Resize;

use lib $*PROGRAM.parent;
use common;

plan 3;

my $camelia = ~$*PROGRAM.sibling("images/500px-Camelia.png");
my $width  = 500;
my $height = 366;

# Test no resample
{
    my $resample = tmp-file("png");
    my $resize   = tmp-file("png");

    resize-image($camelia, $resample, 0.25);
    resize-image($camelia, $resize, 0.25, :no-resample);

    isnt $resample.IO.s, $resize.IO.s, "Resize and resample differ";
}

# Test jpeg quality
{
    my $bad-quality = tmp-file("jpg");
    my $default-quality = tmp-file("jpeg");

    resize-image($camelia, $default-quality, 2.0);
    resize-image($camelia, $bad-quality, 2.0, :jpeg-quality(5));

    ok $bad-quality.IO.s < $default-quality.IO.s, "Bad quality JPEG takes less space";
    ok $bad-quality.IO.s > 0 && $bad-quality.IO.s > 0, "... and they contain data";
}

# vim: expandtab shiftwidth=4


