|
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: Main test class for about plugin library. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <QtTest/QtTest> |
|
20 #include "t_aboutplugin.h" |
|
21 #include "cpaboutplugin.h" |
|
22 #include "cpaboutview.h" |
|
23 #include "cpaboutthirdpartyview.h" |
|
24 #include "cpaboutopensourceview.h" |
|
25 #include <xqsysinfo.h> |
|
26 |
|
27 #include <CpItemDataHelper.h> |
|
28 #include <hbInstance> |
|
29 #include <QEvent> |
|
30 #include <QGraphicsSceneMouseEvent> |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // --------------------------------------------------------------------------- |
|
34 // |
|
35 void TestAboutPlugin::init() |
|
36 { |
|
37 mPlugin = new CpAboutPlugin; |
|
38 QVERIFY(mPlugin); |
|
39 } |
|
40 |
|
41 // --------------------------------------------------------------------------- |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 void TestAboutPlugin::cleanup() |
|
45 { |
|
46 if (mPlugin) { |
|
47 delete mPlugin; |
|
48 mPlugin = 0; |
|
49 QVERIFY(mPlugin == 0); |
|
50 } |
|
51 |
|
52 } |
|
53 |
|
54 // --------------------------------------------------------------------------- |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 void TestAboutPlugin::testCreateSettingFormItemData() |
|
58 { |
|
59 CpItemDataHelper itemDataHelper; |
|
60 QList<CpSettingFormItemData*> itemData = mPlugin->createSettingFormItemData(itemDataHelper); |
|
61 QVERIFY(itemData.count() == 1); |
|
62 } |
|
63 |
|
64 // --------------------------------------------------------------------------- |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void TestAboutPlugin::testCpAboutView() |
|
68 { |
|
69 CpAboutView *view = new CpAboutView(); |
|
70 QVERIFY(view); |
|
71 delete view; |
|
72 view = 0; |
|
73 QVERIFY(view == 0); |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 void TestAboutPlugin::testCpAboutViewOpenThirdPartyView() |
|
80 { |
|
81 CpAboutView *view = new CpAboutView(); |
|
82 QVERIFY(view); |
|
83 |
|
84 HbMainWindow *mainWindow = new HbMainWindow(); |
|
85 mainWindow->addView(view); |
|
86 |
|
87 view->openThirdPartyView(); |
|
88 const QString title = hbTrId("txt_cp_title_control_panel"); |
|
89 QVERIFY(view->mThirdPartyView->title() == title); |
|
90 view->handleThirdPartyViewBackAction(); |
|
91 |
|
92 delete view; |
|
93 view = 0; |
|
94 QVERIFY(view == 0); |
|
95 delete mainWindow; |
|
96 } |
|
97 |
|
98 // --------------------------------------------------------------------------- |
|
99 // --------------------------------------------------------------------------- |
|
100 // |
|
101 void TestAboutPlugin::testCpAboutViewOpenOpenSourceView() |
|
102 { |
|
103 CpAboutView *view = new CpAboutView(); |
|
104 QVERIFY(view); |
|
105 |
|
106 HbMainWindow *mainWindow = new HbMainWindow(); |
|
107 mainWindow->addView(view); |
|
108 |
|
109 view->openOpenSourceView(); |
|
110 const QString title = hbTrId("txt_cp_title_control_panel"); |
|
111 QVERIFY(view->mOpenSourceView->title() == title); |
|
112 view->handleOpenSourceViewBackAction(); |
|
113 |
|
114 delete view; |
|
115 view = 0; |
|
116 QVERIFY(view == 0); |
|
117 delete mainWindow; |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // --------------------------------------------------------------------------- |
|
122 // |
|
123 |
|
124 void TestAboutPlugin::testCpAboutThirdPartyView() |
|
125 { |
|
126 CpAboutThirdPartyView *view = new CpAboutThirdPartyView(); |
|
127 QVERIFY(view); |
|
128 delete view; |
|
129 view = 0; |
|
130 QVERIFY(view == 0); |
|
131 } |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void TestAboutPlugin::testCpAboutOpenSourceView() |
|
137 { |
|
138 CpAboutOpenSourceView *view = new CpAboutOpenSourceView(); |
|
139 QVERIFY(view); |
|
140 delete view; |
|
141 view = 0; |
|
142 QVERIFY(view == 0); |
|
143 } |
|
144 QTEST_MAIN(TestAboutPlugin) |