windowing/windowserver/test/tdynamicres/src/wsdynamicresbasic.cpp
changeset 187 9f66f99ee56f
parent 103 2717213c588a
equal deleted inserted replaced
103:2717213c588a 187:9f66f99ee56f
   507 @SYMTestActions			
   507 @SYMTestActions			
   508 	Run through various ways of changing resolution
   508 	Run through various ways of changing resolution
   509 	For each, check if event has been received
   509 	For each, check if event has been received
   510 @SYMTestExpectedResults	
   510 @SYMTestExpectedResults	
   511 	Based on type of change, check event
   511 	Based on type of change, check event
       
   512 	@note Test uses HAL to simulate display disconnection. Not supported on production platforms.
   512 */
   513 */
   513 void	CWsDynamicResBasic::GRAPHICS_WSERV_DYNAMICRES_0005L()
   514 void	CWsDynamicResBasic::GRAPHICS_WSERV_DYNAMICRES_0005L()
   514 	{
   515 	{
   515 	LOG_AND_PANIC_IF_NOT_GCE;
   516 	LOG_AND_PANIC_IF_NOT_GCE;
   516 	ResetScreens();
   517 	ResetScreens();
   681 	LOG_AND_PANIC_IF_NOT_GCE;
   682 	LOG_AND_PANIC_IF_NOT_GCE;
   682 	ResetScreens();
   683 	ResetScreens();
   683 	TInt error;
   684 	TInt error;
   684 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0006L"),_L("Change Resolution"));
   685 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0006L"),_L("Change Resolution"));
   685 
   686 
   686 	iTestBack=RWindow(iSession);
   687 	iTestBack=RBlankWindow(iSession);
   687 	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
   688 	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
   688 	iTestBack.SetRequiredDisplayMode(iDisplayMode);
   689 	iTestBack.SetRequiredDisplayMode(iDisplayMode);
   689 	iTestBack.SetBackgroundColor(TRgb(255,0,0));
   690 	iTestBack.SetColor(TRgb(255,0,0));
   690 	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
   691 	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
   691 	iTestBack.Activate();
   692 	iTestBack.Activate();
   692 	iTestBack.BeginRedraw();
       
   693 	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
       
   694 	iGc->Deactivate();
       
   695 	iTestBack.EndRedraw();
       
   696 	iTestBack.SetVisible(ETrue);
   693 	iTestBack.SetVisible(ETrue);
   697 	
   694 	
   698 	struct DrawCompare
   695 	struct DrawCompare
   699 		{
   696 		{
   700 		static void Draw(CWindowGc*	aGc)
   697 		static void Draw(CWindowGc*	aGc)
   900 	LOG_AND_PANIC_IF_NOT_GCE;
   897 	LOG_AND_PANIC_IF_NOT_GCE;
   901 	ResetScreens();
   898 	ResetScreens();
   902 	TInt error;
   899 	TInt error;
   903 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0008L"),_L("Change Size Mode"));
   900 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0008L"),_L("Change Size Mode"));
   904 
   901 
   905 	iTestBack=RWindow(iSession);
   902     iTestBack=RBlankWindow(iSession);
   906 	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
   903     ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
   907 	iTestBack.SetRequiredDisplayMode(iDisplayMode);
   904     iTestBack.SetRequiredDisplayMode(iDisplayMode);
   908 	iTestBack.SetBackgroundColor(TRgb(255,0,0));
   905     iTestBack.SetColor(TRgb(255,0,0));
   909 	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
   906     iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
   910 	iTestBack.Activate();
   907     iTestBack.Activate();
   911 	iTestBack.BeginRedraw();
   908     iTestBack.SetVisible(ETrue);
   912 	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
   909     iSession.Finish(ETrue);
   913 	iGc->Deactivate();
       
   914 	iTestBack.EndRedraw();
       
   915 	iTestBack.SetVisible(ETrue);
       
   916 	
   910 	
   917 	
   911 	
   918 	if (CWindowGc*	gc=BeginActivateWithWipe(ETrue,iCompare,TRgb(128,128,128)))
   912 	if (CWindowGc*	gc=BeginActivateWithWipe(ETrue,iCompare,TRgb(128,128,128)))
   919 		{
   913 		{
   920 		gc->SetPenStyle(gc->ESolidPen);
   914 		gc->SetPenStyle(gc->ESolidPen);
  1082 	TInt error;
  1076 	TInt error;
  1083 	iSession.Finish(ETrue);
  1077 	iSession.Finish(ETrue);
  1084 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0009L"),_L("Change Size Mode"));
  1078 	MakeTitleAndCompareWindowsL(_L("GFX_WSERV_DYNAMICRES_0009L"),_L("Change Size Mode"));
  1085 	iSession.Finish(ETrue);
  1079 	iSession.Finish(ETrue);
  1086 
  1080 
  1087 	iTestBack=RWindow(iSession);
  1081     iTestBack=RBlankWindow(iSession);
  1088 	ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
  1082     ASSERT_EQUALS(iTestBack.Construct(iGroup, ++iWindowHandle), KErrNone);
  1089 	iTestBack.SetRequiredDisplayMode(iDisplayMode);
  1083     iTestBack.SetRequiredDisplayMode(iDisplayMode);
  1090 	iTestBack.SetBackgroundColor(TRgb(255,0,0));
  1084     iTestBack.SetColor(TRgb(255,0,0));
  1091 	iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
  1085     iTestBack.SetExtent(iTestPos.iTl,iTestPos.Size());
  1092 	iTestBack.Activate();
  1086     iTestBack.Activate();
  1093 	iTestBack.BeginRedraw();
  1087     iTestBack.SetVisible(ETrue);
  1094 	ActivateWithWipe(iGc,iTestBack,TRgb(255,0,0));
       
  1095 	iGc->Deactivate();
       
  1096 	iTestBack.EndRedraw();
       
  1097 	iTestBack.SetVisible(ETrue);
       
  1098 	iSession.Finish(ETrue);
  1088 	iSession.Finish(ETrue);
  1099 	
  1089 	
  1100 	struct DrawCompare
  1090 	struct DrawCompare
  1101 		{
  1091 		{
  1102 		static void Draw(CWindowGc*	aGc)
  1092 		static void Draw(CWindowGc*	aGc)
  1501 	After(500000);
  1491 	After(500000);
  1502 	}
  1492 	}
  1503 
  1493 
  1504 void CDSATestDrawing::Draw()
  1494 void CDSATestDrawing::Draw()
  1505 	{
  1495 	{
  1506 	iWin->Invalidate();
  1496 	//Should not invalidate the window containing DSA drawing. That's the whole point!
  1507 	iWin->BeginRedraw();
       
  1508 	CFbsBitGc* gc = iDSA->Gc();
  1497 	CFbsBitGc* gc = iDSA->Gc();
  1509 	gc->SetPenStyle(gc->ESolidPen);
  1498 	gc->SetPenStyle(gc->ESolidPen);
  1510 	gc->SetPenColor(TRgb(255,0,0));
  1499 	gc->SetPenColor(TRgb(255,0,0));
  1511 	gc->SetBrushStyle(gc->ENullBrush);
  1500 	gc->SetBrushStyle(gc->ENullBrush);
  1512 	iRect.Shrink(1, 1);
  1501 	iRect.Shrink(1, 1);
  1513 	gc->DrawRect(iRect);
  1502 	gc->DrawRect(iRect);
  1514 	iDSA->ScreenDevice()->Update();
  1503 	iDSA->ScreenDevice()->Update();
  1515 	iWin->EndRedraw();
       
  1516 	
  1504 	
  1517 	}
  1505 	}
  1518 void CDSATestDrawing::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) 
  1506 void CDSATestDrawing::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) 
  1519 	{
  1507 	{
  1520 	
  1508 	
  1635 			{
  1623 			{
  1636 			INFO_PRINTF1(_L("DSA drawing region is empty, skip checking pixel colour"));
  1624 			INFO_PRINTF1(_L("DSA drawing region is empty, skip checking pixel colour"));
  1637 			continue;
  1625 			continue;
  1638 			}
  1626 			}
  1639 		
  1627 		
  1640 		//if my rectangle's iTl is (0,0) and iBr is (100,100). Why does it gives me the rect width and height
       
  1641 		//both 100? 0 - 100 is 101 pixels drawn. Or does this indicates iBr is exclusive and iTl is inclusive?
       
  1642 		//Ruo: Oh I almost believe iBr is exclusive now
  1628 		//Ruo: Oh I almost believe iBr is exclusive now
  1643 		TDisplayConfiguration dispConfigAfter2;
  1629 		TDisplayConfiguration dispConfigAfter2;
  1644 		interface->GetConfiguration(dispConfigAfter2);
  1630 		interface->GetConfiguration(dispConfigAfter2);
  1645 		TSize theSize;
  1631 		TSize theSize;
  1646 		dispConfigAfter2.GetResolution(theSize);
  1632 		dispConfigAfter2.GetResolution(theSize);
  2720 		TInt heapFail = 1;
  2706 		TInt heapFail = 1;
  2721 		TBool notComplete = ETrue;
  2707 		TBool notComplete = ETrue;
  2722 		TInt completeCount = 0;
  2708 		TInt completeCount = 0;
  2723 		while (notComplete)
  2709 		while (notComplete)
  2724 			{
  2710 			{
       
  2711             RDebug::Printf("iInfoScreenDevice->SetAppScreenMode");
  2725 			iInfoScreenDevice->SetAppScreenMode(screenModeList[index]);
  2712 			iInfoScreenDevice->SetAppScreenMode(screenModeList[index]);
  2726 			iSession.Finish(ETrue);
  2713 			iSession.Finish(ETrue);
  2727 			iSession.HeapSetFail(RHeap::EDeterministic,heapFail);
  2714 			iSession.HeapSetFail(RHeap::EDeterministic,heapFail);
       
  2715             RDebug::Printf("iInfoScreenDevice->SetAppScreenMode");
  2728 			iInfoScreenDevice->SetScreenMode(screenModeList[index]);
  2716 			iInfoScreenDevice->SetScreenMode(screenModeList[index]);
       
  2717             RDebug::Printf("SetScreenMode done");
  2729 			iSession.HeapSetFail(RHeap::ENone,0);
  2718 			iSession.HeapSetFail(RHeap::ENone,0);
  2730 			iSession.Finish(ETrue);
  2719 			iSession.Finish(ETrue);
       
  2720             RDebug::Printf("Finish done");
  2731 			Pause(50);
  2721 			Pause(50);
  2732 			TInt newMode = iInfoScreenDevice->CurrentScreenMode();
  2722 			TInt newMode = iInfoScreenDevice->CurrentScreenMode();
  2733 
  2723 
  2734 			if (screenModeList[index] == newMode)
  2724 			if (screenModeList[index] == newMode)
  2735 				{
  2725 				{
  2736 				completeCount++;
  2726 				completeCount++;
  2737 				if (completeCount == 5)
  2727 				if (completeCount == 5)
  2738 					{
  2728 					{
  2739 					INFO_PRINTF2(_L("Succeeded with heapFail = %d"),heapFail);
  2729 					INFO_PRINTF3(_L("Mode %i Succeeded with heapFail = %d"),index, heapFail);
  2740 					notComplete = EFalse;
  2730 					notComplete = EFalse;
  2741 					}
  2731 					}
  2742 				iInfoScreenDevice->SetAppScreenMode(screenModeList[0]);
  2732 				iInfoScreenDevice->SetAppScreenMode(screenModeList[0]);
  2743 				iInfoScreenDevice->SetScreenMode(screenModeList[0]);
  2733 				iInfoScreenDevice->SetScreenMode(screenModeList[0]);
  2744 				iSession.Finish(ETrue);
  2734 				iSession.Finish(ETrue);
  3738 			}
  3728 			}
  3739 		}
  3729 		}
  3740 
  3730 
  3741 	if (aBitmapRegionPairArray.Count()>0)
  3731 	if (aBitmapRegionPairArray.Count()>0)
  3742 		{
  3732 		{
       
  3733         RDebug::Printf("Checking");
       
  3734         TInt countchecks=0;
  3743 		for (TInt i=0; i<width; i++)
  3735 		for (TInt i=0; i<width; i++)
  3744 			{
  3736 			{
  3745 			for (TInt j=0; j<height; j++)
  3737 			for (TInt j=0; j<height; j++)
  3746 				{
  3738 				{
  3747 				TInt arrayIndex = 0;
  3739 				TInt arrayIndex = 0;
  3820 						}
  3812 						}
  3821 					}
  3813 					}
  3822 				}
  3814 				}
  3823 			}
  3815 			}
  3824 		}
  3816 		}
       
  3817 	
  3825 	ignoreDueToResizing.Close();
  3818 	ignoreDueToResizing.Close();
  3826 	if (errorPixels+diffPixels < 2)
  3819 	if (errorPixels+diffPixels < 2)
  3827 		{
  3820 		{
  3828 		return ETrue;
  3821 		return ETrue;
  3829 		}
  3822 		}