os/graphics/graphicsresourceservices/graphicsresource/test/tsgimagesw.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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 "tsgimagesw.h"
    23 #include <graphics/sgimage_sw.h>
    24 
    25 CTSgImageSw::CTSgImageSw()
    26 	{
    27 	INFO_PRINTF1(_L("Graphics resource component test - RSgImage Sw Implementation Tests.\r\n"));
    28 	}
    29 
    30 CTSgImageSw::~CTSgImageSw()
    31 	{
    32 	}
    33 
    34 /** 
    35 Overrides of base class pure virtual
    36 Our implementation only gets called if the base class doTestStepPreambleL() did
    37 not leave. That being the case, the current test result value will be EPass.
    38 @leave Gets system wide error code
    39 @return TVerdict code
    40 */
    41 TVerdict CTSgImageSw::doTestStepL()
    42 	{
    43 	SetTestStepID(_L("GRAPHICS-RESOURCE-0041"));
    44 	INFO_PRINTF1(_L("Getting supported pixel formats on software implementation.\r\n"));
    45 	TestGetPixelFormatsSWL();
    46 	RecordTestResultL();
    47 	
    48 	SetTestStepID(_L("GRAPHICS-RESOURCE-0042"));
    49 	INFO_PRINTF1(_L("Getting the interfaces implemented by CSgImageImpl class.\r\n"));
    50 	TestGetImageInterfacesSWL();
    51 	RecordTestResultL();
    52 		
    53 	SetTestStepID(_L("GRAPHICS-RESOURCE-0043"));
    54 	INFO_PRINTF1(_L("Getting the address information from the MSgImage_Sw interface.\r\n"));
    55 	TestGetImageInterfaceAddressInfo();
    56 	RecordTestResultL();
    57 		
    58 	return TestStepResult();
    59 	}
    60 
    61 /**
    62 @SYMTestCaseID			GRAPHICS-RESOURCE-0041
    63 @SYMTestCaseDesc		Gets supported pixel formats on software reference implementation.
    64 @SYMPREQ				PREQ39
    65 @SYMREQ 				REQ8809
    66 @SYMREQ 				REQ9175
    67 @SYMFssID				RSgImage::GetPixelFormats(const TSgImageInfo&, TUidPixelFormat*, TInt&)
    68 @SYMTestPriority		Critical
    69 @SYMTestType			Unit Test
    70 @SYMTestPurpose			To ensure all the available pixel formats are returned 
    71 						in the array and the actual number of pixel formats in
    72 						the input/output aCount parameter for the software
    73 						reference implementation.
    74 @SYMTestActions			Initialise the graphics resource component. Construct a
    75 						TSgImageInfo object and Initialise the member variables.
    76 						Construct a TInt array of size\n
    77 						\t 1. NULL\n						
    78 						\t 2. greater than the number of supported pixel formats\n
    79 						\t 3. equal to the number of supported pixel formats\n
    80 						\t 4. less than the number of supported pixel formats
    81 @SYMTestExpectedResults	The function must return\n
    82 						\t 1. KErrNone\n
    83 						\t 2. KErrNone\n
    84 						\t 3. KErrNone\n
    85 						\t 4. KErrOverFlow\n
    86 						The supported pixel formats are populated into the array
    87 						and aCount stores the actual number of supported pixel formats.
    88 						The returned pixel formats should cover the pixel formats
    89 						in the image compatibility table that works on all platforms.
    90 						All the returned pixel formats should appear on the image
    91 						compatibility list for the software reference implementation.
    92 @SYMTestStatus			Defined 
    93  */
    94 void CTSgImageSw::TestGetPixelFormatsSWL()
    95 	{
    96 	TestOpenDriverL();
    97 	//check all the pixel formats returned are in the common compatibility guarantees table
    98 	TestGetPixelFormatCompatibilityGuaranteesL();
    99 	
   100 	//check the pixel formates supported by the reference implementation only
   101 	CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageCompositionSource|ESgUsageOpenGlesTexture2D|ESgUsageOpenVgImage|ESgUsageDirectGdiTarget, ETrue, KSgScreenIdMain);
   102 	CheckPixelFormatPresent(EUidPixelFormatRGB_565);
   103 	CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
   104 	CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
   105 	
   106 	TestCloseDriver();
   107 	}
   108 
   109 
   110 /**
   111 @SYMTestCaseID			GRAPHICS-RESOURCE-0042
   112 @SYMTestCaseDesc		Gets the interfaces implemented by CSgImageImpl class.
   113 @SYMPREQ				PREQ39
   114 @SYMREQ 				REQ8809
   115 @SYMREQ 				REQ9175
   116 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
   117 						RSgImage::GetInterface()
   118 @SYMTestPriority		Critical
   119 @SYMTestType			Unit Test
   120 @SYMTestPurpose			To ensure the MSgImage_Sw interface can be returned from RSgImage.
   121 @SYMTestActions			Initialise the graphics resource component. Create an image. Call
   122 						GetInterface() to return the MSgImage_Sw interface.
   123 @SYMTestExpectedResults	Both interfaces are returned successfully.
   124 @SYMTestStatus			Defined 
   125  */
   126 void CTSgImageSw::TestGetImageInterfacesSWL()
   127 	{
   128 	
   129 	}
   130 
   131 /**
   132 @SYMTestCaseID			GRAPHICS-RESOURCE-0043
   133 @SYMTestCaseDesc		Gets the address information from the MSgImage_Sw interface.
   134 @SYMPREQ				PREQ39
   135 @SYMFssID				RSgImage::Create(const TSgImageInfo&, const TAny*, TInt)\n 
   136 						RSgImage::Interface()\n 
   137 						MSgImage_Sw::DataAddress()\n 
   138 						MSgImage_Sw::DataStride()
   139 @SYMTestPriority		Critical
   140 @SYMTestType			Unit Test
   141 @SYMTestPurpose			To ensure the software solution of the RSgImage returns 
   142 						the correct image address information.
   143 @SYMTestActions			Initialise the graphics resource component. Create an image. Call
   144 						GetInterface() to return the MSgImage_Sw interface. Call the DataAddress()
   145 						and DataStride() functions on the interface. Then modify some random 
   146 						byte within the data address of the image and read back to check if the
   147 						byte has been modified.
   148 @SYMTestExpectedResults	The byte should be successfully modified. 
   149 @SYMTestStatus			Defined 
   150  */	
   151 void CTSgImageSw::TestGetImageInterfaceAddressInfo()
   152 	{
   153 	
   154 	}