diff -r dec420019252 -r cf5481c2bc0b videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Fri Apr 16 14:59:52 2010 +0300 @@ -0,0 +1,775 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: TestVideoFileDetails class implementation +* +*/ + +// INCLUDE FILES +#include "hbmessagebox.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "videodetailslabel.h" +#include "hbmessagebox.h" +#include "thumbnailmanager_qt.h" +#include "videocollectioncommon.h" +#include "mpxhbvideocommondefs.h" +#include "videocollectionwrapper.h" +#include "videosortfilterproxymodel.h" +#include "testvideofiledetails.h" + +// trick to get access to protected/private members. +#define private public +#include "videofiledetailsviewplugin.h" +#undef private + +const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview"; +const char *TEST_VIDEO_DETAILS_WIDGET = "mContent"; +const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle"; +const char *TEST_VIDEO_DETAILS_LISTWIDGET ="mDetailsList"; +const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel"; +const char* const VIDEO_DETAILS_BUTTON = "mButton"; +const char *TEST_VIDEO_DETAILS_MENUACTION_DELETE = "mOptionsDelete"; + +// --------------------------------------------------------------------------- +// initTestCase +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::initTestCase() +{ + mDummyModel = 0; + mDummyModel = new VideoSortFilterProxyModel(); + + connect(this, SIGNAL(shortDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(shortDetailsReady(TMPXItemId))); + connect(this, SIGNAL(fullDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(fullVideoDetailsReady(TMPXItemId))); + + connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), + mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); + + connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), + mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); + + VideoCollectionWrapper::instance().setModel(mDummyModel); +} + +// --------------------------------------------------------------------------- +// cleanupTestCase +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::cleanupTestCase() +{ + disconnect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int))); + disconnect(this, SIGNAL(fullDetailsReady(int)),mDummyModel, SIGNAL(fullVideoDetailsReady(int))); + disconnect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), + mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); + disconnect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), + mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); + delete mDummyModel; mDummyModel = 0; + delete mPlugin; mPlugin = 0; +} + +// --------------------------------------------------------------------------- +// init before every test function +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::init() +{ + mDummyModel->reset(); + + mPlugin = new VideoFileDetailsViewPlugin(); + mPlugin->createView(); + mCommandReceived = false; + mReceivedCommand = -1; + ThumbnailManager::mRequests.clear(); +} + +// --------------------------------------------------------------------------- +// cleanup after every test function +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::cleanup() +{ + if(mPlugin->getView()) { + hbInstance->allMainWindows().at(0)->removeView(mPlugin->getView()); + } + mDummyModel->reset(); + delete mPlugin; mPlugin = 0; +} + +// --------------------------------------------------------------------------- +// Helper function that activates view after init() +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::activateView() +{ + hbInstance->allMainWindows().at(0)->addView(mPlugin->getView()); + mPlugin->activateView(); + + // without this the xml loaded objects don't have the correct geometry. + mPlugin->getView()->setGeometry(hbInstance->allMainWindows().at(0)->rect()); +} + +// --------------------------------------------------------------------------- +// Helper function that populates a qmap with dummy data. +// --------------------------------------------------------------------------- +// +QMap TestVideoFileDetails::createDummyMetadata() +{ + using namespace VideoCollectionCommon; + + QMap map; + + int detailCount = sizeof(VideoDetailLabelKeys) / sizeof(int); + QString txt; + for(int i = 0; igetView() != 0 ); + QVERIFY( mPlugin->viewPlugin() == mPlugin ); + QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() ); + + // verify that actions are currently disabled. + HbStackedWidget* thumbWidget = findWidget(VIDEO_DETAILS_THUMBNAIL); + VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); + HbAction* deleteAction = findObject(TEST_VIDEO_DETAILS_MENUACTION_DELETE); + + HbPushButton* button = findWidget(VIDEO_DETAILS_BUTTON); + + QVERIFY( button != 0 ); + QVERIFY( thumbLabel != 0 ); + QVERIFY( deleteAction != 0 ); + QVERIFY( deleteAction->isEnabled() ); + + QVERIFY(mPlugin->mActivated); + // second activation should not affect + activateView(); + QVERIFY(mPlugin->mActivated); + QVERIFY( button != 0 ); + QVERIFY( thumbLabel != 0 ); + QVERIFY( deleteAction != 0 ); + QVERIFY( deleteAction->isEnabled() ); + + cleanup(); + } + +// --------------------------------------------------------------------------- +// Slot: create view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::handleCommand(int command) +{ + mCommandReceived = true; + mReceivedCommand = command; +} + +// --------------------------------------------------------------------------- +// Slot: create view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testCreateView() +{ + init(); + // actual create view is done in the init. + QVERIFY( mPlugin->mModel == mDummyModel ); + QVERIFY( mPlugin->mIsService == false); + QVERIFY( mPlugin->mVideoServices == 0); + // testing the special case where the model is null. + cleanup(); + VideoCollectionWrapper::instance().setModel(0); + init(); + QVERIFY( mPlugin->mModel == 0 ); + QVERIFY( mPlugin->mIsService == false); + QVERIFY( mPlugin->mVideoServices == 0); + // TODO if the plugin is changed to throw exception in case of null model, + // then it needs to be added here. + + // restoring the proper model. + VideoCollectionWrapper::instance().setModel(mDummyModel); + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: destroy view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testDestroyView() +{ + init(); + activateView(); + mPlugin->destroyView(); + QVERIFY( mPlugin->getView() == 0 ); + // plugin is still alive + QVERIFY( mPlugin->viewPlugin() == mPlugin ); + QVERIFY( mPlugin->mNavKeyBackAction == 0 ); + QVERIFY( mPlugin->mActivated == false ); + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: activate view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testActivateViewPortrait() +{ + hbInstance->allMainWindows().at(0)->setOrientation(Qt::Vertical); + activateViewTestRound(); +} + +// --------------------------------------------------------------------------- +// Slot: activate view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testActivateViewLandscape() +{ + hbInstance->allMainWindows().at(0)->setOrientation(Qt::Horizontal); + activateViewTestRound(); +} + +// --------------------------------------------------------------------------- +// Slot: activate view +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testDeactivateView() +{ + init(); + activateView(); + mPlugin->deactivateView(); + QVERIFY( mPlugin->mActivated == false ); + QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() ); + mPlugin->deactivateView(); + QVERIFY( mPlugin->mActivated == false ); + QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() ); + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: data for orientation change test +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testOrientationChange_data() +{ + QTest::addColumn("start"); + QTest::addColumn("switchTo"); + + QTest::newRow("from portrait to landscape") + << static_cast(Qt::Vertical) + << static_cast(Qt::Horizontal); + QTest::newRow("from landscape to portrait") + << static_cast(Qt::Horizontal) + << static_cast(Qt::Vertical); +} + +// --------------------------------------------------------------------------- +// Slot: test for the orientationChange slot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testOrientationChange() +{ + QFETCH(int, start); + QFETCH(int, switchTo); + + init(); + hbInstance->allMainWindows().at(0)->setOrientation(static_cast(start)); + activateView(); + + hbInstance->allMainWindows().at(0)->setOrientation(static_cast(switchTo)); + + // without this the view doesn't have the correct geometry. + mPlugin->getView()->setGeometry(hbInstance->allMainWindows().at(0)->rect()); + // give fw some time to update content + QTest::qWait(100); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the back slot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testBack() +{ + init(); + connect(this, SIGNAL(testSignal()), mPlugin, SLOT(back())); + connect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); + + emit testSignal(); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + mPlugin->mNavKeyBackAction->trigger(); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + activateView(); + + emit testSignal(); + QCOMPARE( mCommandReceived, true ); + QCOMPARE( mReceivedCommand, static_cast(MpxHbVideoCommon::ActivateCollectionView) ); + + mCommandReceived = false; + mReceivedCommand = -1; + + mPlugin->mNavKeyBackAction->trigger(); + QCOMPARE( mCommandReceived, true ); + QCOMPARE( mReceivedCommand, static_cast(MpxHbVideoCommon::ActivateCollectionView) ); + + mCommandReceived = false; + mReceivedCommand = -1; + + mPlugin->deactivateView(); + + emit testSignal(); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + mPlugin->mNavKeyBackAction->trigger(); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); + disconnect(this, SIGNAL(testSignal()), mPlugin, SLOT(back())); + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the shortDetailsReadySlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testShortDetailsReadySlot() +{ + TMPXItemId testIndex(5,0); + QStringList display; + display.append("first row"); + display.append("second row"); + QString filepath("filepath"); + + // TODO need to add the default thumbnail checking. + + init(); + activateView(); + + // no data + emit shortDetailsReady(testIndex); + + QCOMPARE( mPlugin->mVideoId, testIndex ); + QVERIFY( mPlugin->mTitleAnim->text().isEmpty() ); + QCOMPARE( mPlugin->mThumbnailManager->mRequests.count(), 0 ); + + mDummyModel->setData(Qt::DisplayRole, display); + mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath); + + // no tn manager + ThumbnailManager *tmpTnManager = mPlugin->mThumbnailManager; + mPlugin->mThumbnailManager = 0; + emit shortDetailsReady(testIndex); + QCOMPARE( mPlugin->mVideoId, testIndex ); + QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); + mPlugin->mThumbnailManager = tmpTnManager; + + // data exists + emit shortDetailsReady(testIndex); + + QCOMPARE( mPlugin->mVideoId, testIndex ); + QCOMPARE( mDummyModel->lastId(), testIndex ); + QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) ); + QVERIFY( ThumbnailManager::mRequests.contains(0) ); + ThumbnailManager::TnRequest request = ThumbnailManager::mRequests[0]; + QCOMPARE( request.name, filepath ); + // 20 == priorityHight in this case + QCOMPARE( request.priority, 5000 ); + + + mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); + emit fullDetailsReady(testIndex); + + emit shortDetailsReady(testIndex); + + int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); + + HbListWidget* list = findWidget(TEST_VIDEO_DETAILS_LISTWIDGET); + + QVERIFY(list); + QVERIFY(list->count() == 0); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the fullDetailsReadySlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testFullDetailsReadySlot() +{ + TMPXItemId testIndex(6,0); + init(); + activateView(); + + int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int); + + HbListWidget* list = findWidget(TEST_VIDEO_DETAILS_LISTWIDGET); + QVERIFY(list); + QVERIFY(list->count() == 0); + + mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); + + emit fullDetailsReady(testIndex); + + // verify that actions are currently enabled. + HbStackedWidget* thumbWidget = findWidget(VIDEO_DETAILS_THUMBNAIL); + VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); + HbAction* deleteAction = findObject(TEST_VIDEO_DETAILS_MENUACTION_DELETE); + + QVERIFY( thumbLabel != 0 ); + QVERIFY( deleteAction != 0 ); + QVERIFY( deleteAction->isEnabled() ); + + QVERIFY(list->count() == detailCount); + + for(int i = 0; iitem(i); + QVERIFY( detail != 0 ); + QVERIFY( detail->text().contains(expected) ); + } + + // for coverity sake, retest without star-rating + mDummyModel->reset(); + mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() ); + emit fullDetailsReady(testIndex); + + int ii = 0; + for(int i = 0; iitem(ii); + QVERIFY( detail != 0 ); + QVERIFY( detail->text().contains(expected) ); + } + ++ii; + } + + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the testStartPlaybackSlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testStartPlaybackSlot() +{ + TMPXItemId testIndex(6,0); + mDummyModel->reset(); + init(); + activateView(); + + // Note that if the details view has not received signal in it's + // fullDetailsReadySlot, the button is disabled and should not do anything. + + HbStackedWidget* thumbWidget = findWidget(VIDEO_DETAILS_THUMBNAIL); + VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); + QVERIFY( thumbLabel != 0 ); + thumbLabel->click(); + + QCOMPARE( mDummyModel->startPlaybackIndex(), TMPXItemId::InvalidId() ); + + emit fullDetailsReady(testIndex); + mPlugin->mVideoId = testIndex; + + thumbLabel->click(); + + QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); + + // invalid index + mPlugin->mVideoId = TMPXItemId::InvalidId(); + thumbLabel->click(); + // startplayback index has not changed since previous + QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the sendVideoSlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testSendVideoSlot() +{ + // TODO add test after send video has been implemented. +} + +// --------------------------------------------------------------------------- +// Slot: test for the deleteVideoSlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testDeleteVideoSlot() +{ + mDummyModel->reset(); + init(); + + HbAction* deleteAction = findObject(TEST_VIDEO_DETAILS_MENUACTION_DELETE); + + QVERIFY( deleteAction != 0 ); + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 0 ); + mPlugin->mVideoId = (0,0); + + mDummyModel->setDataReturnInvalid(true); + QModelIndex expected = mDummyModel->index(0, 0); + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 1 ); + QVERIFY( mDummyModel->lastIndex() == expected ); + QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. + mDummyModel->setDataReturnInvalid(false); + + mPlugin->mVideoId = (0,0); + expected = mDummyModel->index(0, 0); + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 2 ); + QVERIFY( mDummyModel->lastIndex() == expected ); + QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. + + QStringList display; + display.append("first row"); + display.append("second row"); + mDummyModel->setData(Qt::DisplayRole, display); + + QString expectedText = tr("Do you want to delete \"%1\"?").arg( + display.at(0)); + + HbMessageBox::mQuestionReturnValue = true; + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 3 ); + QVERIFY( mDummyModel->lastIndex() == expected ); + QCOMPARE( mDummyModel->deleteFileIndex(), expected.row() ); + QCOMPARE( HbMessageBox::mLatestTxt, expectedText ); + + HbMessageBox::mQuestionReturnValue = false; + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 4 ); + QVERIFY( mDummyModel->lastIndex() == expected ); + QCOMPARE( mDummyModel->deleteFileIndex(), expected.row() ); + QCOMPARE( HbMessageBox::mLatestTxt, expectedText ); + + + mDummyModel->reset(); + HbMessageBox::mQuestionReturnValue = false; + deleteAction->trigger(); + QCOMPARE( mDummyModel->dataAccessCount(), 1 ); + QVERIFY( mDummyModel->lastIndex() == expected ); + QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted. + QCOMPARE( HbMessageBox::mLatestTxt, expectedText ); + + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: test for the testRowsRemovedSlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testRowsRemovedSlot() +{ + const int testIndex = 9; + TMPXItemId testID(9,0); + init(); + connect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); + + emit rowsRemoved(QModelIndex(), testIndex, testIndex); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + activateView(); + + emit rowsRemoved(QModelIndex(), testIndex, testIndex); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + emit fullDetailsReady(testID); + mPlugin->mVideoId = testID; + mPlugin->mDeletedIndex = testIndex; + + emit rowsRemoved(QModelIndex(), testIndex+1, testIndex-1); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + emit rowsRemoved(QModelIndex(), testIndex-3, testIndex-1); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + emit rowsRemoved(QModelIndex(), testIndex+1, testIndex+3); + QCOMPARE( mCommandReceived, false ); + QCOMPARE( mReceivedCommand, -1 ); + + emit rowsRemoved(QModelIndex(), testIndex, testIndex); + QCOMPARE( mCommandReceived, true ); + QCOMPARE( mReceivedCommand, static_cast(MpxHbVideoCommon::ActivateCollectionView) ); + + disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); + cleanup(); +} + +// --------------------------------------------------------------------------- +// Slot: testHandleErrorSlot test error messages +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testHandleErrorSlot() +{ + init(); + connect(this, SIGNAL(testErrorSignal(int, QVariant&)), mPlugin, SLOT(handleErrorSlot(int, QVariant&))); + + HbMessageBox::mLatestTxt = ""; + QVariant additional = QVariant(); + // invalid msg, + emit testErrorSignal( VideoCollectionCommon::statusMultipleDeleteFail + 1, additional); + + QVERIFY(HbMessageBox::mLatestTxt.isEmpty()); + + // VideoCollectionCommon::statusSingleDeleteFail + // - without additional data + emit testErrorSignal( VideoCollectionCommon::statusSingleDeleteFail , additional); + QVERIFY(HbMessageBox::mLatestTxt.isEmpty()); + + // - with additional data + QString txt = "testdata"; + additional = txt; + emit testErrorSignal( VideoCollectionCommon::statusSingleDeleteFail , additional); + QCOMPARE(HbMessageBox::mLatestTxt, QString("Unable to delete item %1. It is currently open.").arg(txt)); + + HbMessageBox::mLatestTxt = ""; + // VideoCollectionCommon::statusMultipleDeleteFail + emit testErrorSignal( VideoCollectionCommon::statusMultipleDeleteFail , additional); + QVERIFY(HbMessageBox::mLatestTxt.isEmpty()); + + disconnect(this, SIGNAL(testErrorSignal(int, QVariant&)), mPlugin, SLOT(handleErrorSlot(int, QVariant&))); + + cleanup(); +} + + +// --------------------------------------------------------------------------- +// Slot: test for the testThumbnailReadySlot +// --------------------------------------------------------------------------- +// +void TestVideoFileDetails::testThumbnailReadySlot() +{ + TMPXItemId testIndex(9,0); + QStringList display; + display.append("first row"); + display.append("second row"); + QString filepath("filepath"); + + init(); + activateView(); + + mDummyModel->setData(Qt::DisplayRole, display); + mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath); + + emit shortDetailsReady(testIndex); + + mPlugin->mThumbnailManager->mThumbnailReadyError = -1; + mPlugin->mThumbnailManager->emitThumbnailReady(0); + + HbStackedWidget* thumbWidget = findWidget(VIDEO_DETAILS_THUMBNAIL); + VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0); + QVERIFY( thumbLabel->icon().qicon().isNull() == false ); + + mPlugin->mThumbnailManager->mThumbnailReadyError = 0; + emit shortDetailsReady(testIndex); + mPlugin->mThumbnailManager->emitThumbnailReady(0); + + QVERIFY( thumbLabel->icon().qicon().isNull() == false ); + + cleanup(); +} + + +// --------------------------------------------------------------------------- +// findWidget +// --------------------------------------------------------------------------- +// +template +T* TestVideoFileDetails::findWidget(QString name) +{ + return qobject_cast(mPlugin->mLoader.findWidget(name)); +} + +// --------------------------------------------------------------------------- +// findObject +// --------------------------------------------------------------------------- +// +template +T* TestVideoFileDetails::findObject(QString name) +{ + return qobject_cast(mPlugin->mLoader.findObject(name)); +} + +// --------------------------------------------------------------------------- +// main +// --------------------------------------------------------------------------- +// +int main(int argc, char *argv[]) +{ + HbApplication app(argc, argv); + HbApplication::setKeypadNavigationEnabled(false); + HbMainWindow mainWindow; + mainWindow.show(); + + TestVideoFileDetails tc; + + char *pass[3]; + pass[0] = argv[0]; + pass[1] = "-o"; + pass[2] = "c:\\data\\testvideofiledetailsviewplugin.txt"; + + return QTest::qExec(&tc, 3, pass); +} + +// end of file