void CTPointerCapture::NextTest() { TEST(!iFailed); if (iFailed) { _LIT(KLog,"SubTest %d failed"); LOG_MESSAGE2(KLog,iTest->iState); } ++iTest->iState; iSubState=0; iFailed=EFalse; CaseComplete(); _LIT(KLog,"Done NextTest NewSubTest %d"); LOG_MESSAGE2(KLog,iTest->iState); }
void CTMessage::MessageTests(TInt aNoOfMessages,TInt aMsgCountCheck,TBool aSyncSendReceiveFlag,TBool aTestNeedsExtraCheck) { iSyncSendReceiveFlag=aSyncSendReceiveFlag; TestNeedsExtraCheck=aTestNeedsExtraCheck; MsgCountCheck=aMsgCountCheck; iLowPriorityObject->Start(TCallBack(CallbackLowPriority,this)); if(iSyncSendReceiveFlag) { //Messages will be sent and received one by one using the function SendSyncMessages(). CActiveScheduler::Start(); } else { for(TInt count=0;count<aNoOfMessages;count++) { TInt err=CreateAndSendMessages(count,aNoOfMessages); TEST(err==KErrNone); if (err!=KErrNone) { _LIT(KLog,"Error %d when trying to send Messages"); LOG_MESSAGE2(KLog,err); } } CActiveScheduler::Start(); TInt msgCount=(*iMessageReceiver)[iState]->MessageCount(); TEST(msgCount==MsgCountCheck); if (msgCount!=MsgCountCheck) { _LIT(KLog,"Number of messages recieved=%d expected=%d"); LOG_MESSAGE3(KLog,msgCount,MsgCountCheck); } } }
void CTKRepeat::ConstructL() { TheClient->iWs.SetFocusScreen(iTest->iScreenNumber); iWin=new(ELeave) CRKWindow(this); TSize screenSize=Client()->iGroup->Size(); iWin->SetUpL(TPoint(5,5),TSize(Min(Max(screenSize.iWidth/2,250),screenSize.iWidth-10),screenSize.iHeight-10),Client()->iGroup,*Client()->iGc); Client()->iGroup->WinTreeNode()->SetOrdinalPosition(0); Client()->iGroup->SetCurrentWindow(iWin); Client()->iWs.GetKeyboardRepeatRate(iOldInitialTime, iOldTime); iTest->SimulateKeyDownUp(EStdKeyLeftCtrl); iTest->SimulateKeyDownUp(EStdKeyRightCtrl); TInt mods=Client()->iWs.GetModifierState(); TheClient->WaitForRedrawsToFinish(); //Let all pending events be processed before test begins _LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)"); LOG_MESSAGE2(KLog,mods); }
static void dispatchUpdateAndDisplay1(DISPATCH_STATUS_TYPE newStatus, DISPATCH_PTR dispatch) { int32 error = FALSE, printed = TRUE; int32 parentId; DISPATCH_PTR parent_dispatch; X_IPC_MSG_CLASS_TYPE msg_class, mclass; #ifndef NMP_IPC parent_dispatch = findParentDispatch(dispatch); #else parent_dispatch = NULL; #endif parentId = (parent_dispatch ? parent_dispatch->locId : dispatch->pRef); msg_class = dispatch->msg_class; /* 30Aug93: fedor: Replaced msgName = dispatch->msg->msgData->name with DISPATCH_MSG_NAME because the message name may not always be defined for a dispatch. See HandledDispatch - FailureClass */ switch(dispatch->status) { case AllocatedDispatch: switch(newStatus) { case AttendingDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %10s", dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); LOG_MESSAGE1(" --> %-15s (Sent)", dispatch->des->modData->modName); break; case PendingDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %10s", dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); LOG_MESSAGE1(" --> Resource %-6s (Pending)", dispatch->hnd->resource->name); break; case InactiveDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %10s", dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); LOG_MESSAGE(" --> ON HOLD (Inactive)"); break; case HandledDispatch: if (msg_class == FailureClass) { LOG_MESSAGE2("Failure %15s: %s", "*Top Level*", *(char **)dispatch->classData); } break; default: error = TRUE; break; } break; case PendingDispatch: switch(newStatus) { case AttendingDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE2(": Resource %s --> %-15s (Sent)", dispatch->hnd->resource->name, dispatch->des->modData->modName); break; default: error = TRUE; break; } break; case CentralPendingDispatch: switch(newStatus) { case AttendingDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %10s", dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); LOG_MESSAGE1(" --> %-15s (Sent)", dispatch->des->modData->modName); break; default: error = TRUE; break; } break; case AttendingDispatch: switch(newStatus) { case HandledDispatch: if (TWO_WAY_MSG(dispatch->msg)) { LOG_MESSAGE1(" Reply %15s", DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE2(": %10s --> %-15s", dispatch->des->modData->modName, dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); if (!dispatch->org->alive) { LOG_MESSAGE1("\nWARNING: Reply Ignored for dead module: %s", dispatch->org->modData->modName); } } else if (monitorClass(msg_class)) { LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE(": (Completed)"); } else if (msg_class == SuccessClass || (msg_class == InformClass && dispatch->des == GET_S_GLOBAL(x_ipcServerModGlobal))) { mclass = dispatch->msg->msgData->msg_class; if (mclass == InformClass || mclass == BroadcastClass) { LOG_MESSAGE(" Done "); } else { LOG_MESSAGE(" Success "); } LOG_MESSAGE1("%15s", DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE(":"); } else if (msg_class == FailureClass) { LOG_MESSAGE1(" Failure %15s", DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %s", *(char **)dispatch->classData); } else if (msg_class == ReplyClass) { LOG_MESSAGE1(" Reply %15s", DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); #ifdef NMP_IPC LOG_MESSAGE2(": %10s --> %-15s", dispatch->des->modData->modName, dispatch->org->modData->modName); #else LOG_MESSAGE2(": %10s --> %-15s", GET_S_GLOBAL(x_ipcServerModGlobal)->modData->modName, dispatch->org->modData->modName); #endif Log_ParentId(parentId, LOGGING_MESSAGE); } else { printed = FALSE; } break; case CentralPendingDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1(": %10s", dispatch->org->modData->modName); Log_ParentId(parentId, LOGGING_MESSAGE); LOG_MESSAGE1(" --> %-15s (Pending)", dispatch->des->modData->modName); break; default: error = TRUE; break; } break; case InactiveDispatch: LOG_MESSAGE2("%-9s %15s", x_ipc_messageClassName(msg_class), DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE(": ON HOLD "); switch(newStatus) { case AttendingDispatch: LOG_MESSAGE1(" --> %-15s (Sent)", dispatch->des->modData->modName); break; case PendingDispatch: LOG_MESSAGE1(" --> Resource %-6s (Pending)", dispatch->hnd->resource->name); break; default: error = TRUE; break; } break; default: error = TRUE; break; } if (error) { LOG_MESSAGE1("\nWARNING: dispatchUpdateAndDisplay: %s", DISPATCH_MSG_NAME(dispatch)); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE2(": %s --> %s", dispatchStatusName(dispatch->status), dispatchStatusName(newStatus)); } if (printed) { Log_Time(1); LOG_MESSAGE("\n"); } }
void CTScreenDevice::TwipsCacheFlushL() { RWsSession session; CWsScreenDevice* device; CFont* font; CFont* font2; const TFontSpec fontspec(KTestFontTypefaceName,250); TPixelsTwipsAndRotation sizeAndRotation; // create a CWsScreenDevice instance User::LeaveIfError(session.Connect()); device=new(ELeave) CWsScreenDevice(session); device->Construct(iTest->iScreenNumber); // Record a font height for use by latter tests User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); const TInt height0=font->HeightInPixels(); device->ReleaseFont(font); // 1. find font with best-matching height in twips, // 2. change twips size of the screen (leaving pixel-size same), // 3. find font with best-matching height in twips, // 4. make sure that the newly found font is not the same as previous and has the different height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); #if defined(EXTRA_LOGGING) _LIT(KLog1,"Font height: %d for unchanged device. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog1,height0,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif sizeAndRotation.iTwipsSize.iHeight=2000; sizeAndRotation.iTwipsSize.iWidth =3000; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); TInt height=font->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog2,"Font height: %d for device with twips set to 2000x3000"); LOG_MESSAGE2(KLog2,height); #endif TFontSpec returnedSpec=font->FontSpecInTwips(); sizeAndRotation.iTwipsSize.iHeight=4000; sizeAndRotation.iTwipsSize.iWidth =6000; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); TInt height2=font2->HeightInPixels(); TFontSpec returnedSpec2 = font2->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog3,"Font height: %d for device with twips set to 4000x6000"); LOG_MESSAGE2(KLog3,height2); #endif TEST(font!=font2); TEST(height!=height2); _LIT(KLogErrM,"Font Heights in pixels match unexpectantly, height=%d"); if (height==height2) INFO_PRINTF2(KLogErrM,height); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. find font with best-matching height in twips, // 2. change pixel size of the screen (leaving twip-size same), // 3. find font with best-matching height in twips, // 4. make sure that the newly found font is not the same as previous and has the different height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); sizeAndRotation.iPixelSize.iHeight=240; sizeAndRotation.iPixelSize.iWidth =640; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); height=font->HeightInPixels(); returnedSpec=font->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog4,"Font height: %d for device with pixels set to 240x640 twips=%d,%d"); LOG_MESSAGE4(KLog4,height,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif sizeAndRotation.iPixelSize.iHeight=480; sizeAndRotation.iPixelSize.iWidth =1280; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2=font2->HeightInPixels(); returnedSpec2=font2->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog5,"Font height: %d for device with pixels set to 480x1280"); LOG_MESSAGE2(KLog5,height2); #endif TEST(font!=font2); TEST(height!=height2); if (height==height2) INFO_PRINTF2(KLogErrM,height); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. double the width and height of screen in both pixels and twips // 2. find font with best-matching height in twips, // 3. make sure that the newly found font is the same as previous and has the same height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); sizeAndRotation.iPixelSize.iHeight*=2; sizeAndRotation.iPixelSize.iWidth *=2; sizeAndRotation.iTwipsSize.iHeight*=2; sizeAndRotation.iTwipsSize.iWidth *=2; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2=font2->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog6,"Font height: %d for device doubled size. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog6,height2,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif TEST(font==font2); TEST(height0==height2); _LIT(KLogErrD,"Font Heights in pixels don't match, expected=%d, actual=%d"); if (height0!=height2) INFO_PRINTF3(KLogErrD,height0,height2); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. swap width and height sizes of screen for both pixels and twips // 2. find font with best-matching height in twips, // 3. make sure that the newly found font is the same as previous and has the same height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); TInt swap=sizeAndRotation.iPixelSize.iHeight; sizeAndRotation.iPixelSize.iHeight=sizeAndRotation.iPixelSize.iWidth; sizeAndRotation.iPixelSize.iWidth =swap; swap=sizeAndRotation.iTwipsSize.iHeight; sizeAndRotation.iTwipsSize.iHeight=sizeAndRotation.iTwipsSize.iWidth; sizeAndRotation.iTwipsSize.iWidth =swap; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2 = font2->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog7,"Font height: %d for device rotated size. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog7,height2,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif TEST(font==font2); TEST(height0==height2); if (height0!=height2) INFO_PRINTF3(KLogErrD,height0,height2); device->ReleaseFont(font2); device->ReleaseFont(font); delete device; session.Close(); }
void recvMessage(DISPATCH_PTR dispatch, X_IPC_MSG_CLASS_TYPE msg_class, void *classData) { #ifdef UNUSED_PRAGMA #pragma unused(classData) #endif if (GET_S_GLOBAL(x_ipcDebugGlobal)) { x_ipc_idTablePrintInfo(GET_S_GLOBAL(dispatchTable)); X_IPC_MOD_WARNING("\n"); x_ipcStats(stderr); } switch(msg_class) { case QueryClass: case InformClass: tapWhenSent(dispatch); processActiveMessage(dispatch); break; case ReplyClass: recvReplyMessage(dispatch); break; #ifndef NMP_IPC case GoalClass: case PointMonitorClass: case DemonMonitorClass: case PollingMonitorClass: case ExceptionClass: case CommandClass: recvTaskTreeMessage(dispatch, msg_class, classData); break; #endif case BroadcastClass: recvBroadcastMessage(dispatch); break; #ifndef NMP_IPC case MultiQueryClass: recvMultiQueryMessage(dispatch); break; #endif case SuccessClass: case FailureClass: recvSuccessFailureMessage(dispatch, msg_class); break; #ifndef NMP_IPC case FireDemonClass: LOG_MESSAGE2("%-9s %15s [%d]:", "FireDemon", dispatch->msg->msgData->name, *(int32 *)classData); Log_RefId(dispatch, LOGGING_MESSAGE); LOG_MESSAGE1("%10s", dispatch->org->modData->modName); LOG_MESSAGE1(" --> %-15s (Sent)", GET_S_GLOBAL(x_ipcServerModGlobal)->modData->modName); Log_Time(1); LOG_MESSAGE("\n"); fireDemonHnd(dispatch, (int32 *)classData); break; #endif case HandlerRegClass: case UNKNOWN: case ExecHndClass: #ifndef TEST_CASE_COVERAGE default: #endif X_IPC_ERROR1("ERROR: recvMessage: class not implemented: %d\n", msg_class); } }
/** 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(); }