First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include <test/tefunit.h> // for ASSERT macros
22 #include "egltestcommoninisettings.h"
24 EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewL()
26 CEglTestCommonIniSettings* self = CEglTestCommonIniSettings::NewLC();
27 CleanupStack::Pop(self);
31 EXPORT_C CEglTestCommonIniSettings* CEglTestCommonIniSettings::NewLC()
33 CEglTestCommonIniSettings* self = new(ELeave) CEglTestCommonIniSettings;
34 CleanupStack::PushL(self);
39 void CEglTestCommonIniSettings::ConstructL()
41 iIniData = CIniData::NewL(KConfigFileName);
44 EXPORT_C CEglTestCommonIniSettings::~CEglTestCommonIniSettings()
49 EXPORT_C VGImageFormat CEglTestCommonIniSettings::GetVgFormat(const TDesC& aSectioName, const TInt aWhich)
51 TBuf<20> bufVgPixelFormatNameKey;
52 bufVgPixelFormatNameKey.Format(KKeyFormatX, aWhich);
53 TBuf16<100> bufPixelValue16;
54 TPtrC16 ptrPixelValue16(bufPixelValue16);
55 if(!iIniData->FindVar(aSectioName,bufVgPixelFormatNameKey,ptrPixelValue16))
57 return VG_IMAGE_FORMAT_INVALID;
60 _LIT(K565,"VG_sRGB_565");
61 _LIT(KX8888,"VG_sXRGB_8888");
62 _LIT(KA8888,"VG_sARGB_8888");
63 _LIT(KA8888PRE,"VG_sARGB_8888_PRE");
65 if(!ptrPixelValue16.Compare(K565))
69 if(!ptrPixelValue16.Compare(KX8888))
73 if(!ptrPixelValue16.Compare(KA8888))
77 if(!ptrPixelValue16.Compare(KA8888PRE))
79 return VG_sARGB_8888_PRE;
82 return VG_IMAGE_FORMAT_INVALID;
85 EXPORT_C TUidPixelFormat CEglTestCommonIniSettings::GetPixelFormat(const TDesC& aSectioName, const TInt aWhich)
87 TBuf<20> bufPixelNameKey;
88 bufPixelNameKey.Format(KKeyFormatX, aWhich);
89 TBuf16<100> bufPixelValue16;
90 TPtrC16 ptrPixelValue16(bufPixelValue16);
91 if(!iIniData->FindVar(aSectioName,bufPixelNameKey,ptrPixelValue16))
93 return EUidPixelFormatUnknown;
96 _LIT(K565,"EUidPixelFormatRGB_565");
97 _LIT(KX8888,"EUidPixelFormatXRGB_8888");
98 _LIT(KA8888,"EUidPixelFormatARGB_8888");
99 _LIT(KA8888PRE,"EUidPixelFormatARGB_8888_PRE");
100 _LIT(KA8,"EUidPixelFormatA_8");
102 if(!ptrPixelValue16.Compare(K565))
104 return EUidPixelFormatRGB_565;
106 if(!ptrPixelValue16.Compare(KX8888))
108 return EUidPixelFormatXRGB_8888;
110 if(!ptrPixelValue16.Compare(KA8888))
112 return EUidPixelFormatARGB_8888;
114 if(!ptrPixelValue16.Compare(KA8888PRE))
116 return EUidPixelFormatARGB_8888_PRE;
118 if(!ptrPixelValue16.Compare(KA8))
120 return EUidPixelFormatA_8;
122 return EUidPixelFormatUnknown;
125 EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfFormats(const TDesC& aSectioName)
128 if(iIniData->FindVar(aSectioName,KKeyNumFormats,numFormats))
135 EXPORT_C TInt CEglTestCommonIniSettings::GetNumberOfIterations(const TDesC& aSectioName)
137 _LIT(KKeyNumIterations, "NumIterations");
138 TInt numIterations = 0;
139 if(iIniData->FindVar(aSectioName, KKeyNumIterations, numIterations))
141 return numIterations;
146 EXPORT_C TSize CEglTestCommonIniSettings::GetImageSize(const TDesC& aSectioName)
148 _LIT(KKeyBufferWidth, "ImageWidth");
149 _LIT(KKeyBufferHeight, "ImageHeight");
151 if(iIniData->FindVar(aSectioName, KKeyBufferWidth, size.iWidth) &&
152 iIniData->FindVar(aSectioName, KKeyBufferHeight, size.iHeight))
159 EXPORT_C TSize CEglTestCommonIniSettings::GetWindowSize(const TDesC& aSectioName)
161 _LIT(KKeyWindowWidth, "WindowWidth");
162 _LIT(KKeyWindowHeight, "WindowHeight");
164 if(iIniData->FindVar(aSectioName, KKeyWindowWidth, size.iWidth) &&
165 iIniData->FindVar(aSectioName, KKeyWindowHeight, size.iHeight))
172 EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(const TDesC& aSectioName)
174 _LIT(KKeyThresholdGPUUsedMemory, "ThresholdGPUUsedMemory");
175 TInt thresholdGPUUsedMemory = 0;
176 if(iIniData->FindVar(aSectioName, KKeyThresholdGPUUsedMemory, thresholdGPUUsedMemory))
178 return thresholdGPUUsedMemory;
183 EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdLastIteration(const TDesC& aSectioName)
185 _LIT(KKeyThresholdLastIteration, "ThresholdLastIteration");
186 TInt thresholdLastIteration = 0;
187 if(iIniData->FindVar(aSectioName, KKeyThresholdLastIteration, thresholdLastIteration))
189 return thresholdLastIteration;