os/graphics/egl/egltest/src/egltestcommoninisettings.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
*/
sl@0
    20
sl@0
    21
#include <test/tefunit.h> // for ASSERT macros
sl@0
    22
#include "egltestcommoninisettings.h"
sl@0
    23
sl@0
    24
EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewL()
sl@0
    25
	{
sl@0
    26
	CEglTestCommonIniSettings* self = CEglTestCommonIniSettings::NewLC();
sl@0
    27
	CleanupStack::Pop(self);
sl@0
    28
	return self;
sl@0
    29
	}
sl@0
    30
sl@0
    31
EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewLC()
sl@0
    32
	{
sl@0
    33
	CEglTestCommonIniSettings* self = new(ELeave) CEglTestCommonIniSettings;
sl@0
    34
	CleanupStack::PushL(self);
sl@0
    35
	self->ConstructL();
sl@0
    36
	return self;
sl@0
    37
	}
sl@0
    38
sl@0
    39
void CEglTestCommonIniSettings::ConstructL()
sl@0
    40
	{
sl@0
    41
	iIniData = CIniData::NewL(KConfigFileName);
sl@0
    42
	}
sl@0
    43
sl@0
    44
EXPORT_C CEglTestCommonIniSettings::~CEglTestCommonIniSettings()
sl@0
    45
	{
sl@0
    46
	delete iIniData;
sl@0
    47
	}
sl@0
    48
sl@0
    49
EXPORT_C VGImageFormat CEglTestCommonIniSettings::GetVgFormat(const TDesC& aSectioName, const TInt aWhich)
sl@0
    50
	{
sl@0
    51
    TBuf<20> bufVgPixelFormatNameKey;
sl@0
    52
    bufVgPixelFormatNameKey.Format(KKeyFormatX, aWhich);    
sl@0
    53
    TBuf16<100> bufPixelValue16;
sl@0
    54
    TPtrC16 ptrPixelValue16(bufPixelValue16);
sl@0
    55
    if(!iIniData->FindVar(aSectioName,bufVgPixelFormatNameKey,ptrPixelValue16))
sl@0
    56
        {
sl@0
    57
        return VG_IMAGE_FORMAT_INVALID;
sl@0
    58
        }
sl@0
    59
sl@0
    60
    _LIT(K565,"VG_sRGB_565");
sl@0
    61
    _LIT(KX8888,"VG_sXRGB_8888");
sl@0
    62
    _LIT(KA8888,"VG_sARGB_8888");
sl@0
    63
    _LIT(KA8888PRE,"VG_sARGB_8888_PRE");
sl@0
    64
    
sl@0
    65
    if(!ptrPixelValue16.Compare(K565))
sl@0
    66
        {
sl@0
    67
        return VG_sRGB_565;
sl@0
    68
        }
sl@0
    69
    if(!ptrPixelValue16.Compare(KX8888))
sl@0
    70
        {
sl@0
    71
        return VG_sXRGB_8888;
sl@0
    72
        }
sl@0
    73
    if(!ptrPixelValue16.Compare(KA8888))
sl@0
    74
        {
sl@0
    75
        return VG_sARGB_8888;
sl@0
    76
        }
sl@0
    77
    if(!ptrPixelValue16.Compare(KA8888PRE))
sl@0
    78
        {
sl@0
    79
        return VG_sARGB_8888_PRE;
sl@0
    80
        }   
sl@0
    81
    
sl@0
    82
    return VG_IMAGE_FORMAT_INVALID;
sl@0
    83
	}
sl@0
    84
sl@0
    85
EXPORT_C TUidPixelFormat CEglTestCommonIniSettings::GetPixelFormat(const TDesC& aSectioName, const TInt aWhich)
sl@0
    86
	{
sl@0
    87
	TBuf<20> bufPixelNameKey;
sl@0
    88
	bufPixelNameKey.Format(KKeyFormatX, aWhich);	
sl@0
    89
	TBuf16<100> bufPixelValue16;
sl@0
    90
	TPtrC16 ptrPixelValue16(bufPixelValue16);
sl@0
    91
	if(!iIniData->FindVar(aSectioName,bufPixelNameKey,ptrPixelValue16))
sl@0
    92
		{
sl@0
    93
		return EUidPixelFormatUnknown;
sl@0
    94
		}
sl@0
    95
	
sl@0
    96
	_LIT(K565,"EUidPixelFormatRGB_565");
sl@0
    97
	_LIT(KX8888,"EUidPixelFormatXRGB_8888");
sl@0
    98
	_LIT(KA8888,"EUidPixelFormatARGB_8888");
sl@0
    99
	_LIT(KA8888PRE,"EUidPixelFormatARGB_8888_PRE");
sl@0
   100
    _LIT(KA8,"EUidPixelFormatA_8");
sl@0
   101
	
sl@0
   102
	if(!ptrPixelValue16.Compare(K565))
sl@0
   103
		{
sl@0
   104
		return EUidPixelFormatRGB_565;
sl@0
   105
		}
sl@0
   106
	if(!ptrPixelValue16.Compare(KX8888))
sl@0
   107
		{
sl@0
   108
		return EUidPixelFormatXRGB_8888;
sl@0
   109
		}
sl@0
   110
	if(!ptrPixelValue16.Compare(KA8888))
sl@0
   111
		{
sl@0
   112
		return EUidPixelFormatARGB_8888;
sl@0
   113
		}
sl@0
   114
	if(!ptrPixelValue16.Compare(KA8888PRE))
sl@0
   115
		{
sl@0
   116
		return EUidPixelFormatARGB_8888_PRE;
sl@0
   117
		}	
sl@0
   118
    if(!ptrPixelValue16.Compare(KA8))
sl@0
   119
        {
sl@0
   120
        return EUidPixelFormatA_8;
sl@0
   121
        }   
sl@0
   122
	return EUidPixelFormatUnknown;
sl@0
   123
	}
sl@0
   124
sl@0
   125
EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfFormats(const TDesC& aSectioName)
sl@0
   126
	{
sl@0
   127
	TInt numFormats = 0;
sl@0
   128
	if(iIniData->FindVar(aSectioName,KKeyNumFormats,numFormats))
sl@0
   129
		{
sl@0
   130
		return numFormats;
sl@0
   131
		}
sl@0
   132
	return 0;
sl@0
   133
	}
sl@0
   134
sl@0
   135
EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfIterations(const TDesC& aSectioName)
sl@0
   136
    {
sl@0
   137
    _LIT(KKeyNumIterations, "NumIterations"); 
sl@0
   138
    TInt numIterations = 0;
sl@0
   139
    if(iIniData->FindVar(aSectioName, KKeyNumIterations, numIterations))
sl@0
   140
        {
sl@0
   141
        return numIterations;
sl@0
   142
        }
sl@0
   143
    return 0;
sl@0
   144
    }
sl@0
   145
sl@0
   146
EXPORT_C TSize CEglTestCommonIniSettings::GetImageSize(const TDesC& aSectioName)
sl@0
   147
    {
sl@0
   148
    _LIT(KKeyBufferWidth, "ImageWidth");
sl@0
   149
    _LIT(KKeyBufferHeight, "ImageHeight");
sl@0
   150
    TSize size(0, 0);
sl@0
   151
    if(iIniData->FindVar(aSectioName, KKeyBufferWidth, size.iWidth) && 
sl@0
   152
            iIniData->FindVar(aSectioName, KKeyBufferHeight, size.iHeight))
sl@0
   153
        {
sl@0
   154
        return size;
sl@0
   155
        }
sl@0
   156
    return TSize(0,0);
sl@0
   157
   }
sl@0
   158
sl@0
   159
EXPORT_C TSize CEglTestCommonIniSettings::GetWindowSize(const TDesC& aSectioName)
sl@0
   160
    {
sl@0
   161
    _LIT(KKeyWindowWidth, "WindowWidth");
sl@0
   162
    _LIT(KKeyWindowHeight, "WindowHeight");
sl@0
   163
    TSize size(0, 0);
sl@0
   164
    if(iIniData->FindVar(aSectioName, KKeyWindowWidth, size.iWidth) && 
sl@0
   165
            iIniData->FindVar(aSectioName, KKeyWindowHeight, size.iHeight))
sl@0
   166
        {
sl@0
   167
        return size;
sl@0
   168
        }
sl@0
   169
	return TSize(0,0);
sl@0
   170
   }
sl@0
   171
sl@0
   172
EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(const TDesC& aSectioName)
sl@0
   173
    {
sl@0
   174
    _LIT(KKeyThresholdGPUUsedMemory, "ThresholdGPUUsedMemory");
sl@0
   175
    TInt thresholdGPUUsedMemory = 0;
sl@0
   176
    if(iIniData->FindVar(aSectioName, KKeyThresholdGPUUsedMemory, thresholdGPUUsedMemory))
sl@0
   177
        {
sl@0
   178
        return thresholdGPUUsedMemory;
sl@0
   179
        }
sl@0
   180
    return 0;
sl@0
   181
   }
sl@0
   182
sl@0
   183
EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdLastIteration(const TDesC& aSectioName)
sl@0
   184
    {
sl@0
   185
    _LIT(KKeyThresholdLastIteration, "ThresholdLastIteration");
sl@0
   186
    TInt thresholdLastIteration = 0;
sl@0
   187
    if(iIniData->FindVar(aSectioName, KKeyThresholdLastIteration, thresholdLastIteration))
sl@0
   188
        {
sl@0
   189
        return thresholdLastIteration;
sl@0
   190
        }
sl@0
   191
    return 0;
sl@0
   192
   }