Review Request: SoK - Unit Test : core/collections/support/TrackForUrlWorker

Matěj Laitl matej at laitl.cz
Tue Jul 3 10:17:54 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/105389/#review15334
-----------------------------------------------------------



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11952>

    Nicpicky: we usually sort includes alphabetically within a group.



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11953>

    Nicpicky: this is technically a KDE include, so should be near KUrl



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11942>

    Better wording: to make queued signals/slots work with custom payloads



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11943>

    These should be rather but to initTestCase(), otherwise you depend on order of test function execution.



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11951>

    While not enforced in Amarok, I'd suggest using normalized names for SIGNAL/SLOT macros per http://marcmutz.wordpress.com/effective-qt/prefer-to-use-normalised-signalslot-signatures/
    
    We still use traditional Amarok code style for other Qt macros such as Q_ASSERT() etc.



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11944>

    Hmm, I don't think this is the correct test. Instead, you should implement run() in MockTrackForUrlWorker and set m_track inside to to different values (perhaps using data-driven testing, MockTrackForUrlWorker can be documented what variable name and type it fetches) and then ensue that finishedLookup signal emits the correct TrackPtr. QTest::kWaitForSignal may be handy for it.



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11946>

    You can also test that TrackForUrlWorker deletes itself. You don't need to change the mock for it, I think you can do it using QTest::kWaitForSignal( obj, SIGNAL(destroyed(...)) );



tests/core/collections/support/TestTrackForUrlWorker.cpp
<http://git.reviewboard.kde.org/r/105389/#comment11945>

    You can avoid repeating yourself by creating non-slot method textCompleteJobInternal( TrackForUrlWorker *worker ) to share common code.



tests/mocks/MockTrackForUrlWorker.h
<http://git.reviewboard.kde.org/r/105389/#comment11950>

    Code style: & should be near the name, not the type.



tests/mocks/MockTrackForUrlWorker.h
<http://git.reviewboard.kde.org/r/105389/#comment11949>

    There should be no need for this as you already have constructor in the cpp file.



tests/mocks/MockTrackForUrlWorker.h
<http://git.reviewboard.kde.org/r/105389/#comment11947>

    I think you change iplementation (and documentation!) to something like:
    QFETCH( Meta::TrackPtr, workerTrack )
    m_track = workerTrack;



tests/mocks/MockTrackForUrlWorker.h
<http://git.reviewboard.kde.org/r/105389/#comment11948>

    I don't think this helper method should exist.


- Matěj Laitl


On June 29, 2012, 8:08 p.m., Jasneet Bhatti wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/105389/
> -----------------------------------------------------------
> 
> (Updated June 29, 2012, 8:08 p.m.)
> 
> 
> Review request for Amarok, Matěj Laitl and Sven Krohlas.
> 
> 
> Description
> -------
> 
> Added unit test for core/collections/support/TrackForUrlWorker
> 
> Just the one slot completeJob() to test.
> Tested for both KUrl and QString types of urls.
> 
> 
> Diffs
> -----
> 
>   tests/core/collections/CMakeLists.txt b01b655 
>   tests/core/collections/support/CMakeLists.txt PRE-CREATION 
>   tests/core/collections/support/TestTrackForUrlWorker.h PRE-CREATION 
>   tests/core/collections/support/TestTrackForUrlWorker.cpp PRE-CREATION 
>   tests/mocks/MockTrackForUrlWorker.h PRE-CREATION 
>   tests/mocks/MockTrackForUrlWorker.cpp PRE-CREATION 
> 
> Diff: http://git.reviewboard.kde.org/r/105389/diff/
> 
> 
> Testing
> -------
> 
> Builds and runs fine.
> 
> 
> Thanks,
> 
> Jasneet Bhatti
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/amarok-devel/attachments/20120703/1cd86c31/attachment-0001.html>


More information about the Amarok-devel mailing list