/** Utility to close the dialogs once the screen has been compared with a previous capture of an expected display. */ void CConeErrorMsgTestAppUi::CloseDialogsL() { User::LeaveIfError(iWs.Connect()); TInt wgFocus = iWs.GetFocusWindowGroup(); const TUint32 ENullWsHandle = 0xFFFFFFFF; // Events delivered to this handle are thrown away RWindowGroup wg = RWindowGroup(iWs); wg.Construct(ENullWsHandle); TInt wgId = wg.Identifier(); TWsEvent event; event.SetType(EEventKey); TKeyEvent *keyEvent = event.Key(); keyEvent->iCode = EKeyEscape; keyEvent->iScanCode = EStdKeyEscape; keyEvent->iModifiers = 0; TInt limit = 0; for(limit = 0; wgFocus != wgId && (limit < 50); limit++) { iWs.SendEventToAllWindowGroups(event); wgFocus = iWs.GetFocusWindowGroup(); RDebug::Print(_L("CloseAllPanicWindowsL() - EKeyEscape sent to Windows Group")); } wg.Close(); iWs.Close(); }
void COsmo4AppUi::CaptureKey(TInt32 code, TInt32 scancode) { RWindowGroup iWG = CCoeEnv::Static()->RootWin(); if (nb_keys>=MAX_KEY_CAP) return; keys[nb_keys].key_cap = iWG.CaptureKey(code, 0, 0); keys[nb_keys].key_cap_ud = iWG.CaptureKeyUpAndDowns(scancode, 0, 0); nb_keys++; }
/* possible meaning for key codes: EStdKeyYes -Call EStdKeyNo -End EStdKeyApplication0 -Apps key EStdKeyDevice0 -Left softkey EStdKeyDevice1 -Right softkey EStdKeyDevice2 -Power EStdKeyDevice3 -Button press EStdKeyDevice4 -Flip - Open EStdKeyDevice5 -Flip - Close EStdKeyDevice6 -Side key EStdKeyDeviceD -Jog Dial forward EStdKeyDeviceE -Jog Dial back */ void COsmo4AppUi::CaptureKeys(int do_capture) { if (do_capture) { CaptureKey(EKeyIncVolume, EStdKeyIncVolume); CaptureKey(EKeyDecVolume, EStdKeyDecVolume); } else { RWindowGroup iWG = CCoeEnv::Static()->RootWin(); for (int i=0; i<nb_keys; i++) { iWG.CancelCaptureKey(keys[i].key_cap); iWG.CancelCaptureKeyUpAndDowns(keys[i].key_cap_ud); } nb_keys = 0; } }
void ConstructL(TInt aSteps) { iWg=RWindowGroup(iEikonEnv->WsSession()); User::LeaveIfError(iWg.Construct((TUint32)&iWg, EFalse)); iWg.SetOrdinalPosition(1, ECoeWinPriorityAlwaysAtFront+1); iWg.EnableReceiptOfFocus(EFalse); CreateWindowL(&iWg); iSteps=aSteps; iBitmap=new (ELeave) CWsBitmap(iEikonEnv->WsSession()); TBuf<50> bm=_L("c:\\"); #ifndef __S60V3__ bm.Append(_L("system\\data\\")); #else bm.Append(_L("resource\\")); #endif #ifdef FLICKR bm.Append(_L("contextflickr.mbm")); #else bm.Append(_L("context_log.mbm")); #endif #ifndef __WINS__ if (! BaflUtils::FileExists(iEikonEnv->FsSession(), bm) ) bm.Replace(0, 1, _L("e")); #else bm.Replace(0, 1, _L("z")); #endif #ifdef FLICKR User::LeaveIfError(iBitmap->Load(bm, EMbmContextflickrMeaning)); #else User::LeaveIfError(iBitmap->Load(bm, EMbmContext_logMeaning)); #endif SetExtentToWholeScreen(); TInt scale=1; if (Rect().Width()>176) scale=2; progress_left=28*scale; progress_width=120*scale; progress_height=6*scale; progress_top=165*scale; }
void CWsGraphicShareBase::ConstructL() { User::LeaveIfError(iWs.Connect()); iScreen=new(ELeave) CWsScreenDevice(iWs); User::LeaveIfError(iScreen->Construct(iScreenNumber)); iGc=new(ELeave) CWindowGc(iScreen); User::LeaveIfError(iGc->Construct()); iGroupWin=new(ELeave) RWindowGroup(iWs); iGroupWin->Construct(1); iWin=new(ELeave) RWindow(iWs); iWin->Construct(*iGroupWin,ENullWsHandle); iWin->SetRequiredDisplayMode(EColor256); iWin->SetExtent(TPoint(0,0),iScreen->SizeInPixels()); iWin->Activate(); iWin->BeginRedraw(); iWin->EndRedraw(); iWs.Flush(); }
~CSplashScreenImpl() { iWg.Close(); delete iBitmap; }
/** Override of base class pure virtual Our implementation only gets called if the base class doTestStepPreambleL() did not leave. That being the case, the current test result value will be EPass. @return - TVerdict code */ TVerdict CAlphaBlendTest::doTestStepL(TBool aIType) { RWsSession wsSession; User::LeaveIfError(wsSession.Connect()); CleanupClosePushL(wsSession); // // Uncomment to debug WSERV redraw problems. // wsSession.SetAutoFlush(ETrue); CWsScreenDevice* windowDevice = new (ELeave) CWsScreenDevice(wsSession); CleanupStack::PushL(windowDevice); User::LeaveIfError(windowDevice->Construct()); CWindowGc* windowGc=NULL; User::LeaveIfError(windowDevice->CreateContext(windowGc)); // create graphics context CleanupStack::PushL(windowGc); RWindowGroup group; group = RWindowGroup(wsSession); CleanupClosePushL(group); User::LeaveIfError(group.Construct(1, EFalse)); RWindow background; background = RWindow(wsSession); CleanupClosePushL(background); User::LeaveIfError(background.Construct(group, 2)); RWindow window; window = RWindow(wsSession); CleanupClosePushL(window); User::LeaveIfError(window.Construct(group, 3)); TSize windowSize = windowDevice->SizeInPixels(); TDisplayMode windowMode = windowDevice->DisplayMode(); background.Activate(); background.Invalidate(); ClearWindow(wsSession, background, windowGc, BLACK_SEMI_TRANSPARENT); ClearWindow(wsSession, window, windowGc, BLACK_SEMI_TRANSPARENT); window.SetTransparencyAlphaChannel(); window.Activate(); window.Invalidate(); if (aIType) { if (CheckMonoTypeInstalledL()) DoDrawBlendedTestsL(EBlendTestDrawTextIType,wsSession, KDrawVertTextIterationsToTest); else { INFO_PRINTF1(_L("Monotype fonts not installed, skipping test")); } } else { /* Test speed of blended draw rects on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestDrawRect,wsSession, KDrawRectIterationsToTest); /* Test speed of blended draw vertical line calls on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestVerticalLine,wsSession, KDrawVertLineIterationsToTest); /* Test speed of blended draw text calls on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestDrawText,wsSession, KDrawTextIterationsToTest); DoDrawBlendedTestsL(EBlendTestDrawTextAntiAliased,wsSession, KDrawVertTextIterationsToTest); DoDrawBlendedTestsL(EBlendTestDrawVerticalText,wsSession, KDrawVertTextIterationsToTest); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0022 @SYMTestCaseDesc Alphablend test BITBLT with EColor16MA source and EColor16MU destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("Alpha Tests: EColor16MU, EColor16MA"); RDebug::Printf("Alpha Blend"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0022")); DoAlphaBlendBitmapsBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0023 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MU destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("BitBlt Alpha"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0023")); DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0024 @SYMTestCaseDesc Alpha blend test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("Alpha Tests: EColor16MA, EColor16MA"); RDebug::Printf("Alpha Blend"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0024")); DoAlphaBlendBitmapsBitmapTestL(EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0025 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("BitBlt Alpha"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0025")); DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0063 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0063")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0064 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0064")); DoNormalBitBltL(EFalse, EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0065 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0065")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0066 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0066")); DoNormalBitBltL(EFalse, EColor16MA,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0067 @SYMTestCaseDesc Test BITBLT with EColor16MU source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0067")); DoNormalBitBltL(EFalse, EColor16MU,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0068 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0068")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0069 @SYMTestCaseDesc Test BITBLT with EColor16MU source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0069")); DoNormalBitBltL(EFalse, EColor16MU,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0070 @SYMTestCaseDesc Test BITBLT with EColor64K source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0070")); DoNormalBitBltL(ETrue, EColor64K,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0071 @SYMTestCaseDesc Test DrawBitmap with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0071")); DoDrawBitmapL(EFalse, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0072 @SYMTestCaseDesc Test DrawBitmap with different sizes (STRETCHED) with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0072")); DoDrawBitmapL(EFalse, EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0073 @SYMTestCaseDesc Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MU source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0073")); DoDrawBitmapL(ETrue, EColor16MU, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0057 @SYMTestCaseDesc Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0057")); DoDrawBitmapL(ETrue, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); } CleanupStack::PopAndDestroy(6, &wsSession); return TestStepResult(); }
/** * @brief Completes the second phase of Symbian object construction. * Put initialization code that could leave here. */ void CAlarmSwitcherAppUi::ConstructL() { // [[[ begin generated region: do not modify [Generated Contents] BaseConstructL( EAknEnableSkin | EAknEnableMSK ); InitializeContainersL(); // ]]] end generated region [Generated Contents] RASCliSession session; session.Connect(); RArray<TInt> ids; session.GetAlarmIdListL(ids); TASShdAlarm tempAlarm; TASShdAlarm aAlarmInfo; TAlarmStatus newstat; TInt MaskID=EMbmAlarmswitcher_aifQgn_menu_alarmswitcher; TInt ImageID=EMbmAlarmswitcher_aifQgn_menu_alarmswitcher_mask; CEikonEnv::Static()->RootWin().SetOrdinalPosition(-4); RWindowGroup* iWinGroup = new (ELeave) RWindowGroup(CEikonEnv::Static()->WsSession()); iWinGroup->Construct((TUint32)iWinGroup); iWinGroup->EnableReceiptOfFocus(EFalse); // Don't capture any key events. iWinGroup->SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); for (TInt i=0; i<ids.Count(); i++) { TInt err=session.GetAlarmDetails(ids[i],tempAlarm); if (err!=KErrNone) { continue; } if (tempAlarm.Status()==EAlarmStatusDisabled) { ImageID=EMbmAlarmswitcher_aifAlarmon; MaskID=EMbmAlarmswitcher_aifAlarmon_mask; newstat=EAlarmStatusEnabled; } else { ImageID=EMbmAlarmswitcher_aifAlarmoff; MaskID=EMbmAlarmswitcher_aifAlarmoff_mask; newstat=EAlarmStatusDisabled; } tempAlarm.iStatus=newstat; session.SetAlarmStatus(ids[i],newstat); err=session.GetAlarmDetails(ids[i],tempAlarm); RDebug::Print(_L("%d"),i); } session.Close(); RWsSprite* iSprite= new (ELeave) RWsSprite(CEikonEnv::Static()->WsSession()); iSprite->Construct(*iWinGroup,TPoint(0,0),0); TInt ScrX=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iWidth; TInt ScrY=CEikonEnv::Static()->ScreenDevice()->SizeInPixels().iHeight; TInt min=ScrX/2; if (ScrX>ScrY) { min=ScrY/2; } else { min=ScrX/2; } TSize size=TSize(min/2,min/2); TSpriteMember Member; CGulIcon* icon=LoadIcon(ImageID,MaskID,size); Member.iBitmap=icon->Bitmap(); Member.iMaskBitmap=icon->Mask(); Member.iOffset=TPoint(0,0); Member.iInterval=TTimeIntervalMicroSeconds32(60*1000000); Member.iInvertMask=EFalse; iSprite->AppendMember(Member); TInt BitX=Member.iBitmap->SizeInPixels().iWidth; TInt BitY=Member.iBitmap->SizeInPixels().iHeight; iSprite->SetPosition(TPoint(ScrX/2-BitX/2,ScrY/2-BitY/2)); iSprite->Activate(); CEikonEnv::Static()->WsSession().Flush(); User::After(2000000); User::Exit(0); }
/** Test delivery group messages in case when event queue is overflow */ void CTMessage::TestMessageQueueOverflowL() { const TInt numMaxMessages = 60; TInt numWasteMessages = 0; TInt numWgMessages = 5; TInt gotRealWasteMessages = 0; TInt gotRealWgMessages = 0; const TInt oneSecond = 1000000; const TInt allPossibleMessages = 500; RWsSession senderWsSession; RWindowGroup senderGroupWin; TInt sndrHanGrpWin = 7777; RWsSession receiverWsSession; RWindowGroup receiverGroupWin; TInt rcvrHanGrpWin = 8888; TRequestStatus testStatus; TRequestStatus timerStatus; TWsEvent wasteEvent; TWsEvent event; RTimer timer; timer.CreateLocal(); CleanupClosePushL(timer); // Create sender WsSession and the window group User::LeaveIfError(senderWsSession.Connect()); CleanupClosePushL(senderWsSession); senderGroupWin = RWindowGroup(senderWsSession); User::LeaveIfError(senderGroupWin.Construct(sndrHanGrpWin)); CleanupClosePushL(senderGroupWin); // Create reciever WsSession and the window group User::LeaveIfError(receiverWsSession.Connect()); CleanupClosePushL(receiverWsSession); receiverGroupWin = RWindowGroup(receiverWsSession); User::LeaveIfError(receiverGroupWin.Construct(rcvrHanGrpWin)); CleanupClosePushL(receiverGroupWin); TInt err = KErrNone; // Send waste events to the receiver and overflow the event queue for (TInt ind = 0; ind < numMaxMessages; ind++) { wasteEvent.SetType(sndrHanGrpWin); err = senderWsSession.SendEventToWindowGroup(receiverGroupWin.Identifier(), wasteEvent); if (err != KErrNone) { numWasteMessages = ind; // Real number waste messages that was sent break; } } // Send messages to the receiver for (TInt ind = 0; ind < numWgMessages; ind++) { TInt uidData = ind + sndrHanGrpWin; TPtr8 msg((unsigned char*) &uidData, sizeof(uidData)); err = senderWsSession.SendMessageToWindowGroup(receiverGroupWin.Identifier(), TUid::Uid(uidData), msg); if (err != KErrNone) { LOG_MESSAGE2(_L("UnExpected Error Code = %d"),err); numWgMessages = ind; // Real number window group messages that was sent } } // Check and count sent messages for (TInt ind = 0; ind < allPossibleMessages; ind++) { receiverWsSession.EventReady(&testStatus); timer.After(timerStatus, oneSecond); User::WaitForRequest(testStatus, timerStatus); if (testStatus == 0) { // Test incoming events receiverWsSession.GetEvent(event); if (event.Type() == sndrHanGrpWin) { ++gotRealWasteMessages; } else if (event.Type() == EEventMessageReady) { if (gotRealWgMessages == 0) { for (TInt ind = 0; ind < numMaxMessages; ind++) { wasteEvent.SetType(sndrHanGrpWin); err = senderWsSession.SendEventToWindowGroup(receiverGroupWin.Identifier(), wasteEvent); if (err == KErrNone) { ++numWasteMessages; } else { break; } } } ++gotRealWgMessages; TUid uid; TPtr8 msgPtr(NULL,0); err = receiverWsSession.FetchMessage(uid, msgPtr, event); User::Free((TAny *) msgPtr.Ptr()); } // testStatus has been completed. Hence, Cancel the timer. timer.Cancel(); User::WaitForRequest(timerStatus); } else { // Times out, cancel the event notification receiverWsSession.EventReadyCancel(); User::WaitForRequest(testStatus); // All events were recieved break; } } LOG_MESSAGE3(_L("Got Waste message = %d expected =%d"),gotRealWasteMessages,numWasteMessages); LOG_MESSAGE3(_L("Got Group message = %d expected =%d"),gotRealWgMessages,numWgMessages); TEST(gotRealWasteMessages == numWasteMessages); TEST(gotRealWgMessages == numWgMessages); CleanupStack::PopAndDestroy(&receiverGroupWin); CleanupStack::PopAndDestroy(&receiverWsSession); CleanupStack::PopAndDestroy(&senderGroupWin); CleanupStack::PopAndDestroy(&senderWsSession); CleanupStack::PopAndDestroy(&timer); TheClient->iWs.Flush(); }