61 { |
61 { |
62 mDummyModel = 0; |
62 mDummyModel = 0; |
63 mDummyModel = new VideoSortFilterProxyModel(); |
63 mDummyModel = new VideoSortFilterProxyModel(); |
64 |
64 |
65 connect(this, SIGNAL(shortDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(shortDetailsReady(TMPXItemId))); |
65 connect(this, SIGNAL(shortDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(shortDetailsReady(TMPXItemId))); |
66 connect(this, SIGNAL(fullDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(fullDetailsReady(TMPXItemId))); |
66 connect(this, SIGNAL(fullDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(fullVideoDetailsReady(TMPXItemId))); |
67 |
67 |
68 connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
68 connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
69 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
69 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
70 |
70 |
71 connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
71 connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
79 // --------------------------------------------------------------------------- |
79 // --------------------------------------------------------------------------- |
80 // |
80 // |
81 void TestVideoFileDetails::cleanupTestCase() |
81 void TestVideoFileDetails::cleanupTestCase() |
82 { |
82 { |
83 disconnect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int))); |
83 disconnect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int))); |
84 disconnect(this, SIGNAL(fullDetailsReady(int)),mDummyModel, SIGNAL(fullDetailsReady(int))); |
84 disconnect(this, SIGNAL(fullDetailsReady(int)),mDummyModel, SIGNAL(fullVideoDetailsReady(int))); |
85 disconnect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
85 disconnect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), |
86 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
86 mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); |
87 disconnect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
87 disconnect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)), |
88 mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); |
88 mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int))); |
89 delete mDummyModel; mDummyModel = 0; |
89 delete mDummyModel; mDummyModel = 0; |
97 void TestVideoFileDetails::init() |
97 void TestVideoFileDetails::init() |
98 { |
98 { |
99 mDummyModel->reset(); |
99 mDummyModel->reset(); |
100 |
100 |
101 mPlugin = new VideoFileDetailsViewPlugin(); |
101 mPlugin = new VideoFileDetailsViewPlugin(); |
102 mPlugin->createView(); |
|
103 mPlugin->createView(); |
102 mPlugin->createView(); |
104 mCommandReceived = false; |
103 mCommandReceived = false; |
105 mReceivedCommand = -1; |
104 mReceivedCommand = -1; |
106 ThumbnailManager::mRequests.clear(); |
105 ThumbnailManager::mRequests.clear(); |
107 } |
106 } |
243 activateView(); |
242 activateView(); |
244 mPlugin->destroyView(); |
243 mPlugin->destroyView(); |
245 QVERIFY( mPlugin->getView() == 0 ); |
244 QVERIFY( mPlugin->getView() == 0 ); |
246 // plugin is still alive |
245 // plugin is still alive |
247 QVERIFY( mPlugin->viewPlugin() == mPlugin ); |
246 QVERIFY( mPlugin->viewPlugin() == mPlugin ); |
248 QVERIFY( mPlugin->mSecSkAction == 0 ); |
247 QVERIFY( mPlugin->mNavKeyBackAction == 0 ); |
249 QVERIFY( mPlugin->mActivated == false ); |
248 QVERIFY( mPlugin->mActivated == false ); |
250 cleanup(); |
249 cleanup(); |
251 } |
250 } |
252 |
251 |
253 // --------------------------------------------------------------------------- |
252 // --------------------------------------------------------------------------- |
339 |
338 |
340 emit testSignal(); |
339 emit testSignal(); |
341 QCOMPARE( mCommandReceived, false ); |
340 QCOMPARE( mCommandReceived, false ); |
342 QCOMPARE( mReceivedCommand, -1 ); |
341 QCOMPARE( mReceivedCommand, -1 ); |
343 |
342 |
344 mPlugin->mSecSkAction->trigger(); |
343 mPlugin->mNavKeyBackAction->trigger(); |
345 QCOMPARE( mCommandReceived, false ); |
344 QCOMPARE( mCommandReceived, false ); |
346 QCOMPARE( mReceivedCommand, -1 ); |
345 QCOMPARE( mReceivedCommand, -1 ); |
347 |
346 |
348 activateView(); |
347 activateView(); |
349 |
348 |
352 QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) ); |
351 QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) ); |
353 |
352 |
354 mCommandReceived = false; |
353 mCommandReceived = false; |
355 mReceivedCommand = -1; |
354 mReceivedCommand = -1; |
356 |
355 |
357 mPlugin->mSecSkAction->trigger(); |
356 mPlugin->mNavKeyBackAction->trigger(); |
358 QCOMPARE( mCommandReceived, true ); |
357 QCOMPARE( mCommandReceived, true ); |
359 QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) ); |
358 QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) ); |
360 |
359 |
361 mCommandReceived = false; |
360 mCommandReceived = false; |
362 mReceivedCommand = -1; |
361 mReceivedCommand = -1; |
365 |
364 |
366 emit testSignal(); |
365 emit testSignal(); |
367 QCOMPARE( mCommandReceived, false ); |
366 QCOMPARE( mCommandReceived, false ); |
368 QCOMPARE( mReceivedCommand, -1 ); |
367 QCOMPARE( mReceivedCommand, -1 ); |
369 |
368 |
370 mPlugin->mSecSkAction->trigger(); |
369 mPlugin->mNavKeyBackAction->trigger(); |
371 QCOMPARE( mCommandReceived, false ); |
370 QCOMPARE( mCommandReceived, false ); |
372 QCOMPARE( mReceivedCommand, -1 ); |
371 QCOMPARE( mReceivedCommand, -1 ); |
373 |
372 |
374 disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); |
373 disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int))); |
375 disconnect(this, SIGNAL(testSignal()), mPlugin, SLOT(back())); |
374 disconnect(this, SIGNAL(testSignal()), mPlugin, SLOT(back())); |
737 // --------------------------------------------------------------------------- |
736 // --------------------------------------------------------------------------- |
738 // |
737 // |
739 template<class T> |
738 template<class T> |
740 T* TestVideoFileDetails::findWidget(QString name) |
739 T* TestVideoFileDetails::findWidget(QString name) |
741 { |
740 { |
742 return qobject_cast<T *>(mPlugin->mView.findWidget(name)); |
741 return qobject_cast<T *>(mPlugin->mLoader.findWidget(name)); |
743 } |
742 } |
744 |
743 |
745 // --------------------------------------------------------------------------- |
744 // --------------------------------------------------------------------------- |
746 // findObject |
745 // findObject |
747 // --------------------------------------------------------------------------- |
746 // --------------------------------------------------------------------------- |
748 // |
747 // |
749 template<class T> |
748 template<class T> |
750 T* TestVideoFileDetails::findObject(QString name) |
749 T* TestVideoFileDetails::findObject(QString name) |
751 { |
750 { |
752 return qobject_cast<T *>(mPlugin->mView.findObject(name)); |
751 return qobject_cast<T *>(mPlugin->mLoader.findObject(name)); |
753 } |
752 } |
754 |
753 |
755 // --------------------------------------------------------------------------- |
754 // --------------------------------------------------------------------------- |
756 // main |
755 // main |
757 // --------------------------------------------------------------------------- |
756 // --------------------------------------------------------------------------- |