diff --git a/samples/geotag.cpp b/samples/geotag.cpp index df1107fd..e8ece3d7 100644 --- a/samples/geotag.cpp +++ b/samples/geotag.cpp @@ -349,7 +349,7 @@ void charHandler(void* userData,const char* s,int len) } me->bTime=false; } - if ( me->bEle && len > 5 ) { + if ( me->bEle && len > 2 ) { if ( len < l_max ) { memcpy(buffer,s,len); buffer[len]=0; @@ -403,6 +403,7 @@ time_t parseTime(const char* arg,bool bAdjust) T.tm_year = YY -1900 ; T.tm_mon = MM -1 ; T.tm_mday = DD ; + T.tm_isdst = -1 ; // determine value automatically (otherwise hour may shift) result = mktime(&T); } } catch ( ... ) {}; @@ -852,7 +853,7 @@ int main(int argc,const char* argv[]) s = abs(s); int m = s/60 ; s-= m*60 ; - printf("tz,dsl,adjust = %d,%d,%d total = %dsecs (= %d:%d:%d)\n",t,d,a,A,h,m,s); + printf("tz,dst,adjust = %d,%d,%d total = %dsecs (= %d:%d:%d)\n",t,d,a,A,h,m,s); } for ( size_t p = 0 ; !options.dryrun && p < gFiles.size() ; p++ ) { std::string arg = gFiles[p] ; diff --git a/test/Makefile b/test/Makefile index 2dff2e4d..eaaac42f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -67,6 +67,7 @@ TESTS = addmoddel.sh \ conversions.sh \ exifdata-test.sh \ exiv2-test.sh \ + geotag-test.sh \ imagetest.sh \ icc-test.sh \ iotest.sh \ diff --git a/test/data/FurnaceCreekInn.gpx b/test/data/FurnaceCreekInn.gpx new file mode 100644 index 00000000..d6acc6bf --- /dev/null +++ b/test/data/FurnaceCreekInn.gpx @@ -0,0 +1,218 @@ + + + + + + 124.856079 + 001 + 17-MAR-07 + 17-MAR-07 + Flag, Blue + + + 793.688232 + 002 + 27-MAY-07 + 27-MAY-07 + Flag, Blue + + + 325.049072 + GARMIN + GARMIN + GARMIN + Flag, Blue + + + 35.934692 + GRMEUR + GRMEUR + GRMEUR + Flag, Blue + + + 38.097656 + GRMTWN + GRMTWN + GRMTWN + Flag, Blue + + + 47 + + + 91.462524 + + + + -0.824097 + + + + -0.343384 + + + + 0.618042 + + + + 0.618042 + + + + 0.137451 + + + + 0.618042 + + + + 0.618042 + + + + 0.618042 + + + + -1.785278 + + + + -4.188599 + + + + -3.227295 + + + + -2.746704 + + + + -2.265991 + + + + -1.785278 + + + + -1.785278 + + + + -1.785278 + + + + -2.746704 + + + + -4.669312 + + + + -8.033936 + + + + -10.917847 + + + + -12.359863 + + + + -14.282471 + + + + -15.243652 + + + + -14.282471 + + + + -14.763062 + + + + -14.763062 + + + + -14.282471 + + + + -12.359863 + + + + -11.879150 + + + + -8.033936 + + + + -7.553101 + + + + -7.072510 + + + + -6.111206 + + + + -4.188599 + + + + -2.746704 + + + + -1.785278 + + + + -0.343384 + + + + -0.343384 + + + + -0.824097 + + + + -28.221558 + + + + -28.702148 + + + + + diff --git a/test/data/FurnaceCreekInn.jpg b/test/data/FurnaceCreekInn.jpg new file mode 100644 index 00000000..a918f27a Binary files /dev/null and b/test/data/FurnaceCreekInn.jpg differ diff --git a/test/data/geotag-test.out b/test/data/geotag-test.out new file mode 100644 index 00000000..caba0ccf --- /dev/null +++ b/test/data/geotag-test.out @@ -0,0 +1,27 @@ +--- show GPSInfo tags --- +Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0 +Exif.GPSInfo.GPSLatitudeRef Ascii 2 North +Exif.GPSInfo.GPSLatitude Rational 3 36deg 26' 54" +Exif.GPSInfo.GPSLongitudeRef Ascii 2 West +Exif.GPSInfo.GPSLongitude Rational 3 116deg 51' 18" +Exif.GPSInfo.GPSAltitudeRef Byte 1 Below sea level +Exif.GPSInfo.GPSAltitude Rational 1 14.3 m +Exif.GPSInfo.GPSTimeStamp Rational 3 09:54:28 +Exif.GPSInfo.GPSMapDatum Ascii 7 WGS-84 +Exif.GPSInfo.GPSProcessingMethod Undefined 18 65 83 67 73 73 0 0 0 72 89 66 82 73 68 45 70 73 88 +Exif.GPSInfo.GPSDateStamp Ascii 20 2008:05:08 09:54:28 +--- deleting the GPSInfo tags +--- run geotag --- +/Users/rmills/gnu/exiv2/trunk/test/tmp/FurnaceCreekInn.jpg 116.51'18"W 036.26'54"N -14.282 -3 +--- show GPSInfo tags --- +Exif.GPSInfo.GPSVersionID Byte 4 2.2.0.0 +Exif.GPSInfo.GPSLatitudeRef Ascii 2 North +Exif.GPSInfo.GPSLatitude Rational 3 36deg 26' 54" +Exif.GPSInfo.GPSLongitudeRef Ascii 2 West +Exif.GPSInfo.GPSLongitude Rational 3 116deg 51' 18" +Exif.GPSInfo.GPSAltitudeRef Byte 1 Below sea level +Exif.GPSInfo.GPSAltitude Rational 1 14.3 m +Exif.GPSInfo.GPSTimeStamp Rational 3 09:54:28 +Exif.GPSInfo.GPSMapDatum Ascii 7 WGS-84 +Exif.GPSInfo.GPSProcessingMethod Undefined 18 65 83 67 73 73 0 0 0 72 89 66 82 73 68 45 70 73 88 +Exif.GPSInfo.GPSDateStamp Ascii 20 2008:05:08 09:54:28 diff --git a/test/geotag-test.sh b/test/geotag-test.sh new file mode 100755 index 00000000..e6219223 --- /dev/null +++ b/test/geotag-test.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Test driver for geotag + +source ./functions.source + +( cd "$testdir" + + printf "geotag" >&3 + + jpg=FurnaceCreekInn.jpg + gpx=FurnaceCreekInn.gpx + copyTestFiles $jpg $gpx + + echo --- show GPSInfo tags --- + runTest exiv2 -pa --grep GPSInfo $jpg + tags=$(runTest exiv2 -Pk --grep GPSInfo $jpg) + echo --- deleting the GPSInfo tags + for tag in $tags; do runTest exiv2 -M"del $tag" $jpg; done + runTest exiv2 -pa --grep GPS $jpg + echo --- run geotag --- + runTest geotag -tz -8:00 $jpg $gpx + echo --- show GPSInfo tags --- + runTest exiv2 -pa --grep GPSInfo $jpg + +) 3>&1 > $results 2>&1 + +printf "\n" + +# ---------------------------------------------------------------------- +# Evaluate results +cat $results | tr -d $'\r' > $results-stripped +mv $results-stripped $results +reportTest $results $good + +# That's all Folks! +##