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: |
|
15 */ |
|
16 |
|
17 #ifndef TESTWLANWIZARDRNDUI_H_ |
|
18 #define TESTWLANWIZARDRNDUI_H_ |
|
19 |
|
20 #include <QObject> |
|
21 #include <HbView> |
|
22 #include <QSharedPointer> |
|
23 |
|
24 class QGraphicsItem; |
|
25 class HbAutoTestMainWindow; |
|
26 class WlanWizard; |
|
27 class WlanQtUtilsContext; |
|
28 class WlanQtUtils; |
|
29 class WlanQtUtilsAp; |
|
30 class QString; |
|
31 |
|
32 class ContextWlanApList |
|
33 { |
|
34 public: |
|
35 ContextWlanApList(); |
|
36 ~ContextWlanApList(); |
|
37 |
|
38 void Add(QString name, |
|
39 int netMode, |
|
40 int secMode, |
|
41 bool wpaPskInUse, |
|
42 bool wpsSupported, |
|
43 int signalStrength = 0); |
|
44 |
|
45 void clear(); |
|
46 |
|
47 const QList<QSharedPointer<WlanQtUtilsAp> > &List() { return mList; } |
|
48 private: |
|
49 QList<QSharedPointer<WlanQtUtilsAp> > mList; |
|
50 }; |
|
51 |
|
52 class TestView: public HbView |
|
53 { |
|
54 Q_OBJECT |
|
55 |
|
56 public: |
|
57 enum WizardStatusSignal{ |
|
58 WizardStatusSignalNone, |
|
59 WizardStatusSignalFinished, |
|
60 WizardStatusSignalCancelled, |
|
61 WizardStatusSignalUndefined, |
|
62 }; |
|
63 |
|
64 public: |
|
65 TestView(); |
|
66 virtual ~TestView(); |
|
67 |
|
68 void createWizard(); |
|
69 void showWizard(); |
|
70 |
|
71 bool verifyStatus(WizardStatusSignal status, int iapId = -100); |
|
72 |
|
73 private slots: |
|
74 void finished(int iapId, bool connected); |
|
75 void cancelled(); |
|
76 |
|
77 public: |
|
78 void deleteWizard(); |
|
79 |
|
80 public: |
|
81 WlanWizard *mWizard; |
|
82 |
|
83 private: |
|
84 WizardStatusSignal mWizardStatus; |
|
85 int mConnectedIapId; |
|
86 }; |
|
87 |
|
88 |
|
89 class TestWlanWizardUi: public QObject |
|
90 { |
|
91 Q_OBJECT |
|
92 |
|
93 public slots: |
|
94 // Test framework functions |
|
95 void initTestCase(); |
|
96 void cleanupTestCase(); |
|
97 void init(); |
|
98 void cleanup(); |
|
99 |
|
100 private slots: |
|
101 // Test cases |
|
102 void tcStartWizard(); |
|
103 void tc01(); |
|
104 void tc02(); |
|
105 void tc03(); |
|
106 void tc04(); |
|
107 void tc05(); |
|
108 void tc06(); |
|
109 void tc07(); |
|
110 void tc08(); |
|
111 void tc09(); |
|
112 void tc10(); |
|
113 void tc11(); |
|
114 void tc12(); |
|
115 void tc13(); |
|
116 void tc14(); |
|
117 void tc15(); |
|
118 void tc16(); |
|
119 void tc17(); |
|
120 void tc18(); |
|
121 void tc19(); |
|
122 void tc20(); |
|
123 void tc21(); |
|
124 void tc22(); |
|
125 void tc23(); |
|
126 void tc24(); |
|
127 void tc25(); |
|
128 void tc26(); |
|
129 void tc27(); |
|
130 void tc_connect_to_open_success(); |
|
131 void tc_connect_to_open_success_hidden(); |
|
132 void tc_connect_to_open_success_adhoc(); |
|
133 void tc_connect_to_wep_success(); |
|
134 void tc_connect_to_wpa_psk_success(); |
|
135 void tc_connect_to_wpa2_psk_success(); |
|
136 void tc_connect_to_open_success_cancel(); |
|
137 |
|
138 protected: |
|
139 |
|
140 enum ButtonStatus { |
|
141 ButtonHidden, |
|
142 ButtonDisabled, |
|
143 ButtonEnabled |
|
144 }; |
|
145 /*! |
|
146 * Reimplements QObject function that is invoked on any event. This |
|
147 * function handles only a focus event to mSsid edit field. |
|
148 * @param obj contains the object, where the event originates from. |
|
149 * @param event contains the event id. |
|
150 */ |
|
151 bool eventFilter(QObject *obj, QEvent *event); |
|
152 |
|
153 QGraphicsWidget* findChildItem(const QString &itemName, QGraphicsWidget *widget); |
|
154 |
|
155 bool verifyCurrentPage(int pageId, int retries = 10, int wait_ms = 200); |
|
156 bool verifyDialogText(const QString objName, const QString text); |
|
157 bool verifyActionButtonVisibility(bool prevVisible, bool cancelVisible, |
|
158 bool nextVisible, bool finishVisible); |
|
159 bool verifyActionButtons(ButtonStatus prevStatus, ButtonStatus cancelStatus, |
|
160 ButtonStatus nextStatus, ButtonStatus finishStatus); |
|
161 bool mouseClickObject(const QString objName); |
|
162 bool insertTextToObject(const QString objName, const QString text); |
|
163 bool selectRadioButton(const QString objName, int index); |
|
164 |
|
165 bool mouseClickNext(); |
|
166 bool mouseClickPrevious(); |
|
167 bool mouseClickCancel(); |
|
168 bool mouseClickFinish(); |
|
169 |
|
170 private: |
|
171 |
|
172 private: |
|
173 void tc_connect_success( |
|
174 const QString &ssid, |
|
175 int networkMode, |
|
176 int securityMode, |
|
177 bool hidden, |
|
178 QString key); |
|
179 |
|
180 bool mEvent; |
|
181 |
|
182 // Test data |
|
183 TestView *mView; |
|
184 HbAutoTestMainWindow *mMainWindow; |
|
185 |
|
186 WlanQtUtilsContext *mWlanQtUtilsContext; |
|
187 |
|
188 ContextWlanApList *mApList; |
|
189 |
|
190 bool mNoCleanup; |
|
191 |
|
192 }; |
|
193 |
|
194 #endif /* TESTWLANWIZARDRNDUI_H_ */ |
|