convert ok(... eq ..., ... ) to is(..., ..., ...)
authorTony Cook <tony@develop=help.com>
Sun, 26 Nov 2006 11:25:29 +0000 (11:25 +0000)
committerTony Cook <tony@develop=help.com>
Sun, 26 Nov 2006 11:25:29 +0000 (11:25 +0000)
RT 23184

t/t022double.t
t/t023palette.t
t/t07iolayer.t
t/t106tiff.t
t/t30t1font.t
t/t35ttfont.t
t/t36oofont.t
t/t38ft2font.t

index 80d7823d3663da2ba9b094f11e1f1b7946659bda..ec14e2031dee4f67e6ca1a803be2aecfd93fa3e5 100644 (file)
@@ -62,7 +62,7 @@ test_colorf_glin($im_rgb, 0, 1,
 # basic OO tests
 my $ooimg = Imager->new(xsize=>200, ysize=>201, bits=>'double');
 ok($ooimg, "couldn't make double image");
-ok($ooimg->bits eq 'double', "oo didn't give double image");
+is($ooimg->bits, 'double', "oo didn't give double image");
 
 # check that the image is copied correctly
 my $oocopy = $ooimg->copy;
index 6faad048df2415bdb2048666b20579c6010d04fe..d960388020ea175c8b5208f64ff321a110b0bf9d 100644 (file)
@@ -11,7 +11,7 @@ my $img = Imager->new(xsize=>50, ysize=>50, type=>'paletted');
 
 ok($img, "paletted image created");
 
-ok($img->type eq 'paletted', "got a paletted image");
+is($img->type, 'paletted', "got a paletted image");
 
 my $black = Imager::Color->new(0,0,0);
 my $red = Imager::Color->new(255,0,0);
@@ -80,20 +80,20 @@ $img->setcolors(start=>$red, colors=>[$red, $green]);
 
 # draw on the image, make sure it stays paletted when it should
 ok($img->box(color=>$red, filled=>1), "fill with red");
-ok($img->type eq 'paletted', "paletted after fill");
+is($img->type, 'paletted', "paletted after fill");
 ok($img->box(color=>$green, filled=>1, xmin=>10, ymin=>10,
              xmax=>40, ymax=>40), "green box");
-ok($img->type eq 'paletted', 'still paletted after box');
+is($img->type, 'paletted', 'still paletted after box');
 # an AA line will almost certainly convert the image to RGB, don't use
 # an AA line here
 ok($img->line(color=>$blue, x1=>10, y1=>10, x2=>40, y2=>40),
     "draw a line");
-ok($img->type eq 'paletted', 'still paletted after line');
+is($img->type, 'paletted', 'still paletted after line');
 
 # draw with white - should convert to direct
 ok($img->box(color=>$white, filled=>1, xmin=>20, ymin=>20, 
              xmax=>30, ymax=>30), "white box");
-ok($img->type eq 'direct', "now it should be direct");
+is($img->type, 'direct', "now it should be direct");
 
 # various attempted to make a paletted image from our now direct image
 my $palimg = $img->to_paletted;
index a86ddb6970d21954d53af9211202caae3d527f5a..47a98f9fee22a4e23dd0103ce03355f3699a2b4b 100644 (file)
@@ -109,7 +109,7 @@ $work = '';
 ok(Imager::i_writeppm_wiol($im, $IO8), "write to cb");
 # I originally compared this to $data, but that doesn't include the
 # Imager header
-ok($work eq $data2, "write image match");
+is($work, $data2, "write image match");
 ok($did_close, "did close");
 
 # with a short buffer, no closer
@@ -118,7 +118,7 @@ ok($IO9, "making short writecb object");
 $pos = 0;
 $work = '';
 ok(Imager::i_writeppm_wiol($im, $IO9), "write to short cb");
-ok($work eq $data2, "short write image match");
+is($work, $data2, "short write image match");
 
 {
   my $buf_data = "Test data";
index 0c964eca46abe53ae94870603bd50bfc3cee4647..db21e97b184dc6e5f69f0c88434347cbb479aabf 100644 (file)
@@ -142,9 +142,9 @@ SKIP:
   # paletted reads
   my $img4 = Imager->new;
   ok($img4->read(file=>'testimg/comp4.tif'), "reading 4-bit paletted");
-  ok($img4->type eq 'paletted', "image isn't paletted");
+  is($img4->type, 'paletted', "image isn't paletted");
   print "# colors: ", $img4->colorcount,"\n";
-  ok($img4->colorcount <= 16, "more than 16 colors!");
+  cmp_ok($img4->colorcount, '<=', 16, "more than 16 colors!");
   #ok($img4->write(file=>'testout/t106_was4.ppm'),
   #   "Cannot write img4");
   # I know I'm using BMP before it's test, but comp4.tif started life 
@@ -156,7 +156,7 @@ SKIP:
   ok($diff == 0, "image mismatch");
   my $img8 = Imager->new;
   ok($img8->read(file=>'testimg/comp8.tif'), "reading 8-bit paletted");
-  ok($img8->type eq 'paletted', "image isn't paletted");
+  is($img8->type, 'paletted', "image isn't paletted");
   print "# colors: ", $img8->colorcount,"\n";
   #ok($img8->write(file=>'testout/t106_was8.ppm'),
   #   "Cannot write img8");
@@ -174,16 +174,16 @@ SKIP:
   ok($cmp8->read(file=>'testout/t106_pal8.tif'),
      "reading 8-bit paletted");
   #print "# ",$cmp8->errstr,"\n";
-  ok($cmp8->type eq 'paletted', "pal8 isn't paletted");
-  ok($cmp8->colorcount == 256, "pal8 bad colorcount");
+  is($cmp8->type, 'paletted', "pal8 isn't paletted");
+  is($cmp8->colorcount, 256, "pal8 bad colorcount");
   $diff = i_img_diff($img8->{IMG}, $cmp8->{IMG});
   print "# diff $diff\n";
   ok($diff == 0, "written image doesn't match read");
   ok($img4->write(file=>'testout/t106_pal4.tif'), "writing 4-bit paletted");
   ok(my $cmp4 = Imager->new->read(file=>'testout/t106_pal4.tif'),
      "reading 4-bit paletted");
-  ok($cmp4->type eq 'paletted', "pal4 isn't paletted");
-  ok($cmp4->colorcount == 16, "pal4 bad colorcount");
+  is($cmp4->type, 'paletted', "pal4 isn't paletted");
+  is($cmp4->colorcount, 16, "pal4 bad colorcount");
   $diff = i_img_diff($img4->{IMG}, $cmp4->{IMG});
   print "# diff $diff\n";
   ok($diff == 0, "written image doesn't match read");
@@ -260,7 +260,7 @@ SKIP:
                               \&io_closer);
   ok($IO4, "new writecb obj");
   ok(i_writetiff_wiol($img, $IO4), "write to cb");
-  ok($work eq $odata, "write cb match");
+  is($work, $odata, "write cb match");
   ok($did_close, "write cb did close");
   open D1, ">testout/d1.tiff" or die;
   print D1 $work;
@@ -277,7 +277,7 @@ SKIP:
                               \&io_closer, 1);
   ok($IO5, "new writecb obj 2");
   ok(i_writetiff_wiol($img, $IO5), "write to cb2");
-  ok($work eq $odata, "write cb2 match");
+  is($work, $odata, "write cb2 match");
   ok($did_close, "write cb2 did close");
 
   open D3, ">testout/d3.tiff" or die;
@@ -299,7 +299,7 @@ SKIP:
     ok(i_img_diff($imgs[$i]{IMG}, $out[$i]{IMG}) == 0,
        "comparing image $i");
     my ($tag) = $out[$i]->tags(name=>'tiff_pagename');
-    ok($tag eq "Page ".($i+1),
+    is($tag, "Page ".($i+1),
        "tag doesn't match original image");
   }
 
@@ -324,13 +324,12 @@ SKIP:
      "compare second fax image");
 
   my ($format) = $imgs[0]->tags(name=>'i_format');
-  ok(defined $format && $format eq 'tiff', "check i_format tag");
+  is($format, 'tiff', "check i_format tag");
 
   my $unit = $imgs[0]->tags(name=>'tiff_resolutionunit');
   ok(defined $unit && $unit == 2, "check tiff_resolutionunit tag");
   my $unitname = $imgs[0]->tags(name=>'tiff_resolutionunit_name');
-  ok(defined $unitname && $unitname eq 'inch', 
-     "check tiff_resolutionunit_name tag");
+  is($unitname, 'inch', "check tiff_resolutionunit_name tag");
 
   my $warned = Imager->new;
   ok($warned->read(file=>"testimg/tiffwarn.tif"), "read tiffwarn.tif");
index dd8efcce551028a44977701a0763dd08a8dece93..fec8460a5537313a82ce905a2921e31409871634 100644 (file)
@@ -180,9 +180,9 @@ SKIP:
     # names
     my $face_name = Imager::i_t1_face_name($font->{id});
     print "# face $face_name\n";
-    ok($face_name eq 'ExistenceTest', "face name");
+    is($face_name, 'ExistenceTest', "face name");
     $face_name = $font->face_name;
-    ok($face_name eq 'ExistenceTest', "face name");
+    is($face_name, 'ExistenceTest', "face name");
 
     my @glyph_names = $font->glyph_names(string=>"!J/");
     is($glyph_names[0], 'exclam', "check exclam name OO");
index a5892a86b106e749ea91e2b1a9751c722299ceb0..347bb8b8770af540185f67f613c27f8c66f1a4e1 100644 (file)
@@ -136,15 +136,15 @@ SKIP:
     
     my $face_name = Imager::i_tt_face_name($hcfont->{id});
     print "# face $face_name\n";
-    ok($face_name eq 'ExistenceTest', "face name");
+    is($face_name, 'ExistenceTest', "face name (function)");
     $face_name = $hcfont->face_name;
-    ok($face_name eq 'ExistenceTest', "face name");
+    is($face_name, 'ExistenceTest', "face name (OO)");
     
     # FT 1.x cheats and gives names even if the font doesn't have them
     my @glyph_names = $hcfont->glyph_names(string=>"!J/");
-    ok($glyph_names[0] eq 'exclam', "check exclam name OO");
+    is($glyph_names[0], 'exclam', "check exclam name OO");
     ok(!defined($glyph_names[1]), "check for no J name OO");
-    ok($glyph_names[2] eq 'slash', "check slash name OO");
+    is($glyph_names[2], 'slash', "check slash name OO");
     
     print "# ** name table of the test font **\n";
     Imager::i_tt_dump_names($hcfont->{id});
index e24d0c9de1eac9d78ce178b9af65eb67f04df1f5..ec26498751784afa69947aa94358699669f03284 100644 (file)
@@ -121,7 +121,7 @@ SKIP:
   ok($font->utf8, "make sure utf8 method returns true");
 
   my $has_chars = $font->has_chars(string=>"\x01A");
-  ok($has_chars eq "\x00\x01", "has_chars scalar");
+  is($has_chars, "\x00\x01", "has_chars scalar");
   my @has_chars = $font->has_chars(string=>"\x01A");
   ok(!$has_chars[0], "has_chars list 0");
   ok($has_chars[1], "has_chars list 1");
index d69ea6b70bb84c606b9daefac7a5ba367ee7d118..b71e8921713d4370e797a4a355381d94f6595326 100644 (file)
@@ -184,7 +184,7 @@ SKIP:
   ok(@got == 2, "has_chars returned 2 items");
   ok(!$got[0], "have no chr(1)");
   ok($got[1], "have 'H'");
-  ok($oof->has_chars(string=>"H\x01") eq "\x01\x00",
+  is($oof->has_chars(string=>"H\x01"), "\x01\x00",
      "scalar has_chars()");
 
   print "# OO bounding boxes\n";
@@ -256,9 +256,9 @@ SKIP:
     if (Imager::Font::FreeType2::i_ft2_can_face_name()) {
       my $facename = Imager::Font::FreeType2::i_ft2_face_name($exfont->{id});
       print "# face name '$facename'\n";
-      ok($facename eq 'ExistenceTest', "test face name");
+      is($facename, 'ExistenceTest', "test face name");
       $facename = $exfont->face_name;
-      ok($facename eq 'ExistenceTest', "test face name OO");
+      is($facename, 'ExistenceTest', "test face name OO");
     }
     else {
       # make sure we get the error we expect