/****************************************************************************\ | Function: CExampleWsClient::RunL() | Called by active scheduler when an even occurs | Purpose: Processes events according to their type | For key events: calls HandleKeyEventL() (global to client) | For pointer event: calls HandlePointerEvent() for window | event occurred in. \****************************************************************************/ void CExampleWsClient::RunL() { // get the event iWs.GetEvent(iWsEvent); TInt eventType = iWsEvent.Type(); // take action on it switch (eventType) { // events global within window group case EEventNull: break; case EEventKey: { TKeyEvent& keyEvent = *iWsEvent.Key(); // get key event HandleKeyEventL(keyEvent); break; } case EEventKeyUp: case EEventModifiersChanged: case EEventKeyDown: case EEventFocusLost: case EEventFocusGained: case EEventSwitchOn: case EEventPassword: case EEventWindowGroupsChanged: case EEventErrorMessage: break; // events local to specific windows case EEventPointer: { CWindow* window = (CWindow*) (iWsEvent.Handle()); // get window TPointerEvent& pointerEvent = *iWsEvent.Pointer(); window->HandlePointerEvent(pointerEvent); break; } case EEventPointerExit: case EEventPointerEnter: case EEventPointerBufferReady: break; case EEventDragDrop: break; default: break; } IssueRequest(); // maintain outstanding request }
/** @SYMTestCaseID UIF-CoGridStep-RunTestStepL @SYMPREQ @SYMTestCaseDesc Tests different functionalities of Grid Window @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions \n The following tests are performed \n 1. Setting grid with its default settings.\n 2. Simulating right arrow key event.\n 3. Simulating down arrow key event.\n 4. Change Color Settings. \n 5. Setting zoom in factor. \n 6. Setting zoom out factor.\n 7. Toggle Title Lines. \n 8. Scroll Right.\n 9. Scroll Left.\n 7. Paginate the Grid. \n @SYMTestExpectedResults The test pass if the events are handled without exceptions / panic / crashes\n */ void CTestCoeGridAppUi::RunTestStepL(TInt aNumStep) { TKeyEvent theKeyEvent; Mem::FillZ(&theKeyEvent, sizeof(TKeyEvent)); TEventCode theType=EEventKey; User::After(TTimeIntervalMicroSeconds32(1000000)); switch(aNumStep) { case 1: SetTestStepID(_L("UIF-CoGridStep-RunTestStepL")); theKeyEvent.iModifiers = EModifierCtrl; theKeyEvent.iCode=CTRL('r'); INFO_PRINTF1(_L("Set grid to default")); HandleKeyEventL(theKeyEvent,theType); break; case 2: case 3: case 4: INFO_PRINTF1(_L("Move cursor right")); theKeyEvent.iCode = EKeyRightArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 5: case 6: INFO_PRINTF1(_L("Move cursor down")); theKeyEvent.iCode = EKeyDownArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 7: case 8: INFO_PRINTF1(_L("Change color")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('c'); HandleKeyEventL(theKeyEvent,theType); break; case 9: case 10: INFO_PRINTF1(_L("Zoom in")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('m'); HandleKeyEventL(theKeyEvent,theType); break; case 11: case 12: INFO_PRINTF1(_L("Zoom out")); theKeyEvent.iModifiers=EModifierShift; theKeyEvent.iCode = 'm'; HandleKeyEventL(theKeyEvent,theType); break; case 13: INFO_PRINTF1(_L("Toggle title lines")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('t'); HandleKeyEventL(theKeyEvent,theType); break; case 14: INFO_PRINTF1(_L("Scroll right")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = EKeyRightArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 15: INFO_PRINTF1(_L("Scroll left")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = EKeyLeftArrow; iGridWin->OfferKeyEventL(theKeyEvent,theType); break; case 16: INFO_PRINTF1(_L("Toggle title lines")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('t'); HandleKeyEventL(theKeyEvent,theType); break; case 17: INFO_PRINTF1(_L("Paginate")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('p'); HandleKeyEventL(theKeyEvent,theType); break; case 18: INFO_PRINTF1(_L("Set grid to default")); theKeyEvent.iModifiers=EModifierCtrl; theKeyEvent.iCode = CTRL('r'); HandleKeyEventL(theKeyEvent,theType); RecordTestResultL(); CloseTMSGraphicsStep(); break; case 19: SaveL(); iCoeEnv->Flush(); AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); break; } }