50
|
1 |
/**
|
|
2 |
* Copyright (c) 2010 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: tests for VideoOperatorService
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
55
|
18 |
// INCLUDE FILES
|
50
|
19 |
#include <hbapplication.h>
|
|
20 |
#include <hbmainwindow.h>
|
|
21 |
#include <hbinstance.h>
|
|
22 |
#include <qdebug.h>
|
|
23 |
|
|
24 |
#include "testvideooperatorservice.h"
|
55
|
25 |
#include "videooperatorservice_pdata.h"
|
50
|
26 |
|
|
27 |
#define private public
|
|
28 |
#include "videooperatorservice.h"
|
|
29 |
#undef private
|
|
30 |
|
|
31 |
int main(int argc, char *argv[])
|
|
32 |
{
|
|
33 |
HbApplication app(argc, argv);
|
|
34 |
HbMainWindow window;
|
|
35 |
TestVideoOperatorService tv;
|
|
36 |
int res;
|
|
37 |
if (argc > 1)
|
|
38 |
{
|
|
39 |
res = QTest::qExec(&tv, argc, argv);
|
|
40 |
}
|
|
41 |
else
|
|
42 |
{
|
|
43 |
char *pass[3];
|
|
44 |
pass[0] = argv[0];
|
|
45 |
pass[1] = "-o";
|
|
46 |
pass[2] = "c:\\data\\testvideooperatorservice.txt";
|
|
47 |
res = QTest::qExec(&tv, 3, pass);
|
|
48 |
}
|
|
49 |
|
|
50 |
return res;
|
|
51 |
}
|
|
52 |
|
|
53 |
TestVideoOperatorService::TestVideoOperatorService():
|
|
54 |
mTestObject(0)
|
|
55 |
{
|
|
56 |
|
|
57 |
}
|
|
58 |
|
|
59 |
TestVideoOperatorService::~TestVideoOperatorService()
|
|
60 |
{
|
|
61 |
cleanup();
|
|
62 |
}
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// init
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
void TestVideoOperatorService::init()
|
55
|
69 |
{
|
50
|
70 |
// create test object
|
|
71 |
if (!mTestObject)
|
|
72 |
{
|
55
|
73 |
mTestObject = new VideoOperatorService();
|
50
|
74 |
}
|
|
75 |
}
|
|
76 |
|
|
77 |
// ---------------------------------------------------------------------------
|
|
78 |
// cleanup
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
void TestVideoOperatorService::cleanup()
|
|
82 |
{
|
|
83 |
// delete test object
|
|
84 |
delete mTestObject;
|
|
85 |
mTestObject = 0;
|
|
86 |
}
|
|
87 |
|
|
88 |
// TEST CASES START ----------------------------------------------------------
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// test
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
55
|
94 |
void TestVideoOperatorService::test()
|
50
|
95 |
{
|
55
|
96 |
init();
|
|
97 |
|
|
98 |
VideoOperatorServicePrivateData::mLoadReturnValue = true;
|
|
99 |
QVERIFY(mTestObject->load(0, 0, 0, 0) == true);
|
|
100 |
VideoOperatorServicePrivateData::mLoadReturnValue = false;
|
|
101 |
QVERIFY(mTestObject->load(0, 0, 0, 0) == false);
|
|
102 |
|
|
103 |
VideoOperatorServicePrivateData::mTitleReturnValue = "test1";
|
|
104 |
QVERIFY(mTestObject->title() == QString("test1"));
|
|
105 |
VideoOperatorServicePrivateData::mTitleReturnValue = "test2";
|
|
106 |
QVERIFY(mTestObject->title() == QString("test2"));
|
|
107 |
|
|
108 |
VideoOperatorServicePrivateData::mIconResourceReturnValue = "test3";
|
|
109 |
QVERIFY(mTestObject->iconResource() == QString("test3"));
|
|
110 |
VideoOperatorServicePrivateData::mIconResourceReturnValue = "test4";
|
|
111 |
QVERIFY(mTestObject->iconResource() == QString("test4"));
|
|
112 |
|
|
113 |
VideoOperatorServicePrivateData::mLaunchServiceCallCount = 0;
|
50
|
114 |
mTestObject->launchService();
|
55
|
115 |
QCOMPARE(VideoOperatorServicePrivateData::mLaunchServiceCallCount, 1);
|
|
116 |
|
|
117 |
cleanup();
|
50
|
118 |
}
|
|
119 |
|
|
120 |
// end of file
|