|
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 TESTWLANWIZARDRNDUICONTEXT_H_ |
|
18 #define TESTWLANWIZARDRNDUICONTEXT_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 class EapWizard; |
|
32 class EapQtConfigInterfaceContext; |
|
33 class EapQtConfigInterface; |
|
34 class WlanMgmtClientContext; |
|
35 class CWlanMgmtClient; |
|
36 |
|
37 //! 1sec |
|
38 #define WaitTimeForUi 500 |
|
39 |
|
40 enum WizardStatusSignal{ |
|
41 WizardStatusSignalNone, |
|
42 WizardStatusSignalFinished, |
|
43 WizardStatusSignalCancelled, |
|
44 WizardStatusSignalUndefined, |
|
45 }; |
|
46 |
|
47 class ContextWlanApList |
|
48 { |
|
49 public: |
|
50 ContextWlanApList(); |
|
51 ~ContextWlanApList(); |
|
52 |
|
53 void Add(QString name, |
|
54 int netMode, |
|
55 int secMode, |
|
56 bool wpaPskInUse, |
|
57 bool wpsSupported, |
|
58 int signalStrength = 0); |
|
59 |
|
60 void clear(); |
|
61 |
|
62 const QList<QSharedPointer<WlanQtUtilsAp> > &List() { return mList; } |
|
63 private: |
|
64 QList<QSharedPointer<WlanQtUtilsAp> > mList; |
|
65 }; |
|
66 |
|
67 class TestView: public HbView |
|
68 { |
|
69 Q_OBJECT |
|
70 |
|
71 public: |
|
72 |
|
73 |
|
74 public: |
|
75 TestView(); |
|
76 virtual ~TestView(); |
|
77 |
|
78 void createWizard(); |
|
79 void showWizard(); |
|
80 bool verifyStatus(WizardStatusSignal status, int iapId = -100); |
|
81 |
|
82 private slots: |
|
83 void finished(int iapId, bool connected); |
|
84 void cancelled(); |
|
85 |
|
86 public: |
|
87 void deleteWizard(); |
|
88 |
|
89 public: |
|
90 WlanWizard *mWizard; |
|
91 |
|
92 private: |
|
93 WizardStatusSignal mWizardStatus; |
|
94 int mConnectedIapId; |
|
95 }; |
|
96 |
|
97 |
|
98 class TestWlanWizardContext : public QObject |
|
99 { |
|
100 Q_OBJECT |
|
101 public: |
|
102 TestWlanWizardContext(); |
|
103 virtual ~TestWlanWizardContext(); |
|
104 |
|
105 public slots: |
|
106 // Test framework functions |
|
107 void initTestCase(); |
|
108 void cleanupTestCase(); |
|
109 void init(); |
|
110 void cleanup(); |
|
111 |
|
112 protected: |
|
113 static const int ListNotFound = -2; |
|
114 static const int ListNoneSelected = -1; |
|
115 |
|
116 enum ButtonStatus { |
|
117 ButtonHidden, |
|
118 ButtonDisabled, |
|
119 ButtonEnabled |
|
120 }; |
|
121 /*! |
|
122 * Reimplements QObject function that is invoked on any event. This |
|
123 * function handles only a focus event to mSsid edit field. |
|
124 * @param obj contains the object, where the event originates from. |
|
125 * @param event contains the event id. |
|
126 */ |
|
127 bool eventFilter(QObject *obj, QEvent *event); |
|
128 |
|
129 QGraphicsWidget* findChildItem(const QString &itemName, QGraphicsItem *widget); |
|
130 bool verifyStatus(WizardStatusSignal status, int iapId = -100); |
|
131 bool verifyCurrentPage(int pageId, int retries = 10, int wait_ms = 200); |
|
132 bool verifyCurrentPageWithInfo(int pageId, const QString &info, int retries = 10, int wait_ms = 200); |
|
133 bool verifyDialogText(const QString objName, const QString text); |
|
134 bool verifyActionButtonVisibility(bool prevVisible, bool cancelVisible, |
|
135 bool nextVisible, bool finishVisible); |
|
136 bool verifyActionButtons(ButtonStatus prevStatus, ButtonStatus cancelStatus, |
|
137 ButtonStatus nextStatus, ButtonStatus finishStatus); |
|
138 bool verifySummaryPage( |
|
139 const QString &ssid, |
|
140 int netMode, |
|
141 bool hidden, |
|
142 int secMode, |
|
143 bool useWpaPsk, |
|
144 const QString &destination = QString(), |
|
145 int outerType = -1, |
|
146 int innerType = -1, |
|
147 bool eapFastProvMode = false); |
|
148 |
|
149 bool mouseClickObject(const QString objName); |
|
150 bool insertTextToObject(const QString objName, const QString text); |
|
151 bool selectRadioButton(const QString objName, int index); |
|
152 bool verifyRadioButtonState(const QString objName, int index, const QString &text); |
|
153 bool verifyCheckBoxState(const QString &objName, bool checked); |
|
154 QStringList verifyRadioButtons(const QString objName); |
|
155 int verifySelectedRadioButton(const QString objName); |
|
156 bool selectCheckBoxState(const QString &objName, bool check); |
|
157 |
|
158 bool mouseClickNext(); |
|
159 bool mouseClickPrevious(); |
|
160 bool mouseClickCancel(); |
|
161 bool mouseClickFinish(); |
|
162 |
|
163 QString toNetworkModeString(int netMode, bool isHidden); |
|
164 QString toSecurityModeString(int secMode, int useWpaPsk); |
|
165 |
|
166 EapQtConfigInterface *getEapQtConfig(); |
|
167 QString eapTypeToString(int type); |
|
168 |
|
169 void callWlanWizard_startPageOperation(); |
|
170 |
|
171 public: |
|
172 static void setWlanMgmtClientObject(CWlanMgmtClient* object); |
|
173 |
|
174 public: |
|
175 |
|
176 static CWlanMgmtClient *mWlanMgmtClient; |
|
177 |
|
178 protected: |
|
179 bool mEvent; |
|
180 |
|
181 // Test data |
|
182 TestView *mView; |
|
183 HbAutoTestMainWindow *mMainWindow; |
|
184 WlanQtUtilsContext *mWlanQtUtilsContext; |
|
185 EapQtConfigInterfaceContext *mEapQtUtilsContext; |
|
186 WlanMgmtClientContext *mWlanMgmtClientContext; |
|
187 ContextWlanApList *mApList; |
|
188 ContextWlanApList *mApOpenList; |
|
189 }; |
|
190 |
|
191 #endif /* TESTWLANWIZARDRNDUICONTEXT_H_ */ |