parameter wasn't passed to the read() method would produce
diagnostics on stdout, precluding use in web applications. Silenced
it.
+- the setcolors() had a fencepost error making it impossible to
+ use it to set the last color in the palette.
+ http://rt.cpan.org/NoAuth/Bug.html?id=12676
=================================================================
=cut
*/
static int i_setcolors_p(i_img *im, int index, i_color *colors, int count) {
- if (index >= 0 && count >= 1 && index + count < PALEXT(im)->count) {
+ if (index >= 0 && count >= 1 && index + count <= PALEXT(im)->count) {
while (count) {
PALEXT(im)->pal[index++] = *colors++;
--count;
# some of this is tested in t01introvert.t too
use strict;
use lib 't';
-use Test::More tests => 59;
+use Test::More tests => 62;
BEGIN { use_ok("Imager"); }
my $img = Imager->new(xsize=>50, ysize=>50, type=>'paletted');
cmp_ok($warning, '=~', 't023palette\\.t', "correct file");
}
+{ # http://rt.cpan.org/NoAuth/Bug.html?id=12676
+ # setcolors() has a fencepost error
+ my $img = Imager->new(xsize=>10, ysize=>10, type=>'paletted');
+
+ is($img->addcolors(colors=>[ $black, $red ]), "0 but true",
+ "add test colors");
+ ok($img->setcolors(start=>1, colors=>[ $green ]), "set the last color");
+ ok(!$img->setcolors(start=>2, colors=>[ $black ]),
+ "set after the last color");
+}
+
sub coloreq {
my ($left, $right, $comment) = @_;