Branch Coverage

blib/lib/Image/ExifTool/Geotag.pm
Criterion Covered Total %
branch 309 638 48.4


line true false branch
140 0 9 unless (eval { do { require Time::Local } })
148 7 2 unless $points
152 7 2 unless $has
156 0 9 if ($val =~ /^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
0 9 elsif ($val =~ /(\x0d\x0a|\x0d|\x0a)/) { }
163 8 1 if ($et->Open(\*EXIFTOOL_TRKFILE, $val)) { }
1 0 elsif ($val eq 'DATETIMEONLY') { }
166 0 8 unless ($raf->Read($_, 256))
171 3 5 if (/^(\xef\xbb\xbf)?<(\?xml|gpx)[\s>]/) { }
5 0 elsif (/(\x0d\x0a|\x0d|\x0a)/) { }
191 0 8 unless ($from)
208 8 0 unless defined $csvDelim
211 8 322 unless $raf->ReadLine($_)
213 7 315 unless ($format)
215 0 7 if (/^<(\?xml|gpx)[\s>]/) { }
2 5 elsif (/^.*\$([A-Z]{2}(RMC|GGA|GLL|ZDA)|PMGNTRK),/) { }
0 5 elsif (/^A(FLA|XSY|FIL)/) { }
1 4 elsif (/^HFDTE(?:DATE:)?(\d{2})(\d{2})(\d{2})/) { }
0 4 elsif ($nmeaStart and /^B/) { }
0 4 elsif (/^TP,D,/) { }
1 3 elsif (/^\s*\d+\s+.*\sypr\s*$/ and (@tmp = split(' ', $_, 0)) == 12) { }
1 2 elsif (/\b(GPS)?Date/i && /\b(GPS)?(Date)?Time/i || /\bTime\(seconds\)/i and /\Q$csvDelim\E/) { }
0 2 elsif (/"(timelineObjects|placeVisit|activitySegment|latitudeE7)":/) { }
227 0 1 $3 >= 70 ? :
247 1 4 if (/^Time ?\(seconds\)$/i) { }
0 4 elsif (/^Date ?Time/i) { }
0 4 elsif (/^Date/i) { }
0 4 elsif (/^Time(?! ?\(text\))/i) { }
1 3 elsif (/^(Pos)?Lat/i) { }
1 2 elsif (/^(Pos)?Lon/i) { }
0 2 elsif (/^(Pos)?Alt/i) { }
0 2 elsif (/^(Angle)?(Heading|Track)/i) { }
0 2 elsif (/^(Angle)?Pitch/i or /^Camera ?Elevation ?Angle/i) { }
0 2 elsif (/^(Angle)?Roll/i) { }
251 1 0 if ($trackFile and $trackFile =~ m[(\d{4})-(\d{2})-(\d{2})[^/]+(\d{2})-(\d{2})-(\d{2})[^/]*$]) { }
267 0 1 if /ref$/i
270 0 1 if /ref$/i
280 3 2 if ($param) { }
295 0 2 if ++$skipped > 50
302 177 141 if ($format eq 'XML') { }
0 141 elsif ($format eq 'Winplus') { }
7 134 elsif ($format eq 'Bramor') { }
93 41 elsif ($format eq 'CSV') { }
0 41 elsif ($format eq 'JSON') { }
311 38 199 if ($arg =~ /^(\w+:)?(\w+)=(['"])(.*?)\3/g)
313 18 20 if ($tag)
315 0 18 if ($isOrient{$tag}) { }
0 18 elsif ($tag eq 'alt') { }
0 18 elsif ($tag eq 'atemp') { }
319 0 0 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
320 0 0 if $fix->{'alt'}
330 24 146 if (defined $tag and not $tag)
332 12 12 if (not $2) { }
11 1 elsif ($fix and $lastFix and %$fix) { }
340 0 44 unless defined $lastFix->{$_}
345 51 107 if (length $1) { }
0 107 elsif ($tok eq 'td') { }
346 32 19 if ($tag)
347 3 29 if ($tag eq 'coords') { }
349 0 0 if (defined $fix->{'lon'} and defined $fix->{'lat'} and defined $fix->{'alt'})
356 0 29 if ($isOrient{$tag}) { }
11 18 elsif ($tag eq 'alt') { }
0 18 elsif ($tag eq 'atemp') { }
360 0 11 if defined $fix->{'alt'} and not $fix->{'alt'} =~ /^[+-]?\d+\.?\d*/
361 11 0 if $fix->{'alt'}
372 26 14 unless defined $fix->{'lat'} and defined $fix->{'lon'} and $fix->{'time'}
373 0 14 unless ($fix->{'lat'} =~ /^[+-]?\d+\.?\d*/ and $fix->{'lon'} =~ /^[+-]?\d+\.?\d*/)
374 0 0 unless $e0
377 0 14 unless (defined($time = &GetTime($fix->{'time'})))
378 0 0 unless $e1
382 0 14 if defined $fix->{'pdop'} or defined $fix->{'hdop'} or defined $fix->{'nsats'}
384 0 14 if ($fix->{'begin'})
387 0 0 if (defined $begin and $begin < $time)
392 0 0 unless @saveFix
397 0 0 if not $i and $points->{$t}
412 0 0 if $td and not $fix->{'time'} and /[\s>](\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}:\d{2}(\.\d+)?)/
421 0 0 unless m[^TP,D,\s*([-+]?\d+\.\d*),\s*([-+]?\d+\.\d*),\s*(\d+)/(\d+)/(\d{4}),\s*(\d+):(\d+):(\d+)]
438 3 4 unless @parts == 12 and $parts[11] eq "ypr"
441 0 4 unless @d == 3 and @t == 3
467 1 460 unless defined $val
468 184 276 unless $param
469 0 276 if ($param eq 'datetime') { }
0 276 elsif ($param eq 'date') { }
0 276 elsif ($param eq 'time') { }
184 92 elsif ($param eq 'lat' or $param eq 'lon') { }
0 92 elsif ($param eq 'latref') { }
0 92 elsif ($param eq 'lonref') { }
92 0 elsif ($param eq 'runtime') { }
472 0 0 if ($dateTime)
477 0 0 if ($val =~ m[^(\d{2})/(\d{2})/(\d{4})$]) { }
0 0 elsif ($val =~ /(\d{4}).*?(\d{2}).*?(\d{2})/) { }
483 0 0 if ($val =~ /^(\d{1,2}):(\d{2}):(\d{2}(\.\d+)?).*?(([-+])(\d{1,2}):?(\d{2}))?/)
486 0 0 $6 eq '-' ? :
0 0 if $5
491 0 0 if $val =~ /^S/i
493 0 0 if $val =~ /^W/i
503 0 0 unless defined $fix->{$param}
506 92 0 if ($date and defined $secs and defined $fix->{'lat'} and defined $fix->{'lon'})
508 0 92 if defined $fix->{'alt'}
509 0 92 if defined $fix->{'track'}
510 0 92 if defined $fix->{'pitch'}
516 0 0 if (/"(latitudeE7|longitudeE7|latE7|lngE7|timestamp)":\s*"?(.*?)"?,?\s*[\x0d\x0a]/)
517 0 0 if ($1 eq 'timestamp') { }
0 0 elsif ($1 eq 'latitudeE7' or $1 eq 'latE7') { }
519 0 0 if $time and $fix->{'lat'} and $fix->{'lon'}
529 19 22 if ($format eq "NMEA")
532 1 18 unless /^(.*)\$([A-Z]{2}(RMC|GGA|GLL|GSA|ZDA)|PMGNTRK|PTNTHPR),/
534 0 18 if length $1
539 22 18 if ($format eq 'IGC') { }
3 15 elsif ($nmea eq 'RMC') { }
0 15 elsif ($nmea eq 'GGA') { }
0 15 elsif ($nmea eq 'GLL') { }
0 15 elsif ($nmea eq 'GSA') { }
0 15 elsif ($nmea eq 'ZDA') { }
12 3 elsif ($nmea eq 'PMGNTRK') { }
3 0 elsif ($nmea eq 'PTNTHPR') { }
544 12 10 unless /^B(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{3})([NS])(\d{3})(\d{2})(\d{3})([EW])([AV])(\d{5})(\d{5})/
545 10 0 $7 eq 'N' ? :
546 10 0 $11 eq 'E' ? :
547 10 0 $12 eq 'A' ? :
550 10 0 if ($dateFlarm)
551 0 10 if $secs < $lastSecs - &JITTER()
562 0 3 unless /^\$[A-Z]{2}RMC,(\d{2})(\d{2})(\d+(\.\d*)?),A?,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d*\.?\d*),(\d*\.?\d*),(\d{2})(\d{2})(\d+)/
563 0 3 if $13 > 31 or $14 > 12 or $15 > 99
564 3 0 $7 eq 'N' ? :
565 3 0 $10 eq 'E' ? :
566 3 0 if length $11
567 3 0 if length $12
568 0 3 $15 >= 70 ? :
578 0 0 unless /^\$[A-Z]{2}GGA,(\d{2})(\d{2})(\d+(\.\d*)?),(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),[1-6]?,(\d+)?,(\.\d+|\d+\.?\d*)?,(-?\d+\.?\d*)?,M?/
579 0 0 $7 eq 'N' ? :
580 0 0 $10 eq 'E' ? :
590 0 0 unless /^\$[A-Z]{2}GLL,(\d*?)(\d{1,2}\.\d+),([NS]),(\d*?)(\d{1,2}\.\d+),([EW]),(\d{2})(\d{2})(\d+(\.\d*)?),A/
591 0 0 $3 eq 'N' ? :
592 0 0 $6 eq 'E' ? :
599 0 0 unless /^\$[A-Z]{2}GSA,[AM],([23]),((?:\d*,){11}(?:\d*)),(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?,(\d+\.?\d*|\.\d+)?\*/
611 0 0 unless /^\$[A-Z]{2}ZDA,(\d{2})(\d{2})(\d{2}(\.\d*)?),(\d+),(\d+),(\d+)/
620 0 12 unless /^\$PMGNTRK,(\d+)(\d{2}\.\d+),([NS]),(\d+)(\d{2}\.\d+),([EW]),(-?\d+\.?\d*),([MF]),(\d{2})(\d{2})(\d+(\.\d*)?),A,(?:[^,]*,(\d{2})(\d{2})(\d+))?/
621 12 0 $3 eq 'N' ? :
622 0 12 $6 eq 'E' ? :
623 12 0 $8 eq 'M' ? :
625 12 0 if (defined $15)
626 0 12 if $13 > 31 or $14 > 12 or $15 > 99
628 0 12 $15 >= 70 ? :
641 0 3 unless /^\$PTNTHPR,(-?[\d.]+),[MNO],(-?[\d.]+),[MNO],(-?[\d.]+),[MNO]/
650 0 25 if (defined $secs and not defined $date and defined $lastDate)
652 0 0 if ($secs < $lastSecs - &JITTER())
657 0 0 if ($secs - $lastSecs < 10) { }
667 25 3 if (defined $date)
679 25 3 if ($nmea eq $nmeaStart or defined $secs and !defined($fixSecs) || $secs >= $fixSecs && $secs - $fixSecs >= 10 || $secs < $fixSecs && $secs + $secPerDay - $fixSecs >= 10) { }
689 25 0 if (defined $date) { }
0 0 elsif (defined $secs) { }
702 9 0 unless defined $fix->{$_}
704 0 3 if (defined $date) { }
0 3 elsif (defined $secs and not defined $fixSecs) { }
705 0 0 if $fix->{'isDate'}
707 0 0 if (defined $fixSecs) { }
709 0 0 if @fixTimes and $fixTimes[-1] == $fixSecs
713 0 0 if $secs < $fixSecs
720 0 0 if $noDateChanged
736 0 8 if ($noDate and not $geotag->{'NoDate'})
737 0 0 if ($isDate) { }
744 8 0 if $isDate
747 0 8 if ($isCut and $canCut)
751 0 0 unless $fix = $points->{$_}
752 0 0 if ($maxPDOP and $fix->{'pdop'} and $fix->{'pdop'} > $maxPDOP) { }
0 0 elsif ($maxHDOP and $fix->{'hdop'} and $fix->{'hdop'} > $maxHDOP) { }
0 0 elsif ($minSats and defined $fix->{'nsats'} and $fix->{'nsats'} ne '' and $fix->{'nsats'} < $minSats) { }
773 0 8 if $sortFixes
776 0 8 unless $fix = $$points{$fixTimes[0]}
781 1 7 if ($verbose)
783 0 1 unless $format
785 0 1 if $cutPDOP
786 0 1 if $cutHDOP
787 0 1 if $cutSats
788 1 0 if ($numPoints and $verbose > 1)
791 0 1 if $fixTimes[0] > $fixTimes[-1]
793 0 1 if ($verbose > 3)
799 8 0 if ($numPoints)
803 2 6 if $nmea{'GGA'} or $nmea{'PMGNTRK'} or $nmea{'B'}
804 1 7 if $nmea{'RMC'}
805 1 7 if $nmea{'PTNTHPR'}
819 0 14 unless $timeStr =~ /^(\d{4})-(\d+)-(\d+)T(\d+):(\d+):(\d+)(\.\d+)?(.*)/
821 3 11 if $7
826 3 11 if ($tz =~ /^([-+])(\d+):(\d{2})\b/ or $tz =~ /^([-+])(\d{2})(\d{2})?\b/)
828 0 3 if $1 eq "+"
842 3 7 if (ref $sync eq 'HASH') { }
844 2 1 if ($syncTimes) { }
849 0 0 $time < $syncTimes->[$pt] ? :
854 0 2 $t1 == $t0 ? :
879 0 4 if $i < 0 or $i >= scalar @$times
881 3 1 if abs $t - $t0 > $maxSecs
884 0 1 if defined $v
899 0 0 if ($dir) { }
904 0 0 if (defined $t1) { }
0 0 elsif (defined $t2) { }
905 0 0 if (defined $t2) { }
907 0 0 $t - $t1 < $t2 - $t ? :
915 0 0 if (defined $p and $et->{'OPTIONS'}{'Verbose'} > 2)
936 0 10 if $val and $geotag and not $geotag->{'IsDate'}
943 0 13 unless defined $geoMaxIntSecs
944 0 13 unless defined $geoMaxExtSecs
952 0 10 unless (defined $geotag)
956 9 1 unless ($times)
961 0 1 unless ($times and @$times or $geotag->{'DateTimeOnly'})
965 0 10 unless (eval { do { require Time::Local } })
971 10 0 if ($val =~ /^(\d{4}):(\d+):(\d+)\s+(\d+):(\d+):(\d+)(\.\d*)?(Z|([-+])(\d+):(\d+))?/) { }
0 0 elsif ($val =~ /^(\d{2}):(\d+):(\d+)(\.\d*)?(Z|([-+])(\d+):(\d+))?/) { }
984 9 1 if ($tz) { }
987 5 4 if ($tz ne "Z")
989 4 1 $t0 eq '-' ? :
996 1 9 if $fs and $fs ne "."
1000 0 10 if $noDate
1006 2 8 $time =~ /(\.\d+)$/ ? :
1008 1 9 if ($et->Options("Verbose") > 1 and not $secondTry)
1011 1 0 if defined $sync
1012 0 1 unless ($tz)
1018 1 9 if (not $times && @$times) { }
0 9 elsif ($time < $times->[0]) { }
1 8 elsif ($time > $times->[-1]) { }
1022 0 0 if ($time < $times->[0] - $geoMaxExtSecs) { }
1023 0 0 unless $err
1024 0 0 if $verbose > 2
1025 0 0 if $geotag->{'DateTimeOnly'}
1029 0 0 if $verbose > 2
1033 1 0 if ($time > $times->[-1] + $geoMaxExtSecs) { }
1034 1 0 unless $err
1035 0 1 if $verbose > 2
1036 0 1 if $geotag->{'DateTimeOnly'}
1040 0 0 if $verbose > 2
1048 10 14 $time < $times->[$pt] ? :
1055 0 8 $p1->{'first'} && $geoMaxIntSecs ? :
1058 0 8 if ($t1 - $t0 > $maxSecs and !($p1->{'span'} && $points->{$t0}{'span'}) || $p1->{'span'} != $points->{$t0}{'span'}) { }
1063 0 0 if ($time - $t0 < $t1 - $time) { }
1070 0 0 if (abs $time - $tn > $geoMaxExtSecs) { }
1071 0 0 unless $err
1072 0 0 if $verbose > 2
1073 0 0 if $geotag->{'DateTimeOnly'}
1076 0 0 if $verbose > 2
1080 0 8 $t1 == $t0 ? :
1082 0 8 if $verbose > 2
1089 21 19 unless $has->{$category}
1096 30 3 if (defined $v0 and defined $v1) { }
0 3 elsif (defined $f0b) { }
1101 0 0 unless defined $v0 and defined $v1
1107 0 3 if (defined $v0) { }
1111 3 0 unless defined $t0b
1113 0 0 if (defined $v1) { }
1117 0 0 unless defined $t1b
1120 0 0 $t1b == $t0b ? :
1121 0 0 if $verbose > 2
1125 0 30 if ($cyclical{$key} and abs $v1 - $v0 > 180) { }
1128 0 0 $v0 < $v1 ? :
1131 0 0 $key eq 'lon' || $key eq 'roll' ? :
1132 0 0 if $fix->{$key} >= $max
1141 9 1 if ($fix) { }
0 1 elsif ($geotag->{'NoDate'} and not $noDate and $val =~ s/^\S+\s+//) { }
1150 9 4 if ($fix) { }
1155 9 0 unless $noDate
1157 5 4 if (defined $fix->{'alt'}) { }
0 8 elsif ($has->{'alt'} and defined $iExt) { }
1159 0 5 $fix->{'alt'} < 0 ? :
1162 0 0 if ($tFix)
1164 0 0 $tFix->{'alt'} < 0 ? :
1170 1 8 if ($writeGroup)
1180 3 6 if ($has->{'track'})
1182 0 3 if (not defined $fix->{'track'} and defined $iExt)
1184 0 0 if $p
1187 2 1 defined $tFix->{'track'} ? :
1189 1 2 if (defined($spd = $tFix->{'speed'}))
1191 0 1 if ($ref and defined $speedConv{$ref}) { }
1192 0 0 if $speedConv{$speedConv{$ref}}
1201 3 6 if ($has->{'orient'})
1203 0 3 if (not defined $fix->{'dir'} and defined $iExt)
1205 0 0 if $p
1208 2 1 defined $tFix->{'dir'} ? :
1214 0 9 if ($has->{'atemp'})
1216 0 0 if (not defined $fix->{'atemp'} and defined $iExt)
1219 0 0 if $p
1223 8 1 unless ($xmp)
1225 6 1 $fix->{'lat'} > 0 ? :
7 1 if defined $fix->{'lat'}
1226 4 3 $fix->{'lon'} > 0 ? :
7 1 if defined $fix->{'lon'}
1235 9 0 unless ($exif)
1240 1 3 if defined $val
1241 2 2 if $writeGroup
1273 4 1 if ($val =~ /(.*?)\@(.*)/) { }
0 1 elsif (not $val =~ /^\d/ && $val =~ /:/) { }
1275 0 4 -f $2 ? :
1278 0 0 if -f $val
1280 4 1 if ($gpsTime or defined $syncFile) { }
1282 0 4 if (defined $syncFile)
1288 0 0 if $info->{'Error'}
1289 0 0 unless ($gpsTime)
1291 0 0 if $gpsTime and not $info->{'GPSDateTime'}
1293 0 0 unless $gpsTime
1296 0 0 if ($info->{$tag})
1302 0 0 unless $imgTime
1306 4 0 if ($imgTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
0 0 elsif ($gpsTime =~ /^(\d+:\d+:\d+)\s+\d+/) { }
1309 4 0 if ($gpsTime =~ /^\d+:\d+:\d+\s+\d+/) { }
1327 0 4 unless defined $imgSecs
1329 0 4 unless defined $gpsSecs
1331 0 4 if $gpsTime =~ /(\.\d+)/
1332 0 4 if $imgTime =~ /(\.\d+)/
1334 0 4 if ($gpsDateTime ne $gpsTime or $imgDateTime ne $imgTime)
1336 0 0 if $diff > 43200
1337 0 0 if $diff < -43200
1338 0 0 if ($gpsDateTime ne $gpsTime) { }
1347 4 0 unless ($noDate)
1348 2 2 unless $sync->{'Points'}
1351 2 2 if ($et->Options("Verbose") > 1)
1359 2 2 if (@times > 1)
1367 0 1 unless @vals
1372 1 1 unless @vals
1375 0 1 $val =~ /^\s*-/ ? :
1404 0 0 if ($fix)
1406 0 0 unless $_ eq "time" or not defined $fix->{$_}