/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CKeyObserver::ConstructL() { CActiveScheduler::Add(this); iHandle1 = iHandle2 = iHandle3 = iHandle4 = iHandle5 = -1; User::LeaveIfError(iWsSession.Connect()); iWg = RWindowGroup(iWsSession); User::LeaveIfError(iWg.Construct((TUint32)&iWg, EFalse)); iWg.SetOrdinalPosition(-1); iWg.EnableReceiptOfFocus(EFalse); CApaWindowGroupName* wn(NULL); wn=CApaWindowGroupName::NewL(iWsSession); if(wn) { CleanupStack::PushL(wn); wn->SetHidden(ETrue); wn->SetWindowGroupName(iWg); CleanupStack::PopAndDestroy(); } iWg.EnableOnEvents(); CaptureKeys(); Listen(); }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CForegroundObserver::ConstructL() { CActiveScheduler::Add(this); User::LeaveIfError(iWsSession.Connect()); iWg = RWindowGroup(iWsSession); User::LeaveIfError(iWg.Construct((TUint32)&iWg, EFalse)); iWg.SetOrdinalPosition(-1); iWg.EnableReceiptOfFocus(EFalse); // iWg.SetPointerCapture(RWindowBase::TCaptureDragDrop); CApaWindowGroupName* wn(NULL); wn =CApaWindowGroupName::NewL(iWsSession); if(wn) { CleanupStack::PushL(wn); wn->SetHidden(ETrue); wn->SetWindowGroupName(iWg); CleanupStack::PopAndDestroy(); } iWg.EnableFocusChangeEvents(); Listen(); }
void CButton::ConstructL() { #ifdef __DEBUG __LOGSTR("Construct"); #endif CActiveScheduler::Add(this); iColor = KRgbRed; iWs = RWsSession(); iFs.Connect(); iWs.Connect(iFs); iWg = RWindowGroup(iWs); iWg.Construct((TUint32)&iWg,EFalse); iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); iWg.EnableReceiptOfFocus(ETrue); iWindow = RWindow(iWs); iWindow.Construct(iWg,(TUint32)&iWg+1); iWindow.Activate(); iWindow.SetNonFading(ETrue); // iWindow.SetBackgroundColor(KRgbBlack); iScreen=new (ELeave) CWsScreenDevice(iWs); User::LeaveIfError(iScreen->Construct()); User::LeaveIfError(iScreen->CreateContext(iGc)); GetFontSize(); iScreenSize.iY = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iHeight; iScreenSize.iX = iScreen->GetCurrentScreenModeAttributes().iScreenSize.iWidth; iWindow.SetExtent(TPoint(0,iScreenSize.iY-60),TSize(iScreenSize.iX,60)); iWs.Flush(); Draw(); iWs.Flush(); }
void CMediaClientExtDisplayHandler::ConstructL() { DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL +++"); DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWsSession Connect"); TInt err = iWs.Connect(); if (err != KErrNone) { DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL Windows Server unavailable"); User::Leave(err); } DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL CWsScreenDevice Create"); iScreen = new (ELeave) CWsScreenDevice(iWs); User::LeaveIfError(iScreen->Construct(iDisplayId)); DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindowGroup Create"); iRootWindow = RWindowGroup(iWs); User::LeaveIfError(iRootWindow.Construct((TUint32)this, ETrue)); DEBUG_PRINTF2("CMediaClientExtDisplayHandler::ConstructL RWindowGroupId %d", iRootWindow.WindowGroupId()); DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL RWindow Create"); iExternalDisplayWindow = RWindow(iWs); User::LeaveIfError(iExternalDisplayWindow.Construct(iRootWindow,((TUint32)(this)) + 1)); DEBUG_PRINTF2("CMediaClientExtDisplayHandler::ConstructL - iExternalDisplayWindow WsHandle 0x%X", iExternalDisplayWindow.WsHandle()); DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL Setup external window"); iExternalDisplayWindow.SetExtent(TPoint(0,0), iScreen->SizeInPixels()); iExternalDisplayWindow.SetVisible(ETrue); iExternalDisplayWindow.Activate(); iWs.Flush(); DEBUG_PRINTF("CMediaClientExtDisplayHandler::ConstructL ---"); }
void CMicroDialog::CMicroDialogInt::ConstructL(void) { User::LeaveIfError(iWsSession.Connect()); iRootWin=RWindowGroup(iWsSession); User::LeaveIfError(iRootWin.Construct(Handle(),EFalse)); CApaWindowGroupName* groupName=CApaWindowGroupName::NewLC(iWsSession); groupName->SetHidden(ETrue); groupName->SetWindowGroupName(iRootWin); CleanupStack::PopAndDestroy(); //groupName iWindow=RBackedUpWindow(iWsSession); User::LeaveIfError(iWindow.Construct(iRootWin,EColor4K,Handle())); User::LeaveIfError(iWindow.SetExtentErr(TPoint((KScreenWidth-iOwner->iSize.iWidth)/2,(KScreenHeight-iOwner->iSize.iHeight)/2),iOwner->iSize)); iWindow.MaintainBackup(); iBitmap=new(ELeave)CFbsBitmap; User::LeaveIfError(iBitmap->Duplicate(iWindow.BitmapHandle())); iBitmapDevice=CFbsBitmapDevice::NewL(iBitmap); iBitmapDevice->CreateBitmapContext(iBitmapContext); TAlgStyle style; User::LeaveIfError(iBitmapDevice->GetFontById(iFont,TUid::Uid(KScreenFontUidAlp12),style)); iBitmapContext->UseFont(iFont); iWindow.Activate(); iTimer.CreateLocal(); iOwner->iCallback->MicroDialogStart(this); }
/** 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 CMyServer::ConstructL() { __LOGSTR("Construct"); CActiveScheduler::Add(this); iWs = RWsSession(); iFs.Connect(); iTextPlain = CPlainText::NewL(); ReadConf(); __LOGSTR("ReadConfComplete"); iOldName = _L("ClipboardChanged"); iWs.Connect(iFs); iTaskList = new(ELeave) TApaTaskList(iWs); iScreen = new(ELeave) CWsScreenDevice(iWs); CleanupStack::PushL(iScreen); iScreen->Construct(); CleanupStack::Pop(iScreen); iChangeTrap = CChangeTrap::NewL(); iChangeTrap->SetObserver(this); iTimer = CPTimer::NewL(); iTimer->SetObserver(this); iCaller = CCaller::NewL(); iWg = RWindowGroup(iWs); iWg.Construct((TUint32)&iWg,EFalse); iWg.SetOrdinalPosition(0,ECoeWinPriorityAlwaysAtFront); iWg.EnableReceiptOfFocus(EFalse); iScreen->CreateContext(iGc); iWindow = RWindow(iWs); iWindow.Construct(iWg,(TUint32)&iWg+1); iWindow.Activate(); iWindow.SetExtent(TPoint(0,0),TSize(1,1)); iWindow.SetRequiredDisplayMode(EColor16MA); iWindow.SetOrdinalPosition(5555,ECoeWinPriorityAlwaysAtFront); TRgb backgroundColour = KRgbBlack; //if(KErrNone == iWindow.SetTransparencyAlphaChannel()) // { // backgroundColour.SetAlpha(0); // } iWindow.SetBackgroundColor(backgroundColour); GetFontSize(); iWindow.SetSize(iSize); __LOGSTR2("iSize1: %d,iSize2: %d",iSize.iWidth,iSize.iHeight); iPos=TPoint(iConfig.iX,iConfig.iY); iWindow.SetVisible(EFalse); iWs.Flush(); //Draw(iOldName); }
/** Overrides test step preamble. */ enum TVerdict CT_WServGenericpluginStepLoad::doTestStepPreambleL() { TVerdict ret = CTestStep::doTestStepPreambleL(); if ( !GetIntFromConfig( ConfigSection(), KTWServGenericPluginStepTestId, iTestId )) { User::Leave(KErrNotFound); } else { iDisplayMode = EColor64K; User::LeaveIfError(iWsSession.Connect()); // Screen # 0 iScreen = new (ELeave) CWsScreenDevice(iWsSession); User::LeaveIfError(iScreen->Construct()); iWinGroup = RWindowGroup(iWsSession); User::LeaveIfError(iWinGroup.Construct(KNullWsHandle, iScreen)); iWinGroup.AutoForeground(ETrue); iGc = new (ELeave) CWindowGc(iScreen); User::LeaveIfError(iGc->Construct()); // Screen # 1 if( iWsSession.NumberOfScreens() > 1 ) { iScreen1 = new (ELeave) CWsScreenDevice(iWsSession); User::LeaveIfError(iScreen1->Construct(1)); INFO_PRINTF1(_L("WSERV configuration supports two screens.")); iWinGroup1 = RWindowGroup(iWsSession); User::LeaveIfError(iWinGroup1.Construct(KNullWsHandle, iScreen1) ); iWinGroup1.AutoForeground(ETrue); } else { INFO_PRINTF1(_L("WSERV configuration doesn't support two screens.")); INFO_PRINTF1(_L("Tests that used second screen may failed!!!")); } iDefaultPluginBmp = new(ELeave) CFbsBitmap; User::LeaveIfError(iDefaultPluginBmp->Load(KDefaultPluginBmp)); iTestPluginBmp = new(ELeave) CFbsBitmap; User::LeaveIfError(iTestPluginBmp->Load(KTestPluginBmpScreen0)); iWsSession.Flush(); } return ret; }
void COomMessageFetch::PreFail() { iWinGroup2=RWindowGroup(iWs); iWinGroup2.Construct(CLIENT_HANDLE); iWinGroup2.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close TBuf8<MESSAGE_LEN> params(_L8("SomeParams")); TBool retVal = iWs.SendMessageToWindowGroup(iWinGroup2.Identifier(),TUid::Uid(UID_VALUE),params); iTest->TEST(retVal==KErrNone); if (retVal!=KErrNone) iTest->INFO_PRINTF3(_L("iWs.SendMessageToWindowGroup() return value - Expected: %d, Actual: %d"), KErrNone, retVal); }
void COomSetup::ConstructL() { COomFailBase::ConstructL(); User::LeaveIfError(iWs.Connect()); iDummyScreen = new (ELeave) CWsScreenDevice(iWs); User::LeaveIfError(iDummyScreen->Construct(iTest->ScreenNumber())); iWinGroup=RWindowGroup(iWs); iWinGroup.Construct(556); iWinGroup.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close }
void CTWindowSet::ConstructL() { User::LeaveIfError(iWs.Connect()); iWs.SetAutoFlush(ETrue); iWindowGroup = RWindowGroup(iWs); User::LeaveIfError(iWindowGroup.Construct(reinterpret_cast<TUint32>(&iWindowGroup))); iChildWindow = RWindow(iWs); User::LeaveIfError(iChildWindow.Construct(iWindowGroup, reinterpret_cast<TUint32>(&iChildWindow))); }
void CBgAnimHost::CreateWindowL() { iScreenDevice = new (ELeave) CWsScreenDevice(iWsSession); User::LeaveIfError(iScreenDevice->Construct(0)); TPixelsAndRotation rot; TInt screenmode = iScreenDevice->CurrentScreenMode(); iScreenDevice->GetScreenModeSizeAndRotation(screenmode, rot); if (rot.iRotation == CFbsBitGc::EGraphicsOrientationNormal) { iDisplaySize = rot.iPixelSize; } else { iDisplaySize.iWidth = rot.iPixelSize.iHeight; iDisplaySize.iHeight = rot.iPixelSize.iWidth; } iRealDisplaySize = iDisplaySize; iDisplaySize.iWidth/=2; iDisplaySize.iHeight/=2; iWindowGroup=RWindowGroup(iWsSession); User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup)); iWindowGroup.SetOrdinalPosition(-1,-1000); iWindow=RWindow(iWsSession); User::LeaveIfError(iWindow.Construct(iWindowGroup, (TUint32)&iWindow)); User::LeaveIfError(iWindow.SetExtentErr(TPoint(0,0),iDisplaySize)); iWindow.SetVisible(ETrue); iWindow.Activate(); iWindGroupName = CApaWindowGroupName::NewL(iWsSession, iWindowGroup.Identifier()); TUid wgUid; wgUid.iUid = 0x200286D3; iWindGroupName->SetAppUid(wgUid); iWindGroupName->SetCaptionL(KExeCaption); iWindGroupName->SetHidden(ETrue); iWindGroupName->SetAppReady(ETrue); iWindGroupName->SetSystem(ETrue); iWindGroupName->SetWindowGroupName(iWindowGroup); iWsSession.Flush(); }
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 CKeyCapturer::ConstructL() { CActiveScheduler::Add(this); User::LeaveIfError(iWsSession.Connect()); iWg=RWindowGroup(iWsSession); User::LeaveIfError(iWg.Construct((TUint32)&iWg, EFalse)); iWg.SetOrdinalPosition(-1); iWg.EnableReceiptOfFocus(EFalse); CApaWindowGroupName* wn=CApaWindowGroupName::NewLC(iWsSession); wn->SetHidden(ETrue); wn->SetWindowGroupName(iWg); CleanupStack::PopAndDestroy(); iHandle = iWg.CaptureKey(63570/*EKeyDevice0*/, 0,0); Listen(); }
void CWsClient::ConstructL() { // add ourselves to active scheduler CActiveScheduler::Add(this); // get a session going User::LeaveIfError(iWs.Connect()); // construct our one and only window group iGroup = RWindowGroup(iWs); User::LeaveIfError(iGroup.Construct(2, ETrue)); // '2' is a meaningless handle // construct screen device and graphics context iScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session User::LeaveIfError(iScreen->Construct()); // and complete its construction User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context // construct redrawer iRedrawer = new (ELeave) CWsRedrawer; iRedrawer->ConstructL(this); // construct main window ConstructMainWindowL(); // request first event and start scheduler IssueRequest(); }
void CTestStepVidPlayerARN::InitWservL() { TInt err = iWs.Connect(); if (err != KErrNone) { // Access violation if ws is null INFO_PRINTF1(_L("Cannot test, no window server available")); User::Leave(err); } iScreen = new(ELeave) CWsScreenDevice(iWs); // make device for this session User::LeaveIfError(iScreen->Construct()); // and complete its construction iRootWindow = RWindowGroup(iWs); User::LeaveIfError(iRootWindow.Construct((TUint32)this, ETrue)); iWindow = new(ELeave) RWindow(iWs); User::LeaveIfError(((RWindow*)iWindow)->Construct(iRootWindow,((TUint32)(this)) + 1)); iWindow->SetExtent(TPoint(0,0), TSize(400,200)); iWindow->SetVisible(ETrue); iWindow->Activate(); iWs.Flush(); }
void CMediaClientWsEventObserver::ConstructL() { DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL +++"); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWsSession Connect"); TInt err = iWs.Connect(); if (err != KErrNone) { DEBUG_PRINTF2("CMediaClientWsEventObserver::ConstructL Windows Server unavailable, err %d", err); User::Leave(err); } DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup Create"); iWindowGroup = RWindowGroup(iWs); User::LeaveIfError(iWindowGroup.Construct((TUint32)this, EFalse)); // Send created window to the background and hide it from the // application switcher iWindowGroup.SetOrdinalPosition( -1, -1000 ); // -1000 = ECoeWinPriorityNeverAtFront DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL RWindowGroup EnableFocusChangeEvents"); User::LeaveIfError(iWindowGroup.EnableFocusChangeEvents()); UpdateFocusWindowGroupId(ETrue); DEBUG_PRINTF3("CMediaClientWsEventObserver::ConstructL Initial WgId %d Error %d", iWgId, iWgIdError); CActiveScheduler::Add(this); // register with window server to receive focus change notifications DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL iWs.EventReady()"); iWs.EventReady(&iStatus); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL SetActive()"); SetActive(); DEBUG_PRINTF("CMediaClientWsEventObserver::ConstructL ---"); }
/** Creates a RWindowGroup object */ TInt COomWindowGroup::Fail() { iFailWinGroup=RWindowGroup(iWs); return(iFailWinGroup.Construct(987)); }
/** 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(); }
/** 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(); }
TVerdict CTTranslucent::doTestStepL() { User::LeaveIfError(iWsSession.Connect()); iWindowGroup=RWindowGroup(iWsSession); User::LeaveIfError(iWindowGroup.Construct(2, ETrue)); // meaningless handle; enable focus // construct screen device and graphics context iScreen=new (ELeave) CWsScreenDevice(iWsSession); // make device for this session User::LeaveIfError(iScreen->Construct()); // and complete its construction User::LeaveIfError(iScreen->CreateContext(iGc)); // create graphics context iScreenRect = TRect(0,0,iScreen->SizeInPixels().iWidth, iScreen->SizeInPixels().iHeight); // Construct a gradient bitmap for use by bitmap test CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); User::LeaveIfError(bitmap->Create(TSize(80,80), EColor16MA)); CTe_graphicsperformanceSuiteStepBase::VerticalGradientAlphaL(bitmap, TRgb(0x000000ff), TRgb(0xff000000)); delete iBitmap; iBitmap = bitmap; CleanupStack::Pop(bitmap); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0132 @SYMPREQ PREQ1841 @SYMTestCaseDesc Measures time taken to redraw 2, 8, 32 and 144 blank translucent partially overlapping windows. @SYMTestActions 1. Create blank translucent partially overlapping windows. 2. Cover them all with an "ontop" window. 3. Hide the "ontop" window and measure time taken to redraw all overlapping windows underneath. 4. Repeat KIterationsToTest times and calculate average time per iteration. @SYMTestExpectedResults As the number of windows increases, so should the time taken to redraw them. */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0132")); RunTestCaseL(_L("Redraw-BlankWindows2"), EBlankWindows, 2, 1); RunTestCaseL(_L("Redraw-BlankWindows8"), EBlankWindows, 2, 4); RunTestCaseL(_L("Redraw-BlankWindows32"), EBlankWindows, 4, 8); RunTestCaseL(_L("Redraw-BlankWindows144"), EBlankWindows, 12, 12); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0133 @SYMPREQ PREQ1841 @SYMTestCaseDesc Measures time taken to redraw 2, 8, 32 and 144 translucent partially overlapping windows containing drawn text. @SYMTestActions 1. Create translucent partially overlapping windows. 2. Cover them all with an "ontop" window. 3. Hide the "ontop" window and measure time taken to redraw all overlapping windows underneath. 4. Repeat KIterationsToTest times and calculate average time per iteration. @SYMTestExpectedResults As the number of windows increases, so should the time taken to redraw them. */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0133")); RunTestCaseL(_L("Redraw-TextWindows2"), ETextWindows, 2, 1); RunTestCaseL(_L("Redraw-TextWindows8"), ETextWindows, 2, 4); RunTestCaseL(_L("Redraw-TextWindows32"), ETextWindows, 4, 8); RunTestCaseL(_L("Redraw-TextWindows144"), ETextWindows, 12, 12); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0134 @SYMPREQ PREQ1841 @SYMTestCaseDesc Measures time taken to redraw 2, 8, 32 and 144 translucent partially overlapping windows containing drawn ellipsis. @SYMTestActions 1. Create translucent partially overlapping windows. 2. Cover them all with an "ontop" window. 3. Hide the "ontop" window and measure time taken to redraw all overlapping windows underneath. 4. Repeat KIterationsToTest times and calculate average time per iteration. @SYMTestExpectedResults As the number of windows increases, so should the time taken to redraw them. */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0134")); RunTestCaseL(_L("Redraw-EllipseWindows2"), EEllipseWindows, 2, 1); RunTestCaseL(_L("Redraw-EllipseWindows8"), EEllipseWindows, 2, 4); RunTestCaseL(_L("Redraw-EllipseWindows32"), EEllipseWindows, 4, 8); RunTestCaseL(_L("Redraw-EllipseWindows144"), EEllipseWindows, 12, 12); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0135 @SYMPREQ PREQ1841 @SYMTestCaseDesc Measures time taken to redraw 2, 8, 32 and 144 translucent partially overlapping windows containing bitmaps. @SYMTestActions 1. Create translucent partially overlapping windows. 2. Cover them all with an "ontop" window. 3. Hide the "ontop" window and measure time taken to redraw all overlapping windows underneath. 4. Repeat KIterationsToTest times and calculate average time per iteration. @SYMTestExpectedResults As the number of windows increases, so should the time taken to redraw them. */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0135")); RunTestCaseL(_L("Redraw-BitmapWindows2"), EBitmapWindows, 2, 1); RunTestCaseL(_L("Redraw-BitmapWindows8"), EBitmapWindows, 2, 4); RunTestCaseL(_L("Redraw-BitmapWindows32"), EBitmapWindows, 4, 8); RunTestCaseL(_L("Redraw-BitmapWindows144"), EBitmapWindows, 12, 12); RecordTestResultL(); return TestStepResult(); }
TInt COpenMAXALTestModule::al_CreateWindow( CStifItemParser& aItem ) { TInt status(KErrNone); if (iRwSession.Handle()) User::Leave(KErrAlreadyExists); TInt topX; TInt topY ; TInt bottomX; TInt bottomY; TInt posX; TInt posY; status = aItem.GetNextInt(posX); RET_ERR_IF_ERR(status); status = aItem.GetNextInt(posY); RET_ERR_IF_ERR(status); status = aItem.GetNextInt(topX); RET_ERR_IF_ERR(status); status = aItem.GetNextInt(topY); RET_ERR_IF_ERR(status); status = aItem.GetNextInt(bottomX); RET_ERR_IF_ERR(status); status = aItem.GetNextInt(bottomY); RET_ERR_IF_ERR(status); /* Create resources needed for video play back*/ status = iRwSession.Connect(); RET_ERR_IF_ERR(status); TInt groupId = iRwSession.GetFocusWindowGroup(); iRwGroup = RWindowGroup(iRwSession); status = iRwGroup.Construct(groupId, ETrue); RET_ERR_IF_ERR(status); _LIT(KXASTIFWindowGroupName,"XASTIF"); iRwGroup.SetName(KXASTIFWindowGroupName); iRwGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront); iRWindow = RWindow(iRwSession); status = iRWindow.Construct(iRwGroup, (TUint32) this + 1); RET_ERR_IF_ERR(status); TPoint point(posX, posY); iRWindow.SetPosition(point); TRect rect(topX, topY, bottomX, bottomY); TSize size(rect.Size()); iRWindow.SetSize(size); iRWindow.Activate(); iRWindow.SetVisible(ETrue); iRwSession.Flush(); iDevice = NULL; iDevice = new CWsScreenDevice(iRwSession); if (!iDevice) { status = KErrNoMemory; } RET_ERR_IF_ERR(status); status = iDevice->Construct(0); return status; }
void COomMessageSend::PreFail() { iWinGroup2=RWindowGroup(iWs); iWinGroup2.Construct(557); iWinGroup2.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close }
void CWsGceCscBase::SetupL() { iDoTearDown=ETrue; iRed.SetInternal(0xFFFF0000); iGreen.SetInternal(0xFF00FF00); iBlue.SetInternal(0xFF0000FF); iCyan.SetInternal(0xFF00FFFF); iMagenta.SetInternal(0xFFFF00FF); iYellow.SetInternal(0xFFFFFF00); iWhite.SetInternal(0xFFFFFFFF); ASSERT_EQUALS_X(iSession.Connect(), KErrNone); {//Stolen from TAuto CloseAllPanicWindows() TInt idFocus = iSession.GetFocusWindowGroup(); TWsEvent event; event.SetType(EEventKey); //EEventKeyDown TKeyEvent *keyEvent = event.Key(); keyEvent->iCode = EKeyEscape; keyEvent->iScanCode = EStdKeyEscape; keyEvent->iModifiers = 0; TInt theLimit = 50; while(idFocus != NULL && (theLimit-- > 0)) { iSession.SendEventToAllWindowGroups(event); TInt idNewFocus = iSession.GetFocusWindowGroup(); if (idNewFocus!=idFocus) { INFO_PRINTF1(_L("A window was closed [probably a panic box from the previous test].")); } idFocus=idNewFocus; } } TInt err = KErrNone; TRAP(err, iScreenDevice = new (ELeave) CWsScreenDevice(iSession)); PRINT_ON_ERROR2_L(err, _L("Failed to create screen device: %d"), err); ASSERT_EQUALS_X(iScreenDevice->Construct(TGlobalSettings::Instance().iScreen), KErrNone); iDisplayMode = iScreenDevice->DisplayMode(); // Get default display mode TRAP(err, iGc = new (ELeave) CWindowGc(iScreenDevice)); PRINT_ON_ERROR2_L(err, _L("Failed to create graphics context: %d"), err); ASSERT_EQUALS_X(iGc->Construct(), KErrNone); iGroup = RWindowGroup(iSession); ASSERT_EQUALS_X(iGroup.Construct(++iWindowHandle,iScreenDevice), KErrNone); iSession.Flush(); RWindow testTrans(iSession); ASSERT_EQUALS_X(testTrans.Construct(iGroup, ++iWindowHandle), KErrNone); iTransparencyEnabled=(testTrans.SetTransparencyFactor(iWhite)==KErrNone); testTrans.Close(); //clean-up if previous test abended if (PostTestCleanupInstance().iSharedUtility) { //Temp removed - may be causing ONB fails! // if (PostTestCleanupInstance().iSharedUtility->DestroyAll()) // { // INFO_PRINTF1(_L("Destroyed some surfaces from previous test.")); // // } } if (!PostTestCleanupInstance().iCleanedUpOnExit) PostTestCleanupInstance().iCleanedUpOnExit=EFalse; if (!GCEIsSupported()) { INFO_PRINTF1(_L("Some Setup skipped: GCE support is not loaded")); return; } TRAPD(err_FailedToCreateSurfaceUtility, iUtility = CSurfaceUtility::NewL( PostTestCleanupInstance().iSharedUtility)); ASSERT_EQUALS(err_FailedToCreateSurfaceUtility,KErrNone); }