Fix failing test of exiv gps data
ClosedPublic

Authored by astippich on Sun, Jan 6, 11:38 AM.

Details

Summary

A zero value was used before to indicate invalid
data, and thus 0° latitude/longitude or 0 m altitude were
not displayed while being valid data. Use NaN to indicate
invalid data. Increase altitude precision by avoiding
intermediate float type

Diff Detail

Repository
R286 KFileMetaData
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
astippich created this revision.Sun, Jan 6, 11:38 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptSun, Jan 6, 11:38 AM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
astippich requested review of this revision.Sun, Jan 6, 11:38 AM
bruns added a comment.Mon, Jan 7, 2:34 PM

Can you create two test files, one with e.g. altitude == 0, and one without altitude?

bruns requested changes to this revision.Mon, Jan 7, 11:20 PM
This revision now requires changes to proceed.Mon, Jan 7, 11:20 PM
astippich updated this revision to Diff 49317.Sat, Jan 12, 10:41 AM
  • rebase on revision
bruns accepted this revision.Sat, Jan 12, 4:46 PM
This revision is now accepted and ready to land.Sat, Jan 12, 4:46 PM
bruns added inline comments.Sun, Jan 13, 5:57 PM
src/extractors/exiv2extractor.cpp
300

when you rewrite this as

if (it != data.end()) {
    auto ratio = it->value().toRational();
    it = data.findKey(Exiv2::ExifKey("Exif.GPSInfo.GPSAltitudeRef"));
    if ((ratio.second != 0) && (it != data.end())) {
        auto altRef = it->value().toLong();
        if (altRef) {
            alt = -1.0 * ratio.first / ratio.second;
        } else {
            alt = 1.0 * ratio.first / ratio.second;
        }
    }
}

does the unit test pass without special handling of the altitude fuzz?

astippich added inline comments.Thu, Jan 17, 6:54 AM
src/extractors/exiv2extractor.cpp
300

Yes, it does

astippich updated this revision to Diff 49750.Thu, Jan 17, 7:33 PM
  • fix gps altitude precision
astippich retitled this revision from Allow zero altitude/longitude/latitude exiv gps data to Fix failing test of exiv gps data.Thu, Jan 17, 7:35 PM
astippich edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.