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 |
@internalComponent - Internal Symbian test code
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "tgraphicsresourceteststepbase.h"
|
sl@0
|
23 |
#include <e32math.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
CTSgTestStepBase::CTSgTestStepBase()
|
sl@0
|
26 |
{
|
sl@0
|
27 |
}
|
sl@0
|
28 |
|
sl@0
|
29 |
CTSgTestStepBase::~CTSgTestStepBase()
|
sl@0
|
30 |
{
|
sl@0
|
31 |
iSecondThread.Close();
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
/**
|
sl@0
|
35 |
Overrides of base class virtual
|
sl@0
|
36 |
@leave Gets system wide error code
|
sl@0
|
37 |
@return - TVerdict code
|
sl@0
|
38 |
*/
|
sl@0
|
39 |
TVerdict CTSgTestStepBase::doTestStepPreambleL()
|
sl@0
|
40 |
{
|
sl@0
|
41 |
SetTestStepResult(EPass);
|
sl@0
|
42 |
return TestStepResult();
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
/**
|
sl@0
|
46 |
Override of base class virtual
|
sl@0
|
47 |
@leave Gets system wide error code
|
sl@0
|
48 |
@return - TVerdict code
|
sl@0
|
49 |
*/
|
sl@0
|
50 |
TVerdict CTSgTestStepBase::doTestStepPostambleL()
|
sl@0
|
51 |
{
|
sl@0
|
52 |
return TestStepResult();
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
/**
|
sl@0
|
56 |
Override of function from CTestStep so that each test failure is reported in output.
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
EXPORT_C void CTSgTestStepBase::testBooleanTrue(TBool aCondition, const TText8* aFile, TInt aLine)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
TRAP_IGNORE(testBooleanTrueL(aCondition, aFile, aLine, ETrue));
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
/**
|
sl@0
|
64 |
Creates an image with some predefined parametres.
|
sl@0
|
65 |
@param aImage output image handle
|
sl@0
|
66 |
@leave Gets system wide error code
|
sl@0
|
67 |
*/
|
sl@0
|
68 |
void CTSgTestStepBase::CreateImageL(RSgImage& aImage)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
TSgImageInfo info;
|
sl@0
|
71 |
info.iSizeInPixels = TSize(8, 8);
|
sl@0
|
72 |
info.iUsage = ESgUsageDirectGdiSource;
|
sl@0
|
73 |
info.iPixelFormat = EUidPixelFormatRGB_565;
|
sl@0
|
74 |
info.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
75 |
info.iShareable = ETrue;
|
sl@0
|
76 |
|
sl@0
|
77 |
CheckErrorL(KErrNone, aImage.Create(info, KImageData, 16), (TText8*)__FILE__, __LINE__);
|
sl@0
|
78 |
}
|
sl@0
|
79 |
|
sl@0
|
80 |
/**
|
sl@0
|
81 |
Creates an image collection with some predefined parametres.
|
sl@0
|
82 |
@param aCollection output image collection handle
|
sl@0
|
83 |
@leave Gets system wide error code
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
void CTSgTestStepBase::CreateImageCollectionL(RSgImageCollection& aCollection)
|
sl@0
|
86 |
{
|
sl@0
|
87 |
TSgImageInfo info;
|
sl@0
|
88 |
info.iSizeInPixels = TSize(8, 8);
|
sl@0
|
89 |
info.iUsage = ESgUsageDirectGdiSource;
|
sl@0
|
90 |
info.iPixelFormat = EUidPixelFormatRGB_565;
|
sl@0
|
91 |
info.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
92 |
CheckErrorL(KErrNone, aCollection.Create(info, KNumImagesInCollection), (TText8*)__FILE__, __LINE__);
|
sl@0
|
93 |
TEST(!aCollection.IsNull());
|
sl@0
|
94 |
}
|
sl@0
|
95 |
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
Creates a second process and do some tests in it.
|
sl@0
|
98 |
@param aProcessName The name of the new process
|
sl@0
|
99 |
@param aTestInfo The information for the tests
|
sl@0
|
100 |
@leave Gets system wide error code
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
TInt CTSgTestStepBase::CreateSecondProcessAndDoTestL(const TDesC &aProcessName, TSgresTestInfo& aTestInfo)
|
sl@0
|
103 |
{
|
sl@0
|
104 |
// Create a second process
|
sl@0
|
105 |
RProcess process;
|
sl@0
|
106 |
User::LeaveIfError(process.Create(aProcessName, KNullDesC));
|
sl@0
|
107 |
CleanupClosePushL(process);
|
sl@0
|
108 |
|
sl@0
|
109 |
// Specify the test for the second process
|
sl@0
|
110 |
TESTL(KErrNone == process.SetParameter(KSecondProcessFunctionSlot, ((TSgresTestInfo)aTestInfo).iTestCase));
|
sl@0
|
111 |
// Specify the id passed to the second process
|
sl@0
|
112 |
TPckg<TSgresTestInfo> ptr(aTestInfo);
|
sl@0
|
113 |
|
sl@0
|
114 |
TESTL(KErrNone == process.SetParameter(KSecondProcessParametersSlot, ptr));
|
sl@0
|
115 |
// Kick off the second process and wait for it to complete
|
sl@0
|
116 |
// The actual testing is done in the second process
|
sl@0
|
117 |
TRequestStatus status = KRequestPending;
|
sl@0
|
118 |
process.Logon(status);
|
sl@0
|
119 |
process.Resume();
|
sl@0
|
120 |
User::WaitForRequest(status);
|
sl@0
|
121 |
|
sl@0
|
122 |
TInt exitreason = process.ExitReason();
|
sl@0
|
123 |
|
sl@0
|
124 |
CleanupStack::PopAndDestroy();
|
sl@0
|
125 |
|
sl@0
|
126 |
//return test result
|
sl@0
|
127 |
return exitreason;
|
sl@0
|
128 |
}
|
sl@0
|
129 |
|
sl@0
|
130 |
/**
|
sl@0
|
131 |
Creates a second thread and do some tests in it.
|
sl@0
|
132 |
@param aTestInfo The information for the tests
|
sl@0
|
133 |
@leave Gets system wide error code
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
TInt CTSgTestStepBase::CreateSecondThreadAndDoTestL(TSgresTestInfo aTestInfo)
|
sl@0
|
136 |
{
|
sl@0
|
137 |
//create a semaphore
|
sl@0
|
138 |
RSemaphore sem;
|
sl@0
|
139 |
User::LeaveIfError(sem.CreateGlobal(KSecondThreadSemaphore, 0, EOwnerThread));
|
sl@0
|
140 |
CleanupClosePushL(sem);
|
sl@0
|
141 |
|
sl@0
|
142 |
User::LeaveIfError(iSecondThread.Create(KSecondThread, SecondThreadStart, KDefaultStackSize, &User::Heap(), &aTestInfo));
|
sl@0
|
143 |
// Launch second thread
|
sl@0
|
144 |
TRequestStatus statusSecondThread;
|
sl@0
|
145 |
iSecondThread.Logon(statusSecondThread);
|
sl@0
|
146 |
iSecondThread.SetPriority(EPriorityLess);
|
sl@0
|
147 |
iSecondThread.Resume();
|
sl@0
|
148 |
|
sl@0
|
149 |
User::WaitForRequest(statusSecondThread);
|
sl@0
|
150 |
|
sl@0
|
151 |
TInt result = iSecondThread.ExitReason();
|
sl@0
|
152 |
|
sl@0
|
153 |
//Close the handle
|
sl@0
|
154 |
CleanupStack::PopAndDestroy(1, &sem);
|
sl@0
|
155 |
iSecondThread.Close();
|
sl@0
|
156 |
|
sl@0
|
157 |
return result;
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
/**
|
sl@0
|
161 |
Creates a second thread and do some panic tests in it.
|
sl@0
|
162 |
@param aTestInfo The information for the tests
|
sl@0
|
163 |
@param aPanicCode The expected panic code
|
sl@0
|
164 |
@param aExitCategory The expected panic category
|
sl@0
|
165 |
@param aThreadName The name of the new thread
|
sl@0
|
166 |
@leave Gets system wide error code
|
sl@0
|
167 |
*/
|
sl@0
|
168 |
void CTSgTestStepBase::CreateSecondThreadAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
User::LeaveIfError(iSecondThread.Create(aThreadName, SecondThreadStart, KDefaultStackSize, 0x100, 0x100, &aTestInfo));
|
sl@0
|
171 |
// Launch second thread
|
sl@0
|
172 |
TRequestStatus statusSecondThread;
|
sl@0
|
173 |
iSecondThread.Logon(statusSecondThread);
|
sl@0
|
174 |
iSecondThread.SetPriority(EPriorityLess);
|
sl@0
|
175 |
iSecondThread.Resume();
|
sl@0
|
176 |
|
sl@0
|
177 |
User::WaitForRequest(statusSecondThread);
|
sl@0
|
178 |
|
sl@0
|
179 |
if(EExitPanic != iSecondThread.ExitType())
|
sl@0
|
180 |
{
|
sl@0
|
181 |
ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, iSecondThread.ExitType());
|
sl@0
|
182 |
TEST(EFalse);
|
sl@0
|
183 |
}
|
sl@0
|
184 |
|
sl@0
|
185 |
if(aPanicCode != iSecondThread.ExitReason())
|
sl@0
|
186 |
{
|
sl@0
|
187 |
ERR_PRINTF3(_L("Expected panic code: %d, Actual panic code: %d"), aPanicCode, iSecondThread.ExitReason());
|
sl@0
|
188 |
TEST(EFalse);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
TExitCategoryName secondThreadExitCategory = iSecondThread.ExitCategory();
|
sl@0
|
192 |
if(aExitCategory != secondThreadExitCategory)
|
sl@0
|
193 |
{
|
sl@0
|
194 |
ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aExitCategory, &secondThreadExitCategory);
|
sl@0
|
195 |
TEST(EFalse);
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
//close the driver if the second thread exited with type EExitKill
|
sl@0
|
199 |
//assumming the second thread only calls SgDriver::Open() once
|
sl@0
|
200 |
if(iSecondThread.ExitType() != EExitKill)
|
sl@0
|
201 |
{
|
sl@0
|
202 |
SgDriver::Close();
|
sl@0
|
203 |
}
|
sl@0
|
204 |
|
sl@0
|
205 |
//Close the handle
|
sl@0
|
206 |
iSecondThread.Close();
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
/**
|
sl@0
|
210 |
Creates a second process and do some panic tests in it.
|
sl@0
|
211 |
@param aTestInfo The information for the tests
|
sl@0
|
212 |
@param aPanicCode The expected panic code
|
sl@0
|
213 |
@param aExitCategory The expected panic category
|
sl@0
|
214 |
@param aProcessName The name of the new process
|
sl@0
|
215 |
@leave Gets system wide error code
|
sl@0
|
216 |
*/
|
sl@0
|
217 |
void CTSgTestStepBase::CreateSecondProcessAndCheckPanicL(TSgresTestInfo aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aProcessName)
|
sl@0
|
218 |
{
|
sl@0
|
219 |
// Create a second process
|
sl@0
|
220 |
RProcess process;
|
sl@0
|
221 |
User::LeaveIfError(process.Create(KSecondProcess, aProcessName));
|
sl@0
|
222 |
CleanupClosePushL(process);
|
sl@0
|
223 |
|
sl@0
|
224 |
// Specify the test for the second process
|
sl@0
|
225 |
TESTL(KErrNone == process.SetParameter(KSecondProcessFunctionSlot, ((TSgresTestInfo)aTestInfo).iTestCase));
|
sl@0
|
226 |
// Specify the id passed to the second process
|
sl@0
|
227 |
TPckg<TSgresTestInfo> ptr(aTestInfo);
|
sl@0
|
228 |
|
sl@0
|
229 |
TESTL(KErrNone == process.SetParameter(KSecondProcessParametersSlot, ptr));
|
sl@0
|
230 |
// Kick off the second process and wait for it to complete
|
sl@0
|
231 |
// The actual testing is done in the second process
|
sl@0
|
232 |
TRequestStatus status;
|
sl@0
|
233 |
process.Logon(status);
|
sl@0
|
234 |
process.Resume();
|
sl@0
|
235 |
User::WaitForRequest(status);
|
sl@0
|
236 |
|
sl@0
|
237 |
if(EExitPanic != process.ExitType())
|
sl@0
|
238 |
{
|
sl@0
|
239 |
ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, process.ExitType());
|
sl@0
|
240 |
TEST(EFalse);
|
sl@0
|
241 |
}
|
sl@0
|
242 |
if(aPanicCode != process.ExitReason())
|
sl@0
|
243 |
{
|
sl@0
|
244 |
ERR_PRINTF3(_L("Expected panic code: %d, Actual panic code: %d"), aPanicCode, process.ExitReason());
|
sl@0
|
245 |
TEST(EFalse);
|
sl@0
|
246 |
}
|
sl@0
|
247 |
|
sl@0
|
248 |
_LIT(KMemoryLeakCategory, "SGALLOC");
|
sl@0
|
249 |
TExitCategoryName processExitCategory = process.ExitCategory();
|
sl@0
|
250 |
TBool matchCategory;
|
sl@0
|
251 |
if (aExitCategory != KMemoryLeakCategory)
|
sl@0
|
252 |
{
|
sl@0
|
253 |
matchCategory = aExitCategory == processExitCategory;
|
sl@0
|
254 |
}
|
sl@0
|
255 |
else
|
sl@0
|
256 |
{
|
sl@0
|
257 |
matchCategory = processExitCategory.Left(KMemoryLeakCategory().Length()) == KMemoryLeakCategory;
|
sl@0
|
258 |
}
|
sl@0
|
259 |
if (!matchCategory)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aExitCategory, &processExitCategory);
|
sl@0
|
262 |
TEST(EFalse);
|
sl@0
|
263 |
}
|
sl@0
|
264 |
|
sl@0
|
265 |
CleanupStack::PopAndDestroy();
|
sl@0
|
266 |
}
|
sl@0
|
267 |
|
sl@0
|
268 |
/**
|
sl@0
|
269 |
Gets the supporting pixel formats according to the specified cpu access, usage, shareability and screen id flags.
|
sl@0
|
270 |
@leave Gets system wide error code
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
void CTSgTestStepBase::CallGetPixelFormatsL(TSgCpuAccess aCpuAccess, TUint32 aUsage, TBool aShareable, TInt aScreenId)
|
sl@0
|
273 |
{
|
sl@0
|
274 |
TSgImageInfo info;
|
sl@0
|
275 |
info.iCpuAccess = aCpuAccess;
|
sl@0
|
276 |
info.iUsage = aUsage;
|
sl@0
|
277 |
info.iShareable = aShareable;
|
sl@0
|
278 |
info.iScreenId = aScreenId;
|
sl@0
|
279 |
info.iSizeInPixels = TSize(10, 10);
|
sl@0
|
280 |
iPixelFormatCount = KMaxPixelFormats;
|
sl@0
|
281 |
Mem::FillZ(iPixelFormatArray, KMaxPixelFormats * sizeof(TUidPixelFormat));
|
sl@0
|
282 |
CheckErrorL(KErrNone, RSgImage::GetPixelFormats(info, iPixelFormatArray, iPixelFormatCount), (TText8*)__FILE__, __LINE__);
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
/**
|
sl@0
|
286 |
Checks the pixel formats returned against the compatibility guarantee table.
|
sl@0
|
287 |
@leave Gets system wide error code
|
sl@0
|
288 |
*/
|
sl@0
|
289 |
void CTSgTestStepBase::TestGetPixelFormatCompatibilityGuaranteesL()
|
sl@0
|
290 |
{
|
sl@0
|
291 |
CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource, ETrue, KSgScreenIdAny);
|
sl@0
|
292 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
293 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
294 |
CheckPixelFormatPresent(EUidPixelFormatRGB_565);
|
sl@0
|
295 |
|
sl@0
|
296 |
CallGetPixelFormatsL(ESgCpuAccessReadWrite, ESgUsageDirectGdiSource, ETrue, KSgScreenIdMain);
|
sl@0
|
297 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
298 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
299 |
CheckPixelFormatPresent(EUidPixelFormatRGB_565);
|
sl@0
|
300 |
|
sl@0
|
301 |
CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageDirectGdiTarget, ETrue, KSgScreenIdMain);
|
sl@0
|
302 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
303 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
304 |
|
sl@0
|
305 |
CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageOpenGlesTarget, ETrue, KSgScreenIdMain);
|
sl@0
|
306 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
307 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
308 |
|
sl@0
|
309 |
CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageOpenVgTarget, ETrue, KSgScreenIdMain);
|
sl@0
|
310 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
311 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
312 |
|
sl@0
|
313 |
CallGetPixelFormatsL(ESgCpuAccessNone, ESgUsageDirectGdiSource|ESgUsageOpenGles2Target, ETrue, KSgScreenIdMain);
|
sl@0
|
314 |
CheckPixelFormatPresent(EUidPixelFormatARGB_8888_PRE);
|
sl@0
|
315 |
CheckPixelFormatPresent(EUidPixelFormatXRGB_8888);
|
sl@0
|
316 |
}
|
sl@0
|
317 |
|
sl@0
|
318 |
/**
|
sl@0
|
319 |
Helper function to check if a certain pixel format is present
|
sl@0
|
320 |
in the returned pixel formats array.
|
sl@0
|
321 |
@param aPixelFormat The pixelformat to check
|
sl@0
|
322 |
*/
|
sl@0
|
323 |
void CTSgTestStepBase::CheckPixelFormatPresent(TUidPixelFormat aPixelFormat)
|
sl@0
|
324 |
{
|
sl@0
|
325 |
for(TInt i=0; i<iPixelFormatCount; ++i)
|
sl@0
|
326 |
{
|
sl@0
|
327 |
if(aPixelFormat == iPixelFormatArray[i])
|
sl@0
|
328 |
{
|
sl@0
|
329 |
return;
|
sl@0
|
330 |
}
|
sl@0
|
331 |
}
|
sl@0
|
332 |
TEST(EFalse);
|
sl@0
|
333 |
}
|
sl@0
|
334 |
|
sl@0
|
335 |
/**
|
sl@0
|
336 |
Helper function to test the equivalence of two TSgImageInfo structures.
|
sl@0
|
337 |
|
sl@0
|
338 |
@see CTDirectGdiContextTarget::CompareInfos
|
sl@0
|
339 |
@param aInfo1 A TSgImageInfo structure to compare.
|
sl@0
|
340 |
@param aInfo2 A TSgImageInfo structure to compare.
|
sl@0
|
341 |
|
sl@0
|
342 |
@return ETrue if the two are identical, EFalse otherwise.
|
sl@0
|
343 |
*/
|
sl@0
|
344 |
TBool CTSgTestStepBase::CompareInfos(TSgImageInfo& aInfo1, TSgImageInfo& aInfo2)
|
sl@0
|
345 |
{
|
sl@0
|
346 |
TBool result = EFalse;
|
sl@0
|
347 |
if(aInfo1.iCpuAccess == aInfo2.iCpuAccess
|
sl@0
|
348 |
&& aInfo1.iPixelFormat == aInfo2.iPixelFormat
|
sl@0
|
349 |
&& aInfo1.iScreenId == aInfo2.iScreenId
|
sl@0
|
350 |
&& aInfo1.iShareable == aInfo2.iShareable
|
sl@0
|
351 |
&& aInfo1.iSizeInPixels == aInfo2.iSizeInPixels
|
sl@0
|
352 |
&& aInfo1.iUsage | aInfo2.iUsage
|
sl@0
|
353 |
&& aInfo1.iUserAttributeCount == aInfo2.iUserAttributeCount)
|
sl@0
|
354 |
{
|
sl@0
|
355 |
for(TInt i=0; i<aInfo1.iUserAttributeCount; ++i)
|
sl@0
|
356 |
{
|
sl@0
|
357 |
if(aInfo1.iUserAttributes[i].iUid != aInfo2.iUserAttributes[i].iUid)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
break;
|
sl@0
|
360 |
}
|
sl@0
|
361 |
}
|
sl@0
|
362 |
result = ETrue;
|
sl@0
|
363 |
}
|
sl@0
|
364 |
return result;
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
/**
|
sl@0
|
368 |
Wrapper function to open the graphics resource driver and puts an cleanup item
|
sl@0
|
369 |
on the cleanup stack.
|
sl@0
|
370 |
@leave Gets system wide error code
|
sl@0
|
371 |
*/
|
sl@0
|
372 |
void CTSgTestStepBase::TestOpenDriverL()
|
sl@0
|
373 |
{
|
sl@0
|
374 |
CheckErrorL(KErrNone, SgDriver::Open(), (TText8*)__FILE__, __LINE__);
|
sl@0
|
375 |
CleanupStack::PushL(TCleanupItem((TCleanupOperation)CloseDriverWhenLeave, NULL));
|
sl@0
|
376 |
}
|
sl@0
|
377 |
|
sl@0
|
378 |
/**
|
sl@0
|
379 |
Wrapper function to close the graphics resource driver.
|
sl@0
|
380 |
*/
|
sl@0
|
381 |
void CTSgTestStepBase::TestCloseDriver()
|
sl@0
|
382 |
{
|
sl@0
|
383 |
CleanupStack::PopAndDestroy();
|
sl@0
|
384 |
}
|
sl@0
|
385 |
|
sl@0
|
386 |
/**
|
sl@0
|
387 |
Creates an image with specified parametres.
|
sl@0
|
388 |
@param aImage output image handle
|
sl@0
|
389 |
@return KErrNone if the image was created successfully, otherwise one of the system-wide error codes
|
sl@0
|
390 |
*/
|
sl@0
|
391 |
TInt CreateImageWithParameters(TInt aWidth, TInt aHeight, TUidPixelFormat aPixelFormat, TUint32 aUsage, TBool aShareable, TSgCpuAccess aCpuAccess, RSgImage& aImage)
|
sl@0
|
392 |
{
|
sl@0
|
393 |
TSgImageInfo info;
|
sl@0
|
394 |
info.iSizeInPixels = TSize(aWidth, aHeight);
|
sl@0
|
395 |
info.iPixelFormat = aPixelFormat;
|
sl@0
|
396 |
info.iUsage = aUsage;
|
sl@0
|
397 |
info.iCpuAccess = aCpuAccess;
|
sl@0
|
398 |
info.iShareable = aShareable;
|
sl@0
|
399 |
return aImage.Create(info, NULL, 0);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
/**
|
sl@0
|
403 |
Creates an image collection with some predefined parametres.
|
sl@0
|
404 |
@param aCollection output image collection handle
|
sl@0
|
405 |
@return KErrNone if the image was created successfully, otherwise one of the system-wide error codes
|
sl@0
|
406 |
*/
|
sl@0
|
407 |
TInt CreateImageCollectionWithParameters(TInt aWidth, TInt aHeight, TUidPixelFormat aPixelFormat, TUint32 aUsage, TBool aShareable, TSgCpuAccess aCpuAccess, RSgImageCollection& aCollection)
|
sl@0
|
408 |
{
|
sl@0
|
409 |
TSgImageInfo info;
|
sl@0
|
410 |
info.iSizeInPixels = TSize(aWidth, aHeight);
|
sl@0
|
411 |
info.iPixelFormat = aPixelFormat;
|
sl@0
|
412 |
info.iUsage = aUsage;
|
sl@0
|
413 |
info.iCpuAccess = aCpuAccess;
|
sl@0
|
414 |
info.iShareable = aShareable;
|
sl@0
|
415 |
return aCollection.Create(info, KNumImagesInCollection);
|
sl@0
|
416 |
}
|
sl@0
|
417 |
|
sl@0
|
418 |
|
sl@0
|
419 |
/**
|
sl@0
|
420 |
Second thread entry function.
|
sl@0
|
421 |
*/
|
sl@0
|
422 |
TInt CTSgTestStepBase::SecondThreadStart(TAny* aInfo)
|
sl@0
|
423 |
{
|
sl@0
|
424 |
TInt procHandles1 =0;
|
sl@0
|
425 |
TInt threadHandles1=0;
|
sl@0
|
426 |
RThread().HandleCount(procHandles1, threadHandles1);
|
sl@0
|
427 |
__UHEAP_MARK;
|
sl@0
|
428 |
|
sl@0
|
429 |
RSemaphore sem;
|
sl@0
|
430 |
TInt result = 0;
|
sl@0
|
431 |
|
sl@0
|
432 |
TInt openSem = sem.OpenGlobal(KSecondThreadSemaphore, EOwnerThread);
|
sl@0
|
433 |
|
sl@0
|
434 |
TSgresTestCase testcase = ((TSgresTestInfo*)aInfo)->iTestCase;
|
sl@0
|
435 |
|
sl@0
|
436 |
RSgImage image;
|
sl@0
|
437 |
RSgDrawable drawable;
|
sl@0
|
438 |
TSgImageInfo info1;
|
sl@0
|
439 |
TSgImageInfo info2;
|
sl@0
|
440 |
TSgDrawableId id;
|
sl@0
|
441 |
const TAny* dataAddressRead;
|
sl@0
|
442 |
TAny* dataAddressWrite;
|
sl@0
|
443 |
TInt dataStride;
|
sl@0
|
444 |
TSgDrawableId fakeid = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
|
sl@0
|
445 |
|
sl@0
|
446 |
//test cases without the need of an initialised driver
|
sl@0
|
447 |
switch (testcase)
|
sl@0
|
448 |
{
|
sl@0
|
449 |
case ESgresSecondThreadPanicResourceCountNoDriver:
|
sl@0
|
450 |
{
|
sl@0
|
451 |
SgDriver::ResourceCount(); // should panic with SGRES 5
|
sl@0
|
452 |
}
|
sl@0
|
453 |
break;
|
sl@0
|
454 |
case ESgresSecondThreadPanicAllocMarkStartNoDriver:
|
sl@0
|
455 |
{
|
sl@0
|
456 |
SgDriver::AllocMarkStart(); // should panic with SGRES 5
|
sl@0
|
457 |
}
|
sl@0
|
458 |
break;
|
sl@0
|
459 |
case ESgresSecondThreadPanicAllocMarkEndNoDriver:
|
sl@0
|
460 |
{
|
sl@0
|
461 |
SgDriver::AllocMarkEnd(0); // should panic with SGRES 5
|
sl@0
|
462 |
}
|
sl@0
|
463 |
break;
|
sl@0
|
464 |
case ESgresSecondThreadPanicSetAllocFailNoDriver:
|
sl@0
|
465 |
{
|
sl@0
|
466 |
SgDriver::SetAllocFail(RAllocator::EFailNext, 1); // should panic with SGRES 5
|
sl@0
|
467 |
}
|
sl@0
|
468 |
break;
|
sl@0
|
469 |
case ESgresSecondThreadPanicDrawableOpenNoDriver:
|
sl@0
|
470 |
{
|
sl@0
|
471 |
drawable.Open(KSgNullDrawableId); // should panic with SGRES 5
|
sl@0
|
472 |
}
|
sl@0
|
473 |
break;
|
sl@0
|
474 |
case ESgresSecondThreadPanicImageOpenNoDriver1:
|
sl@0
|
475 |
{
|
sl@0
|
476 |
image.Open(KSgNullDrawableId); // should panic with SGRES 5
|
sl@0
|
477 |
}
|
sl@0
|
478 |
break;
|
sl@0
|
479 |
case ESgresSecondThreadPanicImageOpenNoDriver2:
|
sl@0
|
480 |
{
|
sl@0
|
481 |
image.Open(KSgNullDrawableId, ESgDoNotRestrictUsage); // should panic with SGRES 5
|
sl@0
|
482 |
}
|
sl@0
|
483 |
break;
|
sl@0
|
484 |
case ESgresSecondThreadPanicImageCreateNoDriver1:
|
sl@0
|
485 |
{
|
sl@0
|
486 |
image.Create(info1, NULL, 0); // should panic with SGRES 5
|
sl@0
|
487 |
}
|
sl@0
|
488 |
break;
|
sl@0
|
489 |
case ESgresSecondThreadPanicImageCreateNoDriver2:
|
sl@0
|
490 |
{
|
sl@0
|
491 |
RSgImage tempImage;
|
sl@0
|
492 |
image.Create(info1, tempImage); // should panic with SGRES 5
|
sl@0
|
493 |
}
|
sl@0
|
494 |
break;
|
sl@0
|
495 |
case ESgresSecondThreadPanicImageGetPixelFormatsNoDriver:
|
sl@0
|
496 |
{
|
sl@0
|
497 |
TInt count = 0;
|
sl@0
|
498 |
RSgImage::GetPixelFormats(info1, NULL, count); // should panic with SGRES 5
|
sl@0
|
499 |
}
|
sl@0
|
500 |
break;
|
sl@0
|
501 |
case ESgresSecondThreadPanicImageCollectionCreateNoDriver1:
|
sl@0
|
502 |
{
|
sl@0
|
503 |
RSgImageCollection c;
|
sl@0
|
504 |
c.Create(info1, 0); // should panic with SGRES 5
|
sl@0
|
505 |
}
|
sl@0
|
506 |
break;
|
sl@0
|
507 |
case ESgresSecondThreadPanicImageCollectionCreateNoDriver2:
|
sl@0
|
508 |
{
|
sl@0
|
509 |
RSgImageCollection c;
|
sl@0
|
510 |
c.Create(NULL, 0, NULL, 0); // should panic with SGRES 5
|
sl@0
|
511 |
}
|
sl@0
|
512 |
break;
|
sl@0
|
513 |
}
|
sl@0
|
514 |
|
sl@0
|
515 |
|
sl@0
|
516 |
//open driver
|
sl@0
|
517 |
TInt ret = SgDriver::Open();
|
sl@0
|
518 |
if(KErrNoMemory == ret)
|
sl@0
|
519 |
{
|
sl@0
|
520 |
sem.Close();
|
sl@0
|
521 |
return KErrNoMemory;
|
sl@0
|
522 |
}
|
sl@0
|
523 |
if(KErrNone == ret)
|
sl@0
|
524 |
{
|
sl@0
|
525 |
switch (testcase)
|
sl@0
|
526 |
{
|
sl@0
|
527 |
case ESgresSecondThreadOpenImage:
|
sl@0
|
528 |
{
|
sl@0
|
529 |
TInt err = image.Open(((TSgresTestInfo*)aInfo)->iDrawableId);
|
sl@0
|
530 |
if(KErrNoMemory == err)
|
sl@0
|
531 |
{
|
sl@0
|
532 |
result = KErrNoMemory;
|
sl@0
|
533 |
break;
|
sl@0
|
534 |
}
|
sl@0
|
535 |
if(KErrNone == err)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
result |= EFirstTestPassed;
|
sl@0
|
538 |
}
|
sl@0
|
539 |
if(KErrNone == image.GetInfo(info2))
|
sl@0
|
540 |
{
|
sl@0
|
541 |
result |= ESecondTestPassed;
|
sl@0
|
542 |
}
|
sl@0
|
543 |
info1 = ((TSgresTestInfo*)aInfo)->iImageInfo;
|
sl@0
|
544 |
if(CompareInfos(info1, info2))
|
sl@0
|
545 |
{
|
sl@0
|
546 |
result |= EThirdTestPassed;
|
sl@0
|
547 |
}
|
sl@0
|
548 |
id = image.Id();
|
sl@0
|
549 |
if(id != KSgNullDrawableId)
|
sl@0
|
550 |
{
|
sl@0
|
551 |
result |= EFourthTestPassed;
|
sl@0
|
552 |
}
|
sl@0
|
553 |
if(id == ((TSgresTestInfo*)aInfo)->iDrawableId)
|
sl@0
|
554 |
{
|
sl@0
|
555 |
result |= EFifthTestPassed;
|
sl@0
|
556 |
}
|
sl@0
|
557 |
}
|
sl@0
|
558 |
break;
|
sl@0
|
559 |
case ESgresSecondThreadOpenDrawable:
|
sl@0
|
560 |
{
|
sl@0
|
561 |
TInt err = drawable.Open(((TSgresTestInfo*)aInfo)->iDrawableId);
|
sl@0
|
562 |
if(KErrNoMemory == err)
|
sl@0
|
563 |
{
|
sl@0
|
564 |
result = KErrNoMemory;
|
sl@0
|
565 |
break;
|
sl@0
|
566 |
}
|
sl@0
|
567 |
if(KErrNone == err)
|
sl@0
|
568 |
{
|
sl@0
|
569 |
result |= EFirstTestPassed;
|
sl@0
|
570 |
}
|
sl@0
|
571 |
id = drawable.Id();
|
sl@0
|
572 |
if(id != KSgNullDrawableId)
|
sl@0
|
573 |
{
|
sl@0
|
574 |
result |= ESecondTestPassed;
|
sl@0
|
575 |
}
|
sl@0
|
576 |
if(id == ((TSgresTestInfo*)aInfo)->iDrawableId)
|
sl@0
|
577 |
{
|
sl@0
|
578 |
result |= EThirdTestPassed;
|
sl@0
|
579 |
}
|
sl@0
|
580 |
}
|
sl@0
|
581 |
break;
|
sl@0
|
582 |
case ESgresSecondThreadOpenImageInvalid:
|
sl@0
|
583 |
{
|
sl@0
|
584 |
TSgImageInfo info;
|
sl@0
|
585 |
info.iSizeInPixels = TSize(8, 8);
|
sl@0
|
586 |
info.iUsage = ESgUsageDirectGdiSource;
|
sl@0
|
587 |
info.iPixelFormat = EUidPixelFormatRGB_565;
|
sl@0
|
588 |
info.iCpuAccess = ESgCpuAccessReadWrite;
|
sl@0
|
589 |
|
sl@0
|
590 |
TInt err = image.Create(info, KImageData, 16);
|
sl@0
|
591 |
if(KErrNoMemory == err)
|
sl@0
|
592 |
{
|
sl@0
|
593 |
result = KErrNoMemory;
|
sl@0
|
594 |
break;
|
sl@0
|
595 |
}
|
sl@0
|
596 |
if(KErrNone == err)
|
sl@0
|
597 |
{
|
sl@0
|
598 |
result |= EFirstTestPassed;
|
sl@0
|
599 |
}
|
sl@0
|
600 |
|
sl@0
|
601 |
// non-empty handle
|
sl@0
|
602 |
id = ((TSgresTestInfo*)aInfo)->iDrawableId;
|
sl@0
|
603 |
err = image.Open(id);
|
sl@0
|
604 |
if(KErrNoMemory == err)
|
sl@0
|
605 |
{
|
sl@0
|
606 |
result = KErrNoMemory;
|
sl@0
|
607 |
break;
|
sl@0
|
608 |
}
|
sl@0
|
609 |
if(KErrInUse == err)
|
sl@0
|
610 |
{
|
sl@0
|
611 |
result |= ESecondTestPassed;
|
sl@0
|
612 |
}
|
sl@0
|
613 |
image.Close();
|
sl@0
|
614 |
|
sl@0
|
615 |
// null drawable id
|
sl@0
|
616 |
err = image.Open(KSgNullDrawableId);
|
sl@0
|
617 |
if(KErrNoMemory == err)
|
sl@0
|
618 |
{
|
sl@0
|
619 |
result = KErrNoMemory;
|
sl@0
|
620 |
break;
|
sl@0
|
621 |
}
|
sl@0
|
622 |
if(KErrArgument == err)
|
sl@0
|
623 |
{
|
sl@0
|
624 |
result |= EThirdTestPassed;
|
sl@0
|
625 |
}
|
sl@0
|
626 |
image.Close();
|
sl@0
|
627 |
|
sl@0
|
628 |
// non-existing drawable id
|
sl@0
|
629 |
err = image.Open(fakeid);
|
sl@0
|
630 |
if(KErrNoMemory == err)
|
sl@0
|
631 |
{
|
sl@0
|
632 |
result = KErrNoMemory;
|
sl@0
|
633 |
break;
|
sl@0
|
634 |
}
|
sl@0
|
635 |
if(KErrNotFound == err)
|
sl@0
|
636 |
{
|
sl@0
|
637 |
result |= EFourthTestPassed;
|
sl@0
|
638 |
}
|
sl@0
|
639 |
image.Close();
|
sl@0
|
640 |
|
sl@0
|
641 |
// open a non-sharable image
|
sl@0
|
642 |
err = image.Open(id);
|
sl@0
|
643 |
if(KErrNoMemory == err)
|
sl@0
|
644 |
{
|
sl@0
|
645 |
result = KErrNoMemory;
|
sl@0
|
646 |
break;
|
sl@0
|
647 |
}
|
sl@0
|
648 |
if(KErrNone == err)
|
sl@0
|
649 |
{
|
sl@0
|
650 |
result |= EFifthTestPassed;
|
sl@0
|
651 |
}
|
sl@0
|
652 |
image.Close();
|
sl@0
|
653 |
}
|
sl@0
|
654 |
break;
|
sl@0
|
655 |
case ESgresSecondThreadOpenDrawableInvalid:
|
sl@0
|
656 |
// null drawable id
|
sl@0
|
657 |
{
|
sl@0
|
658 |
TInt err = drawable.Open(KSgNullDrawableId);
|
sl@0
|
659 |
if(KErrNoMemory == err)
|
sl@0
|
660 |
{
|
sl@0
|
661 |
result = KErrNoMemory;
|
sl@0
|
662 |
break;
|
sl@0
|
663 |
}
|
sl@0
|
664 |
if(KErrArgument == err)
|
sl@0
|
665 |
{
|
sl@0
|
666 |
result |= EFirstTestPassed;
|
sl@0
|
667 |
}
|
sl@0
|
668 |
drawable.Close();
|
sl@0
|
669 |
|
sl@0
|
670 |
// non-existing drawable id
|
sl@0
|
671 |
err = drawable.Open(fakeid);
|
sl@0
|
672 |
if(KErrNoMemory == err)
|
sl@0
|
673 |
{
|
sl@0
|
674 |
result = KErrNoMemory;
|
sl@0
|
675 |
break;
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
if(KErrNotFound == err)
|
sl@0
|
679 |
{
|
sl@0
|
680 |
result |= ESecondTestPassed;
|
sl@0
|
681 |
}
|
sl@0
|
682 |
drawable.Close();
|
sl@0
|
683 |
|
sl@0
|
684 |
// open a non-sharable image - should succeed
|
sl@0
|
685 |
id = ((TSgresTestInfo*)aInfo)->iDrawableId;
|
sl@0
|
686 |
err = drawable.Open(id);
|
sl@0
|
687 |
if(KErrNoMemory == err)
|
sl@0
|
688 |
{
|
sl@0
|
689 |
result = KErrNoMemory;
|
sl@0
|
690 |
break;
|
sl@0
|
691 |
}
|
sl@0
|
692 |
if(KErrNone == err)
|
sl@0
|
693 |
{
|
sl@0
|
694 |
result |= EThirdTestPassed;
|
sl@0
|
695 |
}
|
sl@0
|
696 |
|
sl@0
|
697 |
// non-empty handle
|
sl@0
|
698 |
if(KErrInUse == drawable.Open(id))
|
sl@0
|
699 |
{
|
sl@0
|
700 |
result |= EFourthTestPassed;
|
sl@0
|
701 |
}
|
sl@0
|
702 |
drawable.Close();
|
sl@0
|
703 |
}
|
sl@0
|
704 |
break;
|
sl@0
|
705 |
case ESgresSecondThreadMapImage:
|
sl@0
|
706 |
{
|
sl@0
|
707 |
id = ((TSgresTestInfo*)aInfo)->iDrawableId;
|
sl@0
|
708 |
TInt err = image.Open(id);
|
sl@0
|
709 |
if(KErrNoMemory == err)
|
sl@0
|
710 |
{
|
sl@0
|
711 |
result = KErrNoMemory;
|
sl@0
|
712 |
break;
|
sl@0
|
713 |
}
|
sl@0
|
714 |
if(KErrNone == err)
|
sl@0
|
715 |
{
|
sl@0
|
716 |
result |= EFirstTestPassed;
|
sl@0
|
717 |
}
|
sl@0
|
718 |
if(KErrNone == image.MapReadOnly(dataAddressRead, dataStride))
|
sl@0
|
719 |
{
|
sl@0
|
720 |
result |= ESecondTestPassed;
|
sl@0
|
721 |
}
|
sl@0
|
722 |
if(KErrNone == image.Unmap())
|
sl@0
|
723 |
{
|
sl@0
|
724 |
result |= EThirdTestPassed;
|
sl@0
|
725 |
}
|
sl@0
|
726 |
if(KErrNone == image.MapWriteOnly(dataAddressWrite, dataStride))
|
sl@0
|
727 |
{
|
sl@0
|
728 |
result |= EFourthTestPassed;
|
sl@0
|
729 |
}
|
sl@0
|
730 |
if(KErrNone == image.Unmap())
|
sl@0
|
731 |
{
|
sl@0
|
732 |
result |= EFifthTestPassed;
|
sl@0
|
733 |
}
|
sl@0
|
734 |
if(KErrNone == image.MapReadWrite(dataAddressWrite, dataStride))
|
sl@0
|
735 |
{
|
sl@0
|
736 |
result |= ESixthTestPassed;
|
sl@0
|
737 |
}
|
sl@0
|
738 |
if(KErrNone == image.Unmap())
|
sl@0
|
739 |
{
|
sl@0
|
740 |
result |= ESeventhTestPassed;
|
sl@0
|
741 |
}
|
sl@0
|
742 |
}
|
sl@0
|
743 |
break;
|
sl@0
|
744 |
case ESgresSecondThreadUnmapImage:
|
sl@0
|
745 |
{
|
sl@0
|
746 |
id = ((TSgresTestInfo*)aInfo)->iDrawableId;
|
sl@0
|
747 |
TInt err = image.Open(id);
|
sl@0
|
748 |
if(KErrNoMemory == err)
|
sl@0
|
749 |
{
|
sl@0
|
750 |
result = KErrNoMemory;
|
sl@0
|
751 |
break;
|
sl@0
|
752 |
}
|
sl@0
|
753 |
if(KErrNone == err)
|
sl@0
|
754 |
{
|
sl@0
|
755 |
result |= EFirstTestPassed;
|
sl@0
|
756 |
}
|
sl@0
|
757 |
if(KErrNone == image.Unmap())
|
sl@0
|
758 |
{
|
sl@0
|
759 |
result |= ESecondTestPassed;
|
sl@0
|
760 |
}
|
sl@0
|
761 |
}
|
sl@0
|
762 |
break;
|
sl@0
|
763 |
case ESgresSecondThreadPanicImageGetInterfaceInvalidHandle:
|
sl@0
|
764 |
{
|
sl@0
|
765 |
RSgImage image;
|
sl@0
|
766 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
767 |
if(KErrNone != ret)
|
sl@0
|
768 |
{
|
sl@0
|
769 |
result = ret;
|
sl@0
|
770 |
break;
|
sl@0
|
771 |
}
|
sl@0
|
772 |
RSgImage anotherImage;
|
sl@0
|
773 |
anotherImage = image;
|
sl@0
|
774 |
image.Close();
|
sl@0
|
775 |
|
sl@0
|
776 |
MSgImage_Sw* swInterface = NULL;
|
sl@0
|
777 |
ret = anotherImage.GetInterface(swInterface); //should panic with SGRES 2
|
sl@0
|
778 |
SgDriver::Close();
|
sl@0
|
779 |
}
|
sl@0
|
780 |
break;
|
sl@0
|
781 |
case ESgresSecondThreadPanicImageGetInterfaceNoDriver:
|
sl@0
|
782 |
{
|
sl@0
|
783 |
RSgImage image;
|
sl@0
|
784 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
785 |
if(KErrNone != ret)
|
sl@0
|
786 |
{
|
sl@0
|
787 |
result = ret;
|
sl@0
|
788 |
break;
|
sl@0
|
789 |
}
|
sl@0
|
790 |
RSgImage anotherImage;
|
sl@0
|
791 |
anotherImage = image;
|
sl@0
|
792 |
image.Close();
|
sl@0
|
793 |
|
sl@0
|
794 |
SgDriver::Close();
|
sl@0
|
795 |
MSgImage_Sw* swInterface = NULL;
|
sl@0
|
796 |
anotherImage.GetInterface(swInterface); // should panic with SGRES 5
|
sl@0
|
797 |
}
|
sl@0
|
798 |
break;
|
sl@0
|
799 |
case ESgresSecondThreadPanicImageCloseInvalidHandle:
|
sl@0
|
800 |
{
|
sl@0
|
801 |
RSgImage image;
|
sl@0
|
802 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
803 |
if(KErrNone != ret)
|
sl@0
|
804 |
{
|
sl@0
|
805 |
result = ret;
|
sl@0
|
806 |
break;
|
sl@0
|
807 |
}
|
sl@0
|
808 |
RSgImage anotherImage;
|
sl@0
|
809 |
anotherImage = image;
|
sl@0
|
810 |
image.Close();
|
sl@0
|
811 |
|
sl@0
|
812 |
anotherImage.Close(); //should panic with SGRES 2
|
sl@0
|
813 |
SgDriver::Close();
|
sl@0
|
814 |
}
|
sl@0
|
815 |
break;
|
sl@0
|
816 |
case ESgresSecondThreadPanicImageCloseNoDriver:
|
sl@0
|
817 |
{
|
sl@0
|
818 |
RSgImage image;
|
sl@0
|
819 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
820 |
if(KErrNone != ret)
|
sl@0
|
821 |
{
|
sl@0
|
822 |
result = ret;
|
sl@0
|
823 |
break;
|
sl@0
|
824 |
}
|
sl@0
|
825 |
RSgImage anotherImage;
|
sl@0
|
826 |
anotherImage = image;
|
sl@0
|
827 |
image.Close();
|
sl@0
|
828 |
SgDriver::Close();
|
sl@0
|
829 |
anotherImage.Close(); // should panic with SGRES 5
|
sl@0
|
830 |
}
|
sl@0
|
831 |
break;
|
sl@0
|
832 |
case ESgresSecondThreadPanicImageIdInvalidHandle:
|
sl@0
|
833 |
{
|
sl@0
|
834 |
RSgImage image;
|
sl@0
|
835 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
836 |
if(KErrNone != ret)
|
sl@0
|
837 |
{
|
sl@0
|
838 |
result = ret;
|
sl@0
|
839 |
break;
|
sl@0
|
840 |
}
|
sl@0
|
841 |
RSgImage anotherImage;
|
sl@0
|
842 |
anotherImage = image;
|
sl@0
|
843 |
image.Close();
|
sl@0
|
844 |
|
sl@0
|
845 |
anotherImage.Id(); //should panic with SGRES 2
|
sl@0
|
846 |
SgDriver::Close();
|
sl@0
|
847 |
}
|
sl@0
|
848 |
break;
|
sl@0
|
849 |
case ESgresSecondThreadPanicImageIdNoDriver:
|
sl@0
|
850 |
{
|
sl@0
|
851 |
RSgImage image;
|
sl@0
|
852 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
853 |
if(KErrNone != ret)
|
sl@0
|
854 |
{
|
sl@0
|
855 |
result = ret;
|
sl@0
|
856 |
break;
|
sl@0
|
857 |
}
|
sl@0
|
858 |
RSgImage anotherImage;
|
sl@0
|
859 |
anotherImage = image;
|
sl@0
|
860 |
image.Close();
|
sl@0
|
861 |
SgDriver::Close();
|
sl@0
|
862 |
anotherImage.Id(); // should panic with SGRES 5
|
sl@0
|
863 |
}
|
sl@0
|
864 |
break;
|
sl@0
|
865 |
case ESgresSecondThreadPanicImageDrawableTypeInvalidHandle:
|
sl@0
|
866 |
{
|
sl@0
|
867 |
RSgImage image;
|
sl@0
|
868 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
869 |
if(KErrNone != ret)
|
sl@0
|
870 |
{
|
sl@0
|
871 |
result = ret;
|
sl@0
|
872 |
break;
|
sl@0
|
873 |
}
|
sl@0
|
874 |
RSgImage anotherImage;
|
sl@0
|
875 |
anotherImage = image;
|
sl@0
|
876 |
image.Close();
|
sl@0
|
877 |
|
sl@0
|
878 |
anotherImage.DrawableType(); //should panic with SGRES 2
|
sl@0
|
879 |
SgDriver::Close();
|
sl@0
|
880 |
}
|
sl@0
|
881 |
break;
|
sl@0
|
882 |
case ESgresSecondThreadPanicImageDrawableTypeNoDriver:
|
sl@0
|
883 |
{
|
sl@0
|
884 |
RSgImage image;
|
sl@0
|
885 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
886 |
if(KErrNone != ret)
|
sl@0
|
887 |
{
|
sl@0
|
888 |
result = ret;
|
sl@0
|
889 |
break;
|
sl@0
|
890 |
}
|
sl@0
|
891 |
RSgImage anotherImage;
|
sl@0
|
892 |
anotherImage = image;
|
sl@0
|
893 |
image.Close();
|
sl@0
|
894 |
SgDriver::Close();
|
sl@0
|
895 |
anotherImage.DrawableType(); // should panic with SGRES 5
|
sl@0
|
896 |
}
|
sl@0
|
897 |
break;
|
sl@0
|
898 |
case ESgresSecondThreadPanicImageCreateInvalidHandle:
|
sl@0
|
899 |
{
|
sl@0
|
900 |
RSgImage image;
|
sl@0
|
901 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
902 |
if(KErrNone != ret)
|
sl@0
|
903 |
{
|
sl@0
|
904 |
result = ret;
|
sl@0
|
905 |
break;
|
sl@0
|
906 |
}
|
sl@0
|
907 |
RSgImage anotherImage;
|
sl@0
|
908 |
anotherImage = image;
|
sl@0
|
909 |
image.Close();
|
sl@0
|
910 |
|
sl@0
|
911 |
RSgImage newImage;
|
sl@0
|
912 |
TSgImageInfo info;
|
sl@0
|
913 |
image.GetInfo(info);
|
sl@0
|
914 |
newImage.Create(info, anotherImage); //should panic with SGRES 3
|
sl@0
|
915 |
SgDriver::Close();
|
sl@0
|
916 |
}
|
sl@0
|
917 |
break;
|
sl@0
|
918 |
case ESgresSecondThreadPanicImageGetInfoInvalidHandle:
|
sl@0
|
919 |
{
|
sl@0
|
920 |
RSgImage image;
|
sl@0
|
921 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
922 |
if(KErrNone != ret)
|
sl@0
|
923 |
{
|
sl@0
|
924 |
result = ret;
|
sl@0
|
925 |
break;
|
sl@0
|
926 |
}
|
sl@0
|
927 |
RSgImage anotherImage;
|
sl@0
|
928 |
anotherImage = image;
|
sl@0
|
929 |
image.Close();
|
sl@0
|
930 |
|
sl@0
|
931 |
TSgImageInfo anotherInfo;
|
sl@0
|
932 |
anotherImage.GetInfo(anotherInfo); //should panic with SGRES 3
|
sl@0
|
933 |
SgDriver::Close();
|
sl@0
|
934 |
}
|
sl@0
|
935 |
break;
|
sl@0
|
936 |
case ESgresSecondThreadPanicImageGetInfoNoDriver:
|
sl@0
|
937 |
{
|
sl@0
|
938 |
RSgImage image;
|
sl@0
|
939 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
940 |
if(KErrNone != ret)
|
sl@0
|
941 |
{
|
sl@0
|
942 |
result = ret;
|
sl@0
|
943 |
break;
|
sl@0
|
944 |
}
|
sl@0
|
945 |
RSgImage anotherImage;
|
sl@0
|
946 |
anotherImage = image;
|
sl@0
|
947 |
image.Close();
|
sl@0
|
948 |
SgDriver::Close();
|
sl@0
|
949 |
TSgImageInfo anotherInfo;
|
sl@0
|
950 |
anotherImage.GetInfo(anotherInfo); // should panic with SGRES 5
|
sl@0
|
951 |
}
|
sl@0
|
952 |
break;
|
sl@0
|
953 |
case ESgresSecondThreadPanicImageMapReadOnlyInvalidHandle:
|
sl@0
|
954 |
{
|
sl@0
|
955 |
RSgImage image;
|
sl@0
|
956 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
957 |
if(KErrNone != ret)
|
sl@0
|
958 |
{
|
sl@0
|
959 |
result = ret;
|
sl@0
|
960 |
break;
|
sl@0
|
961 |
}
|
sl@0
|
962 |
RSgImage anotherImage;
|
sl@0
|
963 |
anotherImage = image;
|
sl@0
|
964 |
image.Close();
|
sl@0
|
965 |
|
sl@0
|
966 |
anotherImage.MapReadOnly(dataAddressRead, dataStride); //should panic with SGRES 3
|
sl@0
|
967 |
SgDriver::Close();
|
sl@0
|
968 |
}
|
sl@0
|
969 |
break;
|
sl@0
|
970 |
case ESgresSecondThreadPanicImageMapReadOnlyNoDriver:
|
sl@0
|
971 |
{
|
sl@0
|
972 |
RSgImage image;
|
sl@0
|
973 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
974 |
if(KErrNone != ret)
|
sl@0
|
975 |
{
|
sl@0
|
976 |
result = ret;
|
sl@0
|
977 |
break;
|
sl@0
|
978 |
}
|
sl@0
|
979 |
RSgImage anotherImage;
|
sl@0
|
980 |
anotherImage = image;
|
sl@0
|
981 |
image.Close();
|
sl@0
|
982 |
SgDriver::Close();
|
sl@0
|
983 |
anotherImage.MapReadOnly(dataAddressRead, dataStride); // should panic with SGRES 5
|
sl@0
|
984 |
}
|
sl@0
|
985 |
break;
|
sl@0
|
986 |
case ESgresSecondThreadPanicImageMapWriteOnlyInvalidHandle:
|
sl@0
|
987 |
{
|
sl@0
|
988 |
RSgImage image;
|
sl@0
|
989 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
990 |
if(KErrNone != ret)
|
sl@0
|
991 |
{
|
sl@0
|
992 |
result = ret;
|
sl@0
|
993 |
break;
|
sl@0
|
994 |
}
|
sl@0
|
995 |
RSgImage anotherImage;
|
sl@0
|
996 |
anotherImage = image;
|
sl@0
|
997 |
image.Close();
|
sl@0
|
998 |
|
sl@0
|
999 |
anotherImage.MapWriteOnly(dataAddressWrite, dataStride); //should panic with SGRES 3
|
sl@0
|
1000 |
SgDriver::Close();
|
sl@0
|
1001 |
}
|
sl@0
|
1002 |
break;
|
sl@0
|
1003 |
case ESgresSecondThreadPanicImageMapWriteOnlyNoDriver:
|
sl@0
|
1004 |
{
|
sl@0
|
1005 |
RSgImage image;
|
sl@0
|
1006 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1007 |
if(KErrNone != ret)
|
sl@0
|
1008 |
{
|
sl@0
|
1009 |
result = ret;
|
sl@0
|
1010 |
break;
|
sl@0
|
1011 |
}
|
sl@0
|
1012 |
RSgImage anotherImage;
|
sl@0
|
1013 |
anotherImage = image;
|
sl@0
|
1014 |
image.Close();
|
sl@0
|
1015 |
SgDriver::Close();
|
sl@0
|
1016 |
anotherImage.MapWriteOnly(dataAddressWrite, dataStride); // should panic with SGRES 5
|
sl@0
|
1017 |
}
|
sl@0
|
1018 |
break;
|
sl@0
|
1019 |
case ESgresSecondThreadPanicImageMapReadWriteInvalidHandle:
|
sl@0
|
1020 |
{
|
sl@0
|
1021 |
RSgImage image;
|
sl@0
|
1022 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1023 |
if(KErrNone != ret)
|
sl@0
|
1024 |
{
|
sl@0
|
1025 |
result = ret;
|
sl@0
|
1026 |
break;
|
sl@0
|
1027 |
}
|
sl@0
|
1028 |
RSgImage anotherImage;
|
sl@0
|
1029 |
anotherImage = image;
|
sl@0
|
1030 |
image.Close();
|
sl@0
|
1031 |
|
sl@0
|
1032 |
anotherImage.MapReadWrite(dataAddressWrite, dataStride); //should panic with SGRES 3
|
sl@0
|
1033 |
SgDriver::Close();
|
sl@0
|
1034 |
}
|
sl@0
|
1035 |
break;
|
sl@0
|
1036 |
case ESgresSecondThreadPanicImageMapReadWriteNoDriver:
|
sl@0
|
1037 |
{
|
sl@0
|
1038 |
RSgImage image;
|
sl@0
|
1039 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1040 |
if(KErrNone != ret)
|
sl@0
|
1041 |
{
|
sl@0
|
1042 |
result = ret;
|
sl@0
|
1043 |
break;
|
sl@0
|
1044 |
}
|
sl@0
|
1045 |
RSgImage anotherImage;
|
sl@0
|
1046 |
anotherImage = image;
|
sl@0
|
1047 |
image.Close();
|
sl@0
|
1048 |
SgDriver::Close();
|
sl@0
|
1049 |
anotherImage.MapReadWrite(dataAddressWrite, dataStride); // should panic with SGRES 5
|
sl@0
|
1050 |
}
|
sl@0
|
1051 |
break;
|
sl@0
|
1052 |
case ESgresSecondThreadPanicImageUnmapInvalidHandle:
|
sl@0
|
1053 |
{
|
sl@0
|
1054 |
RSgImage image;
|
sl@0
|
1055 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1056 |
if(KErrNone != ret)
|
sl@0
|
1057 |
{
|
sl@0
|
1058 |
result = ret;
|
sl@0
|
1059 |
break;
|
sl@0
|
1060 |
}
|
sl@0
|
1061 |
RSgImage anotherImage;
|
sl@0
|
1062 |
anotherImage = image;
|
sl@0
|
1063 |
image.Close();
|
sl@0
|
1064 |
|
sl@0
|
1065 |
anotherImage.Unmap(); //should panic with SGRES 3
|
sl@0
|
1066 |
SgDriver::Close();
|
sl@0
|
1067 |
}
|
sl@0
|
1068 |
break;
|
sl@0
|
1069 |
case ESgresSecondThreadPanicImageUnmapNoDriver:
|
sl@0
|
1070 |
{
|
sl@0
|
1071 |
RSgImage image;
|
sl@0
|
1072 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1073 |
if(KErrNone != ret)
|
sl@0
|
1074 |
{
|
sl@0
|
1075 |
result = ret;
|
sl@0
|
1076 |
break;
|
sl@0
|
1077 |
}
|
sl@0
|
1078 |
RSgImage anotherImage;
|
sl@0
|
1079 |
anotherImage = image;
|
sl@0
|
1080 |
image.Close();
|
sl@0
|
1081 |
SgDriver::Close();
|
sl@0
|
1082 |
anotherImage.Unmap(); // should panic with SGRES 5
|
sl@0
|
1083 |
}
|
sl@0
|
1084 |
break;
|
sl@0
|
1085 |
case ESgresSecondThreadPanicImageCollectionCloseInvalidHandle:
|
sl@0
|
1086 |
{
|
sl@0
|
1087 |
RSgImageCollection collection;
|
sl@0
|
1088 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1089 |
if(KErrNone != ret)
|
sl@0
|
1090 |
{
|
sl@0
|
1091 |
result = ret;
|
sl@0
|
1092 |
break;
|
sl@0
|
1093 |
}
|
sl@0
|
1094 |
|
sl@0
|
1095 |
RSgImageCollection anotherCollection;
|
sl@0
|
1096 |
anotherCollection = collection;
|
sl@0
|
1097 |
collection.Close();
|
sl@0
|
1098 |
anotherCollection.Close(); //should panic with SGRES 4
|
sl@0
|
1099 |
SgDriver::Close();
|
sl@0
|
1100 |
}
|
sl@0
|
1101 |
break;
|
sl@0
|
1102 |
case ESgresSecondThreadPanicImageCollectionCloseNoDriver:
|
sl@0
|
1103 |
{
|
sl@0
|
1104 |
RSgImageCollection collection;
|
sl@0
|
1105 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1106 |
if(KErrNone != ret)
|
sl@0
|
1107 |
{
|
sl@0
|
1108 |
result = ret;
|
sl@0
|
1109 |
break;
|
sl@0
|
1110 |
}
|
sl@0
|
1111 |
|
sl@0
|
1112 |
RSgImageCollection anotherCollection;
|
sl@0
|
1113 |
anotherCollection = collection;
|
sl@0
|
1114 |
collection.Close();
|
sl@0
|
1115 |
SgDriver::Close();
|
sl@0
|
1116 |
anotherCollection.Close(); // should panic with SGRES 5
|
sl@0
|
1117 |
}
|
sl@0
|
1118 |
break;
|
sl@0
|
1119 |
case ESgresSecondThreadPanicImageCollectionSurfaceIdInvalidHandle:
|
sl@0
|
1120 |
{
|
sl@0
|
1121 |
RSgImageCollection collection;
|
sl@0
|
1122 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1123 |
if(KErrNone != ret)
|
sl@0
|
1124 |
{
|
sl@0
|
1125 |
result = ret;
|
sl@0
|
1126 |
break;
|
sl@0
|
1127 |
}
|
sl@0
|
1128 |
|
sl@0
|
1129 |
RSgImageCollection anotherCollection;
|
sl@0
|
1130 |
anotherCollection = collection;
|
sl@0
|
1131 |
collection.Close();
|
sl@0
|
1132 |
anotherCollection.SurfaceId(); //should panic with SGRES 4
|
sl@0
|
1133 |
SgDriver::Close();
|
sl@0
|
1134 |
}
|
sl@0
|
1135 |
break;
|
sl@0
|
1136 |
case ESgresSecondThreadPanicImageCollectionSurfaceIdNoDriver:
|
sl@0
|
1137 |
{
|
sl@0
|
1138 |
RSgImageCollection collection;
|
sl@0
|
1139 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1140 |
if(KErrNone != ret)
|
sl@0
|
1141 |
{
|
sl@0
|
1142 |
result = ret;
|
sl@0
|
1143 |
break;
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
|
sl@0
|
1146 |
RSgImageCollection anotherCollection;
|
sl@0
|
1147 |
anotherCollection = collection;
|
sl@0
|
1148 |
collection.Close();
|
sl@0
|
1149 |
SgDriver::Close();
|
sl@0
|
1150 |
anotherCollection.SurfaceId(); // should panic with SGRES 5
|
sl@0
|
1151 |
}
|
sl@0
|
1152 |
break;
|
sl@0
|
1153 |
case ESgresSecondThreadPanicImageCollectionGetInfoInvalidHandle:
|
sl@0
|
1154 |
{
|
sl@0
|
1155 |
RSgImageCollection collection;
|
sl@0
|
1156 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1157 |
if(KErrNone != ret)
|
sl@0
|
1158 |
{
|
sl@0
|
1159 |
result = ret;
|
sl@0
|
1160 |
break;
|
sl@0
|
1161 |
}
|
sl@0
|
1162 |
|
sl@0
|
1163 |
RSgImageCollection anotherCollection;
|
sl@0
|
1164 |
anotherCollection = collection;
|
sl@0
|
1165 |
collection.Close();
|
sl@0
|
1166 |
TSgImageInfo anotherInfo;
|
sl@0
|
1167 |
anotherCollection.GetInfo(anotherInfo); //should panic with SGRES 4
|
sl@0
|
1168 |
SgDriver::Close();
|
sl@0
|
1169 |
}
|
sl@0
|
1170 |
break;
|
sl@0
|
1171 |
case ESgresSecondThreadPanicImageCollectionGetInfoNoDriver:
|
sl@0
|
1172 |
{
|
sl@0
|
1173 |
RSgImageCollection collection;
|
sl@0
|
1174 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1175 |
if(KErrNone != ret)
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
result = ret;
|
sl@0
|
1178 |
break;
|
sl@0
|
1179 |
}
|
sl@0
|
1180 |
|
sl@0
|
1181 |
RSgImageCollection anotherCollection;
|
sl@0
|
1182 |
anotherCollection = collection;
|
sl@0
|
1183 |
collection.Close();
|
sl@0
|
1184 |
TSgImageInfo anotherInfo;
|
sl@0
|
1185 |
SgDriver::Close();
|
sl@0
|
1186 |
anotherCollection.GetInfo(anotherInfo); // should panic with SGRES 5
|
sl@0
|
1187 |
}
|
sl@0
|
1188 |
break;
|
sl@0
|
1189 |
case ESgresSecondThreadPanicImageCollectionCountInvalidHandle:
|
sl@0
|
1190 |
{
|
sl@0
|
1191 |
RSgImageCollection collection;
|
sl@0
|
1192 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1193 |
if(KErrNone != ret)
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
result = ret;
|
sl@0
|
1196 |
break;
|
sl@0
|
1197 |
}
|
sl@0
|
1198 |
|
sl@0
|
1199 |
RSgImageCollection anotherCollection;
|
sl@0
|
1200 |
anotherCollection = collection;
|
sl@0
|
1201 |
collection.Close();
|
sl@0
|
1202 |
anotherCollection.Count(); //should panic with SGRES 4
|
sl@0
|
1203 |
SgDriver::Close();
|
sl@0
|
1204 |
}
|
sl@0
|
1205 |
break;
|
sl@0
|
1206 |
case ESgresSecondThreadPanicImageCollectionCountNoDriver:
|
sl@0
|
1207 |
{
|
sl@0
|
1208 |
RSgImageCollection collection;
|
sl@0
|
1209 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1210 |
if(KErrNone != ret)
|
sl@0
|
1211 |
{
|
sl@0
|
1212 |
result = ret;
|
sl@0
|
1213 |
break;
|
sl@0
|
1214 |
}
|
sl@0
|
1215 |
|
sl@0
|
1216 |
RSgImageCollection anotherCollection;
|
sl@0
|
1217 |
anotherCollection = collection;
|
sl@0
|
1218 |
collection.Close();
|
sl@0
|
1219 |
SgDriver::Close();
|
sl@0
|
1220 |
anotherCollection.Count(); // should panic with SGRES 5
|
sl@0
|
1221 |
}
|
sl@0
|
1222 |
break;
|
sl@0
|
1223 |
case ESgresSecondThreadPanicImageCollectionOpenImageInvalidHandle:
|
sl@0
|
1224 |
{
|
sl@0
|
1225 |
RSgImageCollection collection;
|
sl@0
|
1226 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1227 |
if(KErrNone != ret)
|
sl@0
|
1228 |
{
|
sl@0
|
1229 |
result = ret;
|
sl@0
|
1230 |
break;
|
sl@0
|
1231 |
}
|
sl@0
|
1232 |
|
sl@0
|
1233 |
RSgImageCollection anotherCollection;
|
sl@0
|
1234 |
anotherCollection = collection;
|
sl@0
|
1235 |
collection.Close();
|
sl@0
|
1236 |
RSgImage image;
|
sl@0
|
1237 |
anotherCollection.OpenImage(0, image); //should panic with SGRES 4
|
sl@0
|
1238 |
SgDriver::Close();
|
sl@0
|
1239 |
}
|
sl@0
|
1240 |
break;
|
sl@0
|
1241 |
case ESgresSecondThreadPanicImageCollectionOpenImageNoDriver:
|
sl@0
|
1242 |
{
|
sl@0
|
1243 |
RSgImageCollection collection;
|
sl@0
|
1244 |
TInt ret = CreateImageCollectionWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, EFalse, ESgCpuAccessReadWrite, collection);
|
sl@0
|
1245 |
if(KErrNone != ret)
|
sl@0
|
1246 |
{
|
sl@0
|
1247 |
result = ret;
|
sl@0
|
1248 |
break;
|
sl@0
|
1249 |
}
|
sl@0
|
1250 |
|
sl@0
|
1251 |
RSgImageCollection anotherCollection;
|
sl@0
|
1252 |
anotherCollection = collection;
|
sl@0
|
1253 |
collection.Close();
|
sl@0
|
1254 |
RSgImage image;
|
sl@0
|
1255 |
SgDriver::Close();
|
sl@0
|
1256 |
anotherCollection.OpenImage(0, image); // should panic with SGRES 5
|
sl@0
|
1257 |
}
|
sl@0
|
1258 |
break;
|
sl@0
|
1259 |
case ESgresMultipleThreadStressTest:
|
sl@0
|
1260 |
{
|
sl@0
|
1261 |
for (TInt i = 0; i < 1000 && result == KErrNone; ++i)
|
sl@0
|
1262 |
{
|
sl@0
|
1263 |
TInt ret = CreateImageWithParameters(8, 8, EUidPixelFormatRGB_565, ESgUsageDirectGdiSource, ETrue, ESgCpuAccessReadWrite, image);
|
sl@0
|
1264 |
if (KErrNone != ret)
|
sl@0
|
1265 |
{
|
sl@0
|
1266 |
result = ret;
|
sl@0
|
1267 |
break;
|
sl@0
|
1268 |
}
|
sl@0
|
1269 |
const TInt KMaxOpenCount = 100;
|
sl@0
|
1270 |
RSgImage images[KMaxOpenCount];
|
sl@0
|
1271 |
TInt count = Math::Random() % KMaxOpenCount;
|
sl@0
|
1272 |
for (TInt k = 0; k < count; ++k)
|
sl@0
|
1273 |
{
|
sl@0
|
1274 |
ret = images[k].Open(((TSgresTestInfo*)aInfo)->iDrawableId);
|
sl@0
|
1275 |
if (KErrNone != ret)
|
sl@0
|
1276 |
{
|
sl@0
|
1277 |
result = ret;
|
sl@0
|
1278 |
break;
|
sl@0
|
1279 |
}
|
sl@0
|
1280 |
}
|
sl@0
|
1281 |
image.Close();
|
sl@0
|
1282 |
for (TInt k = 0; k < count; ++k)
|
sl@0
|
1283 |
{
|
sl@0
|
1284 |
images[k].Close();
|
sl@0
|
1285 |
}
|
sl@0
|
1286 |
}
|
sl@0
|
1287 |
}
|
sl@0
|
1288 |
break;
|
sl@0
|
1289 |
};
|
sl@0
|
1290 |
}
|
sl@0
|
1291 |
image.Close();
|
sl@0
|
1292 |
drawable.Close();
|
sl@0
|
1293 |
SgDriver::Close();
|
sl@0
|
1294 |
if (KErrNone == openSem)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
sem.Signal();
|
sl@0
|
1297 |
}
|
sl@0
|
1298 |
__UHEAP_MARKEND;
|
sl@0
|
1299 |
sem.Close();
|
sl@0
|
1300 |
TInt procHandles2 =0;
|
sl@0
|
1301 |
TInt threadHandles2=0;
|
sl@0
|
1302 |
RThread().HandleCount(procHandles2,threadHandles2);
|
sl@0
|
1303 |
if (threadHandles1 != threadHandles2)
|
sl@0
|
1304 |
{
|
sl@0
|
1305 |
result = KErrGeneral; // Thread-owned handles not closed
|
sl@0
|
1306 |
}
|
sl@0
|
1307 |
|
sl@0
|
1308 |
return result;
|
sl@0
|
1309 |
}
|
sl@0
|
1310 |
|
sl@0
|
1311 |
/**
|
sl@0
|
1312 |
Static function used by the cleanup item to close the driver.
|
sl@0
|
1313 |
*/
|
sl@0
|
1314 |
void CTSgTestStepBase::CloseDriverWhenLeave(TAny* /*aInfo*/)
|
sl@0
|
1315 |
{
|
sl@0
|
1316 |
SgDriver::Close();
|
sl@0
|
1317 |
}
|
sl@0
|
1318 |
|
sl@0
|
1319 |
/**
|
sl@0
|
1320 |
Checks the function for the passed error codes and logs an error if the codes do not match.
|
sl@0
|
1321 |
If the test is running out of memory tests, KErrNoMemory is also an expected error code and
|
sl@0
|
1322 |
the function would just leave with KErrNoMemory in that case.
|
sl@0
|
1323 |
|
sl@0
|
1324 |
@param aExpectedErrorCode The expected error code to check against
|
sl@0
|
1325 |
@param aActualErrorCode The actual error code
|
sl@0
|
1326 |
@param aFile The filename to use when reporting the error
|
sl@0
|
1327 |
@param aLine The line number to use when reporting the error
|
sl@0
|
1328 |
*/
|
sl@0
|
1329 |
void CTSgTestStepBase::CheckErrorL(TInt aExpectedErrorCode, TInt aActualErrorCode, const TText8* aFile, TInt aLine)
|
sl@0
|
1330 |
{
|
sl@0
|
1331 |
if(iRunningOomTests && KErrNoMemory == aActualErrorCode)
|
sl@0
|
1332 |
{
|
sl@0
|
1333 |
User::Leave(KErrNoMemory);
|
sl@0
|
1334 |
}
|
sl@0
|
1335 |
TESTWITHFILENAMEANDLINENUMBERL(aExpectedErrorCode == aActualErrorCode, aFile, aLine);
|
sl@0
|
1336 |
}
|
sl@0
|
1337 |
|
sl@0
|
1338 |
/**
|
sl@0
|
1339 |
Out of memory tests.
|
sl@0
|
1340 |
*/
|
sl@0
|
1341 |
void CTSgTestStepBase::TestOOM()
|
sl@0
|
1342 |
{
|
sl@0
|
1343 |
SgDriver::Open();
|
sl@0
|
1344 |
TInt err = KErrNone;
|
sl@0
|
1345 |
TInt tryCount = 0;
|
sl@0
|
1346 |
iRunningOomTests = ETrue;
|
sl@0
|
1347 |
do
|
sl@0
|
1348 |
{
|
sl@0
|
1349 |
SgDriver::SetAllocFail(RAllocator::EFailNext, ++tryCount);
|
sl@0
|
1350 |
TRAP(err, DoMemoryTestsL());
|
sl@0
|
1351 |
}
|
sl@0
|
1352 |
while(err == KErrNoMemory);
|
sl@0
|
1353 |
|
sl@0
|
1354 |
SgDriver::SetAllocFail(RAllocator::ENone, 0);
|
sl@0
|
1355 |
iRunningOomTests = EFalse;
|
sl@0
|
1356 |
SgDriver::Close();
|
sl@0
|
1357 |
INFO_PRINTF2(_L("- server succeeded at private heap failure rate of %i\n"), tryCount);
|
sl@0
|
1358 |
}
|
sl@0
|
1359 |
|
sl@0
|
1360 |
/**
|
sl@0
|
1361 |
Specifies which functions to run in out of memory conditions.
|
sl@0
|
1362 |
To be overridden by the derived test classes.
|
sl@0
|
1363 |
*/
|
sl@0
|
1364 |
void CTSgTestStepBase::DoMemoryTestsL()
|
sl@0
|
1365 |
{
|
sl@0
|
1366 |
}
|