mpdata/tsrc/unittest_mpsongdata/src/unittest_mpsongdata.cpp
changeset 48 af3740e3753f
parent 32 c163ef0b758d
equal deleted inserted replaced
42:79c49924ae23 48:af3740e3753f
    16 */
    16 */
    17 #include <QSignalSpy>
    17 #include <QSignalSpy>
    18 #include <hbapplication.h>
    18 #include <hbapplication.h>
    19 #include <hbmainwindow.h>
    19 #include <hbmainwindow.h>
    20 #include <hbicon.h>
    20 #include <hbicon.h>
    21 
    21 #include <mpxmedia.h>
    22 #include"unittest_mpsongdata.h"
    22 
       
    23 #include "unittest_mpsongdata.h"
    23 #include "stub/inc/thumbnailmanager_qt.h"
    24 #include "stub/inc/thumbnailmanager_qt.h"
    24 
    25 
    25 // Do this so we can access all member variables.
    26 // Do this so we can access all member variables.
    26 #define private public
    27 #define private public
    27 #include "mpsongdata.h"
    28 #include "mpsongdata.h"
       
    29 #include "mpsongdata_p.h"
    28 #undef private
    30 #undef private
    29 
    31 
       
    32 // This so we can test private functions
       
    33 #include "mpsongdata_p.cpp"
    30 
    34 
    31 /*!
    35 /*!
    32  Make our test case a stand-alone executable that runs all the test functions.
    36  Make our test case a stand-alone executable that runs all the test functions.
    33  */
    37  */
    34 int main(int argc, char *argv[])
    38 int main(int argc, char *argv[])
    46         pass[0] = argv[0];
    50         pass[0] = argv[0];
    47         pass[1] = "-o";
    51         pass[1] = "-o";
    48         pass[2] = "c:\\data\\unittest_mpsongdata.txt";
    52         pass[2] = "c:\\data\\unittest_mpsongdata.txt";
    49 
    53 
    50         return QTest::qExec(&tv, 3, pass);
    54         return QTest::qExec(&tv, 3, pass);
    51     }    
    55     }
    52 }
    56 }
    53 
    57 
    54 //Constructor
    58 //Constructor
    55 TestMpSongData::TestMpSongData()
    59 TestMpSongData::TestMpSongData()
    56     : mTest(0)
    60     : mTest(0)
    67 /*!
    71 /*!
    68  Called before the first testfunction is executed.
    72  Called before the first testfunction is executed.
    69  */
    73  */
    70 void TestMpSongData::initTestCase()
    74 void TestMpSongData::initTestCase()
    71 {
    75 {
    72     
    76 
    73 }
    77 }
    74 
    78 
    75 /*!
    79 /*!
    76  Called after the last testfunction was executed.
    80  Called after the last testfunction was executed.
    77  */
    81  */
    78 void TestMpSongData::cleanupTestCase()
    82 void TestMpSongData::cleanupTestCase()
    79 {
    83 {
    80 QCoreApplication::processEvents();
       
    81 }
    84 }
    82 
    85 
    83 /*!
    86 /*!
    84  Called before each testfunction is executed.
    87  Called before each testfunction is executed.
    85  */
    88  */
    86 void TestMpSongData::init()
    89 void TestMpSongData::init()
    87 {
    90 {
    88     mTest = new MpSongData();
    91     mTest = new MpSongData();
       
    92     mTestPrivate = mTest->d_ptr;
    89 }
    93 }
    90 
    94 
    91 /*!
    95 /*!
    92  Called after every testfunction.
    96  Called after every testfunction.
    93  */
    97  */
   109     QCOMPARE( ThumbnailManager::getInitCounter(), 0 );
   113     QCOMPARE( ThumbnailManager::getInitCounter(), 0 );
   110 }
   114 }
   111 
   115 
   112 
   116 
   113 /*!
   117 /*!
   114  Test title() 
   118  Test title()
   115  */
   119  */
   116 void TestMpSongData::testTitle()
   120 void TestMpSongData::testTitle()
   117 {
   121 {
   118     mTest->mTitle = QString();
   122     mTestPrivate->mTitle = QString();
   119     QVERIFY( mTest->title().isNull() == true );    
   123     QVERIFY( mTest->title().isNull() == true );
   120     
   124 
   121     QString title( "title" );
   125     QString title( "title" );
   122     mTest->mTitle = title;
   126     mTestPrivate->mTitle = title;
   123     QVERIFY( mTest->title().isNull() == false );
   127     QVERIFY( mTest->title().isNull() == false );
   124     QCOMPARE( mTest->title(), title );
   128     QCOMPARE( mTest->title(), title );
   125 }
   129 }
   126 
   130 
   127 /*!
   131 /*!
   128  Test album() 
   132  Test album()
   129  */
   133  */
   130 void TestMpSongData::testAlbum()
   134 void TestMpSongData::testAlbum()
   131 {
   135 {
   132     mTest->mAlbum = QString();
   136     mTestPrivate->mAlbum = QString();
   133     QVERIFY( mTest->album().isNull() == true );
   137     QVERIFY( mTest->album().isNull() == true );
   134     
   138 
   135     QString album( "album" );
   139     QString album( "album" );
   136     mTest->mAlbum = album;
   140     mTestPrivate->mAlbum = album;
   137     QVERIFY( mTest->album().isNull() == false );
   141     QVERIFY( mTest->album().isNull() == false );
   138     QCOMPARE( mTest->album(), album );
   142     QCOMPARE( mTest->album(), album );
   139 }
   143 }
   140 
   144 
   141 /*!
   145 /*!
   142  Test artist() 
   146  Test artist()
   143  */
   147  */
   144 void TestMpSongData::testArtist()
   148 void TestMpSongData::testArtist()
   145 {
   149 {
   146     mTest->mArtist = QString();
   150     mTestPrivate->mArtist = QString();
   147     QVERIFY( mTest->artist().isNull() == true );
   151     QVERIFY( mTest->artist().isNull() == true );
   148     
   152 
   149     QString artist( "artist");
   153     QString artist( "artist");
   150     mTest->mArtist = artist;
   154     mTestPrivate->mArtist = artist;
   151     QVERIFY( mTest->artist().isNull() == false );
   155     QVERIFY( mTest->artist().isNull() == false );
   152     QCOMPARE( mTest->artist(), artist );
   156     QCOMPARE( mTest->artist(), artist );
   153 }
   157 }
   154 
   158 
   155 /*!
   159 /*!
   156  Test comment() 
   160  Test comment()
   157  */
   161  */
   158 void TestMpSongData::testComment()
   162 void TestMpSongData::testComment()
   159 {
   163 {
   160     mTest->mComment = QString();
   164     mTestPrivate->mComment = QString();
   161     QVERIFY( mTest->comment().isNull() == true );
   165     QVERIFY( mTest->comment().isNull() == true );
   162     
   166 
   163     QString comment( "This is a nice song" );
   167     QString comment( "This is a nice song" );
   164     mTest->mComment = comment;
   168     mTestPrivate->mComment = comment;
   165     QVERIFY( mTest->comment().isNull() == false );
   169     QVERIFY( mTest->comment().isNull() == false );
   166     QCOMPARE( mTest->comment(), comment );
   170     QCOMPARE( mTest->comment(), comment );
   167 }
   171 }
   168 
   172 
   169 /*!
   173 /*!
   170  Test albumArt() 
   174  Test albumArt()
   171  */
   175  */
   172 void TestMpSongData::testAlbumArt()
   176 void TestMpSongData::testAlbumArt()
   173 {
   177 {
   174     HbIcon dummyAlbumArt;
   178     HbIcon dummyAlbumArt;
   175     mTest->albumArt( dummyAlbumArt );
   179     mTestPrivate->albumArt( dummyAlbumArt );
   176     QVERIFY( dummyAlbumArt.isNull() == true );
   180     QVERIFY( dummyAlbumArt.isNull() == true );
   177     
   181 
   178     HbIcon dummyAlbumArtTwo;
   182     HbIcon dummyAlbumArtTwo;
   179     mTest->mAlbumArt = new HbIcon( ":/playbackviewicons/someAlbumArt.png" );
   183     mTestPrivate->mAlbumArt = new HbIcon( ":/playbackviewicons/someAlbumArt.png" );
   180     mTest->albumArt( dummyAlbumArtTwo );
   184     mTest->albumArt( dummyAlbumArtTwo );
   181     QVERIFY( dummyAlbumArtTwo.isNull() == false );
   185     QVERIFY( dummyAlbumArtTwo.isNull() == false );
   182 }
   186 }
   183 
   187 
   184 /*!
   188 /*!
   185  Test year() 
   189  Test year()
   186  */
   190  */
   187 void TestMpSongData::testYear()
   191 void TestMpSongData::testYear()
   188 {
   192 {
   189     mTest->mYear = QString();
   193     mTestPrivate->mYear = QString();
   190     QVERIFY( mTest->year().isNull() == true );
   194     QVERIFY( mTest->year().isNull() == true );
   191     
   195 
   192     QString year("2000");
   196     QString year("2000");
   193     mTest->mYear = year;
   197     mTestPrivate->mYear = year;
   194     QVERIFY( mTest->year().isNull() == false );
   198     QVERIFY( mTest->year().isNull() == false );
   195     QCOMPARE( mTest->year(), year );
   199     QCOMPARE( mTest->year(), year );
   196 }
   200 }
   197 
   201 
   198 /*!
   202 /*!
   199  Test genre() 
   203  Test genre()
   200  */
   204  */
   201 void TestMpSongData::testGenre()
   205 void TestMpSongData::testGenre()
   202 {
   206 {
   203     mTest->mGenre = QString();    
   207     mTestPrivate->mGenre = QString();
   204     QVERIFY( mTest->genre().isNull() == true );
   208     QVERIFY( mTest->genre().isNull() == true );
   205 
   209 
   206     QString genre( "pop" );    
   210     QString genre( "pop" );
   207     mTest->mGenre = genre;    
   211     mTestPrivate->mGenre = genre;
   208     QVERIFY( mTest->genre().isNull() == false );
   212     QVERIFY( mTest->genre().isNull() == false );
   209     QCOMPARE( mTest->genre(), genre );
   213     QCOMPARE( mTest->genre(), genre );
   210 }
   214 }
   211 
   215 
   212 /*!
   216 /*!
   213  Test composer() 
   217  Test composer()
   214  */
   218  */
   215 void TestMpSongData::testComposer()
   219 void TestMpSongData::testComposer()
   216 {
   220 {
   217     mTest->mComposer = QString();
   221     mTestPrivate->mComposer = QString();
   218     QVERIFY( mTest->composer().isNull() == true );
   222     QVERIFY( mTest->composer().isNull() == true );
   219     
   223 
   220     QString composer( "composer ");
   224     QString composer( "composer ");
   221     mTest->mComposer = composer;
   225     mTestPrivate->mComposer = composer;
   222     QVERIFY( mTest->composer().isNull() == false );
   226     QVERIFY( mTest->composer().isNull() == false );
   223     QCOMPARE( mTest->composer(), composer );
   227     QCOMPARE( mTest->composer(), composer );
   224 }
   228 }
   225 
   229 
   226 
   230 
   227 /*!
   231 /*!
   228  Test albumTrack() 
   232  Test albumTrack()
   229  */
   233  */
   230 void TestMpSongData::testAlbumtrack()
   234 void TestMpSongData::testAlbumtrack()
   231 {
   235 {
   232     mTest->mAlbumTrack = QString();
   236     mTestPrivate->mAlbumTrack = QString();
   233     QVERIFY( mTest->albumTrack().isNull() == true );
   237     QVERIFY( mTest->albumTrack().isNull() == true );
   234     
   238 
   235     QString albumTrack("2");
   239     QString albumTrack("2");
   236     mTest->mAlbumTrack = albumTrack;
   240     mTestPrivate->mAlbumTrack = albumTrack;
   237     QVERIFY( mTest->albumTrack().isNull() == false );   
   241     QVERIFY( mTest->albumTrack().isNull() == false );
   238     QCOMPARE( mTest->albumTrack(), albumTrack );
   242     QCOMPARE( mTest->albumTrack(), albumTrack );
   239 }
   243 }
   240 
   244 
   241 /*!
   245 /*!
   242  Test link() 
   246  Test link()
   243  */
   247  */
   244 void TestMpSongData::testLink()
   248 void TestMpSongData::testLink()
   245 {
   249 {
   246     mTest->mLink = QString();
   250     mTestPrivate->mLink = QString();
   247     QVERIFY( mTest->link().isNull() == true );
   251     QVERIFY( mTest->link().isNull() == true );
   248     
   252 
   249     QString link( "www.nokia.com" );
   253     QString link( "www.nokia.com" );
   250     mTest->mLink = link;
   254     mTestPrivate->mLink = link;
   251     QVERIFY( mTest->link().isNull() == false );
   255     QVERIFY( mTest->link().isNull() == false );
   252     QCOMPARE( mTest->link(), link );
   256     QCOMPARE( mTest->link(), link );
   253 }
   257 }
   254 
   258 
   255 /*!
   259 /*!
   256  Test fileName()
   260  Test fileName()
   257  */
   261  */
   258 void TestMpSongData::testFileName()
   262 void TestMpSongData::testFileName()
   259 {
   263 {
   260     mTest->mFileName = QString();
   264     mTestPrivate->mFileName = QString();
   261     QVERIFY( mTest->fileName().isNull() == true );
   265     QVERIFY( mTest->fileName().isNull() == true );
   262     
   266 
   263     QString fileName( "test.mp3" );
   267     QString fileName( "test.mp3" );
   264     mTest->mFileName = fileName;
   268     mTestPrivate->mFileName = fileName;
   265     QVERIFY( mTest->fileName().isNull() == false );
   269     QVERIFY( mTest->fileName().isNull() == false );
   266     QCOMPARE( mTest->fileName(), fileName );
   270     QCOMPARE( mTest->fileName(), fileName );
   267 }
   271 }
   268 
   272 
   269 /*!
   273 /*!
   270  Test fileName()
   274  Test fileName()
   271  */
   275  */
   272 void TestMpSongData::testMimeType()
   276 void TestMpSongData::testMimeType()
   273 {
   277 {
   274     mTest->mMimeType = QString();
   278     mTestPrivate->mMimeType = QString();
   275     QVERIFY( mTest->mimeType().isNull() == true );
   279     QVERIFY( mTest->mimeType().isNull() == true );
   276     
   280 
   277     QString mimeType( "mp3" );
   281     QString mimeType( "mp3" );
   278     mTest->mMimeType = mimeType;
   282     mTestPrivate->mMimeType = mimeType;
   279     QVERIFY( mTest->mimeType().isNull() == false );
   283     QVERIFY( mTest->mimeType().isNull() == false );
   280     QCOMPARE( mTest->mimeType(), mimeType );
   284     QCOMPARE( mTest->mimeType(), mimeType );
   281 }
   285 }
   282 
   286 
   283 /*!
   287 /*!
   284  Test fileName()
   288  Test fileName()
   285  */
   289  */
   286 void TestMpSongData::testDuration()
   290 void TestMpSongData::testDuration()
   287 {
   291 {
   288     mTest->mDuration = QString();
   292     mTestPrivate->mDuration = QString();
   289     QVERIFY( mTest->duration().isNull() == true );
   293     QVERIFY( mTest->duration().isNull() == true );
   290     
   294 
   291     QString duration( "04:16" );
   295     QString duration( "04:16" );
   292     mTest->mDuration = duration;
   296     mTestPrivate->mDuration = duration;
   293     QVERIFY( mTest->duration().isNull() == false );
   297     QVERIFY( mTest->duration().isNull() == false );
   294     QCOMPARE( mTest->duration(), duration );
   298     QCOMPARE( mTest->duration(), duration );
   295 }
   299 }
   296 
   300 
   297 /*!
   301 /*!
   298  Test bitRate()
   302  Test bitRate()
   299  */
   303  */
   300 void TestMpSongData::testBitRate()
   304 void TestMpSongData::testBitRate()
   301 {
   305 {
   302     mTest->mBitRate = QString();
   306     mTestPrivate->mBitRate = QString();
   303     QVERIFY( mTest->bitRate().isNull() == true );
   307     QVERIFY( mTest->bitRate().isNull() == true );
   304     
   308 
   305     QString bitRate( "320 Kbps" );
   309     QString bitRate( "320 Kbps" );
   306     mTest->mBitRate = bitRate;
   310     mTestPrivate->mBitRate = bitRate;
   307     QVERIFY( mTest->bitRate().isNull() == false );
   311     QVERIFY( mTest->bitRate().isNull() == false );
   308     QCOMPARE( mTest->bitRate(), bitRate );
   312     QCOMPARE( mTest->bitRate(), bitRate );
   309 }
   313 }
   310 
   314 
   311 /*!
   315 /*!
   312  Test sampleRate()
   316  Test sampleRate()
   313  */
   317  */
   314 void TestMpSongData::testSampleRate()
   318 void TestMpSongData::testSampleRate()
   315 {
   319 {
   316     mTest->mSampleRate = QString();
   320     mTestPrivate->mSampleRate = QString();
   317     QVERIFY( mTest->sampleRate().isNull() == true );
   321     QVERIFY( mTest->sampleRate().isNull() == true );
   318     
   322 
   319     QString sampleRate( "44100 hz" );
   323     QString sampleRate( "44100 hz" );
   320     mTest->mSampleRate = sampleRate;
   324     mTestPrivate->mSampleRate = sampleRate;
   321     QVERIFY( mTest->sampleRate().isNull() == false );
   325     QVERIFY( mTest->sampleRate().isNull() == false );
   322     QCOMPARE( mTest->sampleRate(), sampleRate );
   326     QCOMPARE( mTest->sampleRate(), sampleRate );
   323 }
   327 }
   324 
   328 
   325 /*!
   329 /*!
   326  Test size()
   330  Test size()
   327  */
   331  */
   328 void TestMpSongData::testSize()
   332 void TestMpSongData::testSize()
   329 {
   333 {
   330     mTest->mSize = QString();
   334     mTestPrivate->mSize = QString();
   331     QVERIFY( mTest->size().isNull() == true );
   335     QVERIFY( mTest->size().isNull() == true );
   332     
   336 
   333     QString size( "4.3MB" );
   337     QString size( "4.3MB" );
   334     mTest->mSize = size;
   338     mTestPrivate->mSize = size;
   335     QVERIFY( mTest->size().isNull() == false );
   339     QVERIFY( mTest->size().isNull() == false );
   336     QCOMPARE( mTest->size(), size );
   340     QCOMPARE( mTest->size(), size );
   337 }
   341 }
   338 
   342 
   339 /*!
   343 /*!
   340  Test modified()
   344  Test modified()
   341  */
   345  */
   342 void TestMpSongData::testModified()
   346 void TestMpSongData::testModified()
   343 {
   347 {
   344     mTest->mModified = QString();
   348     mTestPrivate->mModified = QString();
   345     QVERIFY( mTest->modified().isNull() == true );
   349     QVERIFY( mTest->modified().isNull() == true );
   346     
   350 
   347     QString modified( "5.7.2010 14:35:08" );
   351     QString modified( "5.7.2010 14:35:08" );
   348     mTest->mModified = modified;
   352     mTestPrivate->mModified = modified;
   349     QVERIFY( mTest->modified().isNull() == false );
   353     QVERIFY( mTest->modified().isNull() == false );
   350     QCOMPARE( mTest->modified(), modified );
   354     QCOMPARE( mTest->modified(), modified );
   351 }
   355 }
   352 
   356 
   353 /*!
   357 /*!
   354  Test copyright()
   358  Test copyright()
   355  */
   359  */
   356 void TestMpSongData::testCopyright()
   360 void TestMpSongData::testCopyright()
   357 {
   361 {
   358     mTest->mCopyright = QString();
   362     mTestPrivate->mCopyright = QString();
   359     QVERIFY( mTest->copyright().isNull() == true );
   363     QVERIFY( mTest->copyright().isNull() == true );
   360     
   364 
   361     QString copyright( "Copyright holder" );
   365     QString copyright( "Copyright holder" );
   362     mTest->mCopyright = copyright;
   366     mTestPrivate->mCopyright = copyright;
   363     QVERIFY( mTest->copyright().isNull() == false );
   367     QVERIFY( mTest->copyright().isNull() == false );
   364     QCOMPARE( mTest->copyright(), copyright );
   368     QCOMPARE( mTest->copyright(), copyright );
   365 }
   369 }
   366 
   370 
   367 /*!
   371 /*!
   368  Test musicURL()
   372  Test musicURL()
   369  */
   373  */
   370 void TestMpSongData::testMusicURL()
   374 void TestMpSongData::testMusicURL()
   371 {
   375 {
   372     mTest->mMusicURL = QString();
   376     mTestPrivate->mMusicURL = QString();
   373     QVERIFY( mTest->musicURL().isNull() == true );
   377     QVERIFY( mTest->musicURL().isNull() == true );
   374     
   378 
   375     QString musicURL( "www.nokia.com" );
   379     QString musicURL( "www.nokia.com" );
   376     mTest->mMusicURL = musicURL;
   380     mTestPrivate->mMusicURL = musicURL;
   377     QVERIFY( mTest->musicURL().isNull() == false );
   381     QVERIFY( mTest->musicURL().isNull() == false );
   378     QCOMPARE( mTest->musicURL(), musicURL );
   382     QCOMPARE( mTest->musicURL(), musicURL );
   379 }
   383 }
   380 
   384 
   381 /*!
   385 /*!
   382  Test isDrmProtected()
   386  Test isDrmProtected()
   383  */
   387  */
   384 void TestMpSongData::testIsDrmProtected()
   388 void TestMpSongData::testIsDrmProtected()
   385 {
   389 {
   386     mTest->mDrmProtected = true;
   390     mTestPrivate->mDrmProtected = true;
   387     QVERIFY( mTest->isDrmProtected() == true );
   391     QVERIFY( mTest->isDrmProtected() == true );
   388     
   392 
   389     mTest->mDrmProtected = false;
   393     mTestPrivate->mDrmProtected = false;
   390     QVERIFY( mTest->isDrmProtected() == false );
   394     QVERIFY( mTest->isDrmProtected() == false );
   391 }
   395 }
   392 
   396 
   393 /*!
   397 /*!
   394  Test setTitle() 
   398  Test setMpxMedia()
       
   399  */
       
   400 void TestMpSongData::testSetMpxMedia()
       
   401 {
       
   402     RArray<TInt> supportedIds;
       
   403     CleanupClosePushL( supportedIds );
       
   404     supportedIds.AppendL( KMPXMediaIdMusic );
       
   405     supportedIds.AppendL( KMPXMediaIdGeneral );
       
   406     CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
       
   407     CleanupStack::PopAndDestroy(&supportedIds);
       
   408     CleanupStack::PushL(entries);
       
   409 
       
   410     entries->SetTObjectValueL<TInt>(KMPXMediaGeneralId, 1);
       
   411     entries->SetTObjectValueL<TInt>(KMPXMediaMusicAlbumId, 2);
       
   412     entries->SetTextValueL(KMPXMediaGeneralTitle, TPtrC(reinterpret_cast<const TUint16*>(L"Title")));
       
   413     entries->SetTextValueL(KMPXMediaMusicArtist, TPtrC(reinterpret_cast<const TUint16*>(L"Artist")));
       
   414     entries->SetTextValueL(KMPXMediaMusicAlbum, TPtrC(reinterpret_cast<const TUint16*>(L"Album")));
       
   415     entries->SetTextValueL(KMPXMediaMusicAlbumArtFileName, TPtrC(reinterpret_cast<const TUint16*>(L"AlbumArtFileName")));
       
   416     entries->SetTextValueL(KMPXMediaMusicComposer, TPtrC(reinterpret_cast<const TUint16*>(L"Composer")));
       
   417     entries->SetTObjectValueL<TInt64> (KMPXMediaMusicYear, 63241257600000000);
       
   418     entries->SetTextValueL(KMPXMediaMusicAlbumTrack, TPtrC(reinterpret_cast<const TUint16*>(L"1")));
       
   419     entries->SetTextValueL(KMPXMediaMusicGenre, TPtrC(reinterpret_cast<const TUint16*>(L"Genre")));
       
   420     entries->SetTextValueL(KMPXMediaGeneralMimeType, TPtrC(reinterpret_cast<const TUint16*>(L"audio/mp3")));
       
   421     entries->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, 205907);
       
   422     entries->SetTObjectValueL<TUint32>(KMPXMediaAudioBitrate, 128000);
       
   423     entries->SetTObjectValueL<TUint32>(KMPXMediaAudioSamplerate, 44100);
       
   424     entries->SetTextValueL(KMPXMediaGeneralCopyright, TPtrC(reinterpret_cast<const TUint16*>(L"Copyright")));
       
   425     entries->SetTextValueL(KMPXMediaMusicURL, TPtrC(reinterpret_cast<const TUint16*>(L"MusicURL")));
       
   426 
       
   427     CMPXMedia* mediaTestData = CMPXMedia::NewL(*entries);
       
   428     CleanupStack::PushL(mediaTestData);
       
   429 
       
   430     QSignalSpy spy1( mTest, SIGNAL( playbackInfoChanged() ) );
       
   431     QSignalSpy spy2( mTest, SIGNAL( songDetailInfoChanged() ) );
       
   432 
       
   433     mTest->setMpxMedia( *mediaTestData );
       
   434 
       
   435     QCOMPARE( spy1.count(), 1 );
       
   436     QCOMPARE( spy2.count(), 1 );
       
   437 
       
   438     QCOMPARE( mTest->title(), QString("Title") );
       
   439     QCOMPARE( mTest->artist(), QString("Artist") );
       
   440     QCOMPARE( mTest->album(), QString("Album") );
       
   441     QCOMPARE( mTest->year(), QString("2004") );
       
   442     QCOMPARE( mTest->genre(), QString("Genre") );
       
   443     QCOMPARE( mTest->composer(), QString("Composer") );
       
   444     QCOMPARE( mTest->albumTrack(), QString("1") );
       
   445     QCOMPARE( mTest->fileName().isNull(), true );
       
   446     QCOMPARE( mTest->mimeType(), QString("MP3") );
       
   447     QCOMPARE( mTest->duration(), QString("03:25") );
       
   448     QCOMPARE( mTest->bitRate(), QString("128") );
       
   449     QCOMPARE( mTest->sampleRate(), QString("44100") );
       
   450     QCOMPARE( mTest->copyright(), QString("Copyright") );
       
   451     QCOMPARE( mTest->musicURL(), QString("MusicURL") );
       
   452     QCOMPARE( mTest->isDrmProtected(), false );
       
   453 
       
   454     CleanupStack::PopAndDestroy(mediaTestData);
       
   455     CleanupStack::PopAndDestroy(entries);
       
   456 }
       
   457 
       
   458 /*!
       
   459  Test setTitle()
   395  */
   460  */
   396 void TestMpSongData::testSetTitle()
   461 void TestMpSongData::testSetTitle()
   397 {
   462 {
   398     bool result;    
   463     bool result;
   399     QString title( "title" );
   464     QString title( "title" );
   400     mTest->mTitle = QString();
   465     mTestPrivate->mTitle = QString();
   401     result = mTest->setTitle( title );
   466     result = mTestPrivate->setTitle( title );
   402     QCOMPARE( result, true );
   467     QCOMPARE( result, true );
   403     QCOMPARE( mTest->title(), title ); 
   468     QCOMPARE( mTest->title(), title );
   404     
   469 
   405     result = false;
   470     result = false;
   406     title = QString( "title" );
   471     title = QString( "title" );
   407     mTest->mTitle = QString( "titleTwo" );
   472     mTestPrivate->mTitle = QString( "titleTwo" );
   408     result = mTest->setTitle( title );
   473     result = mTestPrivate->setTitle( title );
   409     QCOMPARE( result, true );
   474     QCOMPARE( result, true );
   410     QCOMPARE( mTest->title(), title ); 
   475     QCOMPARE( mTest->title(), title );
   411     
   476 
   412     result = false;
   477     result = false;
   413     title = QString();
   478     title = QString();
   414     mTest->mTitle = QString();
   479     mTestPrivate->mTitle = QString();
   415     result = mTest->setTitle( title );
   480     result = mTestPrivate->setTitle( title );
   416     QCOMPARE( result, false );
   481     QCOMPARE( result, false );
   417     QCOMPARE( mTest->title().isNull(), true ); 
   482     QCOMPARE( mTest->title().isNull(), true );
   418     
   483 
   419     result = false;
   484     result = false;
   420     title = QString();
   485     title = QString();
   421     mTest->mTitle = QString( "titleTwo" );
   486     mTestPrivate->mTitle = QString( "titleTwo" );
   422     result = mTest->setTitle( title );
   487     result = mTestPrivate->setTitle( title );
   423     QCOMPARE( result, true );
   488     QCOMPARE( result, true );
   424     QCOMPARE( mTest->title().isNull(), true ); 
   489     QCOMPARE( mTest->title().isNull(), true );
   425 }
   490 }
   426 
   491 
   427 /*!
   492 /*!
   428  Test SetAlbum() 
   493  Test SetAlbum()
   429  */
   494  */
   430 void TestMpSongData::TestMpSongData::testSetAlbum()
   495 void TestMpSongData::TestMpSongData::testSetAlbum()
   431 {
   496 {
   432     bool result;    
   497     bool result;
   433     QString album( "album" );
   498     QString album( "album" );
   434     mTest->mAlbum = QString();
   499     mTestPrivate->mAlbum = QString();
   435     result = mTest->setAlbum( album );
   500     result = mTestPrivate->setAlbum( album );
   436     QCOMPARE( result, true );
   501     QCOMPARE( result, true );
   437     QCOMPARE( mTest->album(), album ); 
   502     QCOMPARE( mTest->album(), album );
   438     
   503 
   439     result = false;
   504     result = false;
   440     album = QString( "album" );
   505     album = QString( "album" );
   441     mTest->mAlbum = QString( "albumTwo" );
   506     mTestPrivate->mAlbum = QString( "albumTwo" );
   442     result = mTest->setAlbum( album );
   507     result = mTestPrivate->setAlbum( album );
   443     QCOMPARE( result, true );
   508     QCOMPARE( result, true );
   444     QCOMPARE( mTest->album(), album ); 
   509     QCOMPARE( mTest->album(), album );
   445     
   510 
   446     result = false;
   511     result = false;
   447     album = QString();
   512     album = QString();
   448     mTest->mAlbum = QString();
   513     mTestPrivate->mAlbum = QString();
   449     result = mTest->setAlbum( album );
   514     result = mTestPrivate->setAlbum( album );
   450     QCOMPARE( result, false );
   515     QCOMPARE( result, false );
   451     QCOMPARE( mTest->album().isNull(), true ); 
   516     QCOMPARE( mTest->album().isNull(), true );
   452     
   517 
   453     result = false;
   518     result = false;
   454     album = QString();
   519     album = QString();
   455     mTest->mAlbum = QString( "albumTwo" );
   520     mTestPrivate->mAlbum = QString( "albumTwo" );
   456     result = mTest->setAlbum( album );
   521     result = mTestPrivate->setAlbum( album );
   457     QCOMPARE( result, true );
   522     QCOMPARE( result, true );
   458     QCOMPARE( mTest->album().isNull(), true ); 
   523     QCOMPARE( mTest->album().isNull(), true );
   459 }
   524 }
   460 
   525 
   461 /*!
   526 /*!
   462  Test SetArtist() 
   527  Test SetArtist()
   463  */
   528  */
   464 void TestMpSongData::testSetArtist()
   529 void TestMpSongData::testSetArtist()
   465 {
   530 {
   466     bool result;    
   531     bool result;
   467     QString artist( "artist" );
   532     QString artist( "artist" );
   468     mTest->mArtist = QString();
   533     mTestPrivate->mArtist = QString();
   469     result = mTest->setArtist( artist );
   534     result = mTestPrivate->setArtist( artist );
   470     QCOMPARE( result, true );
   535     QCOMPARE( result, true );
   471     QCOMPARE( mTest->artist(), artist ); 
   536     QCOMPARE( mTest->artist(), artist );
   472     
   537 
   473     result = false;
   538     result = false;
   474     artist = QString( "artist" );
   539     artist = QString( "artist" );
   475     mTest->mArtist = QString( "artistTwo" );
   540     mTestPrivate->mArtist = QString( "artistTwo" );
   476     result = mTest->setArtist( artist );
   541     result = mTestPrivate->setArtist( artist );
   477     QCOMPARE( result, true );
   542     QCOMPARE( result, true );
   478     QCOMPARE( mTest->artist(), artist ); 
   543     QCOMPARE( mTest->artist(), artist );
   479     
   544 
   480     result = false;
   545     result = false;
   481     artist = QString();
   546     artist = QString();
   482     mTest->mArtist = QString();
   547     mTestPrivate->mArtist = QString();
   483     result = mTest->setArtist( artist );
   548     result = mTestPrivate->setArtist( artist );
   484     QCOMPARE( result, false );
   549     QCOMPARE( result, false );
   485     QCOMPARE( mTest->artist().isNull(), true ); 
   550     QCOMPARE( mTest->artist().isNull(), true );
   486     
   551 
   487     result = false;
   552     result = false;
   488     artist = QString();
   553     artist = QString();
   489     mTest->mArtist = QString( "artistTwo" );
   554     mTestPrivate->mArtist = QString( "artistTwo" );
   490     result = mTest->setArtist( artist );
   555     result = mTestPrivate->setArtist( artist );
   491     QCOMPARE( result, true );
   556     QCOMPARE( result, true );
   492     QCOMPARE( mTest->artist().isNull(), true ); 
   557     QCOMPARE( mTest->artist().isNull(), true );
   493 }
   558 }
   494 
   559 
   495 /*!
   560 /*!
   496  Test SetComment() 
   561  Test SetComment()
   497  */
   562  */
   498 void TestMpSongData::testSetComment()
   563 void TestMpSongData::testSetComment()
   499 {
   564 {
   500     bool result;    
   565     bool result;
   501     QString comment( "comment" );
   566     QString comment( "comment" );
   502     mTest->mComment = QString();
   567     mTestPrivate->mComment = QString();
   503     result = mTest->setComment( comment );
   568     result = mTestPrivate->setComment( comment );
   504     QCOMPARE( result, true );
   569     QCOMPARE( result, true );
   505     QCOMPARE( mTest->comment(), comment ); 
   570     QCOMPARE( mTest->comment(), comment );
   506     
   571 
   507     result = false;
   572     result = false;
   508     comment = QString( "comment" );
   573     comment = QString( "comment" );
   509     mTest->mComment = QString( "commentTwo" );
   574     mTestPrivate->mComment = QString( "commentTwo" );
   510     result = mTest->setComment( comment );
   575     result = mTestPrivate->setComment( comment );
   511     QCOMPARE( result, true );
   576     QCOMPARE( result, true );
   512     QCOMPARE( mTest->comment(), comment ); 
   577     QCOMPARE( mTest->comment(), comment );
   513     
   578 
   514     result = false;
   579     result = false;
   515     comment = QString();
   580     comment = QString();
   516     mTest->mComment = QString();
   581     mTestPrivate->mComment = QString();
   517     result = mTest->setComment( comment );
   582     result = mTestPrivate->setComment( comment );
   518     QCOMPARE( result, false );
   583     QCOMPARE( result, false );
   519     QCOMPARE( mTest->comment().isNull(), true ); 
   584     QCOMPARE( mTest->comment().isNull(), true );
   520     
   585 
   521     result = false;
   586     result = false;
   522     comment = QString();
   587     comment = QString();
   523     mTest->mComment = QString( "commentTwo" );
   588     mTestPrivate->mComment = QString( "commentTwo" );
   524     result = mTest->setComment( comment );
   589     result = mTestPrivate->setComment( comment );
   525     QCOMPARE( result, true );
   590     QCOMPARE( result, true );
   526     QCOMPARE( mTest->comment().isNull(), true ); 
   591     QCOMPARE( mTest->comment().isNull(), true );
   527 }
   592 }
   528 
   593 
   529 /*!
   594 /*!
   530  Test SetYear() 
   595  Test SetYear()
   531  */
   596  */
   532 void TestMpSongData::testSetYear()
   597 void TestMpSongData::testSetYear()
   533 {
   598 {
   534     bool result;    
   599     bool result;
   535     int year = 2010;
   600     int year = 2010;
   536     mTest->mYear = QString();
   601     mTestPrivate->mYear = QString();
   537     result = mTest->setYear( year );
   602     result = mTestPrivate->setYear( year );
   538     QCOMPARE( result, true );
   603     QCOMPARE( result, true );
   539     QCOMPARE( mTest->year(), QString::number( year ) ); 
   604     QCOMPARE( mTest->year(), QString::number( year ) );
   540     
   605 
   541     result = false;
   606     result = false;
   542     year = 2010;
   607     year = 2010;
   543     mTest->mYear = QString::number( 2011 );
   608     mTestPrivate->mYear = QString::number( 2011 );
   544     result = mTest->setYear( year );
   609     result = mTestPrivate->setYear( year );
   545     QCOMPARE( result, true );
   610     QCOMPARE( result, true );
   546     QCOMPARE( mTest->year(), QString::number( year ) ); 
   611     QCOMPARE( mTest->year(), QString::number( year ) );
   547     
   612 
   548     result = false;
   613     result = false;
   549     year = -1;
   614     year = -1;
   550     mTest->mYear = QString();
   615     mTestPrivate->mYear = QString();
   551     result = mTest->setYear( year );
   616     result = mTestPrivate->setYear( year );
   552     QCOMPARE( result, true );
   617     QCOMPARE( result, true );
   553     QCOMPARE( mTest->year().isNull(), true ); 
   618     QCOMPARE( mTest->year().isNull(), true );
   554     
   619 
   555     result = false;
   620     result = false;
   556     year = -1;
   621     year = -1;
   557     mTest->mYear = QString::number( 2011 );
   622     mTestPrivate->mYear = QString::number( 2011 );
   558     result = mTest->setYear( year );
   623     result = mTestPrivate->setYear( year );
   559     QCOMPARE( result, true );
   624     QCOMPARE( result, true );
   560     QCOMPARE( mTest->year().isNull(), true ); 
   625     QCOMPARE( mTest->year().isNull(), true );
   561 }
   626 }
   562 
   627 
   563 /*!
   628 /*!
   564  Test setGenre() 
   629  Test setGenre()
   565  */
   630  */
   566 void TestMpSongData::testSetGenre()
   631 void TestMpSongData::testSetGenre()
   567 {
   632 {
   568     bool result;    
   633     bool result;
   569     QString genre( "genre" );
   634     QString genre( "genre" );
   570     mTest->mGenre = QString();
   635     mTestPrivate->mGenre = QString();
   571     result = mTest->setGenre( genre );
   636     result = mTestPrivate->setGenre( genre );
   572     QCOMPARE( result, true );
   637     QCOMPARE( result, true );
   573     QCOMPARE( mTest->genre(), genre ); 
   638     QCOMPARE( mTest->genre(), genre );
   574     
   639 
   575     result = false;
   640     result = false;
   576     genre = QString( "genre" );
   641     genre = QString( "genre" );
   577     mTest->mGenre = QString( "genreTwo" );
   642     mTestPrivate->mGenre = QString( "genreTwo" );
   578     result = mTest->setGenre( genre );
   643     result = mTestPrivate->setGenre( genre );
   579     QCOMPARE( result, true );
   644     QCOMPARE( result, true );
   580     QCOMPARE( mTest->genre(), genre ); 
   645     QCOMPARE( mTest->genre(), genre );
   581     
   646 
   582     result = false;
   647     result = false;
   583     genre = QString();
   648     genre = QString();
   584     mTest->mGenre = QString();
   649     mTestPrivate->mGenre = QString();
   585     result = mTest->setGenre( genre );
   650     result = mTestPrivate->setGenre( genre );
   586     QCOMPARE( result, false );
   651     QCOMPARE( result, false );
   587     QCOMPARE( mTest->genre().isNull(), true ); 
   652     QCOMPARE( mTest->genre().isNull(), true );
   588     
   653 
   589     result = false;
   654     result = false;
   590     genre = QString();
   655     genre = QString();
   591     mTest->mGenre = QString( "genreTwo" );
   656     mTestPrivate->mGenre = QString( "genreTwo" );
   592     result = mTest->setGenre( genre );
   657     result = mTestPrivate->setGenre( genre );
   593     QCOMPARE( result, true );
   658     QCOMPARE( result, true );
   594     QCOMPARE( mTest->genre().isNull(), true ); 
   659     QCOMPARE( mTest->genre().isNull(), true );
   595 }
   660 }
   596 
   661 
   597 /*!
   662 /*!
   598  Test setComposer() 
   663  Test setComposer()
   599  */
   664  */
   600 void TestMpSongData::testSetComposer()
   665 void TestMpSongData::testSetComposer()
   601 {
   666 {
   602     bool result;    
   667     bool result;
   603     QString composer( "composer" );
   668     QString composer( "composer" );
   604     mTest->mComposer = QString();
   669     mTestPrivate->mComposer = QString();
   605     result = mTest->setComposer( composer );
   670     result = mTestPrivate->setComposer( composer );
   606     QCOMPARE( result, true );
   671     QCOMPARE( result, true );
   607     QCOMPARE( mTest->composer(), composer ); 
   672     QCOMPARE( mTest->composer(), composer );
   608     
   673 
   609     result = false;
   674     result = false;
   610     composer = QString( "composer" );
   675     composer = QString( "composer" );
   611     mTest->mComposer = QString( "composerTwo" );
   676     mTestPrivate->mComposer = QString( "composerTwo" );
   612     result = mTest->setComposer( composer );
   677     result = mTestPrivate->setComposer( composer );
   613     QCOMPARE( result, true );
   678     QCOMPARE( result, true );
   614     QCOMPARE( mTest->composer(), composer ); 
   679     QCOMPARE( mTest->composer(), composer );
   615     
   680 
   616     result = false;
   681     result = false;
   617     composer = QString();
   682     composer = QString();
   618     mTest->mComposer = QString();
   683     mTestPrivate->mComposer = QString();
   619     result = mTest->setComposer( composer );
   684     result = mTestPrivate->setComposer( composer );
   620     QCOMPARE( result, false );
   685     QCOMPARE( result, false );
   621     QCOMPARE( mTest->composer().isNull(), true ); 
   686     QCOMPARE( mTest->composer().isNull(), true );
   622     
   687 
   623     result = false;
   688     result = false;
   624     composer = QString();
   689     composer = QString();
   625     mTest->mComposer = QString( "composerTwo" );
   690     mTestPrivate->mComposer = QString( "composerTwo" );
   626     result = mTest->setComposer( composer );
   691     result = mTestPrivate->setComposer( composer );
   627     QCOMPARE( result, true );
   692     QCOMPARE( result, true );
   628     QCOMPARE( mTest->composer().isNull(), true ); 
   693     QCOMPARE( mTest->composer().isNull(), true );
   629 }
   694 }
   630 
   695 
   631 /*!
   696 /*!
   632  Test setAlbumTrack() 
   697  Test setAlbumTrack()
   633  */
   698  */
   634 void TestMpSongData::testSetAlbumTrack()
   699 void TestMpSongData::testSetAlbumTrack()
   635 {
   700 {
   636     bool result;    
   701     bool result;
   637     QString albumTrack( "2" );
   702     QString albumTrack( "2" );
   638     mTest->mAlbumTrack = QString();
   703     mTestPrivate->mAlbumTrack = QString();
   639     result = mTest->setAlbumTrack( albumTrack );
   704     result = mTestPrivate->setAlbumTrack( albumTrack );
   640     QCOMPARE( result, true );
   705     QCOMPARE( result, true );
   641     QCOMPARE( mTest->albumTrack(), albumTrack ); 
   706     QCOMPARE( mTest->albumTrack(), albumTrack );
   642     
   707 
   643     result = false;
   708     result = false;
   644     albumTrack = QString( "2" );
   709     albumTrack = QString( "2" );
   645     mTest->mAlbumTrack = QString( "3" );
   710     mTestPrivate->mAlbumTrack = QString( "3" );
   646     result = mTest->setAlbumTrack( albumTrack );
   711     result = mTestPrivate->setAlbumTrack( albumTrack );
   647     QCOMPARE( result, true );
   712     QCOMPARE( result, true );
   648     QCOMPARE( mTest->albumTrack(), albumTrack ); 
   713     QCOMPARE( mTest->albumTrack(), albumTrack );
   649     
   714 
   650     result = false;
   715     result = false;
   651     albumTrack = QString();
   716     albumTrack = QString();
   652     mTest->mAlbumTrack = QString();
   717     mTestPrivate->mAlbumTrack = QString();
   653     result = mTest->setAlbumTrack( albumTrack );
   718     result = mTestPrivate->setAlbumTrack( albumTrack );
   654     QCOMPARE( result, false );
   719     QCOMPARE( result, false );
   655     QCOMPARE( mTest->albumTrack().isNull(), true ); 
   720     QCOMPARE( mTest->albumTrack().isNull(), true );
   656     
   721 
   657     result = false;
   722     result = false;
   658     albumTrack = QString();
   723     albumTrack = QString();
   659     mTest->mAlbumTrack = QString( "3" );
   724     mTestPrivate->mAlbumTrack = QString( "3" );
   660     result = mTest->setAlbumTrack( albumTrack );
   725     result = mTestPrivate->setAlbumTrack( albumTrack );
   661     QCOMPARE( result, true );
   726     QCOMPARE( result, true );
   662     QCOMPARE( mTest->albumTrack().isNull(), true ); 
   727     QCOMPARE( mTest->albumTrack().isNull(), true );
   663 }
   728 }
   664 
   729 
   665 /*!
   730 /*!
   666  Test setLink() 
   731  Test setLink()
   667  */
   732  */
   668 void TestMpSongData::testSetLink()
   733 void TestMpSongData::testSetLink()
   669 {  
   734 {
   670     QString link( "www.nokia.com" );
   735     QString link( "www.nokia.com" );
   671     mTest->mLink = QString();
   736     mTestPrivate->mLink = QString();
   672     mTest->setLink( link );
   737     mTestPrivate->setLink( link );
   673     QCOMPARE( mTest->link(), link ); 
   738     QCOMPARE( mTest->link(), link );
   674     
   739 
   675     link = QString( "www.nokia.com" );
   740     link = QString( "www.nokia.com" );
   676     mTest->mLink = QString( "www.nokia.fi" );
   741     mTestPrivate->mLink = QString( "www.nokia.fi" );
   677     mTest->setLink( link );
   742     mTestPrivate->setLink( link );
   678     QCOMPARE( mTest->link(), link ); 
   743     QCOMPARE( mTest->link(), link );
   679     
   744 
   680     link = QString();
   745     link = QString();
   681     mTest->mLink = QString();
   746     mTestPrivate->mLink = QString();
   682     mTest->setLink( link );
   747     mTestPrivate->setLink( link );
   683     QCOMPARE( mTest->link().isNull(), true ); 
   748     QCOMPARE( mTest->link().isNull(), true );
   684     
   749 
   685     link = QString();
   750     link = QString();
   686     mTest->mLink = QString( "www.nokia.fi" );
   751     mTestPrivate->mLink = QString( "www.nokia.fi" );
   687     mTest->setLink( link );
   752     mTestPrivate->setLink( link );
   688     QCOMPARE( mTest->link().isNull(), true ); 
   753     QCOMPARE( mTest->link().isNull(), true );
   689 }
   754 }
   690 
   755 
   691 /*!
   756 /*!
   692  Test setFileName() 
   757  Test setFileName()
   693  */
   758  */
   694 void TestMpSongData::testSetFileName()
   759 void TestMpSongData::testSetFileName()
   695 {
   760 {
   696     bool result;    
   761     bool result;
   697     QString fileName( "fileName" );
   762     QString fileName( "fileName" );
   698     mTest->mFileName = QString();
   763     mTestPrivate->mFileName = QString();
   699     result = mTest->setFileName( fileName );
   764     result = mTestPrivate->setFileName( fileName );
   700     QCOMPARE( result, true );
   765     QCOMPARE( result, true );
   701     QCOMPARE( mTest->fileName(), fileName ); 
   766     QCOMPARE( mTest->fileName(), fileName );
   702     
   767 
   703     result = false;
   768     result = false;
   704     fileName = QString( "fileName" );
   769     fileName = QString( "fileName" );
   705     mTest->mFileName = QString( "fileNameTwo" );
   770     mTestPrivate->mFileName = QString( "fileNameTwo" );
   706     result = mTest->setFileName( fileName );
   771     result = mTestPrivate->setFileName( fileName );
   707     QCOMPARE( result, true );
   772     QCOMPARE( result, true );
   708     QCOMPARE( mTest->fileName(), fileName ); 
   773     QCOMPARE( mTest->fileName(), fileName );
   709     
   774 
   710     result = false;
   775     result = false;
   711     fileName = QString();
   776     fileName = QString();
   712     mTest->mFileName = QString();
   777     mTestPrivate->mFileName = QString();
   713     result = mTest->setFileName( fileName );
   778     result = mTestPrivate->setFileName( fileName );
   714     QCOMPARE( result, false );
   779     QCOMPARE( result, false );
   715     QCOMPARE( mTest->fileName().isNull(), true ); 
   780     QCOMPARE( mTest->fileName().isNull(), true );
   716     
   781 
   717     result = false;
   782     result = false;
   718     fileName = QString();
   783     fileName = QString();
   719     mTest->mFileName = QString( "fileNameTwo" );
   784     mTestPrivate->mFileName = QString( "fileNameTwo" );
   720     result = mTest->setFileName( fileName );
   785     result = mTestPrivate->setFileName( fileName );
   721     QCOMPARE( result, true );
   786     QCOMPARE( result, true );
   722     QCOMPARE( mTest->fileName().isNull(), true ); 
   787     QCOMPARE( mTest->fileName().isNull(), true );
   723 }
   788 }
   724 
   789 
   725 /*!
   790 /*!
   726  Test setMimeType() 
   791  Test setMimeType()
   727  */
   792  */
   728 void TestMpSongData::testSetMimeType()
   793 void TestMpSongData::testSetMimeType()
   729 {
   794 {
   730     bool result;    
   795     bool result;
   731     QString mimeType( "mimeType" );
   796     QString mimeType( "mimeType" );
   732     mTest->mMimeType = QString();
   797     mTestPrivate->mMimeType = QString();
   733     result = mTest->setMimeType( mimeType );
   798     result = mTestPrivate->setMimeType( mimeType );
   734     QCOMPARE( result, true );
   799     QCOMPARE( result, true );
   735     QCOMPARE( mTest->mimeType(), mimeType ); 
   800     QCOMPARE( mTest->mimeType(), mimeType );
   736     
   801 
   737     result = false;
   802     result = false;
   738     mimeType = QString( "mimeType" );
   803     mimeType = QString( "mimeType" );
   739     mTest->mMimeType = QString( "mimeTypeTwo" );
   804     mTestPrivate->mMimeType = QString( "mimeTypeTwo" );
   740     result = mTest->setMimeType( mimeType );
   805     result = mTestPrivate->setMimeType( mimeType );
   741     QCOMPARE( result, true );
   806     QCOMPARE( result, true );
   742     QCOMPARE( mTest->mimeType(), mimeType ); 
   807     QCOMPARE( mTest->mimeType(), mimeType );
   743     
   808 
   744     result = false;
   809     result = false;
   745     mimeType = QString();
   810     mimeType = QString();
   746     mTest->mMimeType = QString();
   811     mTestPrivate->mMimeType = QString();
   747     result = mTest->setMimeType( mimeType );
   812     result = mTestPrivate->setMimeType( mimeType );
   748     QCOMPARE( result, false );
   813     QCOMPARE( result, false );
   749     QCOMPARE( mTest->mimeType().isNull(), true ); 
   814     QCOMPARE( mTest->mimeType().isNull(), true );
   750     
   815 
   751     result = false;
   816     result = false;
   752     mimeType = QString();
   817     mimeType = QString();
   753     mTest->mMimeType = QString( "mimeTypeTwo" );
   818     mTestPrivate->mMimeType = QString( "mimeTypeTwo" );
   754     result = mTest->setMimeType( mimeType );
   819     result = mTestPrivate->setMimeType( mimeType );
   755     QCOMPARE( result, true );
   820     QCOMPARE( result, true );
   756     QCOMPARE( mTest->mimeType().isNull(), true ); 
   821     QCOMPARE( mTest->mimeType().isNull(), true );
   757 }
   822 }
   758 
   823 
   759 /*!
   824 /*!
   760  Test setDuration()  // TODO: more cases to add here for different time interval
   825  Test setDuration()  // TODO: more cases to add here for different time interval
   761  */
   826  */
   762 void TestMpSongData::testSetDuration()
   827 void TestMpSongData::testSetDuration()
   763 {
   828 {
   764     bool result;    
   829     bool result;
   765     int duration = 100;
   830     int duration = 100;
   766     mTest->mDuration = QString();
   831     mTestPrivate->mDuration = QString();
   767     result = mTest->setDuration( duration );
   832     result = mTestPrivate->setDuration( duration );
   768     QCOMPARE( result, true );
   833     QCOMPARE( result, true );
   769     QCOMPARE( mTest->duration(), QString("01:40") ); 
   834     QCOMPARE( mTest->duration(), QString("01:40") );
   770     
   835 
   771     result = false;
   836     result = false;
   772     duration = 100;
   837     duration = 100;
   773     mTest->mDuration = QString( "02:00" );
   838     mTestPrivate->mDuration = QString( "02:00" );
   774     result = mTest->setDuration( duration );
   839     result = mTestPrivate->setDuration( duration );
   775     QCOMPARE( result, true );
   840     QCOMPARE( result, true );
   776     QCOMPARE( mTest->duration(), QString("01:40") ); 
   841     QCOMPARE( mTest->duration(), QString("01:40") );
   777     
   842 
   778     result = false;
   843     result = false;
   779     duration = -1;
   844     duration = -1;
   780     mTest->mDuration = QString();
   845     mTestPrivate->mDuration = QString();
   781     result = mTest->setDuration( duration );
   846     result = mTestPrivate->setDuration( duration );
   782     QCOMPARE( result, true );
   847     QCOMPARE( result, true );
   783     QCOMPARE( mTest->duration().isNull(), true ); 
   848     QCOMPARE( mTest->duration().isNull(), true );
   784     
   849 
   785     result = false;
   850     result = false;
   786     duration = -1;
   851     duration = -1;
   787     mTest->mDuration = QString( "02:00" );
   852     mTestPrivate->mDuration = QString( "02:00" );
   788     result = mTest->setDuration( duration );
   853     result = mTestPrivate->setDuration( duration );
   789     QCOMPARE( result, true );
   854     QCOMPARE( result, true );
   790     QCOMPARE( mTest->duration().isNull(), true ); 
   855     QCOMPARE( mTest->duration().isNull(), true );
   791 }
   856 }
   792 
   857 
   793 /*!
   858 /*!
   794  Test setBitRate() 
   859  Test setBitRate()
   795  */
   860  */
   796 void TestMpSongData::testSetBitRate()
   861 void TestMpSongData::testSetBitRate()
   797 {
   862 {
   798     bool result;    
   863     bool result;
   799     int bitRate = 302000;
   864     int bitRate = 302000;
   800     mTest->mBitRate = QString();
   865     mTestPrivate->mBitRate = QString();
   801     result = mTest->setBitRate( bitRate );
   866     result = mTestPrivate->setBitRate( bitRate );
   802     QCOMPARE( result, true );
   867     QCOMPARE( result, true );
   803     QCOMPARE( mTest->bitRate(), QString::number( bitRate / 1000 ) ); 
   868     QCOMPARE( mTest->bitRate(), QString::number( bitRate / 1000 ) );
   804     
   869 
   805     result = false;
   870     result = false;
   806     bitRate = 302000;
   871     bitRate = 302000;
   807     mTest->mBitRate = QString::number( 412 );
   872     mTestPrivate->mBitRate = QString::number( 412 );
   808     result = mTest->setBitRate( bitRate );
   873     result = mTestPrivate->setBitRate( bitRate );
   809     QCOMPARE( result, true );
   874     QCOMPARE( result, true );
   810     QCOMPARE( mTest->bitRate(), QString::number( bitRate / 1000 ) ); 
   875     QCOMPARE( mTest->bitRate(), QString::number( bitRate / 1000 ) );
   811     
   876 
   812     result = false;
   877     result = false;
   813     bitRate = -1;
   878     bitRate = -1;
   814     mTest->mBitRate = QString();
   879     mTestPrivate->mBitRate = QString();
   815     result = mTest->setBitRate( bitRate );
   880     result = mTestPrivate->setBitRate( bitRate );
   816     QCOMPARE( result, true );
   881     QCOMPARE( result, true );
   817     QCOMPARE( mTest->bitRate().isNull(), true ); 
   882     QCOMPARE( mTest->bitRate().isNull(), true );
   818     
   883 
   819     result = false;
   884     result = false;
   820     bitRate = -1;
   885     bitRate = -1;
   821     mTest->mBitRate = QString::number( 412 );
   886     mTestPrivate->mBitRate = QString::number( 412 );
   822     result = mTest->setBitRate( bitRate );
   887     result = mTestPrivate->setBitRate( bitRate );
   823     QCOMPARE( result, true );
   888     QCOMPARE( result, true );
   824     QCOMPARE( mTest->bitRate().isNull(), true ); 
   889     QCOMPARE( mTest->bitRate().isNull(), true );
   825 }
   890 }
   826 
   891 
   827 /*!
   892 /*!
   828  Test setSampleRate
   893  Test setSampleRate
   829  */
   894  */
   830 void TestMpSongData::testSetSampleRate()
   895 void TestMpSongData::testSetSampleRate()
   831 {
   896 {
   832     bool result;    
   897     bool result;
   833     int sampleRate = 44100;
   898     int sampleRate = 44100;
   834     mTest->mSampleRate = QString();
   899     mTestPrivate->mSampleRate = QString();
   835     result = mTest->setSampleRate( sampleRate );
   900     result = mTestPrivate->setSampleRate( sampleRate );
   836     QCOMPARE( result, true );
   901     QCOMPARE( result, true );
   837     QCOMPARE( mTest->sampleRate(), QString::number( sampleRate ) ); 
   902     QCOMPARE( mTest->sampleRate(), QString::number( sampleRate ) );
   838     
   903 
   839     result = false;
   904     result = false;
   840     sampleRate = 44100;
   905     sampleRate = 44100;
   841     mTest->mSampleRate = QString::number( 55000 );
   906     mTestPrivate->mSampleRate = QString::number( 55000 );
   842     result = mTest->setSampleRate( sampleRate );
   907     result = mTestPrivate->setSampleRate( sampleRate );
   843     QCOMPARE( result, true );
   908     QCOMPARE( result, true );
   844     QCOMPARE( mTest->sampleRate(), QString::number( sampleRate ) ); 
   909     QCOMPARE( mTest->sampleRate(), QString::number( sampleRate ) );
   845     
   910 
   846     result = false;
   911     result = false;
   847     sampleRate = -1;
   912     sampleRate = -1;
   848     mTest->mSampleRate = QString();
   913     mTestPrivate->mSampleRate = QString();
   849     result = mTest->setSampleRate( sampleRate );
   914     result = mTestPrivate->setSampleRate( sampleRate );
   850     QCOMPARE( result, true );
   915     QCOMPARE( result, true );
   851     QCOMPARE( mTest->sampleRate().isNull(), true ); 
   916     QCOMPARE( mTest->sampleRate().isNull(), true );
   852     
   917 
   853     result = false;
   918     result = false;
   854     sampleRate = -1;
   919     sampleRate = -1;
   855     mTest->mSampleRate = QString::number( 55000 );
   920     mTestPrivate->mSampleRate = QString::number( 55000 );
   856     result = mTest->setSampleRate( sampleRate );
   921     result = mTestPrivate->setSampleRate( sampleRate );
   857     QCOMPARE( result, true );
   922     QCOMPARE( result, true );
   858     QCOMPARE( mTest->sampleRate().isNull(), true ); 
   923     QCOMPARE( mTest->sampleRate().isNull(), true );
   859 }
   924 }
   860 
   925 
   861 /*!
   926 /*!
   862  Test setSize
   927  Test setSize
   863  */
   928  */
   864 void TestMpSongData::testSetSize()
   929 void TestMpSongData::testSetSize()
   865 {
   930 {
   866     bool result;    
   931     bool result;
   867     int size = 4300;
   932     int size = 4300;
   868     mTest->mSize = QString();
   933     mTestPrivate->mSize = QString();
   869     result = mTest->setSize( size );
   934     result = mTestPrivate->setSize( size );
   870     QCOMPARE( result, true );
   935     QCOMPARE( result, true );
   871     QCOMPARE( mTest->size(), QString::number( size / 1000 ) ); 
   936     QCOMPARE( mTest->size(), QString::number( size ) );
   872     
   937 
   873     result = false;
   938     result = false;
   874     size = 4300;
   939     size = 4300;
   875     mTest->mSize = QString( "5" );
   940     mTestPrivate->mSize = QString( "5" );
   876     result = mTest->setSize( size );
   941     result = mTestPrivate->setSize( size );
   877     QCOMPARE( result, true );
   942     QCOMPARE( result, true );
   878     QCOMPARE( mTest->size(), QString::number( size / 1000 ) );     
   943     QCOMPARE( mTest->size(), QString::number( size ) );
   879 }
   944 }
   880 
   945 
   881 /*!
   946 /*!
   882  Test setModified
   947  Test setModified
   883  */
   948  */
   884 void TestMpSongData::testSetModified()
   949 void TestMpSongData::testSetModified()
   885 {
   950 {
   886     bool result;    
   951     bool result;
   887     QString modified( "5.7.2010 14:35:08" );
   952     QString modified( "5.7.2010 14:35:08" );
   888     mTest->mModified = QString();
   953     mTestPrivate->mModified = QString();
   889     result = mTest->setModified( modified );
   954     result = mTestPrivate->setModified( modified );
   890     QCOMPARE( result, true );
   955     QCOMPARE( result, true );
   891     QCOMPARE( mTest->modified(), modified ); 
   956     QCOMPARE( mTest->modified(), modified );
   892     
   957 
   893     result = false;
   958     result = false;
   894     modified = QString( "5.7.2010 14:35:08" );
   959     modified = QString( "5.7.2010 14:35:08" );
   895     mTest->mModified = QString( "9.7.2010 16:35:08" );
   960     mTestPrivate->mModified = QString( "9.7.2010 16:35:08" );
   896     result = mTest->setModified( modified );
   961     result = mTestPrivate->setModified( modified );
   897     QCOMPARE( result, true );
   962     QCOMPARE( result, true );
   898     QCOMPARE( mTest->modified(), modified ); 
   963     QCOMPARE( mTest->modified(), modified );
   899     
   964 
   900     result = false;
   965     result = false;
   901     modified = QString();
   966     modified = QString();
   902     mTest->mModified = QString();
   967     mTestPrivate->mModified = QString();
   903     result = mTest->setModified( modified );
   968     result = mTestPrivate->setModified( modified );
   904     QCOMPARE( result, false );
   969     QCOMPARE( result, false );
   905     QCOMPARE( mTest->modified().isNull(), true ); 
   970     QCOMPARE( mTest->modified().isNull(), true );
   906     
   971 
   907     result = false;
   972     result = false;
   908     modified = QString();
   973     modified = QString();
   909     mTest->mModified = QString( "9.7.2010 16:35:08" );
   974     mTestPrivate->mModified = QString( "9.7.2010 16:35:08" );
   910     result = mTest->setModified( modified );
   975     result = mTestPrivate->setModified( modified );
   911     QCOMPARE( result, true );
   976     QCOMPARE( result, true );
   912     QCOMPARE( mTest->modified().isNull(), true ); 
   977     QCOMPARE( mTest->modified().isNull(), true );
   913 }
   978 }
   914 
   979 
   915 /*!
   980 /*!
   916  Test setCopyright
   981  Test setCopyright
   917  */
   982  */
   918 void TestMpSongData::testSetCopyright()
   983 void TestMpSongData::testSetCopyright()
   919 {
   984 {
   920     bool result;    
   985     bool result;
   921     QString copyright( "copyright" );
   986     QString copyright( "copyright" );
   922     mTest->mCopyright = QString();
   987     mTestPrivate->mCopyright = QString();
   923     result = mTest->setCopyright( copyright );
   988     result = mTestPrivate->setCopyright( copyright );
   924     QCOMPARE( result, true );
   989     QCOMPARE( result, true );
   925     QCOMPARE( mTest->copyright(), copyright ); 
   990     QCOMPARE( mTest->copyright(), copyright );
   926     
   991 
   927     result = false;
   992     result = false;
   928     copyright = QString( "copyright" );
   993     copyright = QString( "copyright" );
   929     mTest->mCopyright = QString( "copyrightTwo" );
   994     mTestPrivate->mCopyright = QString( "copyrightTwo" );
   930     result = mTest->setCopyright( copyright );
   995     result = mTestPrivate->setCopyright( copyright );
   931     QCOMPARE( result, true );
   996     QCOMPARE( result, true );
   932     QCOMPARE( mTest->copyright(), copyright ); 
   997     QCOMPARE( mTest->copyright(), copyright );
   933     
   998 
   934     result = false;
   999     result = false;
   935     copyright = QString();
  1000     copyright = QString();
   936     mTest->mCopyright = QString();
  1001     mTestPrivate->mCopyright = QString();
   937     result = mTest->setCopyright( copyright );
  1002     result = mTestPrivate->setCopyright( copyright );
   938     QCOMPARE( result, false );
  1003     QCOMPARE( result, false );
   939     QCOMPARE( mTest->copyright().isNull(), true ); 
  1004     QCOMPARE( mTest->copyright().isNull(), true );
   940     
  1005 
   941     result = false;
  1006     result = false;
   942     copyright = QString();
  1007     copyright = QString();
   943     mTest->mCopyright = QString( "copyrightTwo" );
  1008     mTestPrivate->mCopyright = QString( "copyrightTwo" );
   944     result = mTest->setCopyright( copyright );
  1009     result = mTestPrivate->setCopyright( copyright );
   945     QCOMPARE( result, true );
  1010     QCOMPARE( result, true );
   946     QCOMPARE( mTest->copyright().isNull(), true ); 
  1011     QCOMPARE( mTest->copyright().isNull(), true );
   947 }
  1012 }
   948 
  1013 
   949 /*!
  1014 /*!
   950  Test setMusicURL
  1015  Test setMusicURL
   951  */
  1016  */
   952 void TestMpSongData::testSetMusicURL()
  1017 void TestMpSongData::testSetMusicURL()
   953 {
  1018 {
   954     bool result;    
  1019     bool result;
   955     QString musicURL( "musicURL" );
  1020     QString musicURL( "musicURL" );
   956     mTest->mMusicURL = QString();
  1021     mTestPrivate->mMusicURL = QString();
   957     result = mTest->setMusicURL( musicURL );
  1022     result = mTestPrivate->setMusicURL( musicURL );
   958     QCOMPARE( result, true );
  1023     QCOMPARE( result, true );
   959     QCOMPARE( mTest->musicURL(), musicURL ); 
  1024     QCOMPARE( mTest->musicURL(), musicURL );
   960     
  1025 
   961     result = false;
  1026     result = false;
   962     musicURL = QString( "musicURL" );
  1027     musicURL = QString( "musicURL" );
   963     mTest->mMusicURL = QString( "musicURLTwo" );
  1028     mTestPrivate->mMusicURL = QString( "musicURLTwo" );
   964     result = mTest->setMusicURL( musicURL );
  1029     result = mTestPrivate->setMusicURL( musicURL );
   965     QCOMPARE( result, true );
  1030     QCOMPARE( result, true );
   966     QCOMPARE( mTest->musicURL(), musicURL ); 
  1031     QCOMPARE( mTest->musicURL(), musicURL );
   967     
  1032 
   968     result = false;
  1033     result = false;
   969     musicURL = QString();
  1034     musicURL = QString();
   970     mTest->mMusicURL = QString();
  1035     mTestPrivate->mMusicURL = QString();
   971     result = mTest->setMusicURL( musicURL );
  1036     result = mTestPrivate->setMusicURL( musicURL );
   972     QCOMPARE( result, false );
  1037     QCOMPARE( result, false );
   973     QCOMPARE( mTest->musicURL().isNull(), true ); 
  1038     QCOMPARE( mTest->musicURL().isNull(), true );
   974     
  1039 
   975     result = false;
  1040     result = false;
   976     musicURL = QString();
  1041     musicURL = QString();
   977     mTest->mMusicURL = QString( "musicURLTwo" );
  1042     mTestPrivate->mMusicURL = QString( "musicURLTwo" );
   978     result = mTest->setMusicURL( musicURL );
  1043     result = mTestPrivate->setMusicURL( musicURL );
   979     QCOMPARE( result, true );
  1044     QCOMPARE( result, true );
   980     QCOMPARE( mTest->musicURL().isNull(), true ); 
  1045     QCOMPARE( mTest->musicURL().isNull(), true );
   981 }
  1046 }
   982 
  1047 
   983 /*!
  1048 /*!
   984  Test setDrmProtected
  1049  Test setDrmProtected
   985  */
  1050  */
   986 void TestMpSongData::testSetDrmProtected()
  1051 void TestMpSongData::testSetDrmProtected()
   987 {
  1052 {
   988     bool result;    
  1053     bool result;
   989     bool drmProtected = false;
  1054     bool drmProtected = false;
   990     mTest->mDrmProtected = true;
  1055     mTestPrivate->mDrmProtected = true;
   991     result = mTest->setDrmProtected( drmProtected );
  1056     result = mTestPrivate->setDrmProtected( drmProtected );
   992     QCOMPARE( result, true );
  1057     QCOMPARE( result, true );
   993     QCOMPARE( mTest->isDrmProtected(), false ); 
  1058     QCOMPARE( mTest->isDrmProtected(), false );
   994     
  1059 
   995     result = false;
  1060     result = false;
   996     drmProtected = false;
  1061     drmProtected = false;
   997     mTest->mDrmProtected = false;
  1062     mTestPrivate->mDrmProtected = false;
   998     result = mTest->setDrmProtected( drmProtected );
  1063     result = mTestPrivate->setDrmProtected( drmProtected );
   999     QCOMPARE( result, false );
  1064     QCOMPARE( result, false );
  1000     QCOMPARE( mTest->isDrmProtected(), false ); 
  1065     QCOMPARE( mTest->isDrmProtected(), false );
  1001     
  1066 
  1002     result = false;
  1067     result = false;
  1003     drmProtected = true;
  1068     drmProtected = true;
  1004     mTest->mDrmProtected = true;
  1069     mTestPrivate->mDrmProtected = true;
  1005     result = mTest->setDrmProtected( drmProtected);
  1070     result = mTestPrivate->setDrmProtected( drmProtected);
  1006     QCOMPARE( result, false );
  1071     QCOMPARE( result, false );
  1007     QCOMPARE( mTest->isDrmProtected(), true ); 
  1072     QCOMPARE( mTest->isDrmProtected(), true );
  1008     
  1073 
  1009     result = false;
  1074     result = false;
  1010     drmProtected = true;
  1075     drmProtected = true;
  1011     mTest->mDrmProtected = false;
  1076     mTestPrivate->mDrmProtected = false;
  1012     result = mTest->setDrmProtected( drmProtected );
  1077     result = mTestPrivate->setDrmProtected( drmProtected );
  1013     QCOMPARE( result, true );
  1078     QCOMPARE( result, true );
  1014     QCOMPARE( mTest->isDrmProtected(), true ); 
  1079     QCOMPARE( mTest->isDrmProtected(), true );
  1015 }
  1080 }
  1016 
  1081 
  1017 
  1082 
  1018 /*!
  1083 /*!
  1019  Test setAlbumArtUri() 
  1084  Test setAlbumArtUri()
  1020  */
  1085  */
  1021 void TestMpSongData::testSetAlbumArtUri() 
  1086 void TestMpSongData::testSetAlbumArtUri()
  1022 {
  1087 {
  1023     const QString albumArtUri( "AlbumArt" );
  1088     const QString albumArtUri( "AlbumArt" );
  1024     const QString albumArtUriEmpty( "" );
  1089     const QString albumArtUriEmpty( "" );
  1025     
  1090 
  1026     QSignalSpy spy( mTest, SIGNAL( albumArtReady() ) );
  1091     QSignalSpy spy( mTest, SIGNAL( albumArtReady() ) );
  1027     
  1092 
  1028     QVERIFY( spy.isValid() );
  1093     QVERIFY( spy.isValid() );
  1029     QCOMPARE( spy.count(), 0 );
  1094     QCOMPARE( spy.count(), 0 );
  1030     
  1095 
  1031     mTest->setAlbumArtUri( albumArtUri );
  1096     mTestPrivate->setAlbumArtUri( albumArtUri );
  1032     QCOMPARE( spy.count(), 0 );
  1097     QCOMPARE( spy.count(), 0 );
  1033     
  1098 
  1034     mTest->mThumbnailManager->mGetThumbFails = true;
  1099     mTestPrivate->mThumbnailManager->mGetThumbFails = true;
  1035     mTest->setAlbumArtUri( albumArtUri );
  1100     mTestPrivate->setAlbumArtUri( albumArtUri );
  1036     QCOMPARE( spy.count(), 1 );
  1101     QCOMPARE( spy.count(), 1 );
  1037     QCOMPARE( mTest->mAlbumArt, mTest->mDefaultAlbumArt );
  1102     QCOMPARE( mTestPrivate->mAlbumArt, mTestPrivate->mDefaultAlbumArt );
  1038     
  1103 
  1039     mTest->setAlbumArtUri( albumArtUriEmpty );
  1104     mTestPrivate->setAlbumArtUri( albumArtUriEmpty );
  1040     QCOMPARE( spy.count(), 2 );
  1105     QCOMPARE( spy.count(), 2 );
  1041     QCOMPARE( mTest->mAlbumArt, mTest->mDefaultAlbumArt );  
  1106     QCOMPARE( mTestPrivate->mAlbumArt, mTestPrivate->mDefaultAlbumArt );
  1042 }
  1107 }
  1043 
  1108 
  1044 /*!
  1109 /*!
  1045  Test thumbnailReady()() 
  1110  Test thumbnailReady()
  1046  */
  1111  */
  1047 void TestMpSongData::testThumbnailReady()
  1112 void TestMpSongData::testThumbnailReady()
  1048 {
  1113 {
  1049    connect( this, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
  1114    connect( this, SIGNAL(thumbnailReady(QPixmap, void *, int, int)),
  1050            mTest->mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)) );    
  1115             mTest->mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void *, int, int)) );
  1051 
  1116 
  1052    QSignalSpy spy(mTest, SIGNAL(albumArtReady()));
  1117    QSignalSpy spy(mTest, SIGNAL(albumArtReady()));
  1053    QVERIFY( spy.isValid() );
  1118    QVERIFY( spy.isValid() );
  1054    QCOMPARE( spy.count(), 0 );
  1119    QCOMPARE( spy.count(), 0 );
  1055    
  1120 
  1056    QPixmap dummyAlbumArt(":/playbackviewicons/someAlbumArt.png" );
  1121    QPixmap dummyAlbumArt(":/playbackviewicons/someAlbumArt.png" );
  1057    
  1122 
  1058    emit thumbnailReady(dummyAlbumArt, 0, -1, 0);
  1123    emit thumbnailReady(dummyAlbumArt, 0, -1, 0);
  1059    QCOMPARE( spy.count(), 1 );
  1124    QCOMPARE( spy.count(), 1 );
  1060    HbIcon dummyAlbumArtCompare;
  1125    HbIcon dummyAlbumArtCompare;
  1061    mTest->albumArt(dummyAlbumArtCompare);
  1126    mTest->albumArt(dummyAlbumArtCompare);
  1062    QCOMPARE( dummyAlbumArtCompare.isNull(), false );
  1127    QCOMPARE( dummyAlbumArtCompare.isNull(), false );
  1063    
  1128 
  1064    emit thumbnailReady(dummyAlbumArt, 0, -1 , 1);
  1129    emit thumbnailReady(dummyAlbumArt, 0, -1 , 1);
  1065    QCOMPARE( spy.count(), 2 );
  1130    QCOMPARE( spy.count(), 2 );
  1066    mTest->albumArt(dummyAlbumArtCompare);
  1131    mTest->albumArt(dummyAlbumArtCompare);
  1067    QCOMPARE( dummyAlbumArtCompare.isNull(), false );
  1132    QCOMPARE( dummyAlbumArtCompare.isNull(), false );
  1068    
  1133 
  1069 }
  1134 }
  1070 
  1135 
  1071 
       
  1072 /*!
       
  1073  Test commitPlaybackInfo() 
       
  1074  */
       
  1075 void TestMpSongData::testCommitPlaybackInfo() 
       
  1076     {
       
  1077     QSignalSpy spy( mTest, SIGNAL( playbackInfoChanged() ) );
       
  1078     
       
  1079     QVERIFY( spy.isValid() );
       
  1080     QCOMPARE( spy.count(), 0 );
       
  1081     
       
  1082     mTest->commitPlaybackInfo();
       
  1083     QCOMPARE( spy.count(), 1 );
       
  1084     
       
  1085     }
       
  1086 
       
  1087 /*!
       
  1088  Test commitSongDetailInfo() 
       
  1089  */
       
  1090 void TestMpSongData::testCommitSongDetailInfo() 
       
  1091     {
       
  1092     QSignalSpy spy( mTest, SIGNAL( songDetailInfoChanged() ) );
       
  1093     
       
  1094     QVERIFY( spy.isValid() );
       
  1095     QCOMPARE( spy.count(), 0 );
       
  1096     
       
  1097     mTest->commitSongDetailInfo();
       
  1098     QCOMPARE( spy.count(), 1 );
       
  1099     
       
  1100     }