1 /** |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: tester for methods in VideoSortFilterProxyModel |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <hbapplication.h> |
|
19 #include <hbinstance.h> |
|
20 #include <xqpluginloader.h> |
|
21 #include <mpxviewpluginqt.h> |
|
22 #include <xqplugininfo.h> |
|
23 |
|
24 |
|
25 #include "testvideoplaybackviewplugin.h" |
|
26 #include "hbvideoplaybackview.h" |
|
27 |
|
28 #include "mpxhbvideoplaybackviewplugin.h" |
|
29 #include "mpxhbvideocommondefs.h" |
|
30 |
|
31 // --------------------------------------------------------------------------- |
|
32 // main |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 int main(int argc, char *argv[]) |
|
36 { |
|
37 HbApplication app(argc, argv); |
|
38 HbMainWindow window; |
|
39 |
|
40 TestVideoPlaybackViewPlugin tv; |
|
41 |
|
42 char *pass[3]; |
|
43 pass[0] = argv[0]; |
|
44 pass[1] = "-o"; |
|
45 pass[2] = "c:\\data\\TestVideoPlaybackViewPlugin.txt"; |
|
46 |
|
47 int res = QTest::qExec(&tv, 3, pass); |
|
48 |
|
49 return res; |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // init |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void TestVideoPlaybackViewPlugin::init() |
|
58 { |
|
59 QList<XQPluginInfo> impls; |
|
60 XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls); |
|
61 |
|
62 XQPluginLoader pluginLoader( MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid ); |
|
63 QObject* instance = pluginLoader.instance(); |
|
64 |
|
65 mVidPBPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin(); ; |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // cleanup |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 void TestVideoPlaybackViewPlugin::cleanup() |
|
73 { |
|
74 delete mVidPBPlugin; |
|
75 mVidPBPlugin = 0; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // Slot: test create view |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 void TestVideoPlaybackViewPlugin::testCreateView() |
|
83 { |
|
84 qDebug("===> testCreateView()"); |
|
85 |
|
86 init(); |
|
87 |
|
88 QVERIFY(mVidPBPlugin != NULL ); |
|
89 |
|
90 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView == NULL ); |
|
91 |
|
92 mVidPBPlugin->createView(); |
|
93 |
|
94 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView != NULL ); |
|
95 |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // Slot: test activate view |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 void TestVideoPlaybackViewPlugin::testActivateView() |
|
103 { |
|
104 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView != NULL ); |
|
105 |
|
106 mVidPBPlugin->activateView(); |
|
107 |
|
108 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mViewActivated == true ); |
|
109 } |
|
110 |
|
111 // --------------------------------------------------------------------------- |
|
112 // Slot: test deactivate view |
|
113 // --------------------------------------------------------------------------- |
|
114 // |
|
115 void TestVideoPlaybackViewPlugin::testDeactivateView() |
|
116 { |
|
117 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView != NULL ); |
|
118 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mViewActivated == true ); |
|
119 |
|
120 mVidPBPlugin->deactivateView(); |
|
121 |
|
122 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mViewActivated == false ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // Slot: test destroy view |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 void TestVideoPlaybackViewPlugin::testDestroyView() |
|
130 { |
|
131 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView != NULL ); |
|
132 |
|
133 mVidPBPlugin->destroyView(); |
|
134 |
|
135 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView == NULL ); |
|
136 |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Slot: test get view |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 void TestVideoPlaybackViewPlugin::testGetView() |
|
144 { |
|
145 QVERIFY( mVidPBPlugin->getView() != NULL ); |
|
146 QVERIFY(reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->mView == |
|
147 reinterpret_cast<QMpxHbVideoPlaybackViewPlugin*>( mVidPBPlugin )->getView() ); |
|
148 } |
|
149 |
|
150 |
|
151 |
|
152 // End of file |
|
153 |
|
154 |
|
155 |
|