[Amarok] 48eb11a: test: adapt TestXSPFPlaylist to CTest

Maximilian Kossick maximilian.kossick at googlemail.com
Wed Mar 24 22:52:55 CET 2010


Are you aware that all these tests are failing in some setups (i.e. on
the CI server) because the test files they depend on are not installed? The
tests might therefore not actually test anything anymore.

On Wed, Mar 24, 2010 at 2:39 PM, Rick W. Chen <stuffcorpse at archlinux.us> wrote:
> commit 48eb11a5421fed0b26e6bf35b816416a4a1ab398
> Author: Rick W. Chen <stuffcorpse at archlinux.us>
> Date:   Wed Mar 24 23:14:53 2010 +1300
>
>    test: adapt TestXSPFPlaylist to CTest
>
> diff --git a/src/App.cpp b/src/App.cpp
> index 14db73b..443f017 100644
> --- a/src/App.cpp
> +++ b/src/App.cpp
> @@ -112,7 +112,6 @@ extern void setupEventHandler_mac(long);
>  #include "TestPlaylistFileProvider.h"
>  #include "TestSqlUserPlaylistProvider.h"
>  #include "TestTimecodeTrackProvider.h"
> -#include "TestXSPFPlaylist.h"
>  #endif // DEBUG
>
>  AMAROK_EXPORT KAboutData aboutData( "amarok", 0,
> @@ -625,7 +624,6 @@ App::runUnitTests( const QStringList options, bool stdout )
>     TestPlaylistFileProvider    test009( options, logPath );
>     TestSqlUserPlaylistProvider test012( options, logPath );
>     TestTimecodeTrackProvider   test013( options, logPath );
> -    TestXSPFPlaylist            test014( options, logPath );
>
>     // modifies the playlist asynchronously, so run this last to avoid messing other test results
>     TestDirectoryLoader        *test015 = new TestDirectoryLoader( options, logPath );
> diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
> index 5bf8c7c..081aecb 100644
> --- a/src/CMakeLists.txt
> +++ b/src/CMakeLists.txt
> @@ -725,7 +725,6 @@ if(KDE4_BUILD_TESTS)
>     set(amaroklib_LIB_SRCS
>         ${amaroklib_LIB_SRCS}
>         ../tests/meta/TestMetaTrack.cpp
> -        ../tests/meta/TestXSPFPlaylist.cpp
>         ../tests/meta/cue/TestMetaCueCueFileItem.cpp
>         ../tests/meta/cue/TestMetaCueTrack.cpp
>         ../tests/meta/file/TestMetaFileTrack.cpp
> diff --git a/tests/meta/CMakeLists.txt b/tests/meta/CMakeLists.txt
> index c3af3e7..c2829b5 100644
> --- a/tests/meta/CMakeLists.txt
> +++ b/tests/meta/CMakeLists.txt
> @@ -3,7 +3,6 @@ include_directories( .
>
>  if(KDE4_BUILD_TESTS)
>  QT4_AUTOMOC( TestMetaTrack.cpp
> -             TestXSPFPlaylist.cpp
>              )
>  add_subdirectory( cue )
>  add_subdirectory( file )
> @@ -21,6 +20,12 @@ set( testplsplaylist_SRCS TestPLSPlaylist.cpp )
>  kde4_add_unit_test( testplsplaylist ${testplsplaylist_SRCS} )
>  target_link_libraries( testplsplaylist ${QT_QTTEST_LIBRARY} amaroklib )
>
> +#------------------------ Test XSPFPLAYLIST -----------------------------
> +
> +set( testxspfplaylist_SRCS TestXSPFPlaylist.cpp )
> +kde4_add_unit_test( testxspfplaylist ${testxspfplaylist_SRCS} )
> +target_link_libraries( testxspfplaylist ${QT_QTTEST_LIBRARY} amaroklib )
> +
>  #------------------------ Test PlaylistFileSupport -----------------------------
>
>  set( testplaylistfilesupport_SRCS
> diff --git a/tests/meta/TestXSPFPlaylist.cpp b/tests/meta/TestXSPFPlaylist.cpp
> index b8ec278..501c491 100644
> --- a/tests/meta/TestXSPFPlaylist.cpp
> +++ b/tests/meta/TestXSPFPlaylist.cpp
> @@ -20,18 +20,26 @@
>  #include "TestXSPFPlaylist.h"
>  #include "core/playlists/impl/file/xspf/XSPFPlaylist.h"
>
> +#include <KStandardDirs>
> +
>  #include <QtTest/QTest>
>  #include <QtCore/QDir>
>  #include <QtCore/QFile>
>
> -TestXSPFPlaylist::TestXSPFPlaylist( const QStringList args, const QString &logPath )
> -    : TestBase( "XSPFPlaylist" )
> +#include <qtest_kde.h>
> +
> +QTEST_KDEMAIN_CORE( TestXSPFPlaylist )
> +
> +TestXSPFPlaylist::TestXSPFPlaylist()
> +{}
> +
> +QString
> +TestXSPFPlaylist::dataPath( const QString &relPath )
>  {
> -    QStringList combinedArgs = args;
> -    addLogging( combinedArgs, logPath );
> -    QTest::qExec( this, combinedArgs );
> +    return KStandardDirs::locate( "data", QDir::toNativeSeparators( relPath ) );
>  }
>
> +
>  void TestXSPFPlaylist::initTestCase()
>  {
>     const QString testXspf = "amarok/testdata/playlists/test.xspf";
> diff --git a/tests/meta/TestXSPFPlaylist.h b/tests/meta/TestXSPFPlaylist.h
> index 7affbd8..b713695 100644
> --- a/tests/meta/TestXSPFPlaylist.h
> +++ b/tests/meta/TestXSPFPlaylist.h
> @@ -20,20 +20,19 @@
>  #ifndef TESTXSPFPLAYLIST_H
>  #define TESTXSPFPLAYLIST_H
>
> -#include "TestBase.h"
> -
> -#include <QtCore/QStringList>
> +#include <QtCore/QObject>
> +#include <QtCore/QString>
>
>  namespace Meta {
>     class XSPFPlaylist;
>  }
>
> -class TestXSPFPlaylist : public TestBase
> +class TestXSPFPlaylist : public QObject
>  {
>  Q_OBJECT
>
>  public:
> -    TestXSPFPlaylist( const QStringList args, const QString &logPath );
> +    TestXSPFPlaylist();
>
>  private slots:
>     void initTestCase();
> @@ -60,6 +59,7 @@ private slots:
>
>  private:
>     Meta::XSPFPlaylist *m_testPlaylist1;
> +    QString dataPath( const QString &relPath );
>  };
>
>  #endif // TESTXSPFPLAYLIST_H
>


More information about the Amarok-devel mailing list