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: Module tests for SW install progress indicator. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "mt_sifuiinstallindicator.h" |
|
19 #include "sifuiinstallindicatorparams.h" |
|
20 #include <hbindicator.h> |
|
21 #include <qvaluespacesubscriber.h> |
|
22 #include <QTest> |
|
23 |
|
24 QTM_USE_NAMESPACE |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // TestSifUiInstallIndicator::activateWithoutParams() |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 void TestSifUiInstallIndicator::activateWithoutParams() |
|
32 { |
|
33 QValueSpaceSubscriber *subscriber = 0; |
|
34 subscriber = new QValueSpaceSubscriber(KSifUiInstallIndicatorStatusPath); |
|
35 QSignalSpy indicatorStatusSpy(subscriber, SIGNAL(contentsChanged())); |
|
36 |
|
37 HbIndicator *indicator = new HbIndicator(); |
|
38 QVERIFY(indicator != 0); |
|
39 QVERIFY(indicator->error() == 0); |
|
40 |
|
41 QVERIFY(indicator->activate(KSifUiInstallIndicatorType)); |
|
42 QTest::qWait(3000); |
|
43 QCOMPARE(indicatorStatusSpy.count(), 1); |
|
44 QVERIFY(indicator->deactivate(KSifUiInstallIndicatorType)); |
|
45 delete indicator; |
|
46 |
|
47 QCOMPARE(indicatorStatusSpy.count(), 2); |
|
48 delete subscriber; |
|
49 } |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // TestSifUiInstallIndicator::activateWithAppName() |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 void TestSifUiInstallIndicator::activateWithAppName() |
|
56 { |
|
57 HbIndicator *indicator = new HbIndicator(); |
|
58 QVERIFY(indicator != 0); |
|
59 QVERIFY(indicator->error() == 0); |
|
60 |
|
61 QValueSpaceSubscriber *subscriber = 0; |
|
62 subscriber = new QValueSpaceSubscriber(KSifUiInstallIndicatorStatusPath); |
|
63 QSignalSpy indicatorStatusSpy(subscriber, SIGNAL(contentsChanged())); |
|
64 |
|
65 QVariant params(QString("Test application")); |
|
66 QVERIFY(indicator->activate(KSifUiInstallIndicatorType, params)); |
|
67 QTest::qWait(3000); |
|
68 QCOMPARE(indicatorStatusSpy.count(), 1); |
|
69 QVERIFY(indicator->deactivate(KSifUiInstallIndicatorType)); |
|
70 delete indicator; |
|
71 |
|
72 QCOMPARE(indicatorStatusSpy.count(), 2); |
|
73 delete subscriber; |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // TestSifUiInstallIndicator::activateWithInvalidParam() |
|
78 // --------------------------------------------------------------------------- |
|
79 // |
|
80 void TestSifUiInstallIndicator::activateWithInvalidParam() |
|
81 { |
|
82 QValueSpaceSubscriber *subscriber = 0; |
|
83 subscriber = new QValueSpaceSubscriber(KSifUiInstallIndicatorStatusPath); |
|
84 QSignalSpy indicatorStatusSpy(subscriber, SIGNAL(contentsChanged())); |
|
85 |
|
86 HbIndicator *indicator = new HbIndicator(); |
|
87 QVERIFY(indicator != 0); |
|
88 QVERIFY(indicator->error() == 0); |
|
89 |
|
90 QVariant params(QByteArray("test")); |
|
91 QVERIFY(indicator->activate(KSifUiInstallIndicatorType, params)); |
|
92 QTest::qWait(3000); |
|
93 QCOMPARE(indicatorStatusSpy.count(), 1); |
|
94 QVERIFY(indicator->deactivate(KSifUiInstallIndicatorType)); |
|
95 delete indicator; |
|
96 |
|
97 QCOMPARE(indicatorStatusSpy.count(), 2); |
|
98 delete subscriber; |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // Main QTestLib definitions |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 QTEST_MAIN(TestSifUiInstallIndicator) |
|
106 #include "moc_mt_sifuiinstallindicator.cpp" |
|
107 |
|