os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagesw.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagesw.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,154 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code 
    1.23 +*/
    1.24 +
    1.25 +#include "tsgimagesw.h"
    1.26 +#include <graphics/sgimage_sw.h>
    1.27 +
    1.28 +CTSgImageSw::CTSgImageSw()
    1.29 +	{
    1.30 +	INFO_PRINTF1(_L("Graphics resource component test - RSgImage Sw Implementation Tests.\r\n"));
    1.31 +	}
    1.32 +
    1.33 +CTSgImageSw::~CTSgImageSw()
    1.34 +	{
    1.35 +	}
    1.36 +
    1.37 +/** 
    1.38 +Overrides of base class pure virtual
    1.39 +Our implementation only gets called if the base class doTestStepPreambleL() did
    1.40 +not leave. That being the case, the current test result value will be EPass.
    1.41 +@leave Gets system wide error code
    1.42 +@return TVerdict code
    1.43 +*/
    1.44 +TVerdict CTSgImageSw::doTestStepL()
    1.45 +	{
    1.46 +	SetTestStepID(_L("GRAPHICS-RESOURCE-0041"));
    1.47 +	INFO_PRINTF1(_L("Getting supported pixel formats on software implementation.\r\n"));
    1.48 +	TestGetPixelFormatsSWL();
    1.49 +	RecordTestResultL();
    1.50 +	
    1.51 +	SetTestStepID(_L("GRAPHICS-RESOURCE-0042"));
    1.52 +	INFO_PRINTF1(_L("Getting the interfaces implemented by CSgImageImpl class.\r\n"));
    1.53 +	TestGetImageInterfacesSWL();
    1.54 +	RecordTestResultL();
    1.55 +		
    1.56 +	SetTestStepID(_L("GRAPHICS-RESOURCE-0043"));
    1.57 +	INFO_PRINTF1(_L("Getting the address information from the MSgImage_Sw interface.\r\n"));
    1.58 +	TestGetImageInterfaceAddressInfo();
    1.59 +	RecordTestResultL();
    1.60 +		
    1.61 +	return TestStepResult();
    1.62 +	}
    1.63 +
    1.64 +/**
    1.65 +@SYMTestCaseID			GRAPHICS-RESOURCE-0041
    1.66 +@SYMTestCaseDesc		Gets supported pixel formats on software reference implementation.
    1.67 +@SYMPREQ				PREQ39
    1.68 +@SYMREQ 				REQ8809
    1.69 +@SYMREQ 				REQ9175
    1.70 +@SYMFssID				RSgImage::GetPixelFormats(const TSgImageInfo&, TUidPixelFormat*, TInt&)
    1.71 +@SYMTestPriority		Critical
    1.72 +@SYMTestType			Unit Test
    1.73 +@SYMTestPurpose			To ensure all the available pixel formats are returned 
    1.74 +						in the array and the actual number of pixel formats in
    1.75 +						the input/output aCount parameter for the software
    1.76 +						reference implementation.
    1.77 +@SYMTestActions			Initialise the graphics resource component. Construct a
    1.78 +						TSgImageInfo object and Initialise the member variables.
    1.79 +						Construct a TInt array of size\n
    1.80 +						\t 1. NULL\n						
    1.81 +						\t 2. greater than the number of supported pixel formats\n
    1.82 +						\t 3. equal to the number of supported pixel formats\n
    1.83 +						\t 4. less than the number of supported pixel formats
    1.84 +@SYMTestExpectedResults	The function must return\n
    1.85 +						\t 1. KErrNone\n
    1.86 +						\t 2. KErrNone\n
    1.87 +						\t 3. KErrNone\n
    1.88 +						\t 4. KErrOverFlow\n
    1.89 +						The supported pixel formats are populated into the array
    1.90 +						and aCount stores the actual number of supported pixel formats.
    1.91 +						The returned pixel formats should cover the pixel formats
    1.92 +						in the image compatibility table that works on all platforms.
    1.93 +						All the returned pixel formats should appear on the image
    1.94 +						compatibility list for the software reference implementation.
    1.95 +@SYMTestStatus			Defined 
    1.96 + */
    1.97 +void CTSgImageSw::TestGetPixelFormatsSWL()
    1.98 +	{
    1.99 +	TestOpenDriverL();
   1.100 +	//check all the pixel formats returned are in the common compatibility guarantees table
   1.101 +	TestGetPixelFormatCompatibilityGuaranteesL();
   1.102 +	
   1.103 +	//check the pixel formates supported by the reference implementation only
   1.104 +	CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageCompositionSource|ESgUsageOpenGlesTexture2D|ESgUsageOpenVgImage|ESgUsageDirectGdiTarget, ETrue, KSgScreenIdMain);
   1.105 +	CheckPixelFormatPresent(EUidPixelFormatRGB_565);
   1.106 +	CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
   1.107 +	CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
   1.108 +	
   1.109 +	TestCloseDriver();
   1.110 +	}
   1.111 +
   1.112 +
   1.113 +/**
   1.114 +@SYMTestCaseID			GRAPHICS-RESOURCE-0042
   1.115 +@SYMTestCaseDesc		Gets the interfaces implemented by CSgImageImpl class.
   1.116 +@SYMPREQ				PREQ39
   1.117 +@SYMREQ 				REQ8809
   1.118 +@SYMREQ 				REQ9175
   1.119 +@SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
   1.120 +						RSgImage::GetInterface()
   1.121 +@SYMTestPriority		Critical
   1.122 +@SYMTestType			Unit Test
   1.123 +@SYMTestPurpose			To ensure the MSgImage_Sw interface can be returned from RSgImage.
   1.124 +@SYMTestActions			Initialise the graphics resource component. Create an image. Call
   1.125 +						GetInterface() to return the MSgImage_Sw interface.
   1.126 +@SYMTestExpectedResults	Both interfaces are returned successfully.
   1.127 +@SYMTestStatus			Defined 
   1.128 + */
   1.129 +void CTSgImageSw::TestGetImageInterfacesSWL()
   1.130 +	{
   1.131 +	
   1.132 +	}
   1.133 +
   1.134 +/**
   1.135 +@SYMTestCaseID			GRAPHICS-RESOURCE-0043
   1.136 +@SYMTestCaseDesc		Gets the address information from the MSgImage_Sw interface.
   1.137 +@SYMPREQ				PREQ39
   1.138 +@SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
   1.139 +						RSgImage::Interface()\n 
   1.140 +						MSgImage_Sw::DataAddress()\n 
   1.141 +						MSgImage_Sw::DataStride()
   1.142 +@SYMTestPriority		Critical
   1.143 +@SYMTestType			Unit Test
   1.144 +@SYMTestPurpose			To ensure the software solution of the RSgImage returns 
   1.145 +						the correct image address information.
   1.146 +@SYMTestActions			Initialise the graphics resource component. Create an image. Call
   1.147 +						GetInterface() to return the MSgImage_Sw interface. Call the DataAddress()
   1.148 +						and DataStride() functions on the interface. Then modify some random 
   1.149 +						byte within the data address of the image and read back to check if the
   1.150 +						byte has been modified.
   1.151 +@SYMTestExpectedResults	The byte should be successfully modified. 
   1.152 +@SYMTestStatus			Defined 
   1.153 + */	
   1.154 +void CTSgImageSw::TestGetImageInterfaceAddressInfo()
   1.155 +	{
   1.156 +	
   1.157 +	}