# -*- mode: perl; coding: utf-8; tab-width: 4 -*-

use strict;
use warnings;
# use Test::More qw(no_plan);
use Test::More tests => 24;
BEGIN { use_ok('Cv', -nomore) }
BEGIN { use_ok('Cv::Test') }

# my $dst = $src->resize([rows, cols]);

if (1) {
	my $rows = 120;
	my $cols = 160;
	my $src = Cv::Mat->new([$rows*2, $cols*2], CV_8UC3);
	my $dst = $src->resize([$rows, $cols]);
	is(ref $dst, ref $src);
	is($dst->rows, $rows);
	is($dst->cols, $cols);
	is($src->rows, 2 * $rows);
	is($src->cols, 2 * $cols);
}

if (2) {
	my $rows = 120;
	my $cols = 160;
	my $src = Cv::Image->new([$rows*2, $cols*2], CV_8UC3);
	my $dst = $src->resize([$rows, $cols]);
	is(ref $dst, ref $src);
	is($dst->rows, $rows);
	is($dst->cols, $cols);
	is($src->rows, 2 * $rows);
	is($src->cols, 2 * $cols);
}

# my $dst = $src->resize($src->new([rows, cols]));

if (3) {
	my $rows = 120;
	my $cols = 160;
	my $src = Cv::Mat->new([$rows*2, $cols*2], CV_8UC3);
	my $dst = $src->resize($src->new([$rows, $cols]));
	is(ref $dst, ref $src);
	is($dst->rows, $rows);
	is($dst->cols, $cols);
	is($src->rows, 2 * $rows);
	is($src->cols, 2 * $cols);
}

if (4) {
	my $rows = 120;
	my $cols = 160;
	my $src = Cv::Image->new([$rows*2, $cols*2], CV_8UC3);
	my $dst = $src->resize($src->new([$rows, $cols]));
	is(ref $dst, ref $src);
	is($dst->rows, $rows);
	is($dst->cols, $cols);
	is($src->rows, 2 * $rows);
	is($src->cols, 2 * $cols);
}

if (10) {
	my $src = Cv::Mat->new([100, 10], CV_8UC3);
	e { $src->resize(1, 2, 3) };
	err_is('Usage: Cv::Arr::cvResize(src, dst, interpolation=CV_INTER_LINEAR)');
}

if (11) {
	my $src = Cv::Mat->new([100, 10], CV_8UC3);
	e { $src->resize(\0) };
	err_like('OpenCV Error:');
}
