/** @SYMTestCaseID GRAPHICS_WSERV_DYNAMICRES_0100L @SYMTestCaseDesc GetInterface in classic @SYMREQ @SYMPREQ PREQ2102 @SYMTestType CT @SYMTestPriority @SYMTestPurpose GetInterface should always return NULL in classic @SYMTestActions Create an RWsSession Create a CWsScreenDevice Call GetInterface with various GUIDS. @SYMTestExpectedResults Should always return NULL **/ void CWsDynamicResClassic::GRAPHICS_WSERV_DYNAMICRES_0100L() { RWsSession session; session.Connect(); CWsScreenDevice* screenDevice = NULL; TRAPD(err, screenDevice = new (ELeave) CWsScreenDevice(session)); PRINT_ON_ERROR2_L(err, _L("Failed to create screen device: %d"), err); if (screenDevice) { ASSERT_EQUALS_X(screenDevice->Construct(0), KErrNone); void* interface = screenDevice->GetInterface(12344321); ASSERT_NULL (interface); interface = screenDevice->GetInterface(0); ASSERT_NULL (interface); } delete screenDevice; session.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); }