os/graphics/graphicsdeviceinterface/bitgdi/tbit/TBitgdiServer.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2006-2010 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 #include "tmultiplescreens.h"
    39 
    40  
    41 
    42 _LIT(KServerName,"TBitgdiServer");
    43 
    44 CTBitgdiServer* CTBitgdiServer::NewL()
    45 	{
    46 	CTBitgdiServer * server = new (ELeave) CTBitgdiServer();
    47 	CleanupStack::PushL(server);
    48 	// CServer base class call
    49 	server->StartL(KServerName);
    50 	CleanupStack::Pop(server);
    51 	return server;
    52 	}
    53 
    54 
    55 LOCAL_C void MainL()
    56 	{
    57  	RProcess().DataCaging(RProcess::EDataCagingOn);
    58 	RProcess().SecureApi(RProcess::ESecureApiOn);
    59 	CActiveScheduler* sched=NULL;
    60 	sched=new(ELeave) CActiveScheduler;
    61 	CActiveScheduler::Install(sched);
    62 	CTBitgdiServer* server = NULL;
    63 	// Create the CTestServer derived server
    64 	TRAPD(err,server = CTBitgdiServer::NewL());
    65 	if(!err)
    66 		{
    67 		// Sync with the client and enter the active scheduler
    68 		RProcess::Rendezvous(KErrNone);
    69 		sched->Start();
    70 		}
    71 	delete server;
    72 	delete sched;
    73 	}
    74 
    75 GLDEF_C TInt E32Main()
    76 	{
    77 	__UHEAP_MARK;
    78 	CTrapCleanup* cleanup = CTrapCleanup::New();
    79 	if(cleanup == NULL)
    80 		{
    81 		return KErrNoMemory;
    82 		}
    83 	TRAPD(err,MainL());
    84 	if (err)
    85 	    {
    86 		RDebug::Print(_L("TBitgdiServer::MainL - Error: %d"), err);
    87 	   	User::Panic(KServerName,err);
    88 	    }
    89 	delete cleanup;
    90 	__UHEAP_MARKEND;
    91 	return KErrNone;
    92     }
    93 
    94 
    95 
    96 CTestStep* CTBitgdiServer::CreateTestStep(const TDesC& aStepName)
    97 	{
    98 	CTestStep* testStep = NULL;
    99 	
   100 	if(aStepName == KTAutoStep)
   101 		{
   102 		testStep = new CTAutoStep();
   103 		}
   104 	else if(aStepName == KTGdiStep)
   105 		{
   106 		testStep = new CTGdiStep();
   107 		}
   108 	else if(aStepName == KTClipStep)
   109 		{
   110 		testStep = new CTClipStep();
   111 		}
   112 	else if(aStepName == KTClip2Step)
   113 		{
   114 		testStep = new CTClip2Step();
   115 		}
   116 	else if(aStepName == KTParamStep)
   117 		{
   118 		testStep = new CTParamStep();
   119 		}
   120 	else if(aStepName == KTSwitchStep)
   121 		{
   122 		testStep = new CTSwitchStep();
   123 		}
   124 	else if(aStepName == KTAcceleratorStep)
   125 		{
   126 		testStep = new CTAcceleratorStep();
   127 		}
   128 	else if(aStepName == KTDefectStep)
   129 		{
   130 		testStep = new CTDefectStep();
   131 		}
   132 	else if(aStepName == KTDefect2Step)
   133 		{
   134 		testStep = new CTDefect2Step();
   135 		}
   136 	else if(aStepName == KTBitBltStep)
   137 		{
   138 		testStep = new CTBitBltStep();
   139 		}
   140 	else if(aStepName == KTBitgdiScalingStep)
   141 		{
   142 		testStep = new CTBitgdiScalingStep();
   143 		}
   144 	else if(aStepName == KTAlphaBlendingStep)
   145 		{
   146 		testStep = new CTAlphaBlendingStep();
   147 		}
   148 	else if(aStepName == KTFontSelectStep)
   149 		{
   150 		testStep = new CTFontSelectStep();
   151 		}		
   152 	else if(aStepName == KTFontStep)
   153 		{
   154 		testStep = new CTFontStep();
   155 		}		
   156 	else if(aStepName == KTOutlineAndShadowFontsStep)
   157 		{
   158 		testStep = new CTOutlineAndShadowFontsStep();
   159 		}
   160 	else if(aStepName == KTExtendedBitmapStep)
   161 		{
   162 		testStep = new CTExtendedBitmapStep();
   163 		}
   164 	else if(aStepName == KTExtendedBitmapNegativeStep)
   165 		{
   166 		testStep = new CTExtendedBitmapNegativeStep();
   167 		}
   168 	else if(aStepName == KTMultipleScreensStep)
   169 		{
   170 		testStep = new CTMultipleScreensStep();
   171 		}
   172 	TBuf<64> log;
   173 	_LIT(KBitgdi,"BITGDI Test %S ");
   174 	_LIT(KSucess,"created sucessfully.");
   175 	_LIT(KFail,"failed to create.");
   176 	log.Format(KBitgdi,&aStepName);
   177 	if (testStep)
   178 		log.Append(KSucess);
   179 	else
   180 		{
   181 		log.Append(KFail);
   182 		INFO_PRINTF1(log);
   183 		}
   184 	RDebug::Print(log);
   185 	return testStep;
   186 	}
   187