windowing/windowserver/test/TAutoServer/TAutoServer.cpp
changeset 0 5d03bc08d59c
child 17 e375a7921169
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Internal Symbian test code
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @internalComponent
       
    21 */
       
    22 
       
    23 #include "TAutoServer.h"
       
    24 
       
    25 // Convereted tests
       
    26 #include "TEVENT.H"
       
    27 #include "TSPRITE.H"
       
    28 #include "TBLANK.H"
       
    29 #include "TMDISPLAY.H"
       
    30 #include "TPROCPRI.H"
       
    31 #include "TWINDOW.H"
       
    32 #include "TRECTLIST.H"
       
    33 #include "TDERIVED.H"
       
    34 #include "TSCRDEV.H"
       
    35 #include "TSCRDEVRESSWITCH.H"
       
    36 #include "TMESSAGE.H"
       
    37 #include "TOOMDRAW.H"
       
    38 #include "TREDRSTR.H"
       
    39 #include "TPNTKEY.H"
       
    40 #include "TScreenModeScaling.h"
       
    41 #include "TSCREENMODEPOSITIONING.H"
       
    42 #include "TKRepeat.H"
       
    43 #include "TBITMAP.H"
       
    44 #include "TBACKUPW.H"
       
    45 #include "TFADE.H"
       
    46 #include "TGETPIXEL.H"
       
    47 #include "TORDINAL.H"
       
    48 #include "TGWHANDLE.H"
       
    49 #include "TTransptAnim.h"
       
    50 #include "TKEY.H"
       
    51 #include "TMODCHG.H"
       
    52 #include "TTEXTCURS.H"
       
    53 #include "TSCROLL.H"
       
    54 #include "TAlphaChannel.H"
       
    55 #include "TPANIC.H"
       
    56 #include "TGDI.H"
       
    57 #include "TRegion.H"
       
    58 #include "TREDRAW.H"
       
    59 #include "TMulTran.H"
       
    60 #include "TALPHAWIN.H"
       
    61 #include "TMULTCON.H"
       
    62 #include "TPNTCAP.H"
       
    63 #include "TSCRMODE.H"
       
    64 #include "TAUTODLL.H"
       
    65 #include "TWSGRAPHS.H"
       
    66 #include "TCAPABILITY.H"
       
    67 #include "TPointer.H"
       
    68 #include "tdirecta.h"
       
    69 #include "tdirecta2.h"
       
    70 #include "TOOM.H"
       
    71 #include "TCapKey.H"
       
    72 #include "TMULSCREENS.h"
       
    73 #include "TBUFFERSECURITY.H"
       
    74 #include "TFLICKERFREE.H"
       
    75 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
       
    76 #include "TFADINGBITMAP.H"
       
    77 #endif
       
    78 #include "tcrpanim.h"
       
    79 #include "TMemLeakMode.h"
       
    80 #include "tgc.h"
       
    81 #include "THeartBeat.h"
       
    82 #include "TGRAPHICSDRAWER.H"
       
    83 #include "tw32cmdbuf.h"
       
    84 #include "tadvancedpointerevent.h"
       
    85 #include "tmultiptrevent.h"
       
    86 #include "tdrawresource.h"
       
    87 #include "twindowsizecache.h"
       
    88 
       
    89 /* Path to the script
       
    90 z:\GraphicsTest\gditest.script
       
    91 */
       
    92 
       
    93 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
       
    94 _LIT(KServerName,"tautoserver_nonnga");
       
    95 #endif
       
    96 
       
    97 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
       
    98 _LIT(KServerName,"tautoserver_nga");
       
    99 #endif
       
   100 
       
   101 //CTClient *client;
       
   102 
       
   103 CTAutoServer* CTAutoServer::NewL()
       
   104 /**
       
   105    @return - Instance of the test server
       
   106    Same code for Secure and non-secure variants
       
   107    Called inside the MainL() function to create and start the
       
   108    CTestServer derived server.
       
   109  */
       
   110 	{
       
   111 
       
   112 	CTAutoServer * server = new (ELeave) CTAutoServer();
       
   113 	CleanupStack::PushL(server);
       
   114 	// CServer base class call
       
   115 	server->StartL(KServerName);
       
   116 	CleanupStack::Pop(server);
       
   117 	return server;
       
   118 	}
       
   119 
       
   120 
       
   121 LOCAL_C void MainL()
       
   122 //
       
   123 // Secure variant
       
   124 // Much simpler, uses the new Rendezvous() call to sync with the client
       
   125 //
       
   126 	{
       
   127 
       
   128 #if (defined __DATA_CAGING__)
       
   129  	RProcess().DataCaging(RProcess::EDataCagingOn);
       
   130 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
   131 #endif
       
   132 
       
   133 	CActiveScheduler* sched=NULL;
       
   134 	sched=new(ELeave) CActiveScheduler;
       
   135 	CActiveScheduler::Install(sched);
       
   136 	CTAutoServer* server = NULL;
       
   137 	// Create the CTestServer derived server
       
   138 	TRAPD(err,server = CTAutoServer::NewL());
       
   139 	if(!err)
       
   140 		{
       
   141 //		client = CreateClientL();
       
   142 //		client->SetScreenNumber(1);
       
   143 //		client->ConstructL();
       
   144 
       
   145 		// Sync with the client and enter the active scheduler
       
   146 		RProcess::Rendezvous(KErrNone);
       
   147 		sched->Start();
       
   148 
       
   149 		}
       
   150 	delete server;
       
   151 	delete sched;
       
   152 //
       
   153 	}
       
   154 
       
   155 GLDEF_C TInt E32Main()
       
   156 
       
   157 /** @return - Standard Epoc error code on process exit
       
   158     Secure variant only
       
   159     Process entry point. Called by client using RProcess API
       
   160 */
       
   161 	{
       
   162 
       
   163 
       
   164 	__UHEAP_MARK;
       
   165 
       
   166 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
   167 	if(cleanup == NULL)
       
   168 		{
       
   169 		return KErrNoMemory;
       
   170 		}
       
   171 
       
   172 	TWinCommand commandLine;
       
   173 	User::CommandLine(commandLine);
       
   174 	TInt ret=KErrNone;
       
   175 	if (commandLine.Length()>0)
       
   176 		{
       
   177 		ret=CProcess::Start(commandLine);
       
   178 		// pass test result to parent process (in multi display test)
       
   179 		RProcess().Terminate(ret);
       
   180 		return(ret);
       
   181 		}
       
   182 
       
   183 
       
   184 	TRAPD(err,MainL());
       
   185 	// This if statement is here just to shut up RVCT, which would otherwise warn
       
   186 	// that err was set but never used
       
   187 	if (err)
       
   188 	    {
       
   189 	    err = KErrNone;
       
   190 	    }
       
   191 	delete cleanup;
       
   192 
       
   193 	__UHEAP_MARKEND;
       
   194 
       
   195 //	if (client != NULL)
       
   196 //	delete client;
       
   197 	return KErrNone;
       
   198     }
       
   199 
       
   200 CTestStep* CTAutoServer::CreateTestStep(const TDesC& aStepName)
       
   201 /**
       
   202    @return - A CTestStep derived instance
       
   203    Secure and non-secure variants
       
   204    Implementation of CTestServer pure virtual
       
   205  */
       
   206 	{
       
   207 	// Debug statements to indicate the progress of the wserv test suite
       
   208 	RDebug::Print(_L("**********************************************"));
       
   209 	RDebug::Print(_L("* WServ Test Step: %S"), &aStepName);
       
   210 	RDebug::Print(_L("**********************************************"));
       
   211 	
       
   212 	++CTestDriver::iTestNum;
       
   213 	CTestStep* testStep = NULL;
       
   214 	if(aStepName == KTEventTestStep)
       
   215 		testStep = new CTEventTestStep();
       
   216 	else if(aStepName == KTTSpriteStep)
       
   217 		testStep = new CTTSpriteStep();
       
   218 	else if(aStepName == KTBlankStep)
       
   219 		testStep = new CTBlankStep();
       
   220 	else if(aStepName == KTRectListStep)
       
   221 		testStep = new CTRectListStep();
       
   222 	else if(aStepName == KTMultiDisplayStep)
       
   223 		testStep = new CTMultiDisplayStep();
       
   224 	else if(aStepName == KTWindowTestStep)
       
   225 		testStep = new CTWindowTestStep();
       
   226 	else if(aStepName == KTDerivedStep)
       
   227 		testStep = new CTDerivedStep();
       
   228 	else if(aStepName == KTScreenDeviceStep)
       
   229 		testStep = new CTScreenDeviceStep();
       
   230 	else if(aStepName == KTScreenDeviceResSwitchStep)
       
   231 	    testStep = new CTScreenDeviceResSwitchStep();
       
   232 	else if(aStepName == KTMessageStep)
       
   233 		testStep = new CTMessageStep();
       
   234 	else if(aStepName == KToomDrawStep)
       
   235 		testStep = new CToomDrawStep();
       
   236 	else if(aStepName == KTRedrawStoringStep)
       
   237 		testStep = new CTRedrawStoringStep();
       
   238 	else if(aStepName == KTPntKeyStep)
       
   239 		testStep = new CTPntKeyStep();
       
   240 	else if(aStepName == KTKRepeatStep)
       
   241 		testStep = new CTKRepeatStep();
       
   242 	else if(aStepName == KTBitmapStep)
       
   243 		testStep = new CTBitmapStep();
       
   244 	else if(aStepName == KTScreenModeScalingStep)
       
   245 		testStep = new CTScreenModeScalingStep();
       
   246 	else if(aStepName == KTScreenModePositioningStep)
       
   247 		testStep = new CTScreenModePositioningStep();
       
   248 	else if(aStepName == KTBackedUpWindowStep)
       
   249 		testStep = new CTBackedUpWindowStep();
       
   250 	else if(aStepName == KTFadeStep)
       
   251 		testStep = new CTFadeStep();
       
   252 	else if(aStepName == KTGetPixelStep)
       
   253 		testStep = new CTGetPixelStep();
       
   254 	else if(aStepName == KTOrdinalStep)
       
   255 		testStep = new CTOrdinalStep();
       
   256 	else if(aStepName == KTGwHandleStep)
       
   257 		testStep = new CTGwHandleStep();
       
   258 	else if (aStepName == KTTransparentAnimStep)
       
   259 		testStep = new CTTransparentAnimStep();	
       
   260 	else if(aStepName == KTProcPriStep)
       
   261 		testStep = new CTProcPriStep();
       
   262 	else if(aStepName == KTKeyStep)
       
   263 		testStep = new CTKeyStep();
       
   264  	else if(aStepName == KTModifiersChangedStep)
       
   265   		testStep = new CTModifiersChangedStep();
       
   266  	else if(aStepName == KTCursorTestStep)
       
   267   		testStep = new CTCursorTestStep();
       
   268  	else if(aStepName == KTScrollStep)
       
   269   		testStep = new CTScrollStep();
       
   270   	else if(aStepName == KTAlphaChannelStep)
       
   271   		testStep = new CTAlphaChannelStep();
       
   272  	else if(aStepName == KTPanicStep)
       
   273   		testStep = new CTPanicStep();
       
   274  	else if(aStepName == KTGdiStep)
       
   275   		testStep = new CTGdiStep();
       
   276  	else if(aStepName == KTRegionStep)
       
   277   		testStep = new CTRegionStep();
       
   278  	else if(aStepName == KTRedrawTestStep)
       
   279   		testStep = new CTRedrawTestStep();
       
   280  	else if(aStepName == KTMultipleTransStep)
       
   281   		testStep = new CTMultipleTransStep();
       
   282  	else if(aStepName == KTAlphaWinStep)
       
   283   		testStep = new CTAlphaWinStep();
       
   284  	else if(aStepName == KTMultiConStep)
       
   285   		testStep = new CTMultiConStep();
       
   286  	else if(aStepName == KTPointerCaptureStep)
       
   287   		testStep = new CTPointerCaptureStep();
       
   288  	else if(aStepName == KTScrModeStep)
       
   289   		testStep = new CTScrModeStep();
       
   290  	else if(aStepName == KTAnimDllStep)
       
   291   		testStep = new CTAnimDllStep();
       
   292  	else if(aStepName == KTWsGraphsStep)
       
   293   		testStep = new CTWsGraphsStep();
       
   294  	else if(aStepName == KTCapabilityStep)
       
   295   		testStep = new CTCapabilityStep();
       
   296  	else if(aStepName == KTPointerStep)
       
   297   		testStep = new CTPointerStep();
       
   298  	else if(aStepName == KTDirectStep)
       
   299   		testStep = new CTDirectStep();
       
   300  	else if(aStepName == KTDirect2Step)
       
   301   		testStep = new CTDirect2Step();
       
   302  	else if(aStepName == KTOomStep)
       
   303   		testStep = new CTOomStep();
       
   304  	else if(aStepName == KTCaptureKeyStep)
       
   305   		testStep = new CTCaptureKeyStep();
       
   306   	else if(aStepName == KTMulScreensStep)
       
   307   		testStep = new CTMulScreensStep();
       
   308  	else if(aStepName == KTBufferSecurityStep)
       
   309   		testStep = new CTBufferSecurityStep();
       
   310    	else if(aStepName == KTFlickerFreeStep)
       
   311   		testStep = new CTFlickerFreeStep();
       
   312 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
       
   313 	else if(aStepName == KTFadingBitmapStep)
       
   314   		testStep = new CTFadingBitmapStep();
       
   315 #endif
       
   316 	else if(aStepName == KTCrpAnimStep)
       
   317 		testStep = new CTCrpAnimStep();
       
   318 	else if(aStepName == KTMemLeakCheckEnableStep)
       
   319 		testStep = new CTMemLeakCheckEnableStep();
       
   320 	else if(aStepName == KTMemLeakCheckOneShotStep)
       
   321 		testStep = new CTMemLeakCheckOneShotStep();
       
   322 	else if(aStepName == KTGcStep)
       
   323 		testStep = new CTGcStep(); 
       
   324  	else if(aStepName == KTHeartBeatTestStep)
       
   325   		testStep = new CTHeartBeatTestStep();
       
   326  	else if(aStepName == KTGraphicsDrawerStep)
       
   327  		testStep = new CTGraphicsDrawerStep();
       
   328  	else if(aStepName == KTW32CmdBufStep) 
       
   329  		testStep = new CTW32CmdBufStep();
       
   330 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
       
   331  	else if(aStepName == KTAdvancedPointerEventStep)
       
   332  		testStep = new CTAdvancedPointerEventStep();
       
   333  	else if(aStepName == KTMultiPtrEventTestStep) 
       
   334  	 	testStep = new CTMultiPtrEventTestStep();
       
   335 	else if(aStepName == KTDrawResourceStep)
       
   336 		testStep = new CTDrawResourceStep();
       
   337     else if(aStepName == KTWindowSizeCacheTestStep)
       
   338         testStep = new CTWindowSizeCacheTestStep();
       
   339 #endif
       
   340 	return testStep;
       
   341 	}