From 5386861ea0f35cedfa8d7ce4000b6b5d12b6e4a0 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sun, 26 Nov 2006 11:25:29 +0000 Subject: [PATCH] convert ok(... eq ..., ... ) to is(..., ..., ...) RT 23184 --- t/t022double.t | 2 +- t/t023palette.t | 10 +++++----- t/t07iolayer.t | 4 ++-- t/t106tiff.t | 25 ++++++++++++------------- t/t30t1font.t | 4 ++-- t/t35ttfont.t | 8 ++++---- t/t36oofont.t | 2 +- t/t38ft2font.t | 6 +++--- 8 files changed, 30 insertions(+), 31 deletions(-) diff --git a/t/t022double.t b/t/t022double.t index 80d7823d..ec14e203 100644 --- a/t/t022double.t +++ b/t/t022double.t @@ -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; diff --git a/t/t023palette.t b/t/t023palette.t index 6faad048..d9603880 100644 --- a/t/t023palette.t +++ b/t/t023palette.t @@ -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; diff --git a/t/t07iolayer.t b/t/t07iolayer.t index a86ddb69..47a98f9f 100644 --- a/t/t07iolayer.t +++ b/t/t07iolayer.t @@ -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"; diff --git a/t/t106tiff.t b/t/t106tiff.t index 0c964eca..db21e97b 100644 --- a/t/t106tiff.t +++ b/t/t106tiff.t @@ -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"); diff --git a/t/t30t1font.t b/t/t30t1font.t index dd8efcce..fec8460a 100644 --- a/t/t30t1font.t +++ b/t/t30t1font.t @@ -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"); diff --git a/t/t35ttfont.t b/t/t35ttfont.t index a5892a86..347bb8b8 100644 --- a/t/t35ttfont.t +++ b/t/t35ttfont.t @@ -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}); diff --git a/t/t36oofont.t b/t/t36oofont.t index e24d0c9d..ec264987 100644 --- a/t/t36oofont.t +++ b/t/t36oofont.t @@ -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"); diff --git a/t/t38ft2font.t b/t/t38ft2font.t index d69ea6b7..b71e8921 100644 --- a/t/t38ft2font.t +++ b/t/t38ft2font.t @@ -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 -- 2.39.5