taglibextractortest: Add test for files with empty metadata
ClosedPublic

Authored by michaelh on Apr 7 2018, 7:08 PM.

Details

Summary

Indicates a bug in kfilemetadata delivering genre property when genre has no value.

  • Copy appropiate sample files to no-meta/
  • Remove tag data with picard or kid3
  • Create test (of course)
Test Plan

make test

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.
michaelh created this revision.Apr 7 2018, 7:08 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptApr 7 2018, 7:08 PM
michaelh requested review of this revision.Apr 7 2018, 7:08 PM

I need more time. I will try to look at it today. By the way, the stack concept seems very useful. Thanks

I need more time. I will try to look at it today. By the way, the stack concept seems very useful. Thanks

Yes, it has its downsides though. It is easy to find oneself in a rebasing hell.

michaelh edited the summary of this revision. (Show Details)Apr 11 2018, 12:39 PM
mgallien requested changes to this revision.Apr 11 2018, 9:11 PM

Thanks for this work. Fix the issues and we should be good to go.

autotests/taglibextractortest.cpp
233

Please remove failMessage and use directly the expected value in each addRow. I fail to see what we gain by using this variable.

291

Why not use a simple variable here ?
TagLibExtractor plugin;

This revision now requires changes to proceed.Apr 11 2018, 9:11 PM
michaelh updated this revision to Diff 31934.Apr 11 2018, 10:47 PM
  • Apply suggested change
michaelh added inline comments.Apr 11 2018, 10:52 PM
autotests/taglibextractortest.cpp
291

This converts the enums to strings. That way it is easier to spot which properties are responsible for the failure.

bruns added a subscriber: bruns.Apr 11 2018, 10:56 PM

I need more time. I will try to look at it today. By the way, the stack concept seems very useful. Thanks

Yes, it has its downsides though. It is easy to find oneself in a rebasing hell.

  1. Squash all commits you want as one Phabricator revision using git rebase -i
  2. Create a branch for you stack on the first commit
  3. Submit the commit with arc diff HEAD^
  4. Cherry-pick the next commit

Repeat 3. and 4. until finished

Updating a commit/revision:

  • git rebase -i, select 'e'dit for the commit
  • edit, git add, git commit --amend
  • arc diff --preview HEAD^
  • git rebase --continue
bruns added inline comments.Apr 11 2018, 11:00 PM
autotests/taglibextractortest.cpp
291

What he likely meant:
TagLibExtractor plugin{this};
instead of
QScopedPointer<ExtractorPlugin> plugin(new TagLibExtractor(this));

michaelh added inline comments.Apr 12 2018, 12:13 PM
autotests/taglibextractortest.cpp
291

Well,... In that case: D12145

michaelh updated this revision to Diff 31968.Apr 12 2018, 12:17 PM
  • Simple plugin variable
michaelh marked an inline comment as done.Apr 12 2018, 12:18 PM
mgallien accepted this revision.Apr 12 2018, 3:52 PM

Thanks

This revision is now accepted and ready to land.Apr 12 2018, 3:52 PM
This revision was automatically updated to reflect the committed changes.
bruns added a comment.Apr 12 2018, 5:28 PM

Untested, but looks good to me otherwise.

autotests/taglibextractortest.cpp
42

Nitpick - needs some indentation

This revision is now accepted and ready to land.Apr 12 2018, 6:15 PM
michaelh updated this revision to Diff 31989.EditedApr 12 2018, 6:20 PM
  • Recreate sample files and adapt tests for mp3, m4a, ogg, opus, flac recreate files with

    $ ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -t 1 test.<ext>

mpc with kid3-qt remove all tags and add ' ' as genre

  • Expect all test to fail
  • Add debug output
michaelh requested review of this revision.Apr 12 2018, 6:21 PM
bruns added inline comments.Apr 12 2018, 7:39 PM
autotests/taglibextractortest.cpp
300

Unfortunately QCOMPARE does not do a deep compare if sizes mismatch.

To get a better output in case the test fails, you can do something like:

auto excessKeys() = ...
auto missingKeys() = ...

if (excessKeys().size()) {
    QWARN("Excess properties: " + excessKeys.join(", "));
    if (!failMessage.isEmpty())
        QEXPECT_FAIL(...)
    QCOMPARE(excessKeys.size(), 0);
}

if (missingKeys().size()) {
    ...
}
michaelh updated this revision to Diff 32009.Apr 12 2018, 8:14 PM
  • Optimize failure messages
bruns accepted this revision.Apr 13 2018, 12:31 AM

Ok, lets see Jenkins opinion ...

This revision is now accepted and ready to land.Apr 13 2018, 12:31 AM
michaelh updated this revision to Diff 32048.Apr 13 2018, 10:34 AM
  • Rebased
This revision was automatically updated to reflect the committed changes.