Branch Coverage

blib/lib/Image/ExifTool/PNG.pm
Criterion Covered Total %
branch 178 408 43.6


line true false branch
766 13 11 if $lang =~ /^([a-z]{2,3}|[xi])(-[a-z]{2})\b(.*)/i
804 0 0 $yr > 70 ? :
0 0 if $yr < 100
805 0 0 unless $mon = $monthNum{ucfirst lc $mon}
806 0 0 if (not $tz) { }
0 0 elsif ($tzConv{uc $tz}) { }
0 0 elsif ($tz =~ /^([-+]\d+):?(\d{2})/) { }
817 0 0 if ($et->Options("StrictDate") and not $et->{'TAGS_FROM_FILE'} or $et->Options("Validate"))
830 0 0 if ($et->Options("StrictDate"))
832 0 0 if ($val =~ /^(\d{4}):(\d{2}):(\d{2}) (\d{2})(:\d{2})(:\d{2})?(?:\.\d*)?\s*(\S*)/)
834 0 0 unless $sec
836 0 0 unless $mon = $monName{$mon + 0}
837 0 0 if (length $tz)
838 0 0 unless $tz =~ /^(Z|[-+]\d{2}:?\d{2})/
842 0 0 unless $err
844 0 0 if ($err)
861 0 23 if $tagInfo->{'SubDirectory'}
877 0 100 unless defined $val
880 1 99 if ($lang)
889 0 100 if (not $tagInfo and $lang)
892 0 0 if $tagInfo
898 2 98 if ($compressed and $compressed > 1)
899 2 0 if ($compressed == 2) { }
900 2 0 if (eval { do { require Compress::Zlib } }) { }
0 0 elsif (not $noCompressLib) { }
903 2 0 if $inflate
904 2 0 if ($inflate and $stat == Compress::Zlib::Z_STREAM_END()) { }
920 0 0 if ($compressed and $verbose and $tagInfo and $tagInfo->{'SubDirectory'})
924 0 2 if ($deflateErr and not $outBuff)
926 0 0 if $deflateErr =~ /^Install/
930 22 12 if ($enc and not $compressed and not $tagInfo && $tagInfo->{'SubDirectory'})
936 100 0 if ($tagInfo) { }
0 0 elsif ($outBuff) { }
939 64 36 if ($tagInfo->{'SubDirectory'})
940 0 0 if ($et->{'OPTIONS'}{'Validate'} and $tagInfo->{'NonStandard'})
945 64 0 if (not $compressed) { }
0 0 elsif ($outBuff) { }
947 0 64 if ($verbose and $et->{'INDENT'} ne " ")
948 0 0 if ($wasCompressed and $verbose > 2)
950 0 0 if $wasCompressed
960 5 59 if $outBuff and not $subTable->{'WRITE_PROC'}
973 1 1 if $wasCompressed and $processProc and $processProc eq \&Image::ExifTool::PNG::ProcessPNG_Compressed
975 5 54 if ($outBuff and not $processProc and $subTable ne \%Image::ExifTool::PNG::TextualData) { }
976 2 3 unless $et->{'EDIT_DIRS'}{$dirName}
978 3 0 if ($tagName eq "XMP" and $$outBuff)
988 0 0 if ($et->{'DEL_GROUP'}{$dirName} or $dirName eq 'EXIF' and $et->{'DEL_GROUP'}{'IFD0'}) { }
993 0 0 if ($et->{'EDIT_DIRS'}{$dirName} or $dirName eq "EXIF" and $et->{'EDIT_DIRS'}{'IFD0'})
1001 23 70 if ($outBuff)
1004 5 3 if ($writable or $tagTablePtr->{'WRITABLE'} and not defined $writable and not $tagInfo->{'SubDirectory'})
1009 1 4 if ($et->{'DEL_GROUP'}{'PNG'}) { }
1019 0 4 if (defined $deflateErr) { }
1022 0 0 if ($isOverwriting > 0) { }
0 0 elsif ($isOverwriting) { }
1026 0 0 if $deflateErr
1029 0 4 if ($isOverwriting < 0)
1036 2 3 if ($isOverwriting)
1037 0 2 defined $newVal ? :
1040 0 2 if defined $newVal
1043 6 17 if (defined $$outBuff and length $$outBuff)
1044 3 3 if ($enc) { }
0 3 elsif ($wasCompressed) { }
1050 0 0 if ($deflate) { }
1052 0 0 if defined $$outBuff
1056 0 0 if (not $$outBuff) { }
0 0 elsif (lc $tag eq 'zxif') { }
1065 44 26 if $processed
1067 0 0 if ($et->{'DEL_GROUP'}{'PNG'} and $tagTablePtr eq \%Image::ExifTool::PNG::TextualData)
1078 0 0 if $lang
1080 0 0 if $tag =~ /^Raw profile type /
1081 0 0 if $verbose
1087 0 26 if ($verbose)
1096 0 0 if $subdir
1100 0 26 if ($compressed and not defined $tagInfo->{'ValueConv'})
1105 0 26 if $delRawConv
1124 0 1 unless $$dataPt =~ /^\n(.*?)\n\s*(\d+)\n(.*)/s
1129 0 1 if ($len ne $actualLen)
1134 0 1 if ($verbose)
1135 0 0 if ($verbose > 2)
1157 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)/) { }
1160 0 1 if ($tagName eq "IPTC_Profile" and $buff =~ /^\x1c/)
1164 0 1 if ($outBuff) { }
1167 0 0 unless $dir =~ /^ICC/
1168 0 0 unless $editDirs->{$dir}
1176 0 0 if $outBuff and not $editDirs->{'IFD0'}
1180 0 0 if ($outBuff) { }
1182 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1189 0 0 if $$outBuff
1200 0 0 if ($outBuff) { }
1201 0 0 unless $editDirs->{'XMP'}
1203 0 0 if $$outBuff
1210 0 0 if $outBuff and not $editDirs->{'IFD0'}
1211 0 0 if ($outBuff) { }
1213 0 0 if ($et->{'DEL_GROUP'}{'EXIF'} or $et->{'DEL_GROUP'}{'IFD0'})
1229 0 0 if ($outBuff and defined $$outBuff and length $$outBuff)
1230 0 0 if ($et->{'CHANGED'} != $oldChanged) { }
1250 0 2 unless defined $val
1259 1 1 if ($tagInfo and $tagInfo->{'Name'} eq 'ICC_Profile') { }
1262 1 0 if length $tag and not $outBuff
1264 0 1 if ($outBuff and $$outBuff)
1266 0 0 if (defined $profileName)
1288 1 20 if $et->{'OPTIONS'}{'Verbose'}
1301 0 12 unless defined $dat and length $dat >= 4
1305 0 12 if $compressed
1307 1 11 if $et->{'OPTIONS'}{'Verbose'}
1326 0 2 if ($$dataPt =~ /^Exif\0\0/)
1330 0 0 if $dirInfo->{'DirLen'}
1332 2 0 if ($$dataPt =~ /^(\0|II|MM)/) { }
0 0 elsif ($del) { }
1343 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'}) { }
1382 0 12 unless $raf->Read($sig, 8) == 8 and $pngLookup{$sig}
1384 5 7 if ($outfile) { }
1386 5 0 if $outfile
1395 0 7 if $fastScan
1402 0 12 if ($fileType ne "PNG")
1410 5 7 if ($outfile)
1413 0 30 if $len > 2147483647
1414 15 15 if ($wasDat) { }
5 10 elsif ($isDatChunk{$chunk}) { }
1415 5 10 if $noLeapFrog{$chunk}
1416 10 0 if $isTxtChunk{$chunk}
1420 0 25 unless $raf->Seek($len + 4, 1)
1422 0 5 unless $raf->Seek(8, 0)
1429 15 95 if ($doTxt)
1431 0 15 unless $raf->Seek(shift @txtOffset, 0)
1433 5 10 unless @txtOffset
1437 7 103 if ($wasEnd) { }
0 103 elsif ($n != 8) { }
1438 7 0 unless $n
1440 0 0 if $n < 8
1443 0 0 unless $wasEnd
1447 0 103 if ($len > 2147483647)
1448 0 0 unless $wasEnd
1451 9 94 if ($verbose)
1452 2 7 if $doTxt
1454 1 8 if ($datCount and $chunk ne $datChunk)
1455 0 1 $datCount > 1 ? :
1457 0 1 if $md5
1461 12 91 unless ($wasHdr)
1462 12 0 if ($chunk eq $hdrChunk) { }
0 0 elsif ($hdrChunk eq 'IHDR' and $chunk eq 'CgBI') { }
1470 5 40 if ($outfile and $isDatChunk{$chunk} || $chunk eq $endChunk and @txtOffset)
1476 12 86 if ($isDatChunk{$chunk}) { }
1477 0 12 if ($fastScan and $fastScan >= 2)
1488 40 58 if ($outfile)
1490 10 30 if ($datChunk or $chunk eq $endChunk) { }
0 30 elsif ($chunk eq 'PLTE') { }
1495 0 10 unless &AddChunks($et, $outfile)
1496 0 10 unless &AddChunks($et, $outfile, "IFD0")
1503 12 86 if ($chunk eq $endChunk)
1505 0 12 unless ($raf->Read($cbuf, 4) == 4)
1506 0 0 unless $wasEnd
1509 1 11 if $verbose
1511 5 7 if ($outfile)
1513 0 5 unless &Write($outfile, $hbuf, $cbuf)
1514 0 5 if ($et->{'DEL_GROUP'}{'Trailer'}) { }
1515 0 0 if ($raf->Read($hbuf, 1))
1516 0 0 if $verbose
1523 5 0 unless $n = $raf->Read($hbuf, 65536)
1525 0 0 unless &Write($outfile, $hbuf)
1527 0 5 if $tot and $verbose
1533 12 74 if ($datChunk) { }
15 59 elsif ($wasDat and $isTxtChunk{$chunk}) { }
1535 5 7 if ($outfile) { }
7 0 elsif (not $validate or $len > $chunkSizeLimit) { }
1537 0 5 if ($len > $chunkSizeLimit)
1538 0 0 unless &Write($outfile, $hbuf)
1539 0 0 unless &Image::ExifTool::CopyBlock($raf, $outfile, $len + 4)
1544 0 7 if ($md5) { }
1546 0 0 unless $raf->Read($cbuf, 4) == 4
1548 0 7 unless $raf->Seek($len + 4, 1)
1554 5 10 if (not $outfile) { }
0 10 elsif (defined $doTxt) { }
1564 0 79 unless ($raf->Read($dbuf, $len) == $len and $raf->Read($cbuf, 4) == 4)
1565 0 0 unless $wasEnd
1568 0 79 if $md5 and $datChunk
1569 28 44 if ($verbose or $validate or $outfile and not $fastScan)
1573 0 35 unless ($crc == unpack("N", $cbuf))
1575 0 0 $outfile ? :
1577 5 30 if ($datChunk)
1578 5 0 if $outfile
1582 10 20 if ($outfile and $wasDat)
1583 10 0 if ($isTxtChunk{$chunk} and not defined $doTxt)
1584 0 10 if $et->{'FORCE_WRITE'}{'PNG'}
1585 2 8 if $verbose
1589 0 0 if $noLeapFrog{$chunk}
1591 4 16 if ($verbose)
1593 0 4 if $verbose > 2
1597 0 64 if (not $tagTablePtr->{$chunk} and $Image::ExifTool::PNG::stdCase{lc $chunk})
1599 0 0 if ($outfile and $et->{'EDIT_DIRS'}{'IFD0'} || !($stdChunk =~ /^[ez]xif$/i)) { }
1609 20 44 if $outfile
1610 64 0 if ($tagTablePtr->{$chunk}) { }
0 0 elsif ($mngTablePtr and $mngTablePtr->{$chunk}) { }
1615 20 44 if ($outfile)
1616 5 15 if (defined $theBuff)
1617 2 3 unless length $theBuff
1619 3 0 if ($et->{'TextChunkType'})
1629 0 18 unless &Write($outfile, $hbuf, $dbuf, $cbuf)
1633 0 5 if $outfile and $err || !$wasEnd