void TestPlaylistFileProvider::testSave()
{
    Meta::TrackList tempTrackList;
    const KUrl trackUrl = dataPath( "data/audio/Platz 01.mp3" );
    tempTrackList.append( CollectionManager::instance()->trackForUrl( trackUrl ) );
    QCOMPARE( tempTrackList.size(), 1 );

    QFETCH(QString, name);
    QFETCH(QString, result);

    Playlists::PlaylistPtr testPlaylist = m_testPlaylistFileProvider->save( tempTrackList, name );
    QVERIFY( testPlaylist );

    QVERIFY( QFile::exists( Amarok::saveLocation( "playlists" ) + result ) );
    QCOMPARE( testPlaylist->name(), QString( result ) );
    QCOMPARE( testPlaylist->tracks().size(), 1 );
    QFile::remove( Amarok::saveLocation( "playlists" ) + result );
}
示例#2
0
Playlists::PlaylistPtr
IpodPlaylistProvider::addPlaylist( Playlists::PlaylistPtr playlist )
{
    return save( playlist->tracks(), playlist->name() );
}