changeset 26 | 3d09643def13 |
parent 24 | 9d760f716ca8 |
child 27 | 6bfad47013df |
24:9d760f716ca8 | 26:3d09643def13 |
---|---|
17 |
17 |
18 #include <QtTest/QtTest> |
18 #include <QtTest/QtTest> |
19 #include <QEventLoop> |
19 #include <QEventLoop> |
20 #include <QDebug> |
20 #include <QDebug> |
21 #include <QtCore> |
21 #include <QtCore> |
22 |
|
23 #include <W32STD.H> |
|
24 |
|
22 #include "mytestwindowgroup.h" |
25 #include "mytestwindowgroup.h" |
23 #include <W32STD.H> |
26 #include "stub/remconcoreapitarget.h" |
27 #include "stub/remconcallhandlingtarget.h" |
|
28 #include "stub/remconinterfaceselector.h" |
|
29 |
|
30 #include "targetwrapper.h" |
|
31 |
|
24 #include <xqkeycapture.h> |
32 #include <xqkeycapture.h> |
25 |
|
26 #include <QFile> |
33 #include <QFile> |
34 |
|
35 const int KAllFlagsOn = XQKeyCapture::CaptureBasic | |
|
36 XQKeyCapture::CaptureCallHandlingExt | |
|
37 XQKeyCapture::CaptureEnableRemoteExtEvents; |
|
38 const Qt::Key KNotSpecifiedKey = Qt::Key_F35; |
|
27 |
39 |
28 class TestXQKeyCapture : public QObject |
40 class TestXQKeyCapture : public QObject |
29 { |
41 { |
30 Q_OBJECT |
42 Q_OBJECT |
31 |
43 |
111 void testCancelCaptureLongKey_S60(); |
123 void testCancelCaptureLongKey_S60(); |
112 |
124 |
113 void testCancelCaptureLongKeyList_S60_data(); |
125 void testCancelCaptureLongKeyList_S60_data(); |
114 void testCancelCaptureLongKeyList_S60(); |
126 void testCancelCaptureLongKeyList_S60(); |
115 |
127 |
128 void testCaptureRemoteKeys_data(); |
|
129 void testCaptureRemoteKeys(); |
|
130 |
|
131 void testCaptureRemoteKeys_SelectorFail_data(); |
|
132 void testCaptureRemoteKeys_SelectorFail(); |
|
133 |
|
134 void testCaptureRemoteKeys_ApiCore_data(); |
|
135 void testCaptureRemoteKeys_ApiCore(); |
|
136 |
|
137 void testCaptureRemoteKeys_ApiCoreCancel_data(); |
|
138 void testCaptureRemoteKeys_ApiCoreCancel(); |
|
139 |
|
140 void testCaptureRemoteKeys_CallHandling_data(); |
|
141 void testCaptureRemoteKeys_CallHandling(); |
|
142 |
|
143 void testCaptureRemoteKeys_CallHandlingCancel_data(); |
|
144 void testCaptureRemoteKeys_CallHandlingCancel(); |
|
145 |
|
146 void testCaptureRemoteKeys_Basic_data(); |
|
147 void testCaptureRemoteKeys_Basic(); |
|
148 |
|
149 void testCaptureRemoteKeys_Extended_data(); |
|
150 void testCaptureRemoteKeys_Extended(); |
|
151 |
|
152 void testCancelCaptureRemoteKeys_data(); |
|
153 void testCancelCaptureRemoteKeys(); |
|
154 |
|
155 |
|
116 void testErrorString(); |
156 void testErrorString(); |
117 void testErrorId(); |
157 void testErrorId(); |
118 |
158 |
119 void testKeyMapperFile(); |
159 void testKeyMapperFile(); |
120 |
160 |
121 private: |
161 private: |
122 QString clearString(const QString& line); |
162 QString clearString(const QString& line); |
123 QString clearString(const QString& line, const QString& prefix, const QString& comment); |
163 QString clearString(const QString& line, const QString& prefix, const QString& comment); |
164 void setProperKeys(bool extended); |
|
124 |
165 |
125 private: |
166 private: |
126 XQKeyCapture* keyCapture; |
167 XQKeyCapture* keyCapture; |
127 |
168 |
128 Qt::Key aKey; |
169 Qt::Key aKey; |
143 bool additionalResult; |
184 bool additionalResult; |
144 bool ignoreWindowGroupAction; |
185 bool ignoreWindowGroupAction; |
145 |
186 |
146 |
187 |
147 public slots: |
188 public slots: |
148 void windowGroupAction( WindowGroupActionType, QList<unsigned int> ); |
189 void windowGroupAction(WindowGroupActionType, QList<unsigned int>); |
149 void windowGroupActionCancel( WindowGroupActionType, QList<long int> ); |
190 void windowGroupActionCancel(WindowGroupActionType, QList<long int>); |
150 |
191 |
192 public: |
|
193 //for events handling |
|
194 bool event(QEvent *); |
|
195 bool eventFilter(QObject *, QEvent *); |
|
196 void processEvent(QEvent *ev); |
|
197 |
|
198 void resetKeys(); |
|
199 QWidget myGlobalWidget; |
|
200 Qt::Key myLastKeyPressed; |
|
201 Qt::Key myLastKeyReleased; |
|
202 Qt::Key myLastKeyPress; |
|
203 Qt::Key myLastKeyExtendedPress; |
|
204 Qt::Key myLastKeyRelease; |
|
205 Qt::Key myLastKeyExtendedRelease; |
|
206 QMap<TRemConCoreApiOperationId, Qt::Key> myKeyMapping; |
|
151 }; |
207 }; |
152 |
208 |
153 // ======== MEMBER FUNCTIONS ======== |
209 // ======== MEMBER FUNCTIONS ======== |
210 void TestXQKeyCapture::resetKeys() |
|
211 { |
|
212 myLastKeyPressed = KNotSpecifiedKey; |
|
213 myLastKeyReleased = KNotSpecifiedKey; |
|
214 myLastKeyPress = KNotSpecifiedKey; |
|
215 myLastKeyExtendedPress = KNotSpecifiedKey; |
|
216 myLastKeyRelease = KNotSpecifiedKey; |
|
217 myLastKeyExtendedRelease = KNotSpecifiedKey; |
|
218 } |
|
154 void TestXQKeyCapture::initTestCase() |
219 void TestXQKeyCapture::initTestCase() |
155 { |
220 { |
156 bool ret = connect( MyTestWindowGroup::Instance(), SIGNAL( windowGroupAction( WindowGroupActionType, QList<unsigned int> )), |
221 bool ret = connect(MyTestWindowGroup::Instance(), SIGNAL(windowGroupAction(WindowGroupActionType, QList<unsigned int>)), |
157 this, SLOT( windowGroupAction( WindowGroupActionType, QList<unsigned int> ) ) ); |
222 this, SLOT(windowGroupAction(WindowGroupActionType, QList<unsigned int>))); |
158 QVERIFY( ret ); |
223 QVERIFY(ret); |
159 ret = connect( MyTestWindowGroup::Instance(), SIGNAL( windowGroupActionCancel( WindowGroupActionType, QList<long int> )), |
224 ret = connect(MyTestWindowGroup::Instance(), SIGNAL(windowGroupActionCancel(WindowGroupActionType, QList<long int>)), |
160 this, SLOT( windowGroupActionCancel( WindowGroupActionType, QList<long int> ) ) ); |
225 this, SLOT(windowGroupActionCancel(WindowGroupActionType, QList<long int>))); |
161 QVERIFY( ret ); |
226 QVERIFY(ret); |
162 |
227 |
228 myGlobalWidget.installEventFilter(this); |
|
229 |
|
230 // load key mapping |
|
231 |
|
232 TargetWrapper* myTargetWrapper = new TargetWrapper(); |
|
233 myTargetWrapper->init(XQKeyCapture::CaptureBasic); |
|
234 myKeyMapping = myTargetWrapper->keyMapping; |
|
235 delete myTargetWrapper; |
|
236 myGlobalWidget.setFocus(); |
|
237 myGlobalWidget.activateWindow(); |
|
163 } |
238 } |
164 |
239 |
165 void TestXQKeyCapture::cleanupTestCase() |
240 void TestXQKeyCapture::cleanupTestCase() |
166 { |
241 { |
242 //is this needed - looking for panic reason. |
|
243 myGlobalWidget.removeEventFilter(this); |
|
244 myGlobalWidget.deleteLater(); |
|
167 //delete MyTestWindowGroup::Instance(); |
245 //delete MyTestWindowGroup::Instance(); |
168 } |
246 } |
169 |
247 |
170 void TestXQKeyCapture::init() |
248 void TestXQKeyCapture::init() |
171 { |
249 { |
172 keyCapture = new XQKeyCapture(); |
250 keyCapture = new XQKeyCapture(); |
251 resetKeys(); |
|
173 } |
252 } |
174 |
253 |
175 void TestXQKeyCapture::cleanup() |
254 void TestXQKeyCapture::cleanup() |
176 { |
255 { |
177 delete keyCapture; |
256 delete keyCapture; |
257 CRemConCoreApiTarget::setNewLLeave(false); |
|
258 CRemConCallHandlingTarget::setNewLLeave(false); |
|
259 myGlobalWidget.setVisible(false); |
|
178 } |
260 } |
179 |
261 |
180 void TestXQKeyCapture::testCreateAndDestroy() |
262 void TestXQKeyCapture::testCreateAndDestroy() |
181 { |
263 { |
182 //empty, all done in init and cleanup |
264 //empty, all done in init and cleanup |
199 QTest::addColumn<long int>("reqNum"); |
281 QTest::addColumn<long int>("reqNum"); |
200 |
282 |
201 QTest::addColumn<bool>("additional"); |
283 QTest::addColumn<bool>("additional"); |
202 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
284 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
203 |
285 |
204 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
286 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
205 << static_cast<unsigned int> ( Qt::NoModifier ) |
287 << static_cast<unsigned int>(Qt::NoModifier) |
206 << static_cast<unsigned int> ( Qt::NoModifier ) |
288 << static_cast<unsigned int>(Qt::NoModifier) |
207 << static_cast<unsigned int> ( EKeyEscape ) |
289 << static_cast<unsigned int>(EKeyEscape) |
208 << static_cast<unsigned int> ( 0 ) |
290 << static_cast<unsigned int>(0) |
209 << static_cast<unsigned int> ( 0 ) |
291 << static_cast<unsigned int>(0) |
210 << static_cast<long int> ( 12 ) |
292 << static_cast<long int>(12) |
211 << false |
293 << false |
212 << static_cast<unsigned int> ( 0 ); |
294 << static_cast<unsigned int>(0); |
213 |
295 |
214 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( Qt::Key_Escape ) |
296 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int>(Qt::Key_Escape) |
215 << static_cast<unsigned int> ( Qt::NoModifier ) |
297 << static_cast<unsigned int>(Qt::NoModifier) |
216 << static_cast<unsigned int> ( Qt::NoModifier ) |
298 << static_cast<unsigned int>(Qt::NoModifier) |
217 << static_cast<unsigned int> ( EKeyEscape ) |
299 << static_cast<unsigned int>(EKeyEscape) |
218 << static_cast<unsigned int> ( 0 ) |
300 << static_cast<unsigned int>(0) |
219 << static_cast<unsigned int> ( 0 ) |
301 << static_cast<unsigned int>(0) |
220 << static_cast<long int> ( KErrNotSupported ) |
302 << static_cast<long int>(KErrNotSupported) |
221 << false |
303 << false |
222 << static_cast<unsigned int> ( 0 ); |
304 << static_cast<unsigned int>(0); |
223 |
305 |
224 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( Qt::Key_Escape ) |
306 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int>(Qt::Key_Escape) |
225 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
307 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
226 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
308 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
227 << static_cast<unsigned int> ( EKeyEscape ) |
309 << static_cast<unsigned int>(EKeyEscape) |
228 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
310 << static_cast<unsigned int>(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) |
229 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
311 << static_cast<unsigned int>(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) |
230 << static_cast<long int> ( 13 ) |
312 << static_cast<long int>(13) |
231 << false |
313 << false |
232 << static_cast<unsigned int> ( 0 ); |
314 << static_cast<unsigned int>(0); |
233 |
315 |
234 QTest::newRow("shift_key") << static_cast<unsigned int> ( Qt::Key_Shift ) |
316 QTest::newRow("shift_key") << static_cast<unsigned int>(Qt::Key_Shift) |
235 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
317 << static_cast<unsigned int>(Qt::ShiftModifier) |
236 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
318 << static_cast<unsigned int>(Qt::ShiftModifier) |
237 << static_cast<unsigned int> ( EKeyLeftShift ) |
319 << static_cast<unsigned int>(EKeyLeftShift) |
238 << static_cast<unsigned int> ( EModifierShift ) |
320 << static_cast<unsigned int>(EModifierShift) |
239 << static_cast<unsigned int> ( EModifierShift ) |
321 << static_cast<unsigned int>(EModifierShift) |
240 << static_cast<long int> ( 12 ) |
322 << static_cast<long int>(12) |
241 << true |
323 << true |
242 << static_cast<unsigned int> ( EKeyRightShift ); |
324 << static_cast<unsigned int>(EKeyRightShift); |
243 |
325 |
244 QTest::newRow("control_key") << static_cast<unsigned int> ( Qt::Key_Control ) |
326 QTest::newRow("control_key") << static_cast<unsigned int>(Qt::Key_Control) |
245 << static_cast<unsigned int> ( Qt::NoModifier ) |
327 << static_cast<unsigned int>(Qt::NoModifier) |
246 << static_cast<unsigned int> ( Qt::NoModifier ) |
328 << static_cast<unsigned int>(Qt::NoModifier) |
247 << static_cast<unsigned int> ( EKeyLeftCtrl ) |
329 << static_cast<unsigned int>(EKeyLeftCtrl) |
248 << static_cast<unsigned int> ( 0 ) |
330 << static_cast<unsigned int>(0) |
249 << static_cast<unsigned int> ( 0 ) |
331 << static_cast<unsigned int>(0) |
250 << static_cast<long int> ( 12 ) |
332 << static_cast<long int>(12) |
251 << true |
333 << true |
252 << static_cast<unsigned int> ( EKeyRightCtrl ); |
334 << static_cast<unsigned int>(EKeyRightCtrl); |
253 |
335 |
254 QTest::newRow("meta_key") << static_cast<unsigned int> ( Qt::Key_Super_R ) |
336 QTest::newRow("meta_key") << static_cast<unsigned int>(Qt::Key_Super_R) |
255 << static_cast<unsigned int> ( Qt::NoModifier ) |
337 << static_cast<unsigned int>(Qt::NoModifier) |
256 << static_cast<unsigned int> ( Qt::NoModifier ) |
338 << static_cast<unsigned int>(Qt::NoModifier) |
257 << static_cast<unsigned int> ( EKeyRightFunc ) |
339 << static_cast<unsigned int>(EKeyRightFunc) |
258 << static_cast<unsigned int> ( 0 ) |
340 << static_cast<unsigned int>(0) |
259 << static_cast<unsigned int> ( 0 ) |
341 << static_cast<unsigned int>(0) |
260 << static_cast<long int> ( 12 ) |
342 << static_cast<long int>(12) |
261 << true |
343 << true |
262 << static_cast<unsigned int> ( EKeyRightFunc ); |
344 << static_cast<unsigned int>(EKeyRightFunc); |
263 |
|
264 |
|
265 } |
345 } |
266 |
346 |
267 void TestXQKeyCapture::testCaptureKey() |
347 void TestXQKeyCapture::testCaptureKey() |
268 { |
348 { |
269 numOfArgs = 3; |
349 numOfArgs = 3; |
292 additionalResults.clear(); |
372 additionalResults.clear(); |
293 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
373 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
294 |
374 |
295 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
375 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
296 |
376 |
297 keyCapture->captureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
377 keyCapture->captureKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
298 |
|
299 // keyCapture->captureKey( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
|
300 } |
378 } |
301 |
379 |
302 void TestXQKeyCapture::testCaptureKeyList_data() |
380 void TestXQKeyCapture::testCaptureKeyList_data() |
303 { |
381 { |
304 testCaptureKey_data(); |
382 testCaptureKey_data(); |
332 additionalResults.clear(); |
410 additionalResults.clear(); |
333 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
411 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
334 |
412 |
335 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
413 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
336 |
414 |
337 keyCapture->captureKey( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
415 keyCapture->captureKey(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
338 } |
416 } |
339 |
417 |
340 //////////////////////////////////////////////////////////////// |
418 //////////////////////////////////////////////////////////////// |
341 //Capture Key Up And Downs |
419 //Capture Key Up And Downs |
342 //////////////////////////////////////////////////////////////// |
420 //////////////////////////////////////////////////////////////// |
354 QTest::addColumn<long int>("reqNum"); |
432 QTest::addColumn<long int>("reqNum"); |
355 |
433 |
356 QTest::addColumn<bool>("additional"); |
434 QTest::addColumn<bool>("additional"); |
357 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
435 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
358 |
436 |
359 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
437 QTest::newRow("esc_key") << static_cast<unsigned int>(EKeyEscape) |
360 << static_cast<unsigned int> ( Qt::NoModifier ) |
438 << static_cast<unsigned int>(Qt::NoModifier) |
361 << static_cast<unsigned int> ( Qt::NoModifier ) |
439 << static_cast<unsigned int>(Qt::NoModifier) |
362 << static_cast<unsigned int> ( EKeyEscape ) |
440 << static_cast<unsigned int>(EKeyEscape) |
363 << static_cast<unsigned int> ( 0 ) |
441 << static_cast<unsigned int>(0) |
364 << static_cast<unsigned int> ( 0 ) |
442 << static_cast<unsigned int>(0) |
365 << static_cast<long int> ( 12 ) |
443 << static_cast<long int>(12) |
366 << false |
444 << false |
367 << static_cast<unsigned int> ( 0 ); |
445 << static_cast<unsigned int>(0); |
368 |
446 |
369 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( EKeyEscape ) |
447 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int>(EKeyEscape) |
370 << static_cast<unsigned int> ( Qt::NoModifier ) |
448 << static_cast<unsigned int>(Qt::NoModifier) |
371 << static_cast<unsigned int> ( Qt::NoModifier ) |
449 << static_cast<unsigned int>(Qt::NoModifier) |
372 << static_cast<unsigned int> ( EKeyEscape ) |
450 << static_cast<unsigned int>(EKeyEscape) |
373 << static_cast<unsigned int> ( 0 ) |
451 << static_cast<unsigned int>(0) |
374 << static_cast<unsigned int> ( 0 ) |
452 << static_cast<unsigned int>(0) |
375 << static_cast<long int> ( KErrNotSupported ) |
453 << static_cast<long int>(KErrNotSupported) |
376 << false |
454 << false |
377 << static_cast<unsigned int> ( 0 ); |
455 << static_cast<unsigned int>(0); |
378 |
456 |
379 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( EKeyEscape ) |
457 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int>(EKeyEscape) |
380 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
458 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
381 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
459 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
382 << static_cast<unsigned int> ( EKeyEscape ) |
460 << static_cast<unsigned int>(EKeyEscape) |
383 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
461 << static_cast<unsigned int>(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) |
384 << static_cast<unsigned int> ( EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad ) |
462 << static_cast<unsigned int>(EModifierShift | EModifierCtrl | EModifierAlt | EModifierKeypad) |
385 << static_cast<long int> ( 13 ) |
463 << static_cast<long int>(13) |
386 << false |
464 << false |
387 << static_cast<unsigned int> ( 0 ); |
465 << static_cast<unsigned int>(0); |
388 |
466 |
389 QTest::newRow("shift_key") << static_cast<unsigned int> ( EKeyLeftShift ) |
467 QTest::newRow("shift_key") << static_cast<unsigned int>(EKeyLeftShift) |
390 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
468 << static_cast<unsigned int>(Qt::ShiftModifier) |
391 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
469 << static_cast<unsigned int>(Qt::ShiftModifier) |
392 << static_cast<unsigned int> ( EKeyLeftShift ) |
470 << static_cast<unsigned int>(EKeyLeftShift) |
393 << static_cast<unsigned int> ( EModifierShift ) |
471 << static_cast<unsigned int>(EModifierShift) |
394 << static_cast<unsigned int> ( EModifierShift ) |
472 << static_cast<unsigned int>(EModifierShift) |
395 << static_cast<long int> ( 12 ) |
473 << static_cast<long int>(12) |
396 << true |
474 << true |
397 << static_cast<unsigned int> ( EKeyRightShift ); |
475 << static_cast<unsigned int>(EKeyRightShift); |
398 |
476 |
399 QTest::newRow("control_key") << static_cast<unsigned int> ( EKeyRightCtrl ) |
477 QTest::newRow("control_key") << static_cast<unsigned int>(EKeyRightCtrl) |
400 << static_cast<unsigned int> ( Qt::NoModifier ) |
478 << static_cast<unsigned int>(Qt::NoModifier) |
401 << static_cast<unsigned int> ( Qt::NoModifier ) |
479 << static_cast<unsigned int>(Qt::NoModifier) |
402 << static_cast<unsigned int> ( EKeyRightCtrl ) |
480 << static_cast<unsigned int>(EKeyRightCtrl) |
403 << static_cast<unsigned int> ( 0 ) |
481 << static_cast<unsigned int>(0) |
404 << static_cast<unsigned int> ( 0 ) |
482 << static_cast<unsigned int>(0) |
405 << static_cast<long int> ( 12 ) |
483 << static_cast<long int>(12) |
406 << true |
484 << true |
407 << static_cast<unsigned int> ( EKeyRightFunc ); |
485 << static_cast<unsigned int>(EKeyRightFunc); |
408 |
486 |
409 QTest::newRow("meta_key") << static_cast<unsigned int> ( EKeyLeftCtrl ) |
487 QTest::newRow("meta_key") << static_cast<unsigned int>(EKeyLeftCtrl) |
410 << static_cast<unsigned int> ( Qt::NoModifier ) |
488 << static_cast<unsigned int>(Qt::NoModifier) |
411 << static_cast<unsigned int> ( Qt::NoModifier ) |
489 << static_cast<unsigned int>(Qt::NoModifier) |
412 << static_cast<unsigned int> ( EKeyLeftCtrl ) |
490 << static_cast<unsigned int>(EKeyLeftCtrl) |
413 << static_cast<unsigned int> ( 0 ) |
491 << static_cast<unsigned int>(0) |
414 << static_cast<unsigned int> ( 0 ) |
492 << static_cast<unsigned int>(0) |
415 << static_cast<long int> ( 12 ) |
493 << static_cast<long int>(12) |
416 << true |
494 << true |
417 << static_cast<unsigned int> ( EKeyLeftFunc ); |
495 << static_cast<unsigned int>(EKeyLeftFunc); |
418 |
496 |
419 |
497 |
420 } |
498 } |
421 |
499 |
422 void TestXQKeyCapture::testCaptureKey_S60() |
500 void TestXQKeyCapture::testCaptureKey_S60() |
446 |
524 |
447 additionalResults.clear(); |
525 additionalResults.clear(); |
448 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
526 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
449 |
527 |
450 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
528 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
451 keyCapture->captureKey( static_cast<TUint> (s60Key), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
529 keyCapture->captureKey(static_cast<TUint>(s60Key), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
452 } |
530 } |
453 |
531 |
454 void TestXQKeyCapture::testCaptureKeyList_S60_data() |
532 void TestXQKeyCapture::testCaptureKeyList_S60_data() |
455 { |
533 { |
456 testCaptureKey_S60_data(); |
534 testCaptureKey_S60_data(); |
483 |
561 |
484 additionalResults.clear(); |
562 additionalResults.clear(); |
485 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
563 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
486 |
564 |
487 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
565 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
488 keyCapture->captureKey(QList<TUint>() << static_cast<TUint> (s60Key), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
566 keyCapture->captureKey(QList<TUint>() << static_cast<TUint>(s60Key), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
489 } |
567 } |
490 |
568 |
491 //////////////////////////////////////////////////////////////// |
569 //////////////////////////////////////////////////////////////// |
492 //Capture Key Up And Downs |
570 //Capture Key Up And Downs |
493 //////////////////////////////////////////////////////////////// |
571 //////////////////////////////////////////////////////////////// |
504 QTest::addColumn<long int>("reqNum"); |
582 QTest::addColumn<long int>("reqNum"); |
505 |
583 |
506 QTest::addColumn<bool>("additional"); |
584 QTest::addColumn<bool>("additional"); |
507 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
585 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
508 |
586 |
509 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
587 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
510 << static_cast<unsigned int> ( Qt::NoModifier ) |
588 << static_cast<unsigned int>(Qt::NoModifier) |
511 << static_cast<unsigned int> ( Qt::NoModifier ) |
589 << static_cast<unsigned int>(Qt::NoModifier) |
512 << static_cast<unsigned int> ( EStdKeyEscape ) |
590 << static_cast<unsigned int>(EStdKeyEscape) |
513 << static_cast<unsigned int> ( 0 ) |
591 << static_cast<unsigned int>(0) |
514 << static_cast<unsigned int> ( 0 ) |
592 << static_cast<unsigned int>(0) |
515 << static_cast<long int> ( 12 ) |
593 << static_cast<long int>(12) |
516 << false |
594 << false |
517 << static_cast<unsigned int> ( 0 ); |
595 << static_cast<unsigned int>(0); |
518 } |
596 } |
519 |
597 |
520 void TestXQKeyCapture::testCaptureKeyUpAndDowns() |
598 void TestXQKeyCapture::testCaptureKeyUpAndDowns() |
521 { |
599 { |
522 numOfArgs = 3; |
600 numOfArgs = 3; |
544 |
622 |
545 additionalResults.clear(); |
623 additionalResults.clear(); |
546 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
624 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
547 |
625 |
548 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
626 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
549 keyCapture->captureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
627 keyCapture->captureKeyUpAndDowns(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
550 } |
628 } |
551 |
629 |
552 void TestXQKeyCapture::testCaptureKeyUpAndDownsList_data() |
630 void TestXQKeyCapture::testCaptureKeyUpAndDownsList_data() |
553 { |
631 { |
554 testCaptureKeyUpAndDowns_data(); |
632 testCaptureKeyUpAndDowns_data(); |
581 |
659 |
582 additionalResults.clear(); |
660 additionalResults.clear(); |
583 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
661 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
584 |
662 |
585 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
663 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
586 keyCapture->captureKeyUpAndDowns( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
664 keyCapture->captureKeyUpAndDowns(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
587 } |
665 } |
588 |
666 |
589 //////////////////////////////////////////////////////////////// |
667 //////////////////////////////////////////////////////////////// |
590 //Capture Key Up And Downs |
668 //Capture Key Up And Downs |
591 //////////////////////////////////////////////////////////////// |
669 //////////////////////////////////////////////////////////////// |
602 QTest::addColumn<long int>("reqNum"); |
680 QTest::addColumn<long int>("reqNum"); |
603 |
681 |
604 QTest::addColumn<bool>("additional"); |
682 QTest::addColumn<bool>("additional"); |
605 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
683 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
606 |
684 |
607 QTest::newRow("esc_key") << static_cast<unsigned int> ( EStdKeyEscape ) |
685 QTest::newRow("esc_key") << static_cast<unsigned int>(EStdKeyEscape) |
608 << static_cast<unsigned int> ( Qt::NoModifier ) |
686 << static_cast<unsigned int>(Qt::NoModifier) |
609 << static_cast<unsigned int> ( Qt::NoModifier ) |
687 << static_cast<unsigned int>(Qt::NoModifier) |
610 << static_cast<unsigned int> ( EStdKeyEscape ) |
688 << static_cast<unsigned int>(EStdKeyEscape) |
611 << static_cast<unsigned int> ( 0 ) |
689 << static_cast<unsigned int>(0) |
612 << static_cast<unsigned int> ( 0 ) |
690 << static_cast<unsigned int>(0) |
613 << static_cast<long int> ( 12 ) |
691 << static_cast<long int>(12) |
614 << false |
692 << false |
615 << static_cast<unsigned int> ( 0 ); |
693 << static_cast<unsigned int>(0); |
616 } |
694 } |
617 |
695 |
618 void TestXQKeyCapture::testCaptureKeyUpAndDowns_S60() |
696 void TestXQKeyCapture::testCaptureKeyUpAndDowns_S60() |
619 { |
697 { |
620 numOfArgs = 3; |
698 numOfArgs = 3; |
642 |
720 |
643 additionalResults.clear(); |
721 additionalResults.clear(); |
644 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
722 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
645 |
723 |
646 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
724 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
647 keyCapture->captureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
725 keyCapture->captureKeyUpAndDowns(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
648 } |
726 } |
649 |
727 |
650 void TestXQKeyCapture::testCaptureKeyUpAndDownsList_S60_data() |
728 void TestXQKeyCapture::testCaptureKeyUpAndDownsList_S60_data() |
651 { |
729 { |
652 testCaptureKeyUpAndDowns_S60_data(); |
730 testCaptureKeyUpAndDowns_S60_data(); |
679 |
757 |
680 additionalResults.clear(); |
758 additionalResults.clear(); |
681 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
759 additionalResults << additionalSymbianKey << symbianMask << symbianModifier; |
682 |
760 |
683 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
761 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
684 keyCapture->captureKeyUpAndDowns( QList<TUint>() << static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
762 keyCapture->captureKeyUpAndDowns(QList<TUint>() << static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
685 } |
763 } |
686 |
764 |
687 //////////////////////////////////////////////////////////////// |
765 //////////////////////////////////////////////////////////////// |
688 //Capture Long Key |
766 //Capture Long Key |
689 //////////////////////////////////////////////////////////////// |
767 //////////////////////////////////////////////////////////////// |
704 |
782 |
705 QTest::addColumn<bool>("additional"); |
783 QTest::addColumn<bool>("additional"); |
706 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
784 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
707 |
785 |
708 |
786 |
709 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
787 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
710 << static_cast<unsigned int> ( Qt::NoModifier ) |
788 << static_cast<unsigned int>(Qt::NoModifier) |
711 << static_cast<unsigned int> ( Qt::NoModifier ) |
789 << static_cast<unsigned int>(Qt::NoModifier) |
712 << static_cast<int> ( XQKeyCapture::LongNormal ) |
790 << static_cast<int>(XQKeyCapture::LongNormal) |
713 << static_cast<unsigned int> ( EKeyEscape ) |
791 << static_cast<unsigned int>(EKeyEscape) |
714 << static_cast<unsigned int> ( 0 ) |
792 << static_cast<unsigned int>(0) |
715 << static_cast<unsigned int> ( 0 ) |
793 << static_cast<unsigned int>(0) |
716 << static_cast<int> ( 0 ) //priority |
794 << static_cast<int>(0) //priority |
717 << static_cast<int> ( XQKeyCapture::LongNormal ) |
795 << static_cast<int>(XQKeyCapture::LongNormal) |
718 << static_cast<long int> ( 12 ) |
796 << static_cast<long int>(12) |
719 << false |
797 << false |
720 << static_cast<unsigned int> ( 0 ); |
798 << static_cast<unsigned int>(0); |
721 |
799 |
722 } |
800 } |
723 |
801 |
724 void TestXQKeyCapture::testCaptureLongKey() |
802 void TestXQKeyCapture::testCaptureLongKey() |
725 { |
803 { |
751 |
829 |
752 additionalResults.clear(); |
830 additionalResults.clear(); |
753 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
831 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
754 |
832 |
755 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
833 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
756 keyCapture->captureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
834 keyCapture->captureLongKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
757 } |
835 } |
758 |
836 |
759 void TestXQKeyCapture::testCaptureLongKeyList_data() |
837 void TestXQKeyCapture::testCaptureLongKeyList_data() |
760 { |
838 { |
761 testCaptureLongKey_data(); |
839 testCaptureLongKey_data(); |
791 |
869 |
792 additionalResults.clear(); |
870 additionalResults.clear(); |
793 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
871 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
794 |
872 |
795 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
873 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
796 keyCapture->captureLongKey( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
874 keyCapture->captureLongKey(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
797 } |
875 } |
798 |
876 |
799 //////////////////////////////////////////////////////////////// |
877 //////////////////////////////////////////////////////////////// |
800 //Capture Long Key |
878 //Capture Long Key |
801 //////////////////////////////////////////////////////////////// |
879 //////////////////////////////////////////////////////////////// |
816 |
894 |
817 QTest::addColumn<bool>("additional"); |
895 QTest::addColumn<bool>("additional"); |
818 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
896 QTest::addColumn<unsigned int>("additionalSymbianKey"); |
819 |
897 |
820 |
898 |
821 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
899 QTest::newRow("esc_key") << static_cast<unsigned int>(EKeyEscape) |
822 << static_cast<unsigned int> ( Qt::NoModifier ) |
900 << static_cast<unsigned int>(Qt::NoModifier) |
823 << static_cast<unsigned int> ( Qt::NoModifier ) |
901 << static_cast<unsigned int>(Qt::NoModifier) |
824 << static_cast<int> ( XQKeyCapture::LongNormal ) |
902 << static_cast<int>(XQKeyCapture::LongNormal) |
825 << static_cast<unsigned int> ( EKeyEscape ) |
903 << static_cast<unsigned int>(EKeyEscape) |
826 << static_cast<unsigned int> ( 0 ) |
904 << static_cast<unsigned int>(0) |
827 << static_cast<unsigned int> ( 0 ) |
905 << static_cast<unsigned int>(0) |
828 << static_cast<int> ( 0 ) //priority |
906 << static_cast<int>(0) //priority |
829 << static_cast<int> ( XQKeyCapture::LongNormal ) |
907 << static_cast<int>(XQKeyCapture::LongNormal) |
830 << static_cast<long int> ( 12 ) |
908 << static_cast<long int>(12) |
831 << false |
909 << false |
832 << static_cast<unsigned int> ( 0 ); |
910 << static_cast<unsigned int>(0); |
833 |
911 |
834 } |
912 } |
835 |
913 |
836 void TestXQKeyCapture::testCaptureLongKey_S60() |
914 void TestXQKeyCapture::testCaptureLongKey_S60() |
837 { |
915 { |
863 |
941 |
864 additionalResults.clear(); |
942 additionalResults.clear(); |
865 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
943 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
866 |
944 |
867 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
945 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
868 keyCapture->captureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
946 keyCapture->captureLongKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
869 } |
947 } |
870 |
948 |
871 void TestXQKeyCapture::testCaptureLongKeyList_S60_data() |
949 void TestXQKeyCapture::testCaptureLongKeyList_S60_data() |
872 { |
950 { |
873 testCaptureLongKey_S60_data(); |
951 testCaptureLongKey_S60_data(); |
903 |
981 |
904 additionalResults.clear(); |
982 additionalResults.clear(); |
905 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
983 additionalResults << additionalSymbianKey << symbianMask << symbianModifier << symbianPriority << symbianLongFlags; |
906 |
984 |
907 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
985 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
908 keyCapture->captureLongKey( QList<TUint>() << static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
986 keyCapture->captureLongKey(QList<TUint>() << static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
909 } |
987 } |
910 |
988 |
911 //////////////////////////////////////////////////////////////// |
989 //////////////////////////////////////////////////////////////// |
912 // CANCEL |
990 // CANCEL |
913 //Cancel Capture Key |
991 //Cancel Capture Key |
921 QTest::addColumn<long int>("reqNum"); |
999 QTest::addColumn<long int>("reqNum"); |
922 |
1000 |
923 QTest::addColumn<bool>("additional"); |
1001 QTest::addColumn<bool>("additional"); |
924 QTest::addColumn<long int>("additionalReqNum"); |
1002 QTest::addColumn<long int>("additionalReqNum"); |
925 |
1003 |
926 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
1004 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
927 << static_cast<unsigned int> ( Qt::NoModifier ) |
1005 << static_cast<unsigned int>(Qt::NoModifier) |
928 << static_cast<unsigned int> ( Qt::NoModifier ) |
1006 << static_cast<unsigned int>(Qt::NoModifier) |
929 << static_cast<long int> ( 12 ) |
1007 << static_cast<long int>(12) |
930 << false |
1008 << false |
931 << static_cast<long int> ( 0 ); |
1009 << static_cast<long int>(0); |
932 |
1010 |
933 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( Qt::Key_Escape ) |
1011 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int>(Qt::Key_Escape) |
934 << static_cast<unsigned int> ( Qt::NoModifier ) |
1012 << static_cast<unsigned int>(Qt::NoModifier) |
935 << static_cast<unsigned int> ( Qt::NoModifier ) |
1013 << static_cast<unsigned int>(Qt::NoModifier) |
936 << static_cast<long int> ( KErrNotSupported ) |
1014 << static_cast<long int>(KErrNotSupported) |
937 << false |
1015 << false |
938 << static_cast<long int> ( 0 ); |
1016 << static_cast<long int>(0); |
939 |
1017 |
940 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( Qt::Key_Escape ) |
1018 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int>(Qt::Key_Escape) |
941 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
1019 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
942 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
1020 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
943 << static_cast<long int> ( 13 ) |
1021 << static_cast<long int>(13) |
944 << false |
1022 << false |
945 << static_cast<long int> ( 0 ); |
1023 << static_cast<long int>(0); |
946 |
1024 |
947 QTest::newRow("shift_key") << static_cast<unsigned int> ( Qt::Key_Shift ) |
1025 QTest::newRow("shift_key") << static_cast<unsigned int>(Qt::Key_Shift) |
948 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
1026 << static_cast<unsigned int>(Qt::ShiftModifier) |
949 << static_cast<unsigned int> ( Qt::ControlModifier ) |
1027 << static_cast<unsigned int>(Qt::ControlModifier) |
950 << static_cast<long int> ( 15 ) |
1028 << static_cast<long int>(15) |
951 << true |
1029 << true |
952 << static_cast<long int> ( 16 ); |
1030 << static_cast<long int>(16); |
953 |
1031 |
954 QTest::newRow("control_key") << static_cast<unsigned int> ( Qt::Key_Control ) |
1032 QTest::newRow("control_key") << static_cast<unsigned int>(Qt::Key_Control) |
955 << static_cast<unsigned int> ( Qt::ControlModifier ) |
1033 << static_cast<unsigned int>(Qt::ControlModifier) |
956 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
1034 << static_cast<unsigned int>(Qt::ShiftModifier) |
957 << static_cast<long int> ( 17 ) |
1035 << static_cast<long int>(17) |
958 << true |
1036 << true |
959 << static_cast<long int> ( 18 ); |
1037 << static_cast<long int>(18); |
960 |
1038 |
961 QTest::newRow("meta_key") << static_cast<unsigned int> ( Qt::Key_Meta ) |
1039 QTest::newRow("meta_key") << static_cast<unsigned int>(Qt::Key_Meta) |
962 << static_cast<unsigned int> ( Qt::NoModifier ) |
1040 << static_cast<unsigned int>(Qt::NoModifier) |
963 << static_cast<unsigned int> ( Qt::NoModifier ) |
1041 << static_cast<unsigned int>(Qt::NoModifier) |
964 << static_cast<long int> ( 19 ) |
1042 << static_cast<long int>(19) |
965 << true |
1043 << true |
966 << static_cast<long int> ( 20 ); |
1044 << static_cast<long int>(20); |
967 |
1045 |
968 |
1046 |
969 } |
1047 } |
970 |
1048 |
971 void TestXQKeyCapture::testCancelCaptureKey() |
1049 void TestXQKeyCapture::testCancelCaptureKey() |
992 cancelAdditionalResults.clear(); |
1070 cancelAdditionalResults.clear(); |
993 cancelAdditionalResults << additionalReqNum; |
1071 cancelAdditionalResults << additionalReqNum; |
994 |
1072 |
995 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1073 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
996 ignoreWindowGroupAction = true; |
1074 ignoreWindowGroupAction = true; |
997 keyCapture->captureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1075 keyCapture->captureKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
998 ignoreWindowGroupAction = false; |
1076 ignoreWindowGroupAction = false; |
999 willBeAdditionalRequest = additional; |
1077 willBeAdditionalRequest = additional; |
1000 keyCapture->cancelCaptureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1078 keyCapture->cancelCaptureKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1001 } |
1079 } |
1002 |
1080 |
1003 void TestXQKeyCapture::testCancelCaptureKeyList_data() |
1081 void TestXQKeyCapture::testCancelCaptureKeyList_data() |
1004 { |
1082 { |
1005 testCancelCaptureKey_data(); |
1083 testCancelCaptureKey_data(); |
1029 cancelAdditionalResults.clear(); |
1107 cancelAdditionalResults.clear(); |
1030 cancelAdditionalResults << additionalReqNum; |
1108 cancelAdditionalResults << additionalReqNum; |
1031 |
1109 |
1032 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1110 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1033 ignoreWindowGroupAction = true; |
1111 ignoreWindowGroupAction = true; |
1034 keyCapture->captureKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1112 keyCapture->captureKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1035 ignoreWindowGroupAction = false; |
1113 ignoreWindowGroupAction = false; |
1036 willBeAdditionalRequest = additional; |
1114 willBeAdditionalRequest = additional; |
1037 keyCapture->cancelCaptureKey( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1115 keyCapture->cancelCaptureKey(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1038 } |
1116 } |
1039 |
1117 |
1040 //////////////////////////////////////////////////////////////// |
1118 //////////////////////////////////////////////////////////////// |
1041 // CANCEL |
1119 // CANCEL |
1042 //Cancel Capture Key |
1120 //Cancel Capture Key |
1050 QTest::addColumn<long int>("reqNum"); |
1128 QTest::addColumn<long int>("reqNum"); |
1051 |
1129 |
1052 QTest::addColumn<bool>("additional"); |
1130 QTest::addColumn<bool>("additional"); |
1053 QTest::addColumn<long int>("additionalReqNum"); |
1131 QTest::addColumn<long int>("additionalReqNum"); |
1054 |
1132 |
1055 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
1133 QTest::newRow("esc_key") << static_cast<unsigned int>(EKeyEscape) |
1056 << static_cast<unsigned int> ( Qt::NoModifier ) |
1134 << static_cast<unsigned int>(Qt::NoModifier) |
1057 << static_cast<unsigned int> ( Qt::NoModifier ) |
1135 << static_cast<unsigned int>(Qt::NoModifier) |
1058 << static_cast<long int> ( 12 ) |
1136 << static_cast<long int>(12) |
1059 << false |
1137 << false |
1060 << static_cast<long int> ( 0 ); |
1138 << static_cast<long int>(0); |
1061 |
1139 |
1062 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int> ( EKeyEscape ) |
1140 QTest::newRow("esc_key_not_supported") << static_cast<unsigned int>(EKeyEscape) |
1063 << static_cast<unsigned int> ( Qt::NoModifier ) |
1141 << static_cast<unsigned int>(Qt::NoModifier) |
1064 << static_cast<unsigned int> ( Qt::NoModifier ) |
1142 << static_cast<unsigned int>(Qt::NoModifier) |
1065 << static_cast<long int> ( KErrNotSupported ) |
1143 << static_cast<long int>(KErrNotSupported) |
1066 << false |
1144 << false |
1067 << static_cast<long int> ( 0 ); |
1145 << static_cast<long int>(0); |
1068 |
1146 |
1069 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int> ( EKeyEscape ) |
1147 QTest::newRow("esc_key_modifiers") << static_cast<unsigned int>(EKeyEscape) |
1070 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
1148 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
1071 << static_cast<unsigned int> ( Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier ) |
1149 << static_cast<unsigned int>(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt:: KeypadModifier) |
1072 << static_cast<long int> ( 13 ) |
1150 << static_cast<long int>(13) |
1073 << false |
1151 << false |
1074 << static_cast<long int> ( 0 ); |
1152 << static_cast<long int>(0); |
1075 |
1153 |
1076 QTest::newRow("shift_key") << static_cast<unsigned int> ( EKeyLeftShift ) |
1154 QTest::newRow("shift_key") << static_cast<unsigned int>(EKeyLeftShift) |
1077 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
1155 << static_cast<unsigned int>(Qt::ShiftModifier) |
1078 << static_cast<unsigned int> ( Qt::ControlModifier ) |
1156 << static_cast<unsigned int>(Qt::ControlModifier) |
1079 << static_cast<long int> ( 15 ) |
1157 << static_cast<long int>(15) |
1080 << true |
1158 << true |
1081 << static_cast<long int> ( 16 ); |
1159 << static_cast<long int>(16); |
1082 |
1160 |
1083 QTest::newRow("control_key") << static_cast<unsigned int> ( EKeyLeftCtrl ) |
1161 QTest::newRow("control_key") << static_cast<unsigned int>(EKeyLeftCtrl) |
1084 << static_cast<unsigned int> ( Qt::ControlModifier ) |
1162 << static_cast<unsigned int>(Qt::ControlModifier) |
1085 << static_cast<unsigned int> ( Qt::ShiftModifier ) |
1163 << static_cast<unsigned int>(Qt::ShiftModifier) |
1086 << static_cast<long int> ( 17 ) |
1164 << static_cast<long int>(17) |
1087 << true |
1165 << true |
1088 << static_cast<long int> ( 18 ); |
1166 << static_cast<long int>(18); |
1089 |
1167 |
1090 QTest::newRow("meta_key") << static_cast<unsigned int> ( EKeyRightCtrl ) |
1168 QTest::newRow("meta_key") << static_cast<unsigned int>(EKeyRightCtrl) |
1091 << static_cast<unsigned int> ( Qt::NoModifier ) |
1169 << static_cast<unsigned int>(Qt::NoModifier) |
1092 << static_cast<unsigned int> ( Qt::NoModifier ) |
1170 << static_cast<unsigned int>(Qt::NoModifier) |
1093 << static_cast<long int> ( 19 ) |
1171 << static_cast<long int>(19) |
1094 << true |
1172 << true |
1095 << static_cast<long int> ( 20 ); |
1173 << static_cast<long int>(20); |
1096 |
|
1097 |
|
1098 } |
1174 } |
1099 |
1175 |
1100 void TestXQKeyCapture::testCancelCaptureKey_S60() |
1176 void TestXQKeyCapture::testCancelCaptureKey_S60() |
1101 { |
1177 { |
1102 numOfArgs = 1; |
1178 numOfArgs = 1; |
1121 cancelAdditionalResults.clear(); |
1197 cancelAdditionalResults.clear(); |
1122 cancelAdditionalResults << additionalReqNum; |
1198 cancelAdditionalResults << additionalReqNum; |
1123 |
1199 |
1124 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1200 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1125 ignoreWindowGroupAction = true; |
1201 ignoreWindowGroupAction = true; |
1126 keyCapture->captureKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1202 keyCapture->captureKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1127 ignoreWindowGroupAction = false; |
1203 ignoreWindowGroupAction = false; |
1128 willBeAdditionalRequest = additional; |
1204 willBeAdditionalRequest = additional; |
1129 keyCapture->cancelCaptureKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1205 keyCapture->cancelCaptureKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1130 } |
1206 } |
1131 |
1207 |
1132 void TestXQKeyCapture::testCancelCaptureKeyList_S60_data() |
1208 void TestXQKeyCapture::testCancelCaptureKeyList_S60_data() |
1133 { |
1209 { |
1134 testCancelCaptureKey_S60_data(); |
1210 testCancelCaptureKey_S60_data(); |
1158 cancelAdditionalResults.clear(); |
1234 cancelAdditionalResults.clear(); |
1159 cancelAdditionalResults << additionalReqNum; |
1235 cancelAdditionalResults << additionalReqNum; |
1160 |
1236 |
1161 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1237 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1162 ignoreWindowGroupAction = true; |
1238 ignoreWindowGroupAction = true; |
1163 keyCapture->captureKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1239 keyCapture->captureKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1164 ignoreWindowGroupAction = false; |
1240 ignoreWindowGroupAction = false; |
1165 willBeAdditionalRequest = additional; |
1241 willBeAdditionalRequest = additional; |
1166 keyCapture->cancelCaptureKey( QList<TUint>() << static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1242 keyCapture->cancelCaptureKey(QList<TUint>() << static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1167 } |
1243 } |
1168 |
1244 |
1169 //////////////////////////////////////////////////////////////// |
1245 //////////////////////////////////////////////////////////////// |
1170 //Cancel Capture Key Up And Downs |
1246 //Cancel Capture Key Up And Downs |
1171 //////////////////////////////////////////////////////////////// |
1247 //////////////////////////////////////////////////////////////// |
1178 QTest::addColumn<long int>("reqNum"); |
1254 QTest::addColumn<long int>("reqNum"); |
1179 |
1255 |
1180 QTest::addColumn<bool>("additional"); |
1256 QTest::addColumn<bool>("additional"); |
1181 QTest::addColumn<long int>("additionalReqNum"); |
1257 QTest::addColumn<long int>("additionalReqNum"); |
1182 |
1258 |
1183 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
1259 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
1184 << static_cast<unsigned int> ( Qt::NoModifier ) |
1260 << static_cast<unsigned int>(Qt::NoModifier) |
1185 << static_cast<unsigned int> ( Qt::NoModifier ) |
1261 << static_cast<unsigned int>(Qt::NoModifier) |
1186 << static_cast<long int> ( 34 ) |
1262 << static_cast<long int>(34) |
1187 << false |
1263 << false |
1188 << static_cast<long int> ( 35 ); |
1264 << static_cast<long int>(35); |
1189 |
1265 |
1190 } |
1266 } |
1191 |
1267 |
1192 void TestXQKeyCapture::testCancelCaptureKeyUpAndDowns() |
1268 void TestXQKeyCapture::testCancelCaptureKeyUpAndDowns() |
1193 { |
1269 { |
1213 cancelAdditionalResults.clear(); |
1289 cancelAdditionalResults.clear(); |
1214 cancelAdditionalResults << additionalReqNum; |
1290 cancelAdditionalResults << additionalReqNum; |
1215 |
1291 |
1216 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1292 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1217 ignoreWindowGroupAction = true; |
1293 ignoreWindowGroupAction = true; |
1218 keyCapture->captureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1294 keyCapture->captureKeyUpAndDowns(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1219 ignoreWindowGroupAction = false; |
1295 ignoreWindowGroupAction = false; |
1220 willBeAdditionalRequest = additional; |
1296 willBeAdditionalRequest = additional; |
1221 keyCapture->cancelCaptureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1297 keyCapture->cancelCaptureKeyUpAndDowns(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1222 } |
1298 } |
1223 |
1299 |
1224 void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_data() |
1300 void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_data() |
1225 { |
1301 { |
1226 testCancelCaptureKeyUpAndDowns_data(); |
1302 testCancelCaptureKeyUpAndDowns_data(); |
1250 cancelAdditionalResults.clear(); |
1326 cancelAdditionalResults.clear(); |
1251 cancelAdditionalResults << additionalReqNum; |
1327 cancelAdditionalResults << additionalReqNum; |
1252 |
1328 |
1253 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1329 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1254 ignoreWindowGroupAction = true; |
1330 ignoreWindowGroupAction = true; |
1255 keyCapture->captureKeyUpAndDowns( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1331 keyCapture->captureKeyUpAndDowns(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1256 ignoreWindowGroupAction = false; |
1332 ignoreWindowGroupAction = false; |
1257 willBeAdditionalRequest = additional; |
1333 willBeAdditionalRequest = additional; |
1258 keyCapture->cancelCaptureKeyUpAndDowns(QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1334 keyCapture->cancelCaptureKeyUpAndDowns(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1259 } |
1335 } |
1260 |
1336 |
1261 //////////////////////////////////////////////////////////////// |
1337 //////////////////////////////////////////////////////////////// |
1262 //Cancel Capture Key Up And Downs |
1338 //Cancel Capture Key Up And Downs |
1263 //////////////////////////////////////////////////////////////// |
1339 //////////////////////////////////////////////////////////////// |
1270 QTest::addColumn<long int>("reqNum"); |
1346 QTest::addColumn<long int>("reqNum"); |
1271 |
1347 |
1272 QTest::addColumn<bool>("additional"); |
1348 QTest::addColumn<bool>("additional"); |
1273 QTest::addColumn<long int>("additionalReqNum"); |
1349 QTest::addColumn<long int>("additionalReqNum"); |
1274 |
1350 |
1275 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
1351 QTest::newRow("esc_key") << static_cast<unsigned int>(EKeyEscape) |
1276 << static_cast<unsigned int> ( Qt::NoModifier ) |
1352 << static_cast<unsigned int>(Qt::NoModifier) |
1277 << static_cast<unsigned int> ( Qt::NoModifier ) |
1353 << static_cast<unsigned int>(Qt::NoModifier) |
1278 << static_cast<long int> ( 34 ) |
1354 << static_cast<long int>(34) |
1279 << false |
1355 << false |
1280 << static_cast<long int> ( 35 ); |
1356 << static_cast<long int>(35); |
1281 |
1357 |
1282 } |
1358 } |
1283 |
1359 |
1284 void TestXQKeyCapture::testCancelCaptureKeyUpAndDowns_S60() |
1360 void TestXQKeyCapture::testCancelCaptureKeyUpAndDowns_S60() |
1285 { |
1361 { |
1305 cancelAdditionalResults.clear(); |
1381 cancelAdditionalResults.clear(); |
1306 cancelAdditionalResults << additionalReqNum; |
1382 cancelAdditionalResults << additionalReqNum; |
1307 |
1383 |
1308 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1384 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1309 ignoreWindowGroupAction = true; |
1385 ignoreWindowGroupAction = true; |
1310 keyCapture->captureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1386 keyCapture->captureKeyUpAndDowns(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1311 ignoreWindowGroupAction = false; |
1387 ignoreWindowGroupAction = false; |
1312 willBeAdditionalRequest = additional; |
1388 willBeAdditionalRequest = additional; |
1313 keyCapture->cancelCaptureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1389 keyCapture->cancelCaptureKeyUpAndDowns(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1314 } |
1390 } |
1315 |
1391 |
1316 void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_S60_data() |
1392 void TestXQKeyCapture::testCancelCaptureKeyUpAndDownsList_S60_data() |
1317 { |
1393 { |
1318 testCancelCaptureKeyUpAndDowns_S60_data(); |
1394 testCancelCaptureKeyUpAndDowns_S60_data(); |
1342 cancelAdditionalResults.clear(); |
1418 cancelAdditionalResults.clear(); |
1343 cancelAdditionalResults << additionalReqNum; |
1419 cancelAdditionalResults << additionalReqNum; |
1344 |
1420 |
1345 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1421 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1346 ignoreWindowGroupAction = true; |
1422 ignoreWindowGroupAction = true; |
1347 keyCapture->captureKeyUpAndDowns( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1423 keyCapture->captureKeyUpAndDowns(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1348 ignoreWindowGroupAction = false; |
1424 ignoreWindowGroupAction = false; |
1349 willBeAdditionalRequest = additional; |
1425 willBeAdditionalRequest = additional; |
1350 keyCapture->cancelCaptureKeyUpAndDowns(QList<TUint>() << static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ) ); |
1426 keyCapture->cancelCaptureKeyUpAndDowns(QList<TUint>() << static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier)); |
1351 } |
1427 } |
1352 |
1428 |
1353 //////////////////////////////////////////////////////////////// |
1429 //////////////////////////////////////////////////////////////// |
1354 //Cancel Capture Long Key |
1430 //Cancel Capture Long Key |
1355 //////////////////////////////////////////////////////////////// |
1431 //////////////////////////////////////////////////////////////// |
1363 QTest::addColumn<long int>("reqNum"); |
1439 QTest::addColumn<long int>("reqNum"); |
1364 |
1440 |
1365 QTest::addColumn<bool>("additional"); |
1441 QTest::addColumn<bool>("additional"); |
1366 QTest::addColumn<long int>("additionalReqNum"); |
1442 QTest::addColumn<long int>("additionalReqNum"); |
1367 |
1443 |
1368 QTest::newRow("esc_key") << static_cast<unsigned int> ( Qt::Key_Escape ) |
1444 QTest::newRow("esc_key") << static_cast<unsigned int>(Qt::Key_Escape) |
1369 << static_cast<unsigned int> ( Qt::NoModifier ) |
1445 << static_cast<unsigned int>(Qt::NoModifier) |
1370 << static_cast<unsigned int> ( Qt::NoModifier ) |
1446 << static_cast<unsigned int>(Qt::NoModifier) |
1371 << static_cast<int> ( XQKeyCapture::LongNormal ) |
1447 << static_cast<int>(XQKeyCapture::LongNormal) |
1372 << static_cast<long int> ( 22 ) |
1448 << static_cast<long int>(22) |
1373 << false |
1449 << false |
1374 << static_cast<long int> ( 23 ); |
1450 << static_cast<long int>(23); |
1375 |
1451 |
1376 |
1452 |
1377 |
1453 |
1378 |
1454 |
1379 |
1455 |
1404 cancelAdditionalResults.clear(); |
1480 cancelAdditionalResults.clear(); |
1405 cancelAdditionalResults << additionalReqNum; |
1481 cancelAdditionalResults << additionalReqNum; |
1406 |
1482 |
1407 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1483 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1408 ignoreWindowGroupAction = true; |
1484 ignoreWindowGroupAction = true; |
1409 keyCapture->captureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1485 keyCapture->captureLongKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1410 ignoreWindowGroupAction = false; |
1486 ignoreWindowGroupAction = false; |
1411 willBeAdditionalRequest = additional; |
1487 willBeAdditionalRequest = additional; |
1412 keyCapture->cancelCaptureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1488 keyCapture->cancelCaptureLongKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1413 } |
1489 } |
1414 |
1490 |
1415 void TestXQKeyCapture::testCancelCaptureLongKeyList_data() |
1491 void TestXQKeyCapture::testCancelCaptureLongKeyList_data() |
1416 { |
1492 { |
1417 testCancelCaptureLongKey_data(); |
1493 testCancelCaptureLongKey_data(); |
1442 cancelAdditionalResults.clear(); |
1518 cancelAdditionalResults.clear(); |
1443 cancelAdditionalResults << additionalReqNum; |
1519 cancelAdditionalResults << additionalReqNum; |
1444 |
1520 |
1445 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1521 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1446 ignoreWindowGroupAction = true; |
1522 ignoreWindowGroupAction = true; |
1447 keyCapture->captureLongKey( static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1523 keyCapture->captureLongKey(static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1448 ignoreWindowGroupAction = false; |
1524 ignoreWindowGroupAction = false; |
1449 willBeAdditionalRequest = additional; |
1525 willBeAdditionalRequest = additional; |
1450 keyCapture->cancelCaptureLongKey( QList<Qt::Key>() << static_cast<Qt::Key> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1526 keyCapture->cancelCaptureLongKey(QList<Qt::Key>() << static_cast<Qt::Key>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1451 } |
1527 } |
1452 |
1528 |
1453 //////////////////////////////////////////////////////////////// |
1529 //////////////////////////////////////////////////////////////// |
1454 //Cancel Capture Long Key |
1530 //Cancel Capture Long Key |
1455 //////////////////////////////////////////////////////////////// |
1531 //////////////////////////////////////////////////////////////// |
1463 QTest::addColumn<long int>("reqNum"); |
1539 QTest::addColumn<long int>("reqNum"); |
1464 |
1540 |
1465 QTest::addColumn<bool>("additional"); |
1541 QTest::addColumn<bool>("additional"); |
1466 QTest::addColumn<long int>("additionalReqNum"); |
1542 QTest::addColumn<long int>("additionalReqNum"); |
1467 |
1543 |
1468 QTest::newRow("esc_key") << static_cast<unsigned int> ( EKeyEscape ) |
1544 QTest::newRow("esc_key") << static_cast<unsigned int>(EKeyEscape) |
1469 << static_cast<unsigned int> ( Qt::NoModifier ) |
1545 << static_cast<unsigned int>(Qt::NoModifier) |
1470 << static_cast<unsigned int> ( Qt::NoModifier ) |
1546 << static_cast<unsigned int>(Qt::NoModifier) |
1471 << static_cast<int> ( XQKeyCapture::LongNormal ) |
1547 << static_cast<int>(XQKeyCapture::LongNormal) |
1472 << static_cast<long int> ( 22 ) |
1548 << static_cast<long int>(22) |
1473 << false |
1549 << false |
1474 << static_cast<long int> ( 23 ); |
1550 << static_cast<long int>(23); |
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
1551 |
1480 } |
1552 } |
1481 |
1553 |
1482 void TestXQKeyCapture::testCancelCaptureLongKey_S60() |
1554 void TestXQKeyCapture::testCancelCaptureLongKey_S60() |
1483 { |
1555 { |
1504 cancelAdditionalResults.clear(); |
1576 cancelAdditionalResults.clear(); |
1505 cancelAdditionalResults << additionalReqNum; |
1577 cancelAdditionalResults << additionalReqNum; |
1506 |
1578 |
1507 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1579 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1508 ignoreWindowGroupAction = true; |
1580 ignoreWindowGroupAction = true; |
1509 keyCapture->captureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1581 keyCapture->captureLongKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1510 ignoreWindowGroupAction = false; |
1582 ignoreWindowGroupAction = false; |
1511 willBeAdditionalRequest = additional; |
1583 willBeAdditionalRequest = additional; |
1512 keyCapture->cancelCaptureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1584 keyCapture->cancelCaptureLongKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1513 } |
1585 } |
1514 |
1586 |
1515 void TestXQKeyCapture::testCancelCaptureLongKeyList_S60_data() |
1587 void TestXQKeyCapture::testCancelCaptureLongKeyList_S60_data() |
1516 { |
1588 { |
1517 testCancelCaptureLongKey_S60_data(); |
1589 testCancelCaptureLongKey_S60_data(); |
1542 cancelAdditionalResults.clear(); |
1614 cancelAdditionalResults.clear(); |
1543 cancelAdditionalResults << additionalReqNum; |
1615 cancelAdditionalResults << additionalReqNum; |
1544 |
1616 |
1545 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1617 MyTestWindowGroup::Instance()->setRequestNumber(reqNum); |
1546 ignoreWindowGroupAction = true; |
1618 ignoreWindowGroupAction = true; |
1547 keyCapture->captureLongKey( static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1619 keyCapture->captureLongKey(static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1548 ignoreWindowGroupAction = false; |
1620 ignoreWindowGroupAction = false; |
1549 willBeAdditionalRequest = additional; |
1621 willBeAdditionalRequest = additional; |
1550 keyCapture->cancelCaptureLongKey(QList<TUint>() << static_cast<TUint> (qtKey), Qt::KeyboardModifier( qtMask ), Qt::KeyboardModifier( qtModifier ), static_cast<XQKeyCapture::LongFlags> (longFlags) ); |
1622 keyCapture->cancelCaptureLongKey(QList<TUint>() << static_cast<TUint>(qtKey), Qt::KeyboardModifier(qtMask), Qt::KeyboardModifier(qtModifier), static_cast<XQKeyCapture::LongFlags>(longFlags)); |
1551 } |
1623 } |
1624 |
|
1625 void TestXQKeyCapture::testCaptureRemoteKeys_data() |
|
1626 { |
|
1627 QTest::addColumn<unsigned int>("flags"); |
|
1628 |
|
1629 // there are 4 flags: |
|
1630 // XQKeyCapture::CaptureNone = 0x0 |
|
1631 // XQKeyCapture::CaptureBasic = 0x1 |
|
1632 // XQKeyCapture::CaptureCallHandlingExt = 0x2 |
|
1633 // XQKeyCapture::CaptureEnableRemoteExtEvents = 0x4 |
|
1634 // so we should iterate through all combinations: |
|
1635 for(unsigned int i(0); i <= KAllFlagsOn; ++i) { |
|
1636 QString desc("flag:0x" + QString::number(i,16)); |
|
1637 QTest::newRow(desc.toAscii()) << i ; |
|
1638 } |
|
1639 } |
|
1640 |
|
1641 void TestXQKeyCapture::testCaptureRemoteKeys() |
|
1642 { |
|
1643 QFETCH(unsigned int, flags); |
|
1644 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1645 int oldCoreApiCount = CRemConCoreApiTarget::getCount(); |
|
1646 int oldCallHandlingCount = CRemConCallHandlingTarget::getCount(); |
|
1647 int expectedCoreApiCount(oldCoreApiCount); |
|
1648 int expectedCallHandlingCount(oldCallHandlingCount); |
|
1649 keyCapture->captureRemoteKeys(static_cast<XQKeyCapture::CapturingFlag>(flag)); |
|
1650 if(flag & XQKeyCapture::CaptureBasic) expectedCoreApiCount++; |
|
1651 if(flag & XQKeyCapture::CaptureCallHandlingExt) expectedCallHandlingCount++; |
|
1652 int newCoreApiCount = CRemConCoreApiTarget::getCount(); |
|
1653 int newCallHandlingCount = CRemConCallHandlingTarget::getCount(); |
|
1654 QVERIFY2(expectedCoreApiCount == newCoreApiCount, "expected core api creation count was different"); |
|
1655 QVERIFY2(expectedCallHandlingCount == newCallHandlingCount, "expected call handling api creation count was different"); |
|
1656 } |
|
1657 |
|
1658 void TestXQKeyCapture::testCaptureRemoteKeys_SelectorFail_data() |
|
1659 { |
|
1660 testCaptureRemoteKeys_data(); |
|
1661 } |
|
1662 |
|
1663 void TestXQKeyCapture::testCaptureRemoteKeys_SelectorFail() |
|
1664 { |
|
1665 QFETCH(unsigned int, flags); |
|
1666 CRemConInterfaceSelector::setNewLLeave(); |
|
1667 bool result = keyCapture->captureRemoteKeys(static_cast<XQKeyCapture::CapturingFlag>(flags)); |
|
1668 QVERIFY2(!result , "CaptureRemoteKeys did not fail and it should."); |
|
1669 CRemConInterfaceSelector::setNewLLeave(); |
|
1670 result = keyCapture->cancelCaptureRemoteKeys(static_cast<XQKeyCapture::CapturingFlag>(flags)); |
|
1671 QVERIFY2(!result , "CaptureRemoteKeys did not fail and it should."); |
|
1672 } |
|
1673 |
|
1674 void TestXQKeyCapture::testCaptureRemoteKeys_ApiCore_data() |
|
1675 { |
|
1676 testCaptureRemoteKeys_data(); |
|
1677 } |
|
1678 |
|
1679 void TestXQKeyCapture::testCaptureRemoteKeys_ApiCore() |
|
1680 { |
|
1681 QFETCH(unsigned int, flags); |
|
1682 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1683 CRemConCoreApiTarget::setNewLLeave(); |
|
1684 bool result = keyCapture->captureRemoteKeys(flag); |
|
1685 bool expected = !(flag & XQKeyCapture::CaptureBasic); |
|
1686 QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); |
|
1687 } |
|
1688 |
|
1689 void TestXQKeyCapture::testCaptureRemoteKeys_ApiCoreCancel_data() |
|
1690 { |
|
1691 testCaptureRemoteKeys_data(); |
|
1692 } |
|
1693 void TestXQKeyCapture::testCaptureRemoteKeys_ApiCoreCancel() |
|
1694 { |
|
1695 QFETCH(unsigned int, flags); |
|
1696 |
|
1697 // set all flags on |
|
1698 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(KAllFlagsOn); |
|
1699 bool result = keyCapture->captureRemoteKeys(flag); |
|
1700 QVERIFY2(result, "CaptureRemoteKeys failed."); |
|
1701 |
|
1702 // check cancel for each flag |
|
1703 CRemConCoreApiTarget::setNewLLeave(); |
|
1704 flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1705 // it should fail only if CaptureBasic is not removed and was set. |
|
1706 bool expected = (flag & XQKeyCapture::CaptureBasic); |
|
1707 result = keyCapture->cancelCaptureRemoteKeys(flag); |
|
1708 QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); |
|
1709 } |
|
1710 |
|
1711 |
|
1712 void TestXQKeyCapture::testCaptureRemoteKeys_CallHandling_data() |
|
1713 { |
|
1714 testCaptureRemoteKeys_data(); |
|
1715 } |
|
1716 void TestXQKeyCapture::testCaptureRemoteKeys_CallHandling() |
|
1717 { |
|
1718 QFETCH(unsigned int, flags); |
|
1719 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1720 |
|
1721 CRemConCallHandlingTarget::setNewLLeave(); |
|
1722 bool result = keyCapture->captureRemoteKeys(flag); |
|
1723 bool expected = !(flag & XQKeyCapture::CaptureCallHandlingExt); |
|
1724 QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); |
|
1725 } |
|
1726 |
|
1727 void TestXQKeyCapture::testCaptureRemoteKeys_CallHandlingCancel_data() |
|
1728 { |
|
1729 testCaptureRemoteKeys_data(); |
|
1730 } |
|
1731 void TestXQKeyCapture::testCaptureRemoteKeys_CallHandlingCancel() |
|
1732 { |
|
1733 QFETCH(unsigned int, flags); |
|
1734 |
|
1735 // set all flags |
|
1736 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(KAllFlagsOn); |
|
1737 bool result = keyCapture->captureRemoteKeys(flag); |
|
1738 QVERIFY2(result, "CaptureRemoteKeys failed."); |
|
1739 |
|
1740 // check cancel |
|
1741 CRemConCallHandlingTarget::setNewLLeave(); |
|
1742 flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1743 // it should fail only if CaptureBasic flag is unset |
|
1744 bool expected = (flag & XQKeyCapture::CaptureCallHandlingExt); |
|
1745 result = keyCapture->cancelCaptureRemoteKeys(flag); |
|
1746 QVERIFY2(result == expected, "CaptureRemoteKeys did not fail and it should."); |
|
1747 } |
|
1748 |
|
1749 void TestXQKeyCapture::testCaptureRemoteKeys_Basic_data() |
|
1750 { |
|
1751 QTest::addColumn<unsigned int>("buttonAction"); |
|
1752 QTest::addColumn<unsigned int>("operationId"); |
|
1753 QTest::addColumn<unsigned int>("operationQtKey"); |
|
1754 // this test will take few minutes to go thru all possible button / operation |
|
1755 for(unsigned int buttonA(0); buttonA < 3; buttonA++) { // 0 - ERemConCoreApiButtonPress, 1 - ERemConCoreApiButtonRelease, 2 - ERemConCoreApiButtonClick |
|
1756 foreach(TRemConCoreApiOperationId operationId, myKeyMapping.keys()) { |
|
1757 QTest::newRow(QString::number(operationId).toAscii()) << buttonA << static_cast<unsigned int>(operationId) << static_cast<unsigned int>(myKeyMapping.value(operationId)); |
|
1758 } |
|
1759 } |
|
1760 } |
|
1761 |
|
1762 void TestXQKeyCapture::testCaptureRemoteKeys_Basic() |
|
1763 { |
|
1764 QFETCH(unsigned int, buttonAction); |
|
1765 QFETCH(unsigned int, operationId); |
|
1766 QFETCH(unsigned int, operationQtKey); |
|
1767 // this test in the beginning was supposed to test whole event delivery process; |
|
1768 // now it will just check proper translation between qt and symbian. |
|
1769 myGlobalWidget.setVisible(true); |
|
1770 myGlobalWidget.setFocus(); |
|
1771 myGlobalWidget.activateWindow(); |
|
1772 |
|
1773 TRemConCoreApiOperationId opId = static_cast<TRemConCoreApiOperationId>(operationId); |
|
1774 TargetWrapper* myTargetWrapper = new TargetWrapper(); |
|
1775 XQKeyCapture::CapturingFlags myFlag = XQKeyCapture::CaptureBasic; |
|
1776 myTargetWrapper->init(myFlag); |
|
1777 int oldCount = CRemConCoreApiTarget::getSendResponseCount(); |
|
1778 TRemConCoreApiButtonAction btnAction = static_cast<TRemConCoreApiButtonAction>(buttonAction); |
|
1779 myTargetWrapper->MrccatoCommand(opId, btnAction); |
|
1780 |
|
1781 // verify core Api calls |
|
1782 QVERIFY2(CRemConCoreApiTarget::getSendResponseCount() == oldCount+1, "Send Response Count is not equal"); |
|
1783 QVERIFY2(CRemConCoreApiTarget::getLastOperationId() == opId, "Operation Id is different then requested"); |
|
1784 |
|
1785 // verify proper symbian -> qt key call |
|
1786 bool extendedEvents = (myFlag & XQKeyCapture::CaptureEnableRemoteExtEvents); |
|
1787 setProperKeys(extendedEvents); |
|
1788 if(btnAction == ERemConCoreApiButtonClick) { |
|
1789 QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyPressed, "Qt key does not correspond to proper Symbian key"); |
|
1790 QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyReleased, "Qt key does not correspond to proper Symbian key"); |
|
1791 } |
|
1792 if(btnAction == ERemConCoreApiButtonPress) { |
|
1793 QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyPressed, "Qt key does not correspond to proper Symbian key"); |
|
1794 QVERIFY2(myLastKeyReleased == KNotSpecifiedKey, "Qt key does not correspond to proper Symbian key"); |
|
1795 } |
|
1796 if(btnAction == ERemConCoreApiButtonRelease) { |
|
1797 QVERIFY2(myLastKeyPressed == KNotSpecifiedKey, "Qt key does not correspond to proper Symbian key"); |
|
1798 QVERIFY2(myTargetWrapper->mapKey(opId) == myLastKeyReleased, "Qt key does not correspond to proper Symbian key"); |
|
1799 } |
|
1800 delete myTargetWrapper; |
|
1801 } |
|
1802 |
|
1803 void TestXQKeyCapture::testCaptureRemoteKeys_Extended_data() |
|
1804 { |
|
1805 testCaptureRemoteKeys_data(); |
|
1806 } |
|
1807 |
|
1808 void TestXQKeyCapture::testCaptureRemoteKeys_Extended() |
|
1809 { |
|
1810 QFETCH(unsigned int, flags); |
|
1811 XQKeyCapture::CapturingFlag flag = static_cast<XQKeyCapture::CapturingFlag>(flags); |
|
1812 |
|
1813 TargetWrapper* myTargetWrapper = new TargetWrapper(); |
|
1814 myTargetWrapper->init(flag); |
|
1815 |
|
1816 bool expected = (flag & XQKeyCapture::CaptureCallHandlingExt); |
|
1817 bool extendedEvents = (flag & XQKeyCapture::CaptureEnableRemoteExtEvents); |
|
1818 myGlobalWidget.setVisible(true); |
|
1819 myGlobalWidget.setFocus(); |
|
1820 myGlobalWidget.activateWindow(); |
|
1821 |
|
1822 // key call |
|
1823 resetKeys(); |
|
1824 myTargetWrapper->AnswerCall(); |
|
1825 setProperKeys(extendedEvents); |
|
1826 QVERIFY((myLastKeyPressed == Qt::Key_Call) == expected); |
|
1827 QVERIFY((myLastKeyReleased == Qt::Key_Call) == expected); |
|
1828 |
|
1829 // End call |
|
1830 resetKeys(); |
|
1831 myTargetWrapper->EndCall(); |
|
1832 setProperKeys(extendedEvents); |
|
1833 QVERIFY((myLastKeyPressed == Qt::Key_Hangup) == expected); |
|
1834 QVERIFY((myLastKeyReleased == Qt::Key_Hangup) == expected); |
|
1835 |
|
1836 // Answer End Call |
|
1837 resetKeys(); |
|
1838 myTargetWrapper->AnswerEndCall(); |
|
1839 setProperKeys(extendedEvents); |
|
1840 QVERIFY((myLastKeyPressed == Qt::Key_Hangup) == expected); |
|
1841 QVERIFY((myLastKeyReleased == Qt::Key_Hangup) == expected); |
|
1842 delete myTargetWrapper; |
|
1843 } |
|
1844 |
|
1845 void TestXQKeyCapture::testCancelCaptureRemoteKeys_data() |
|
1846 { |
|
1847 testCaptureRemoteKeys_data(); |
|
1848 } |
|
1849 |
|
1850 void TestXQKeyCapture::testCancelCaptureRemoteKeys() |
|
1851 { |
|
1852 QFETCH(unsigned int, flags); |
|
1853 keyCapture->cancelCaptureRemoteKeys(static_cast<XQKeyCapture::CapturingFlag>(flags)); |
|
1854 } |
|
1552 |
1855 |
1553 |
1856 |
1554 |
1857 |
1555 //////////////////////////////////////////////////////////////// |
1858 //////////////////////////////////////////////////////////////// |
1556 // ERRORS |
1859 // ERRORS |
1568 void TestXQKeyCapture::testErrorId() |
1871 void TestXQKeyCapture::testErrorId() |
1569 { |
1872 { |
1570 keyCapture->errorId(); |
1873 keyCapture->errorId(); |
1571 } |
1874 } |
1572 |
1875 |
1573 QString TestXQKeyCapture::clearString(const QString& line) { |
1876 QString TestXQKeyCapture::clearString(const QString& line) |
1877 { |
|
1574 QString s(line); |
1878 QString s(line); |
1575 s.replace(" ", ""); |
1879 s.replace(" ", ""); |
1576 s.replace("\t", ""); |
1880 s.replace("\t", ""); |
1577 return s.trimmed(); |
1881 return s.trimmed(); |
1578 } |
1882 } |
1579 |
1883 |
1580 QString TestXQKeyCapture::clearString(const QString& line, const QString& prefix, const QString& comment) { |
1884 QString TestXQKeyCapture::clearString(const QString& line, const QString& prefix, const QString& comment) |
1885 { |
|
1581 QString s(line); |
1886 QString s(line); |
1582 s.replace(prefix, comment); |
1887 s.replace(prefix, comment); |
1583 s.replace(" ", ""); |
1888 s.replace(" ", ""); |
1584 s.replace("\t", ""); |
1889 s.replace("\t", ""); |
1585 return s.trimmed(); |
1890 return s.trimmed(); |
1586 } |
1891 } |
1587 |
1892 |
1893 void TestXQKeyCapture::setProperKeys(bool extendedEvents) |
|
1894 { |
|
1895 if(extendedEvents) { |
|
1896 myLastKeyPressed = myLastKeyExtendedPress; |
|
1897 myLastKeyReleased = myLastKeyExtendedRelease; |
|
1898 QVERIFY((myLastKeyPress == KNotSpecifiedKey)); |
|
1899 QVERIFY((myLastKeyRelease == KNotSpecifiedKey)); |
|
1900 } else { |
|
1901 myLastKeyPressed = myLastKeyPress; |
|
1902 myLastKeyReleased = myLastKeyRelease; |
|
1903 QVERIFY((myLastKeyExtendedPress == KNotSpecifiedKey)); |
|
1904 QVERIFY((myLastKeyExtendedRelease == KNotSpecifiedKey)); |
|
1905 } |
|
1906 } |
|
1907 |
|
1588 //////////////////////////////////////////////////////////////// |
1908 //////////////////////////////////////////////////////////////// |
1589 // TEST KEY MAPPER FILE |
1909 // TEST KEY MAPPER FILE |
1590 //////////////////////////////////////////////////////////////// |
1910 //////////////////////////////////////////////////////////////// |
1591 void TestXQKeyCapture::testKeyMapperFile() |
1911 void TestXQKeyCapture::testKeyMapperFile() |
1592 { |
1912 { |
1606 QFile kcFile("c:\\keymapper.cpp"); |
1926 QFile kcFile("c:\\keymapper.cpp"); |
1607 QVERIFY2(kcFile.open(QIODevice::ReadOnly | QIODevice::Text), "Failed to open: kcFile"); |
1927 QVERIFY2(kcFile.open(QIODevice::ReadOnly | QIODevice::Text), "Failed to open: kcFile"); |
1608 |
1928 |
1609 QTextStream inQtFile(&qtFile); |
1929 QTextStream inQtFile(&qtFile); |
1610 bool test(false); |
1930 bool test(false); |
1611 while (!inQtFile.atEnd()) { |
1931 while(!inQtFile.atEnd()) { |
1612 QString line = inQtFile.readLine(); |
1932 QString line = inQtFile.readLine(); |
1613 // trim everything that is on right side of comment and add to list if needed |
1933 // trim everything that is on the right side of comment and add to list if needed |
1614 if (test) qt.append(clearString(line.split(comment).at(0))); |
1934 if(test) qt.append(clearString(line.split(comment).at(0))); |
1615 if (line.contains(firstline)) { |
1935 if(line.contains(firstline)) { |
1616 test = true; |
1936 test = true; |
1617 } |
1937 } |
1618 if (line.contains(lastline)) { |
1938 if(line.contains(lastline)) { |
1619 test = false; |
1939 test = false; |
1620 } |
1940 } |
1621 } |
1941 } |
1622 test = false; |
1942 test = false; |
1623 QTextStream inKcFile(&kcFile); |
1943 QTextStream inKcFile(&kcFile); |
1624 while (!inKcFile.atEnd()) { |
1944 while(!inKcFile.atEnd()) { |
1625 QString line = inKcFile.readLine(); |
1945 QString line = inKcFile.readLine(); |
1626 // trim everything that is on right side of comment and add to list if needed |
1946 // trim everything that is on the right side of comment and add to list if needed |
1627 if (test) kc.append(clearString(line.split(comment).at(0))); |
1947 if(test) kc.append(clearString(line.split(comment).at(0))); |
1628 if (line.contains(firstline)) { |
1948 if(line.contains(firstline)) { |
1629 test = true; |
1949 test = true; |
1630 } |
1950 } |
1631 if (line.contains(lastline)) { |
1951 if(line.contains(lastline)) { |
1632 test = false; |
1952 test = false; |
1633 } |
1953 } |
1634 } |
1954 } |
1635 |
1955 |
1636 QVERIFY2(qt.count() == kc.count(), "Amount of lines inside key definition is different"); |
1956 QVERIFY2(qt.count() == kc.count(), "Amount of lines inside key definition is different"); |
1640 QVERIFY2(qt.contains(keys), "qtFile does not contain key(s) from capture keys"); |
1960 QVERIFY2(qt.contains(keys), "qtFile does not contain key(s) from capture keys"); |
1641 } |
1961 } |
1642 |
1962 |
1643 for(int i = 0; i < qt.size(); i++) { |
1963 for(int i = 0; i < qt.size(); i++) { |
1644 QString keys = qt.at(i); |
1964 QString keys = qt.at(i); |
1645 QVERIFY2(kc.contains(keys), "kcFile does not conatin qt keys"); |
1965 QVERIFY2(kc.contains(keys), "kcFile does not contain qt keys"); |
1646 } |
1966 } |
1647 #else |
1967 #else |
1648 // Skip test on hw |
1968 // Skip test on hw |
1649 QSKIP( "This test is valid only on emulator", SkipSingle); |
1969 QSKIP("This test is valid only on emulator", SkipSingle); |
1650 #endif // __WINSCW__ |
1970 #endif // __WINSCW__ |
1651 } |
1971 } |
1652 |
1972 |
1653 |
1973 |
1654 //////////////////////////////////////////////////////////////// |
1974 //////////////////////////////////////////////////////////////// |
1655 // REQUEST SLOT |
1975 // REQUEST SLOT |
1656 //windowGroupAction |
1976 //windowGroupAction |
1657 //////////////////////////////////////////////////////////////// |
1977 //////////////////////////////////////////////////////////////// |
1658 void TestXQKeyCapture::windowGroupAction( WindowGroupActionType wgat, QList<unsigned int> paramList ) |
1978 void TestXQKeyCapture::windowGroupAction(WindowGroupActionType wgat, QList<unsigned int> paramList) |
1659 { |
1979 { |
1660 if( !ignoreWindowGroupAction ) |
1980 if(!ignoreWindowGroupAction) |
1661 { |
1981 { |
1662 QVERIFY( wgat == actionType ); |
1982 QVERIFY(wgat == actionType); |
1663 QVERIFY( paramList.count() == numOfArgs ); |
1983 QVERIFY(paramList.count() == numOfArgs); |
1664 |
1984 |
1665 for( int i = 0; i < numOfArgs; i++) |
1985 for(int i = 0; i < numOfArgs; i++) |
1666 { |
1986 { |
1667 if( additionalResult ) |
1987 if(additionalResult) |
1668 QVERIFY( paramList[i] == additionalResults[i] ); |
1988 QVERIFY(paramList[i] == additionalResults[i]); |
1669 else |
1989 else |
1670 QVERIFY( paramList[i] == results[i] ); |
1990 QVERIFY(paramList[i] == results[i]); |
1671 } |
1991 } |
1672 } |
1992 } |
1673 if( willBeAdditionalRequest ){ |
1993 if(willBeAdditionalRequest){ |
1674 additionalResult = true; |
1994 additionalResult = true; |
1675 MyTestWindowGroup::Instance()->setRequestNumber(additionalRequestHandle); |
1995 MyTestWindowGroup::Instance()->setRequestNumber(additionalRequestHandle); |
1676 } |
1996 } |
1677 } |
1997 } |
1678 |
1998 |
1679 //////////////////////////////////////////////////////////////// |
1999 //////////////////////////////////////////////////////////////// |
1680 //windowGroupActionCancel |
2000 //windowGroupActionCancel |
1681 //////////////////////////////////////////////////////////////// |
2001 //////////////////////////////////////////////////////////////// |
1682 void TestXQKeyCapture::windowGroupActionCancel( WindowGroupActionType wgat, QList<long int> paramList ) |
2002 void TestXQKeyCapture::windowGroupActionCancel(WindowGroupActionType wgat, QList<long int> paramList) |
1683 { |
2003 { |
1684 QVERIFY( wgat == actionType ); |
2004 QVERIFY(wgat == actionType); |
1685 QVERIFY( paramList.count() == numOfArgs ); |
2005 QVERIFY(paramList.count() == numOfArgs); |
1686 |
2006 |
1687 for( int i = 0; i < numOfArgs; i++) |
2007 for(int i = 0; i < numOfArgs; i++){ |
1688 { |
2008 if(additionalResult) QVERIFY(paramList[i] == cancelAdditionalResults[i]); |
1689 if( additionalResult ) |
2009 else QVERIFY(paramList[i] == cancelResults[i]); |
1690 QVERIFY( paramList[i] == cancelAdditionalResults[i] ); |
2010 } |
1691 else |
2011 |
1692 QVERIFY( paramList[i] == cancelResults[i] ); |
2012 if(willBeAdditionalRequest){ |
1693 } |
|
1694 |
|
1695 if( willBeAdditionalRequest ){ |
|
1696 additionalResult = true; |
2013 additionalResult = true; |
1697 } |
2014 } |
2015 } |
|
2016 |
|
2017 bool TestXQKeyCapture::event(QEvent *ev) |
|
2018 { |
|
2019 processEvent(ev); |
|
2020 return false; |
|
2021 } |
|
2022 |
|
2023 bool TestXQKeyCapture::eventFilter(QObject *o, QEvent *ev) |
|
2024 { |
|
2025 processEvent(ev); |
|
2026 return qApp->eventFilter(o, ev); |
|
2027 } |
|
2028 |
|
2029 void TestXQKeyCapture::processEvent(QEvent *ev) |
|
2030 { |
|
2031 if(ev){ |
|
2032 if(ev->type() == QEvent::KeyPress) { |
|
2033 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev); |
|
2034 myLastKeyPress = static_cast<Qt::Key>(keyEvent->key()); |
|
2035 } else if(ev->type() == QEvent::KeyRelease) { |
|
2036 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev); |
|
2037 myLastKeyRelease = static_cast<Qt::Key>(keyEvent->key()); |
|
2038 } else if(ev->type() == XQKeyCapture::remoteEventType_KeyPress()) { |
|
2039 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev); |
|
2040 myLastKeyExtendedPress = static_cast<Qt::Key>(keyEvent->key()); |
|
2041 } else if(ev->type() == XQKeyCapture::remoteEventType_KeyRelease()) { |
|
2042 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(ev); |
|
2043 myLastKeyExtendedRelease = static_cast<Qt::Key>(keyEvent->key()); |
|
2044 } |
|
2045 } |
|
1698 } |
2046 } |
1699 |
2047 |
1700 //////////////////////////////////////////////////////////////// |
2048 //////////////////////////////////////////////////////////////// |
1701 // MAIN |
2049 // MAIN |
1702 //main |
2050 //main |
1703 //////////////////////////////////////////////////////////////// |
2051 //////////////////////////////////////////////////////////////// |
1704 |
2052 |
1705 #ifdef _XQKEYCAPTURE_UNITTEST_LOG_TO_C_ |
2053 #ifdef _XQKEYCAPTURE_UNITTEST_LOG_TO_C_ |
1706 main (int argc, char* argv[]) |
2054 main(int argc, char* argv[]) |
1707 { |
2055 { |
1708 QApplication app(argc, argv); |
2056 QApplication app(argc, argv); |
1709 TestXQKeyCapture tc; |
2057 TestXQKeyCapture tc; |
1710 int c = 3; |
2058 int c = 3; |
1711 char* v[] = {argv[0], "-o", "c:/test.txt"}; |
2059 char* v[] = {argv[0], "-o", "c:/test.txt"}; |