]> git.imager.perl.org - imager.git/blobdiff - t/450-api/100-inline.t
fix potential memory leaks for failing mixing scaling on very large images
[imager.git] / t / 450-api / 100-inline.t
index c9a1f939db6b5a3eb756bfb2555ad3dfd0ccfb61..9d2cd4fb3e379bcdd2359b2c650b9beafee329a7 100644 (file)
@@ -21,7 +21,7 @@ plan skip_all => "perl 5.005_04, 5.005_05 too buggy"
 
 print STDERR "Inline version $Inline::VERSION\n";
 
-plan tests => 117;
+plan tests => 120;
 require Inline;
 Inline->import(with => 'Imager');
 Inline->import("FORCE"); # force rebuild
@@ -467,6 +467,25 @@ test_slots() {
   return 1;
 }
 
+int
+color_channels(Imager im) {
+  return i_img_color_channels(im);
+}
+
+int
+color_model(Imager im) {
+  return (int)i_img_color_model(im);
+}
+
+int
+alpha_channel(Imager im) {
+  int channel;
+  if (!i_img_alpha_channel(im, &channel))
+    channel = -1;
+
+  return channel;
+}
+
 EOS
 
 my $im = Imager->new(xsize=>50, ysize=>50);
@@ -683,6 +702,13 @@ for my $bits (8, 16) {
   is($im->type, "paletted", "make sure we kept the image type");
 }
 
+{
+  my $rgb = Imager->new(xsize => 10, ysize => 10);
+  is(color_model($rgb), 3, "check i_img_color_model() api");
+  is(color_channels($rgb), 3, "check i_img_color_channels() api");
+  is(alpha_channel($rgb), -1, "check i_img_alpha_channel() api");
+}
+
 ok(test_mutex(), "call mutex APIs");
 
 ok(test_slots(), "call slot APIs");