mpviewplugins/mpcollectionviewplugin/tsrc/unittest_mpcollectioncontainers/src/unittest_mpcollectioncontainers.cpp
changeset 48 af3740e3753f
parent 29 8192e5b5c935
child 51 560ce2306a17
equal deleted inserted replaced
42:79c49924ae23 48:af3740e3753f
   243     QCOMPARE(allSongs->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
   243     QCOMPARE(allSongs->mList->verticalScrollBarPolicy(), HbScrollArea::ScrollBarAsNeeded);
   244     QCOMPARE(allSongs->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
   244     QCOMPARE(allSongs->mList->listItemPrototype()->graphicsSize(), HbListViewItem::Thumbnail);
   245     QVERIFY(allSongs->mIndexFeedback->itemView() == allSongs->mList);
   245     QVERIFY(allSongs->mIndexFeedback->itemView() == allSongs->mList);
   246 
   246 
   247     // Normal mode. Should see count.
   247     // Normal mode. Should see count.
   248     QCOMPARE(allSongs->mInfoBar->heading(), hbTrId("txt_mus_subhead_ln_songs", 5));
   248     QCOMPARE(allSongs->mInfoBar->heading(), hbTrId("txt_mus_subhead_songs_l1").arg( 5 ) );
   249 }
   249 }
   250 
   250 
   251 /*!
   251 /*!
   252  Test setupContainer via setDataModel for AllSongs container in Fetcher mode.
   252  Test setupContainer via setDataModel for AllSongs container in Fetcher mode.
   253  */
   253  */
   800     MpCollectionContainerArtists *artists = static_cast<MpCollectionContainerArtists*>(mTest);
   800     MpCollectionContainerArtists *artists = static_cast<MpCollectionContainerArtists*>(mTest);
   801 
   801 
   802     mCollectionData->mCurrentAlbumAvailable = false;
   802     mCollectionData->mCurrentAlbumAvailable = false;
   803     artists->mAlbumIndexOffset = 0;
   803     artists->mAlbumIndexOffset = 0;
   804     artists->mCurrentAlbumIndex = 0;
   804     artists->mCurrentAlbumIndex = 0;
   805     artists->albumCentered();
   805     artists->albumCentered( QModelIndex() );
   806     QCOMPARE(artists->mCurrentAlbumIndex, -1);
   806     QCOMPARE(artists->mCurrentAlbumIndex, -1);
   807     QCOMPARE(spy.count(), 1);
   807     QCOMPARE(spy.count(), 1);
   808     QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
   808     QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
   809 
   809 
   810     mCollectionData->mCurrentAlbumAvailable = true;
   810     mCollectionData->mCurrentAlbumAvailable = true;
   811     artists->mAlbumIndexOffset = 0;
   811     artists->mAlbumIndexOffset = 0;
   812     artists->mCurrentAlbumIndex = 0;
   812     artists->mCurrentAlbumIndex = 0;
   813     artists->albumCentered();
   813     artists->albumCentered( QModelIndex() );
   814     QCOMPARE(artists->mCurrentAlbumIndex, -1);
   814     QCOMPARE(artists->mCurrentAlbumIndex, -1);
   815     QCOMPARE(spy.count(), 1);
   815     QCOMPARE(spy.count(), 1);
   816 
   816 
   817     // Re-centered on same item
   817     // Re-centered on same item
   818     artists->mAlbumIndexOffset = 1;
   818     artists->mAlbumIndexOffset = 1;
   819     artists->mCurrentAlbumIndex = 0;
   819     artists->mCurrentAlbumIndex = 0;
   820     artists->albumCentered();
   820     artists->albumCentered( QModelIndex() );
   821     QCOMPARE(spy.count(), 1);
   821     QCOMPARE(spy.count(), 1);
   822 }
   822 }
   823 
   823 
   824 /*!
   824 /*!
   825  Test albumCentered - Albums container.
   825  Test albumCentered - Albums container.
   831     QSignalSpy spy(mTest, SIGNAL(findAlbumSongs(int)));
   831     QSignalSpy spy(mTest, SIGNAL(findAlbumSongs(int)));
   832     MpCollectionContainerAlbums *albums = static_cast<MpCollectionContainerAlbums*>(mTest);
   832     MpCollectionContainerAlbums *albums = static_cast<MpCollectionContainerAlbums*>(mTest);
   833 
   833 
   834     mCollectionData->mCurrentAlbumAvailable = false;
   834     mCollectionData->mCurrentAlbumAvailable = false;
   835     albums->mCurrentAlbumIndex = 0;
   835     albums->mCurrentAlbumIndex = 0;
   836     albums->albumCentered();
   836     albums->albumCentered( QModelIndex() );
   837     QCOMPARE(albums->mCurrentAlbumIndex, -1);
   837     QCOMPARE(albums->mCurrentAlbumIndex, -1);
   838     QCOMPARE(spy.count(), 1);
   838     QCOMPARE(spy.count(), 1);
   839     QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
   839     QCOMPARE(qvariant_cast<int>(spy.at(0).at(0)), -1);
   840 
   840 
   841     mCollectionData->mCurrentAlbumAvailable = true;
   841     mCollectionData->mCurrentAlbumAvailable = true;
   842     albums->mCurrentAlbumIndex = 0;
   842     albums->mCurrentAlbumIndex = 0;
   843     albums->albumCentered();
   843     albums->albumCentered( QModelIndex() );
   844     QCOMPARE(albums->mCurrentAlbumIndex, -1);
   844     QCOMPARE(albums->mCurrentAlbumIndex, -1);
   845     QCOMPARE(spy.count(), 1);
   845     QCOMPARE(spy.count(), 1);
   846 
   846 
   847     // Re-centered on same item
   847     // Re-centered on same item
   848     albums->mCurrentAlbumIndex = -1;
   848     albums->mCurrentAlbumIndex = -1;
   849     albums->albumCentered();
   849     albums->albumCentered( QModelIndex() );
   850     QCOMPARE(spy.count(), 1);
   850     QCOMPARE(spy.count(), 1);
   851 }
   851 }
   852 
   852