Branch Coverage

blib/lib/Image/ExifTool/PNG.pm
Criterion Covered Total %
branch 175 400 43.7


line true false branch
681 13 11 if $lang =~ /^([a-z]{2,3}|[xi])(-[a-z]{2})\b(.*)/i
719 0 0 $yr > 70 ? :
0 0 if $yr < 100
720 0 0 unless $mon = $monthNum{ucfirst lc $mon}
721 0 0 if (not $tz) { }
0 0 elsif ($tzConv{uc $tz}) { }
0 0 elsif ($tz =~ /^([-+]\d+):?(\d{2})/) { }
732 0 0 if ($et->Options("StrictDate") and not $et->{'TAGS_FROM_FILE'} or $et->Options("Validate"))
745 0 0 if ($et->Options("StrictDate"))
747 0 0 if ($val =~ /^(\d{4}):(\d{2}):(\d{2}) (\d{2})(:\d{2})(:\d{2})?(?:\.\d*)?\s*(\S*)/)
749 0 0 unless $sec
751 0 0 unless $mon = $monName{$mon + 0}
752 0 0 if (length $tz)
753 0 0 unless $tz =~ /^(Z|[-+]\d{2}:?\d{2})/
757 0 0 unless $err
759 0 0 if ($err)
776 0 23 if $tagInfo->{'SubDirectory'}
792 0 100 unless defined $val
795 1 99 if ($lang)
804 0 100 if (not $tagInfo and $lang)
807 0 0 if $tagInfo
813 2 98 if ($compressed and $compressed > 1)
814 2 0 if ($compressed == 2) { }
815 2 0 if (eval { do { require Compress::Zlib } }) { }
0 0 elsif (not $noCompressLib) { }
818 2 0 if $inflate
819 2 0 if ($inflate and $stat == Compress::Zlib::Z_STREAM_END()) { }
835 0 0 if ($compressed and $verbose and $tagInfo and $tagInfo->{'SubDirectory'})
839 0 2 if ($deflateErr and not $outBuff)
841 0 0 if $deflateErr =~ /^Install/
845 22 12 if ($enc and not $compressed and not $tagInfo && $tagInfo->{'SubDirectory'})
851 100 0 if ($tagInfo) { }
0 0 elsif ($outBuff) { }
854 64 36 if ($tagInfo->{'SubDirectory'})
855 0 0 if ($et->{'OPTIONS'}{'Validate'} and $tagInfo->{'NonStandard'})
860 64 0 if (not $compressed) { }
0 0 elsif ($outBuff) { }
862 0 64 if ($verbose and $et->{'INDENT'} ne " ")
863 0 0 if ($wasCompressed and $verbose > 2)
865 0 0 if $wasCompressed
875 5 59 if $outBuff and not $subTable->{'WRITE_PROC'}
888 1 1 if $wasCompressed and $processProc and $processProc eq \&Image::ExifTool::PNG::ProcessPNG_Compressed
890 5 54 if ($outBuff and not $processProc and $subTable ne \%Image::ExifTool::PNG::TextualData) { }
891 2 3 unless $et->{'EDIT_DIRS'}{$dirName}
893 3 0 if ($tagName eq "XMP" and $$outBuff)
903 0 0 if ($et->{'DEL_GROUP'}{$dirName} or $dirName eq 'EXIF' and $et->{'DEL_GROUP'}{'IFD0'}) { }
908 0 0 if ($et->{'EDIT_DIRS'}{$dirName} or $dirName eq "EXIF" and $et->{'EDIT_DIRS'}{'IFD0'})
916 23 70 if ($outBuff)
919 5 3 if ($writable or $tagTablePtr->{'WRITABLE'} and not defined $writable and not $tagInfo->{'SubDirectory'})
924 1 4 if ($et->{'DEL_GROUP'}{'PNG'}) { }
934 0 4 if (defined $deflateErr) { }
937 0 0 if ($isOverwriting > 0) { }
0 0 elsif ($isOverwriting) { }
941 0 0 if $deflateErr
944 0 4 if ($isOverwriting < 0)
951 2 3 if ($isOverwriting)
952 0 2 defined $newVal ? :
955 0 2 if defined $newVal
958 6 17 if (defined $$outBuff and length $$outBuff)
959 3 3 if ($enc) { }
0 3 elsif ($wasCompressed) { }
965 0 0 if ($deflate) { }
967 0 0 if defined $$outBuff
971 0 0 if (not $$outBuff) { }
0 0 elsif (lc $tag eq 'zxif') { }
980 44 26 if $processed
982 0 0 if ($et->{'DEL_GROUP'}{'PNG'} and $tagTablePtr eq \%Image::ExifTool::PNG::TextualData)
993 0 0 if $lang
995 0 0 if $tag =~ /^Raw profile type /
996 0 0 if $verbose
1002 0 26 if ($verbose)
1011 0 0 if $subdir
1015 0 26 if ($compressed and not defined $tagInfo->{'ValueConv'})
1020 0 26 if $delRawConv
1039 0 1 unless $$dataPt =~ /^\n(.*?)\n\s*(\d+)\n(.*)/s
1044 0 1 if ($len ne $actualLen)
1049 0 1 if ($verbose)
1050 0 0 if ($verbose > 2)
1072 1 0 if ($tagTablePtr ne $exifTable) { }
0 0 elsif ($buff =~ /^$Image::ExifTool::exifAPP1hdr/) { }
0 0 elsif ($buff =~ /^$Image::ExifTool::xmpAPP1hdr/) { }
0 0 elsif ($buff =~ /^(MM\0\x2a|II\x2a\0)/) { }
1075 0 1 if ($tagName eq "IPTC_Profile" and $buff =~ /^\x1c/)
1079 0 1 if ($outBuff) { }
1082 0 0 unless $dir =~ /^ICC/
1083 0 0 unless $editDirs->{$dir}
1091 0 0 if $outBuff and not $editDirs->{'IFD0'}
1095 0 0 if ($outBuff) { }
1097 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1104 0 0 if $$outBuff
1115 0 0 if ($outBuff) { }
1116 0 0 unless $editDirs->{'XMP'}
1118 0 0 if $$outBuff
1125 0 0 if $outBuff and not $editDirs->{'IFD0'}
1126 0 0 if ($outBuff) { }
1128 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1144 0 0 if ($outBuff and defined $$outBuff and length $$outBuff)
1145 0 0 if ($et->{'CHANGED'} != $oldChanged) { }
1165 0 2 unless defined $val
1174 1 1 if ($tagInfo and $tagInfo->{'Name'} eq 'ICC_Profile') { }
1177 1 0 if length $tag and not $outBuff
1179 0 1 if ($outBuff and $$outBuff)
1181 0 0 if (defined $profileName)
1203 1 20 if $et->{'OPTIONS'}{'Verbose'}
1216 0 12 unless defined $dat and length $dat >= 4
1220 0 12 if $compressed
1222 1 11 if $et->{'OPTIONS'}{'Verbose'}
1241 0 2 if ($$dataPt =~ /^Exif\0\0/)
1245 0 0 if $dirInfo->{'DirLen'}
1247 2 0 if ($$dataPt =~ /^(\0|II|MM)/) { }
0 0 elsif ($del) { }
1258 0 2 if ($type eq "\000") { }
2 0 elsif (not $outBuff) { }
0 0 elsif ($del and lc $tag eq 'zxif') { }
0 0 elsif ($et->{'EDIT_DIRS'}{'IFD0'}) { }
1296 0 12 unless $raf->Read($sig, 8) == 8 and $pngLookup{$sig}
1298 5 7 if ($outfile) { }
1300 5 0 if $outfile
1309 0 7 if $fastScan
1316 0 12 if ($fileType ne "PNG")
1324 5 7 if ($outfile)
1327 0 30 if $len > 2147483647
1328 15 15 if ($wasDat) { }
5 10 elsif ($isDatChunk{$chunk}) { }
1329 5 10 if $noLeapFrog{$chunk}
1330 10 0 if $isTxtChunk{$chunk}
1334 0 25 unless $raf->Seek($len + 4, 1)
1336 0 5 unless $raf->Seek(8, 0)
1343 15 95 if ($doTxt)
1345 0 15 unless $raf->Seek(shift @txtOffset, 0)
1347 5 10 unless @txtOffset
1351 7 103 if ($wasEnd) { }
0 103 elsif ($n != 8) { }
1352 7 0 unless $n
1354 0 0 if $n < 8
1357 0 0 unless $wasEnd
1361 0 103 if ($len > 2147483647)
1362 0 0 unless $wasEnd
1365 9 94 if ($verbose)
1366 2 7 if $doTxt
1368 1 8 if ($datCount and $chunk ne $datChunk)
1369 0 1 $datCount > 1 ? :
1374 12 91 unless ($wasHdr)
1375 12 0 if ($chunk eq $hdrChunk) { }
0 0 elsif ($hdrChunk eq 'IHDR' and $chunk eq 'CgBI') { }
1383 5 40 if ($outfile and $isDatChunk{$chunk} || $chunk eq $endChunk and @txtOffset)
1389 12 86 if ($isDatChunk{$chunk}) { }
1390 0 12 if ($fastScan and $fastScan >= 2)
1401 40 58 if ($outfile)
1403 10 30 if ($datChunk or $chunk eq $endChunk) { }
0 30 elsif ($chunk eq 'PLTE') { }
1408 0 10 unless &AddChunks($et, $outfile)
1409 0 10 unless &AddChunks($et, $outfile, "IFD0")
1416 12 86 if ($chunk eq $endChunk)
1418 0 12 unless ($raf->Read($cbuf, 4) == 4)
1419 0 0 unless $wasEnd
1422 1 11 if $verbose
1424 5 7 if ($outfile)
1426 0 5 unless &Write($outfile, $hbuf, $cbuf)
1427 0 5 if ($et->{'DEL_GROUP'}{'Trailer'}) { }
1428 0 0 if ($raf->Read($hbuf, 1))
1429 0 0 if $verbose
1436 5 0 unless $n = $raf->Read($hbuf, 65536)
1438 0 0 unless &Write($outfile, $hbuf)
1440 0 5 if $tot and $verbose
1446 12 74 if ($datChunk) { }
15 59 elsif ($wasDat and $isTxtChunk{$chunk}) { }
1448 5 7 if ($outfile) { }
7 0 elsif (not $validate or $len > $chunkSizeLimit) { }
1450 0 5 if ($len > $chunkSizeLimit)
1451 0 0 unless &Write($outfile, $hbuf)
1452 0 0 unless &Image::ExifTool::CopyBlock($raf, $outfile, $len + 4)
1457 0 7 unless $raf->Seek($len + 4, 1)
1462 5 10 if (not $outfile) { }
0 10 elsif (defined $doTxt) { }
1472 0 79 unless ($raf->Read($dbuf, $len) == $len and $raf->Read($cbuf, 4) == 4)
1473 0 0 unless $wasEnd
1476 28 44 if ($verbose or $validate or $outfile and not $fastScan)
1480 0 35 unless ($crc == unpack("N", $cbuf))
1482 0 0 $outfile ? :
1484 5 30 if ($datChunk)
1485 5 0 if $outfile
1489 10 20 if ($outfile and $wasDat)
1490 10 0 if ($isTxtChunk{$chunk} and not defined $doTxt)
1491 0 10 if $et->{'FORCE_WRITE'}{'PNG'}
1492 2 8 if $verbose
1496 0 0 if $noLeapFrog{$chunk}
1498 4 16 if ($verbose)
1500 0 4 if $verbose > 2
1504 0 64 if (not $tagTablePtr->{$chunk} and $Image::ExifTool::PNG::stdCase{lc $chunk})
1506 0 0 if ($outfile and $et->{'EDIT_DIRS'}{'IFD0'} || !($stdChunk =~ /^[ez]xif$/i)) { }
1516 20 44 if $outfile
1517 64 0 if ($tagTablePtr->{$chunk}) { }
0 0 elsif ($mngTablePtr and $mngTablePtr->{$chunk}) { }
1522 20 44 if ($outfile)
1523 5 15 if (defined $theBuff)
1524 2 3 unless length $theBuff
1526 3 0 if ($et->{'TextChunkType'})
1536 0 18 unless &Write($outfile, $hbuf, $dbuf, $cbuf)
1540 0 5 if $outfile and $err || !$wasEnd