#!perl -w use strict; use Test::More; use Imager; # this script tests an internal set of functions for Imager, they # aren't intended to be used at the perl level. # these functions aren't present in all Imager builds unless (Imager::Internal::Hlines::testing()) { plan skip_all => 'Imager not built to run this test'; } plan tests => 17; my $hline = Imager::Internal::Hlines::new(0, 100, 0, 100); my $base_text = 'start_y: 0 limit_y: 100 start_x: 0 limit_x: 100'; ok($hline, "made hline"); is($hline->dump, "$base_text\n", "check values"); $hline->add(5, -5, 7); is($hline->dump, <add(5, 8, 4); is($hline->dump, <add(5, 3, 3); is($hline->dump, <add(5, 2, 6); is($hline->dump, <add(6, -5, 5); is($hline->dump, $current, "check (6, -5, 5) not added"); $hline->add(6, 100, 5); is($hline->dump, $current, "check (6, 100, 5) not added"); $hline->add(-1, 5, 2); is($hline->dump, $current, "check (-1, 5, 2) not added"); $hline->add(100, 5, 2); is($hline->dump, $current, "check (10, 5, 2) not added"); # overlapped add check $hline->add(6, 2, 6); $hline->add(6, 3, 4); is($hline->dump, <add(7, $i*2, 1); } is($hline->dump, <add(7, 1, 39); is($hline->dump, <add(51, 45, 10); $hline->add(51, 55, 4); is($hline->dump, <add(52, 90, 5); $hline->add(52, 87, 5); is($hline->dump, <new(xsize => 50, ysize => 60); my $hl = Imager::Internal::Hlines::new_img($im->{IMG}); ok($hl, "make hlines object from image"); is($hl->dump, "start_y: 0 limit_y: 60 start_x: 0 limit_x: 50\n", "check initialized properly"); }