Fix failing test of exiv gps data
ClosedPublic

Authored by astippich on Jan 6 2019, 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
Branch
fix_zero_gps
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 7233
Build 7251: arc lint + arc unit
astippich created this revision.Jan 6 2019, 11:38 AM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptJan 6 2019, 11:38 AM
Restricted Application added subscribers: Baloo, kde-frameworks-devel. · View Herald Transcript
astippich requested review of this revision.Jan 6 2019, 11:38 AM
bruns added a comment.Jan 7 2019, 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.Jan 7 2019, 11:20 PM
This revision now requires changes to proceed.Jan 7 2019, 11:20 PM
astippich updated this revision to Diff 49317.Jan 12 2019, 10:41 AM
  • rebase on revision
bruns accepted this revision.Jan 12 2019, 4:46 PM
This revision is now accepted and ready to land.Jan 12 2019, 4:46 PM
bruns added inline comments.Jan 13 2019, 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.Jan 17 2019, 6:54 AM
src/extractors/exiv2extractor.cpp
300

Yes, it does

astippich updated this revision to Diff 49750.Jan 17 2019, 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.Jan 17 2019, 7:35 PM
astippich edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.