graphicsdeviceinterface/bitgdi/tbit/TBitgdiServer.cpp
changeset 0 5d03bc08d59c
child 136 62bb7c97884c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2006-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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 #include "TBitgdiServer.h"
       
    23 #include "TAUTO.H"
       
    24 #include "tbase.h"
       
    25 #include "TClip.h"
       
    26 #include "tparam.h"
       
    27 #include "tswitch.h"
       
    28 #include "TAccelerator.h"
       
    29 #include "TDefect.h"
       
    30 #include "TDefect2.h"
       
    31 #include "tbitblt.h"
       
    32 #include "TBitgdiScaling.h"
       
    33 #include "TAlphaBlend.h"
       
    34 #include "tfontselect.h"
       
    35 #include "TFont.h"
       
    36 #include "toutlineandshadowfonts.h"
       
    37 #include "textendedbitmap.h"
       
    38 
       
    39  
       
    40 
       
    41 _LIT(KServerName,"TBitgdiServer");
       
    42 
       
    43 CTBitgdiServer* CTBitgdiServer::NewL()
       
    44 	{
       
    45 	CTBitgdiServer * server = new (ELeave) CTBitgdiServer();
       
    46 	CleanupStack::PushL(server);
       
    47 	// CServer base class call
       
    48 	server->StartL(KServerName);
       
    49 	CleanupStack::Pop(server);
       
    50 	return server;
       
    51 	}
       
    52 
       
    53 
       
    54 LOCAL_C void MainL()
       
    55 	{
       
    56  	RProcess().DataCaging(RProcess::EDataCagingOn);
       
    57 	RProcess().SecureApi(RProcess::ESecureApiOn);
       
    58 	CActiveScheduler* sched=NULL;
       
    59 	sched=new(ELeave) CActiveScheduler;
       
    60 	CActiveScheduler::Install(sched);
       
    61 	CTBitgdiServer* server = NULL;
       
    62 	// Create the CTestServer derived server
       
    63 	TRAPD(err,server = CTBitgdiServer::NewL());
       
    64 	if(!err)
       
    65 		{
       
    66 		// Sync with the client and enter the active scheduler
       
    67 		RProcess::Rendezvous(KErrNone);
       
    68 		sched->Start();
       
    69 		}
       
    70 	delete server;
       
    71 	delete sched;
       
    72 	}
       
    73 
       
    74 GLDEF_C TInt E32Main()
       
    75 	{
       
    76 	__UHEAP_MARK;
       
    77 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    78 	if(cleanup == NULL)
       
    79 		{
       
    80 		return KErrNoMemory;
       
    81 		}
       
    82 	TRAPD(err,MainL());
       
    83 	if (err)
       
    84 	    {
       
    85 		RDebug::Print(_L("TBitgdiServer::MainL - Error: %d"), err);
       
    86 	   	User::Panic(KServerName,err);
       
    87 	    }
       
    88 	delete cleanup;
       
    89 	__UHEAP_MARKEND;
       
    90 	return KErrNone;
       
    91     }
       
    92 
       
    93 
       
    94 
       
    95 CTestStep* CTBitgdiServer::CreateTestStep(const TDesC& aStepName)
       
    96 	{
       
    97 	CTestStep* testStep = NULL;
       
    98 	
       
    99 	if(aStepName == KTAutoStep)
       
   100 		{
       
   101 		testStep = new CTAutoStep();
       
   102 		}
       
   103 	else if(aStepName == KTGdiStep)
       
   104 		{
       
   105 		testStep = new CTGdiStep();
       
   106 		}
       
   107 	else if(aStepName == KTClipStep)
       
   108 		{
       
   109 		testStep = new CTClipStep();
       
   110 		}
       
   111 	else if(aStepName == KTClip2Step)
       
   112 		{
       
   113 		testStep = new CTClip2Step();
       
   114 		}
       
   115 	else if(aStepName == KTParamStep)
       
   116 		{
       
   117 		testStep = new CTParamStep();
       
   118 		}
       
   119 	else if(aStepName == KTSwitchStep)
       
   120 		{
       
   121 		testStep = new CTSwitchStep();
       
   122 		}
       
   123 	else if(aStepName == KTAcceleratorStep)
       
   124 		{
       
   125 		testStep = new CTAcceleratorStep();
       
   126 		}
       
   127 	else if(aStepName == KTDefectStep)
       
   128 		{
       
   129 		testStep = new CTDefectStep();
       
   130 		}
       
   131 	else if(aStepName == KTDefect2Step)
       
   132 		{
       
   133 		testStep = new CTDefect2Step();
       
   134 		}
       
   135 	else if(aStepName == KTBitBltStep)
       
   136 		{
       
   137 		testStep = new CTBitBltStep();
       
   138 		}
       
   139 	else if(aStepName == KTBitgdiScalingStep)
       
   140 		{
       
   141 		testStep = new CTBitgdiScalingStep();
       
   142 		}
       
   143 	else if(aStepName == KTAlphaBlendingStep)
       
   144 		{
       
   145 		testStep = new CTAlphaBlendingStep();
       
   146 		}
       
   147 	else if(aStepName == KTFontSelectStep)
       
   148 		{
       
   149 		testStep = new CTFontSelectStep();
       
   150 		}		
       
   151 	else if(aStepName == KTFontStep)
       
   152 		{
       
   153 		testStep = new CTFontStep();
       
   154 		}		
       
   155 	else if(aStepName == KTOutlineAndShadowFontsStep)
       
   156 		{
       
   157 		testStep = new CTOutlineAndShadowFontsStep();
       
   158 		}
       
   159 	else if(aStepName == KTExtendedBitmapStep)
       
   160 		{
       
   161 		testStep = new CTExtendedBitmapStep();
       
   162 		}
       
   163 	else if(aStepName == KTExtendedBitmapNegativeStep)
       
   164 		{
       
   165 		testStep = new CTExtendedBitmapNegativeStep();
       
   166 		}
       
   167 	TBuf<64> log;
       
   168 	_LIT(KBitgdi,"BITGDI Test %S ");
       
   169 	_LIT(KSucess,"created sucessfully.");
       
   170 	_LIT(KFail,"failed to create.");
       
   171 	log.Format(KBitgdi,&aStepName);
       
   172 	if (testStep)
       
   173 		log.Append(KSucess);
       
   174 	else
       
   175 		{
       
   176 		log.Append(KFail);
       
   177 		INFO_PRINTF1(log);
       
   178 		}
       
   179 	RDebug::Print(log);
       
   180 	return testStep;
       
   181 	}
       
   182