43
|
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: Unit test for MpPlaybackDocumentLoader
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <qnamespace.h>
|
|
19 |
#include <hbtoolbutton.h>
|
|
20 |
|
|
21 |
#include "mpalbumcoverwidget.h"
|
|
22 |
#include "unittest_mpplaybackdocumentloader.h"
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
// Do this so we can access all member variables.
|
|
27 |
#define private public
|
|
28 |
#include "mpplaybackdocumentloader.h"
|
|
29 |
#undef private
|
|
30 |
|
|
31 |
/*!
|
|
32 |
Make our test case a stand-alone executable that runs all the test functions.
|
|
33 |
*/
|
|
34 |
int main(int argc, char *argv[])
|
|
35 |
{
|
|
36 |
QApplication app(argc, argv);
|
|
37 |
TestMpPlaybackDocumentLoader tv;
|
|
38 |
|
|
39 |
if ( argc > 1 ) {
|
|
40 |
return QTest::qExec( &tv, argc, argv);
|
|
41 |
}
|
|
42 |
else {
|
|
43 |
char *pass[3];
|
|
44 |
pass[0] = argv[0];
|
|
45 |
pass[1] = "-o";
|
|
46 |
pass[2] = "c:\\data\\unittest_mpplaybackdocumentloader.txt";
|
|
47 |
|
|
48 |
return QTest::qExec(&tv, 3, pass);
|
|
49 |
}
|
|
50 |
}
|
|
51 |
|
|
52 |
TestMpPlaybackDocumentLoader::TestMpPlaybackDocumentLoader()
|
|
53 |
: mTest(0)
|
|
54 |
{
|
|
55 |
}
|
|
56 |
|
|
57 |
TestMpPlaybackDocumentLoader::~TestMpPlaybackDocumentLoader()
|
|
58 |
{
|
|
59 |
delete mTest;
|
|
60 |
}
|
|
61 |
|
|
62 |
/*!
|
|
63 |
Called before the first testfunction is executed.
|
|
64 |
*/
|
|
65 |
void TestMpPlaybackDocumentLoader::initTestCase()
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
/*!
|
|
70 |
Called after the last testfunction was executed.
|
|
71 |
*/
|
|
72 |
void TestMpPlaybackDocumentLoader::cleanupTestCase()
|
|
73 |
{
|
|
74 |
}
|
|
75 |
|
|
76 |
/*!
|
|
77 |
Called before each testfunction is executed.
|
|
78 |
*/
|
|
79 |
void TestMpPlaybackDocumentLoader::init()
|
|
80 |
{
|
|
81 |
mTest = new MpPlaybackDocumentLoader();
|
|
82 |
}
|
|
83 |
|
|
84 |
/*!
|
|
85 |
Called after every testfunction.
|
|
86 |
*/
|
|
87 |
void TestMpPlaybackDocumentLoader::cleanup()
|
|
88 |
{
|
|
89 |
delete mTest;
|
|
90 |
mTest = 0;
|
|
91 |
}
|
|
92 |
|
|
93 |
/*!
|
|
94 |
Tests the correct creation of MpAlbumCoverWidget.
|
|
95 |
*/
|
|
96 |
void TestMpPlaybackDocumentLoader::testCreateMpAlbumCoverWidget()
|
|
97 |
{
|
|
98 |
cleanup();
|
|
99 |
init();
|
|
100 |
QObject *theObject;
|
|
101 |
theObject = mTest->createObject(QString("MpAlbumCoverWidget"),QString("myMpAlbumCoverWidget"));
|
|
102 |
QCOMPARE(theObject->metaObject()->className(),"MpAlbumCoverWidget");
|
|
103 |
QCOMPARE(theObject->objectName(),QString("myMpAlbumCoverWidget"));
|
|
104 |
QVERIFY(qobject_cast<MpAlbumCoverWidget*>(theObject));
|
|
105 |
delete theObject;
|
|
106 |
|
|
107 |
}
|
|
108 |
|
|
109 |
/*!
|
|
110 |
Tests the correct creation of QObject, this should be pased to the
|
|
111 |
base class and base class should return a named object.
|
|
112 |
*/
|
|
113 |
void TestMpPlaybackDocumentLoader::testCreateQObject()
|
|
114 |
{
|
|
115 |
cleanup();
|
|
116 |
init();
|
|
117 |
QObject *theObject;
|
|
118 |
theObject = mTest->createObject(QString("QObject"),QString("myQObject"));
|
|
119 |
QCOMPARE(theObject->metaObject()->className(),"QObject");
|
|
120 |
QCOMPARE(theObject->objectName(),QString("myQObject"));
|
|
121 |
delete theObject;
|
|
122 |
}
|
|
123 |
|
|
124 |
// End of file
|