0
|
1 |
// Copyright (c) 2001-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 the License "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 |
// Overview:
|
|
15 |
// Test the video driver kernel extension
|
|
16 |
// API Information:
|
|
17 |
// HAL, UserSvr
|
|
18 |
// Details:
|
|
19 |
// - Get and report the value for brightness & max brightness. Adjust
|
|
20 |
// the brightness. Verify results are as expected.
|
|
21 |
// - Get and report the value for contrast & max contrast. Adjust the
|
|
22 |
// contrast. Verify results are as expected.
|
|
23 |
// - Get and set backlight status, verify results.
|
|
24 |
// - Get the number of display modes and the current display mode.
|
|
25 |
// - Get screen information for current display mode.
|
|
26 |
// - Get Bits per pixel for current display mode, for an illegal mode
|
|
27 |
// and for all modes.
|
|
28 |
// - Switch display modes and verify results are as expected.
|
|
29 |
// - Get and set palette entries, verify the results.
|
|
30 |
// - Turn the display on and off.
|
|
31 |
// - If additional screens are supported, test each screen as above.
|
|
32 |
// - Test more devices than the kernel supports, verify the results.
|
|
33 |
// Platforms/Drives/Compatibility:
|
|
34 |
// All.
|
|
35 |
// Assumptions/Requirement/Pre-requisites:
|
|
36 |
// Failures and causes:
|
|
37 |
// Base Port information:
|
|
38 |
//
|
|
39 |
//
|
|
40 |
|
|
41 |
#include <e32test.h>
|
|
42 |
#include <videodriver.h>
|
|
43 |
#include <hal.h>
|
|
44 |
#include <e32svr.h>
|
|
45 |
|
|
46 |
LOCAL_D RTest test(_L("T_VIDEO"));
|
|
47 |
|
|
48 |
LOCAL_C void RunTests(void);
|
|
49 |
|
|
50 |
#ifndef __WINS__
|
|
51 |
#define DUMP(x) test.Printf(_L(#x"= %d =0x%08x\n"), x, x)
|
|
52 |
#endif
|
|
53 |
|
|
54 |
LOCAL_C void RunTests(void)
|
|
55 |
{
|
|
56 |
TInt ret = KErrNone;
|
|
57 |
TInt HALArg;
|
|
58 |
TInt saved = 0;
|
|
59 |
|
|
60 |
/* BRIGHTNESS */
|
|
61 |
|
|
62 |
TBool HALMaxBrightnessSupported = EFalse;
|
|
63 |
TBool HALGetBrightnessSupported = EFalse;
|
|
64 |
TBool HALSetBrightnessSupported = EFalse;
|
|
65 |
|
|
66 |
test.Next(_L("Max Brightness using HAL"));
|
|
67 |
TInt maxBrightness=-1;
|
|
68 |
ret = HAL::Get(HAL::EDisplayBrightnessMax, maxBrightness);
|
|
69 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
70 |
|
|
71 |
if (KErrNone == ret)
|
|
72 |
{
|
|
73 |
HALMaxBrightnessSupported = ETrue;
|
|
74 |
test.Printf(_L("Maximum brightness = %d\n"), maxBrightness);
|
|
75 |
}
|
|
76 |
else
|
|
77 |
test.Printf(_L("Maximum brightness is NOT SUPPORTED by HAL\n"));
|
|
78 |
|
|
79 |
|
|
80 |
test.Next(_L("Get Brightness using HAL"));
|
|
81 |
HALArg = -1;
|
|
82 |
ret = HAL::Get(HAL::EDisplayBrightness, HALArg);
|
|
83 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
84 |
if (KErrNone == ret)
|
|
85 |
{
|
|
86 |
test.Printf(_L("Brightness = %d\n"), HALArg);
|
|
87 |
HALGetBrightnessSupported = ETrue;
|
|
88 |
saved = HALArg;
|
|
89 |
}
|
|
90 |
else
|
|
91 |
{
|
|
92 |
test.Printf(_L("Get Brightness is NOT SUPPORTED by HAL\n"));
|
|
93 |
}
|
|
94 |
|
|
95 |
test.Next(_L("Test brightness is <= maxBrightness"));
|
|
96 |
test(HALArg <= maxBrightness);
|
|
97 |
|
|
98 |
test.Next(_L("Set Brightness using HAL"));
|
|
99 |
ret = HAL::Set(HAL::EDisplayBrightness, 0);
|
|
100 |
test ((KErrNone == ret) || (KErrNotSupported == ret) || (KErrArgument == ret));
|
|
101 |
if ((KErrNone == ret) || (KErrArgument == ret))
|
|
102 |
HALSetBrightnessSupported = ETrue;
|
|
103 |
else
|
|
104 |
test.Printf(_L("Set brightness is NOT SUPPORTED by HAL\n"));
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
//if any of the brightness funcs are supported, test they all are
|
|
109 |
//we've already tested Ldd/HAL are giving same support
|
|
110 |
if (HALSetBrightnessSupported && HALGetBrightnessSupported && HALMaxBrightnessSupported)
|
|
111 |
{
|
|
112 |
//all supported
|
|
113 |
//do more comprehensive set/gets
|
|
114 |
test.Next(_L("Set Brightness using HAL to saved value"));
|
|
115 |
ret = HAL::Set(HAL::EDisplayBrightness, saved);
|
|
116 |
test (KErrNone == ret);
|
|
117 |
|
|
118 |
test.Next(_L("Get Brightness using HAL"));
|
|
119 |
HALArg = -1;
|
|
120 |
ret = HAL::Get(HAL::EDisplayBrightness, HALArg);
|
|
121 |
test (KErrNone == ret);
|
|
122 |
test (saved == HALArg);
|
|
123 |
|
|
124 |
test.Next(_L("Set Brightness to the max using HAL"));
|
|
125 |
ret = HAL::Set(HAL::EDisplayBrightness, maxBrightness);
|
|
126 |
test.Printf(_L("ret = %d maxbr = %d"),ret, maxBrightness);
|
|
127 |
test (KErrNone == ret);
|
|
128 |
|
|
129 |
test.Next(_L("Get Brightness using HAL"));
|
|
130 |
HALArg = 0;
|
|
131 |
ret = HAL::Get(HAL::EDisplayBrightness, HALArg);
|
|
132 |
test (KErrNone == ret);
|
|
133 |
test (maxBrightness == HALArg);
|
|
134 |
|
|
135 |
test.Next(_L("Set Brightness using HAL"));
|
|
136 |
ret = HAL::Set(HAL::EDisplayBrightness, saved);
|
|
137 |
test (KErrNone == ret);
|
|
138 |
|
|
139 |
|
|
140 |
//test some out of range values
|
|
141 |
ret = HAL::Get(HAL::EDisplayBrightness, HALArg);
|
|
142 |
test (KErrNone == ret);
|
|
143 |
saved = HALArg;
|
|
144 |
|
|
145 |
test.Next(_L("Set Brightness too large using HAL"));
|
|
146 |
ret = HAL::Set(HAL::EDisplayBrightness, maxBrightness+1);
|
|
147 |
test (KErrArgument == ret);
|
|
148 |
|
|
149 |
test.Next(_L("Set Brightness too small using HAL"));
|
|
150 |
ret = HAL::Set(HAL::EDisplayBrightness, -1);
|
|
151 |
test (KErrArgument == ret);
|
|
152 |
|
|
153 |
}
|
|
154 |
else //check none are supported
|
|
155 |
test(!(HALSetBrightnessSupported || HALGetBrightnessSupported || HALMaxBrightnessSupported));
|
|
156 |
|
|
157 |
|
|
158 |
/* CONTRAST */
|
|
159 |
|
|
160 |
TBool HALMaxContrastSupported = EFalse;
|
|
161 |
TBool HALGetContrastSupported = EFalse;
|
|
162 |
TBool HALSetContrastSupported = EFalse;
|
|
163 |
|
|
164 |
|
|
165 |
test.Next(_L("Max Contrast using HAL"));
|
|
166 |
TInt maxContrast=-1;
|
|
167 |
ret = HAL::Get(HAL::EDisplayContrastMax, maxContrast);
|
|
168 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
169 |
|
|
170 |
if (KErrNone == ret)
|
|
171 |
{
|
|
172 |
HALMaxContrastSupported = ETrue;
|
|
173 |
test.Printf(_L("Maximum Contrast = %d\n"), maxContrast);
|
|
174 |
}
|
|
175 |
else
|
|
176 |
test.Printf(_L("Maximum Contrast is NOT SUPPORTED by HAL\n"));
|
|
177 |
|
|
178 |
|
|
179 |
test.Next(_L("Get Contrast using HAL"));
|
|
180 |
HALArg = -1;
|
|
181 |
ret = HAL::Get(HAL::EDisplayContrast, HALArg);
|
|
182 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
183 |
if (KErrNone == ret)
|
|
184 |
{
|
|
185 |
test.Printf(_L("Contrast = %d\n"), HALArg);
|
|
186 |
HALGetContrastSupported = ETrue;
|
|
187 |
saved = HALArg;
|
|
188 |
}
|
|
189 |
else
|
|
190 |
{
|
|
191 |
test.Printf(_L("Get Contrast is NOT SUPPORTED by HAL\n"));
|
|
192 |
}
|
|
193 |
|
|
194 |
test.Next(_L("Test contrast is <= maxcontrast"));
|
|
195 |
test(HALArg <= maxContrast);
|
|
196 |
|
|
197 |
test.Next(_L("Set Contrast using HAL"));
|
|
198 |
ret = HAL::Set(HAL::EDisplayContrast, 0);
|
|
199 |
test ((KErrNone == ret) || (KErrNotSupported == ret) || (KErrArgument == ret));
|
|
200 |
if ((KErrNone == ret) || (KErrArgument == ret))
|
|
201 |
HALSetContrastSupported = ETrue;
|
|
202 |
else
|
|
203 |
test.Printf(_L("Set Contrast is NOT SUPPORTED by HAL\n"));
|
|
204 |
|
|
205 |
|
|
206 |
|
|
207 |
//if any of the Contrast funcs are supported, test they all are
|
|
208 |
//we've already tested Ldd/HAL are giving same support
|
|
209 |
if (HALSetContrastSupported && HALGetContrastSupported && HALMaxContrastSupported)
|
|
210 |
{
|
|
211 |
//all supported
|
|
212 |
//do more comprehensive set/gets
|
|
213 |
test.Next(_L("Set Contrast using HAL to saved value"));
|
|
214 |
ret = HAL::Set(HAL::EDisplayContrast, saved);
|
|
215 |
test (KErrNone == ret);
|
|
216 |
|
|
217 |
test.Next(_L("Get Contrast using HAL"));
|
|
218 |
HALArg = -1;
|
|
219 |
ret = HAL::Get(HAL::EDisplayContrast, HALArg);
|
|
220 |
test (KErrNone == ret);
|
|
221 |
test (saved == HALArg);
|
|
222 |
|
|
223 |
test.Next(_L("Set Contrast to the max using HAL"));
|
|
224 |
ret = HAL::Set(HAL::EDisplayContrast, maxContrast);
|
|
225 |
test (KErrNone == ret);
|
|
226 |
|
|
227 |
test.Next(_L("Get Contrast using HAL"));
|
|
228 |
HALArg = 0;
|
|
229 |
ret = HAL::Get(HAL::EDisplayContrast, HALArg);
|
|
230 |
test (KErrNone == ret);
|
|
231 |
test (maxContrast == HALArg);
|
|
232 |
|
|
233 |
test.Next(_L("Set Contrast using HAL"));
|
|
234 |
ret = HAL::Set(HAL::EDisplayContrast, saved);
|
|
235 |
test (KErrNone == ret);
|
|
236 |
|
|
237 |
|
|
238 |
//test some out of range values
|
|
239 |
ret = HAL::Get(HAL::EDisplayContrast, HALArg);
|
|
240 |
test (KErrNone == ret);
|
|
241 |
saved = HALArg;
|
|
242 |
|
|
243 |
test.Next(_L("Set Contrast too large using HAL"));
|
|
244 |
ret = HAL::Set(HAL::EDisplayContrast, maxContrast+1);
|
|
245 |
test (KErrArgument == ret);
|
|
246 |
|
|
247 |
test.Next(_L("Set Contrast too small using HAL"));
|
|
248 |
ret = HAL::Set(HAL::EDisplayContrast, -1);
|
|
249 |
test (KErrArgument == ret);
|
|
250 |
|
|
251 |
}
|
|
252 |
else //check none are supported
|
|
253 |
test(!(HALSetContrastSupported || HALGetContrastSupported || HALMaxContrastSupported));
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
/* BACKLIGHT */
|
|
258 |
|
|
259 |
TBool HALGetBacklightSupported = EFalse;
|
|
260 |
TBool HALSetBacklightSupported = EFalse;
|
|
261 |
TBool lightSupported = EFalse;
|
|
262 |
|
|
263 |
test.Next(_L("check if backlight supported using HAL"));
|
|
264 |
HALArg = -1;
|
|
265 |
ret = HAL::Get(HAL::EBacklight, lightSupported);
|
|
266 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
267 |
test.Printf(_L("Backlight supported = %d"), lightSupported);
|
|
268 |
|
|
269 |
|
|
270 |
|
|
271 |
test.Next(_L("Get Backlight state using HAL"));
|
|
272 |
HALArg = -1;
|
|
273 |
ret = HAL::Get(HAL::EBacklightState, HALArg);
|
|
274 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
275 |
if (KErrNone == ret)
|
|
276 |
{
|
|
277 |
HALGetBacklightSupported = ETrue;
|
|
278 |
test.Printf(_L("Backlight is = %d from HAL\n"), HALArg);
|
|
279 |
}
|
|
280 |
else
|
|
281 |
test.Printf(_L("Get Light is NOT SUPPORTED by HAL\n"));
|
|
282 |
|
|
283 |
|
|
284 |
test.Next(_L("Set Backlight state using HAL"));
|
|
285 |
HALArg = 0;
|
|
286 |
ret = HAL::Set(HAL::EBacklightState, HALArg);
|
|
287 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
288 |
if (KErrNone == ret)
|
|
289 |
{
|
|
290 |
HALSetBacklightSupported = ETrue;
|
|
291 |
test.Printf(_L("Backlight is set to = %d from HAL\n"), HALArg);
|
|
292 |
}
|
|
293 |
else
|
|
294 |
test.Printf(_L("Set Light is NOT SUPPORTED by HAL\n"));
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
|
|
299 |
if (HALGetBacklightSupported && HALSetBacklightSupported)
|
|
300 |
{
|
|
301 |
|
|
302 |
test.Next(_L("Get Backlight state using HAL (should be off)"));
|
|
303 |
HALArg = -1;
|
|
304 |
ret = HAL::Get(HAL::EBacklightState, HALArg);
|
|
305 |
test (KErrNone == ret);
|
|
306 |
test (0 == HALArg);
|
|
307 |
|
|
308 |
test.Next(_L("Set Backlight state to on using HAL"));
|
|
309 |
ret = HAL::Set(HAL::EBacklightState, 1);
|
|
310 |
test (KErrNone == ret);
|
|
311 |
|
|
312 |
}
|
|
313 |
else
|
|
314 |
test (!HALGetBacklightSupported == !HALSetBacklightSupported);
|
|
315 |
|
|
316 |
|
|
317 |
/* maximum display colors*/
|
|
318 |
test.Next(_L("Display Colors"));
|
|
319 |
ret = HAL::Get(HAL::EDisplayColors, HALArg);
|
|
320 |
test (KErrNone == ret);
|
|
321 |
|
|
322 |
|
|
323 |
/* DISPLAY MODE */
|
|
324 |
test.Next(_L("Display Modes"));
|
|
325 |
TInt totalModes;
|
|
326 |
ret = HAL::Get(HAL::EDisplayNumModes, totalModes);
|
|
327 |
test (KErrNone == ret);
|
|
328 |
|
|
329 |
TInt displayMode;
|
|
330 |
ret = HAL::Get(HAL::EDisplayMode, displayMode);
|
|
331 |
test (KErrNone == ret);
|
|
332 |
|
|
333 |
|
|
334 |
|
|
335 |
/* SCREEN INFORMATION*/
|
|
336 |
|
|
337 |
test.Next(_L("Get Screen Info for current mode using driver"));
|
|
338 |
|
|
339 |
|
|
340 |
test.Next(_L("Get screen info using usersvr"));
|
|
341 |
TScreenInfoV01 screenInfo;
|
|
342 |
TPckg<TScreenInfoV01> sI(screenInfo);
|
|
343 |
UserSvr::ScreenInfo(sI);
|
|
344 |
test (screenInfo.iScreenAddressValid != screenInfo.iWindowHandleValid);
|
|
345 |
if (screenInfo.iScreenAddressValid)
|
|
346 |
test (screenInfo.iScreenAddress != 0);
|
|
347 |
if (screenInfo.iWindowHandleValid)
|
|
348 |
test (screenInfo.iWindowHandle != 0);
|
|
349 |
|
|
350 |
|
|
351 |
TInt val;
|
|
352 |
test.Next(_L("Get DisplayXPixels using HAL"));
|
|
353 |
ret = HAL::Get(HAL::EDisplayXPixels, val);
|
|
354 |
test (KErrNone == ret);
|
|
355 |
test (val == screenInfo.iScreenSize.iWidth);
|
|
356 |
|
|
357 |
test.Next(_L("Get DisplayYPixels using HAL"));
|
|
358 |
ret = HAL::Get(HAL::EDisplayYPixels, val);
|
|
359 |
test (KErrNone == ret);
|
|
360 |
test (val == screenInfo.iScreenSize.iHeight);
|
|
361 |
|
|
362 |
TInt xtwips;
|
|
363 |
test.Next(_L("Get DisplayXTwips using HAL"));
|
|
364 |
ret = HAL::Get(HAL::EDisplayXTwips, xtwips);
|
|
365 |
test (KErrNone == ret);
|
|
366 |
|
|
367 |
TInt ytwips;
|
|
368 |
test.Next(_L("Get DisplayYTwips using HAL"));
|
|
369 |
ret = HAL::Get(HAL::EDisplayYTwips, ytwips);
|
|
370 |
test (KErrNone == ret);
|
|
371 |
|
|
372 |
TInt vaddr;
|
|
373 |
test.Next(_L("Get video address using HAL"));
|
|
374 |
ret = HAL::Get(HAL::EDisplayMemoryAddress, vaddr);
|
|
375 |
test (KErrNone == ret);
|
|
376 |
#ifndef __WINS__
|
|
377 |
test (vaddr == (TInt)screenInfo.iScreenAddress);
|
|
378 |
#else
|
|
379 |
test (vaddr == (TInt)screenInfo.iWindowHandle);
|
|
380 |
#endif
|
|
381 |
|
|
382 |
test.Next(_L("Use machine info"));
|
|
383 |
|
|
384 |
TMachineInfoV1 mi;
|
|
385 |
TMachineInfoV1Buf mib;
|
|
386 |
|
|
387 |
UserHal::MachineInfo(mib);
|
|
388 |
mi = mib();
|
|
389 |
|
|
390 |
test.Printf(_L("si.iWidth = %d, si.iHeight = %d, mi.iWidth = %d, mi.iHeight = %d\n"),screenInfo.iScreenSize.iWidth, screenInfo.iScreenSize.iHeight, mi.iDisplaySizeInPixels.iWidth, mi.iDisplaySizeInPixels.iHeight);
|
|
391 |
test.Printf(_L("xtwips = %d, ytwips = %d, iWidth = %d, iHeight = %d\n"),xtwips, ytwips, mi.iPhysicalScreenSize.iWidth, mi.iPhysicalScreenSize.iHeight);
|
|
392 |
|
|
393 |
test (screenInfo.iScreenSize.iWidth == mi.iDisplaySizeInPixels.iWidth);
|
|
394 |
test (screenInfo.iScreenSize.iHeight == mi.iDisplaySizeInPixels.iHeight);
|
|
395 |
test (xtwips == mi.iPhysicalScreenSize.iWidth);
|
|
396 |
test (ytwips == mi.iPhysicalScreenSize.iHeight);
|
|
397 |
|
|
398 |
|
|
399 |
/* BITS PER PIXEL */
|
|
400 |
|
|
401 |
test.Next(_L("Get Bits per pixel for current display mode using HAL"));
|
|
402 |
|
|
403 |
HALArg = displayMode;
|
|
404 |
ret = HAL::Get(HAL::EDisplayBitsPerPixel, HALArg);
|
|
405 |
test (KErrNone == ret);
|
|
406 |
|
|
407 |
|
|
408 |
test.Next(_L("Get Bits per pixel with illegal mode using HAL"));
|
|
409 |
HALArg = -1;
|
|
410 |
ret = HAL::Get(HAL::EDisplayBitsPerPixel, HALArg);
|
|
411 |
test (KErrArgument == ret);
|
|
412 |
|
|
413 |
HALArg = totalModes;
|
|
414 |
ret = HAL::Get(HAL::EDisplayBitsPerPixel, HALArg);
|
|
415 |
test (KErrArgument == ret);
|
|
416 |
|
|
417 |
|
|
418 |
/*DISPLAY MODES*/
|
|
419 |
test.Next(_L("loop through the display modes getting the info"));
|
|
420 |
|
|
421 |
TInt count;
|
|
422 |
|
|
423 |
|
|
424 |
for (count = 0; count < totalModes; count++)
|
|
425 |
{
|
|
426 |
|
|
427 |
test.Next(_L("Offset To first pixel"));
|
|
428 |
HALArg = count;
|
|
429 |
ret = HAL::Get(HAL::EDisplayOffsetToFirstPixel, HALArg);
|
|
430 |
test (KErrNone == ret);
|
|
431 |
test (HALArg >= 0);
|
|
432 |
|
|
433 |
test.Next(_L("Test Offset between lines is > 0"));
|
|
434 |
HALArg = count;
|
|
435 |
ret = HAL::Get(HAL::EDisplayOffsetBetweenLines, HALArg);
|
|
436 |
test (KErrNone == ret);
|
|
437 |
#ifndef __WINS__
|
|
438 |
test (HALArg > 0);
|
|
439 |
#else
|
|
440 |
test.Printf(_L("WINS can return 0 here as it doesn't handle the buffer itself, target hardware must return > 0"));
|
|
441 |
test (HALArg >= 0);
|
|
442 |
#endif
|
|
443 |
test.Next(_L("is display mono"));
|
|
444 |
HALArg = count;
|
|
445 |
ret = HAL::Get(HAL::EDisplayIsMono, HALArg);
|
|
446 |
test (KErrNone == ret);
|
|
447 |
|
|
448 |
test.Next(_L("is display palettized"));
|
|
449 |
HALArg = count;
|
|
450 |
ret = HAL::Get(HAL::EDisplayIsPalettized, HALArg);
|
|
451 |
test (KErrNone == ret);
|
|
452 |
|
|
453 |
test.Next(_L("bits per pixel"));
|
|
454 |
HALArg = count;
|
|
455 |
ret = HAL::Get(HAL::EDisplayBitsPerPixel, HALArg);
|
|
456 |
test (KErrNone == ret);
|
|
457 |
|
|
458 |
}
|
|
459 |
|
|
460 |
|
|
461 |
test.Next(_L("switch display modes must be supported if > 1 display mode"));
|
|
462 |
|
|
463 |
TInt oldMode = displayMode;
|
|
464 |
#ifndef __X86__
|
|
465 |
if (totalModes > 1)
|
|
466 |
{
|
|
467 |
HALArg = displayMode;
|
|
468 |
ret = HAL::Set(HAL::EDisplayMode, HALArg);
|
|
469 |
test.Printf(_L("ret is %d dmode is %d\n"),ret, HALArg);
|
|
470 |
test (KErrNone == ret);
|
|
471 |
|
|
472 |
ret = HAL::Get(HAL::EDisplayMode, HALArg);
|
|
473 |
test (KErrNone == ret);
|
|
474 |
test (HALArg == displayMode);
|
|
475 |
|
|
476 |
}
|
|
477 |
#endif
|
|
478 |
for (count = 0; count < totalModes; count++)
|
|
479 |
{
|
|
480 |
|
|
481 |
#ifndef __X86__
|
|
482 |
if (totalModes > 1) //we must support mode change
|
|
483 |
{
|
|
484 |
test.Printf(_L("Setting Display Mode to %d\n"), count);
|
|
485 |
|
|
486 |
ret = HAL::Set(HAL::EDisplayMode, count);
|
|
487 |
test (KErrNone == ret);
|
|
488 |
|
|
489 |
ret = HAL::Get(HAL::EDisplayMode, HALArg);
|
|
490 |
test (KErrNone == ret);
|
|
491 |
test (HALArg == count);
|
|
492 |
}
|
|
493 |
#endif
|
|
494 |
|
|
495 |
/* PALETTE */
|
|
496 |
|
|
497 |
//get the palette entries
|
|
498 |
//set a few to something else
|
|
499 |
//set them again
|
|
500 |
|
|
501 |
TInt palettized = count;
|
|
502 |
test.Next(_L("Get if we are using a palette using HAL"));
|
|
503 |
ret = HAL::Get(HAL::EDisplayIsPalettized, palettized);
|
|
504 |
test (KErrNone == ret);
|
|
505 |
|
|
506 |
if (palettized)
|
|
507 |
{
|
|
508 |
HALArg = count;
|
|
509 |
ret = HAL::Get(HAL::EDisplayBitsPerPixel, HALArg);
|
|
510 |
test (KErrNone == ret);
|
|
511 |
test.Printf(_L("Bitsperpixel is %d\n"),HALArg);
|
|
512 |
test (HALArg <= 8);
|
|
513 |
|
|
514 |
TInt max = (1 << HALArg) - 1;
|
|
515 |
test.Printf(_L("number of palette entries is %d\n"),max);
|
|
516 |
|
|
517 |
test.Next(_L("Get legal Palette entries using HAL and driver in loop"));
|
|
518 |
for (TInt x = 0; x <= max; x++)
|
|
519 |
{
|
|
520 |
HALArg = x;
|
|
521 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, HALArg);
|
|
522 |
test.Printf(_L("getting entry %d, ret is %d\n"),x, ret);
|
|
523 |
test (KErrNone == ret);
|
|
524 |
|
|
525 |
}
|
|
526 |
|
|
527 |
|
|
528 |
//try a few sets
|
|
529 |
TInt saved;
|
|
530 |
|
|
531 |
test.Next(_L("Set Palette entry 0 to red using HAL"));
|
|
532 |
|
|
533 |
saved = 0;
|
|
534 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, saved);
|
|
535 |
test (KErrNone == ret);
|
|
536 |
|
|
537 |
HALArg = 0xF80000;
|
|
538 |
ret = HAL::Set(HAL::EDisplayPaletteEntry, HALArg);
|
|
539 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
540 |
|
|
541 |
if (KErrNone == ret)
|
|
542 |
{
|
|
543 |
HALArg = 0;
|
|
544 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, HALArg);
|
|
545 |
test (KErrNone == ret);
|
|
546 |
test ((HALArg & 0xF8FFFF)==0xF80000);
|
|
547 |
|
|
548 |
ret = HAL::Set(HAL::EDisplayPaletteEntry, saved);
|
|
549 |
test (KErrNone == ret);
|
|
550 |
|
|
551 |
|
|
552 |
HALArg = 1;
|
|
553 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, HALArg);
|
|
554 |
test (KErrNone == ret);
|
|
555 |
|
|
556 |
|
|
557 |
HALArg = (7 << 24) || 0xFFFF00;
|
|
558 |
ret = HAL::Set(HAL::EDisplayPaletteEntry, HALArg);
|
|
559 |
test (KErrNone == ret);
|
|
560 |
|
|
561 |
|
|
562 |
}
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
HALArg = count;
|
|
567 |
test (KErrNone == HAL::Get(HAL::EDisplayBitsPerPixel, HALArg));
|
|
568 |
|
|
569 |
if (4 == HALArg)
|
|
570 |
{
|
|
571 |
test.Next(_L("Get Illegal palette entry using HAL"));
|
|
572 |
HALArg = 18;
|
|
573 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, HALArg);
|
|
574 |
test (KErrArgument == ret);
|
|
575 |
|
|
576 |
|
|
577 |
test.Next(_L("Set Illegal palette entry using HAL"));
|
|
578 |
HALArg = 0x12 << 24 ;
|
|
579 |
ret = HAL::Set(HAL::EDisplayPaletteEntry, HALArg);
|
|
580 |
test (KErrArgument == ret);
|
|
581 |
}
|
|
582 |
|
|
583 |
}
|
|
584 |
else
|
|
585 |
{
|
|
586 |
//not palettized
|
|
587 |
test.Next(_L("Get palette entry using HAL - should fail"));
|
|
588 |
HALArg = 0;
|
|
589 |
ret = HAL::Get(HAL::EDisplayPaletteEntry, HALArg);
|
|
590 |
test (KErrNotSupported == ret);
|
|
591 |
}
|
|
592 |
|
|
593 |
|
|
594 |
}
|
|
595 |
|
|
596 |
#ifndef __X86__
|
|
597 |
if (totalModes > 1) //we must support mode change
|
|
598 |
{
|
|
599 |
ret = HAL::Set(HAL::EDisplayMode, oldMode);
|
|
600 |
test (KErrNone == ret);
|
|
601 |
}
|
|
602 |
#endif
|
|
603 |
|
|
604 |
|
|
605 |
|
|
606 |
|
|
607 |
/* DISPLAY ON/OFF */
|
|
608 |
|
|
609 |
TInt displayState;
|
|
610 |
|
|
611 |
test.Next(_L("Check Display is on using HAL"));
|
|
612 |
displayState = EFalse;
|
|
613 |
ret = HAL::Get(HAL::EDisplayState, displayState);
|
|
614 |
test (KErrNone == ret);
|
|
615 |
test (displayState!=EFalse);
|
|
616 |
|
|
617 |
test.Next(_L("Turn Display Off using HAL"));
|
|
618 |
ret = HAL::Set(HAL::EDisplayState, 0);
|
|
619 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
620 |
|
|
621 |
if (KErrNone == ret)
|
|
622 |
{
|
|
623 |
// test.Next(_L("Check Display is off using HAL"));
|
|
624 |
displayState = ETrue;
|
|
625 |
ret = HAL::Get(HAL::EDisplayState, displayState);
|
|
626 |
test (KErrNone == ret);
|
|
627 |
test (displayState==EFalse);
|
|
628 |
|
|
629 |
// test.Next(_L("Display On using HAL"));
|
|
630 |
// ret = HAL::Set(HAL::EDisplayState, 1);
|
|
631 |
// test (KErrNotSupported == ret);
|
|
632 |
|
|
633 |
|
|
634 |
//need some way of turning on the display!
|
|
635 |
RTimer timer;
|
|
636 |
test(timer.CreateLocal()==KErrNone);
|
|
637 |
TTime now;
|
|
638 |
now.HomeTime();
|
|
639 |
TTime wakeup;
|
|
640 |
wakeup=now+TTimeIntervalSeconds(10);
|
|
641 |
TRequestStatus done;
|
|
642 |
timer.At(done,wakeup);
|
|
643 |
|
|
644 |
UserHal::SwitchOff();
|
|
645 |
User::WaitForRequest(done);
|
|
646 |
|
|
647 |
TRawEvent switchon;
|
|
648 |
switchon.Set(TRawEvent::ESwitchOn);
|
|
649 |
UserSvr::AddEvent(switchon);
|
|
650 |
}
|
|
651 |
else
|
|
652 |
test.Printf(_L("Display On/Off not supported by HAL on this playform\n"));
|
|
653 |
|
|
654 |
|
|
655 |
test.Next(_L("Check Display On using HAL"));
|
|
656 |
displayState = EFalse;
|
|
657 |
ret = HAL::Get(HAL::EDisplayState, displayState);
|
|
658 |
test (KErrNone == ret);
|
|
659 |
test (displayState!=EFalse);
|
|
660 |
|
|
661 |
|
|
662 |
// !!! Disable platform security tests until we get the new APIs
|
|
663 |
/*
|
|
664 |
test.Next(_L("Check if secure screen supported"));
|
|
665 |
TInt secure = EFalse;
|
|
666 |
ret = HAL::Get(HAL::ESecureDisplay, secure);
|
|
667 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
668 |
if (KErrNone == ret)
|
|
669 |
{
|
|
670 |
//get the secure address
|
|
671 |
TInt addr = 0;
|
|
672 |
ret = HAL::Get(HAL::ESecureDisplayMemoryAddress, addr);
|
|
673 |
test (KErrNone == ret);
|
|
674 |
|
|
675 |
//switch to secure screen
|
|
676 |
ret = HAL::Set(HAL::ESecureDisplay, ETrue);
|
|
677 |
test (KErrNone == ret);
|
|
678 |
User::After(2000000);
|
|
679 |
|
|
680 |
//switch to insecure screen
|
|
681 |
ret = HAL::Set(HAL::ESecureDisplay, EFalse);
|
|
682 |
test (KErrNone == ret);
|
|
683 |
User::After(2000000);
|
|
684 |
|
|
685 |
//switch to secure screen
|
|
686 |
ret = HAL::Set(HAL::ESecureDisplay, ETrue);
|
|
687 |
test (KErrNone == ret);
|
|
688 |
User::After(2000000);
|
|
689 |
|
|
690 |
//switch to insecure screen
|
|
691 |
ret = HAL::Set(HAL::ESecureDisplay, EFalse);
|
|
692 |
test (KErrNone == ret);
|
|
693 |
}
|
|
694 |
else
|
|
695 |
test.Printf(_L("secure screen not supported on this platform\n"));
|
|
696 |
*/
|
|
697 |
|
|
698 |
}
|
|
699 |
|
|
700 |
|
|
701 |
//the function above tests HAL APIs where no screen number is specified
|
|
702 |
//and implicitly screen 0 is assumed. This function runs only for additional
|
|
703 |
//screens if any (screen1, screen2 etc.)
|
|
704 |
//this uses the HAL APIs that take a screen number
|
|
705 |
LOCAL_C void RunTestsAdditionalScreens(TInt screen)
|
|
706 |
{
|
|
707 |
TInt ret = KErrNone;
|
|
708 |
TInt HALArg;
|
|
709 |
TInt saved = 0;
|
|
710 |
|
|
711 |
/* BRIGHTNESS */
|
|
712 |
|
|
713 |
TBool HALMaxBrightnessSupported = EFalse;
|
|
714 |
TBool HALGetBrightnessSupported = EFalse;
|
|
715 |
TBool HALSetBrightnessSupported = EFalse;
|
|
716 |
|
|
717 |
|
|
718 |
test.Next(_L("Max Brightness using HAL"));
|
|
719 |
TInt maxBrightness=-1;
|
|
720 |
ret = HAL::Get(screen, HAL::EDisplayBrightnessMax, maxBrightness);
|
|
721 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
722 |
|
|
723 |
if (KErrNone == ret)
|
|
724 |
{
|
|
725 |
HALMaxBrightnessSupported = ETrue;
|
|
726 |
test.Printf(_L("Maximum brightness = %d\n"), maxBrightness);
|
|
727 |
}
|
|
728 |
else
|
|
729 |
test.Printf(_L("Maximum brightness is NOT SUPPORTED by HAL\n"));
|
|
730 |
|
|
731 |
|
|
732 |
test.Next(_L("Get Brightness using HAL"));
|
|
733 |
HALArg = -1;
|
|
734 |
ret = HAL::Get(screen, HAL::EDisplayBrightness, HALArg);
|
|
735 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
736 |
if (KErrNone == ret)
|
|
737 |
{
|
|
738 |
test.Printf(_L("Brightness = %d\n"), HALArg);
|
|
739 |
HALGetBrightnessSupported = ETrue;
|
|
740 |
saved = HALArg;
|
|
741 |
}
|
|
742 |
else
|
|
743 |
{
|
|
744 |
test.Printf(_L("Get Brightness is NOT SUPPORTED by HAL\n"));
|
|
745 |
}
|
|
746 |
|
|
747 |
test.Next(_L("Test brightness is <= maxBrightness"));
|
|
748 |
test(HALArg <= maxBrightness);
|
|
749 |
|
|
750 |
test.Next(_L("Set Brightness using HAL"));
|
|
751 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, 0);
|
|
752 |
test ((KErrNone == ret) || (KErrNotSupported == ret) || (KErrArgument == ret));
|
|
753 |
if ((KErrNone == ret) || (KErrArgument == ret))
|
|
754 |
HALSetBrightnessSupported = ETrue;
|
|
755 |
else
|
|
756 |
test.Printf(_L("Set brightness is NOT SUPPORTED by HAL\n"));
|
|
757 |
|
|
758 |
|
|
759 |
|
|
760 |
//if any of the brightness funcs are supported, test they all are
|
|
761 |
//we've already tested Ldd/HAL are giving same support
|
|
762 |
if (HALSetBrightnessSupported && HALGetBrightnessSupported && HALMaxBrightnessSupported)
|
|
763 |
{
|
|
764 |
//all supported
|
|
765 |
//do more comprehensive set/gets
|
|
766 |
test.Next(_L("Set Brightness using HAL to saved value"));
|
|
767 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, saved);
|
|
768 |
test (KErrNone == ret);
|
|
769 |
|
|
770 |
test.Next(_L("Get Brightness using HAL"));
|
|
771 |
HALArg = -1;
|
|
772 |
ret = HAL::Get(screen, HAL::EDisplayBrightness, HALArg);
|
|
773 |
test (KErrNone == ret);
|
|
774 |
test (saved == HALArg);
|
|
775 |
|
|
776 |
test.Next(_L("Set Brightness to the max using HAL"));
|
|
777 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, maxBrightness);
|
|
778 |
test.Printf(_L("ret = %d maxbr = %d"),ret, maxBrightness);
|
|
779 |
test (KErrNone == ret);
|
|
780 |
|
|
781 |
test.Next(_L("Get Brightness using HAL"));
|
|
782 |
HALArg = 0;
|
|
783 |
ret = HAL::Get(screen, HAL::EDisplayBrightness, HALArg);
|
|
784 |
test (KErrNone == ret);
|
|
785 |
test (maxBrightness == HALArg);
|
|
786 |
|
|
787 |
test.Next(_L("Set Brightness using HAL"));
|
|
788 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, saved);
|
|
789 |
test (KErrNone == ret);
|
|
790 |
|
|
791 |
|
|
792 |
//test some out of range values
|
|
793 |
ret = HAL::Get(screen, HAL::EDisplayBrightness, HALArg);
|
|
794 |
test (KErrNone == ret);
|
|
795 |
saved = HALArg;
|
|
796 |
|
|
797 |
test.Next(_L("Set Brightness too large using HAL"));
|
|
798 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, maxBrightness+1);
|
|
799 |
test (KErrArgument == ret);
|
|
800 |
|
|
801 |
test.Next(_L("Set Brightness too small using HAL"));
|
|
802 |
ret = HAL::Set(screen, HAL::EDisplayBrightness, -1);
|
|
803 |
test (KErrArgument == ret);
|
|
804 |
|
|
805 |
}
|
|
806 |
else //check none are supported
|
|
807 |
test(!(HALSetBrightnessSupported || HALGetBrightnessSupported || HALMaxBrightnessSupported));
|
|
808 |
|
|
809 |
|
|
810 |
/* CONTRAST */
|
|
811 |
|
|
812 |
TBool HALMaxContrastSupported = EFalse;
|
|
813 |
TBool HALGetContrastSupported = EFalse;
|
|
814 |
TBool HALSetContrastSupported = EFalse;
|
|
815 |
|
|
816 |
|
|
817 |
test.Next(_L("Max Contrast using HAL"));
|
|
818 |
TInt maxContrast=-1;
|
|
819 |
ret = HAL::Get(screen, HAL::EDisplayContrastMax, maxContrast);
|
|
820 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
821 |
|
|
822 |
if (KErrNone == ret)
|
|
823 |
{
|
|
824 |
HALMaxContrastSupported = ETrue;
|
|
825 |
test.Printf(_L("Maximum Contrast = %d\n"), maxContrast);
|
|
826 |
}
|
|
827 |
else
|
|
828 |
test.Printf(_L("Maximum Contrast is NOT SUPPORTED by HAL\n"));
|
|
829 |
|
|
830 |
|
|
831 |
test.Next(_L("Get Contrast using HAL"));
|
|
832 |
HALArg = -1;
|
|
833 |
ret = HAL::Get(screen, HAL::EDisplayContrast, HALArg);
|
|
834 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
835 |
if (KErrNone == ret)
|
|
836 |
{
|
|
837 |
test.Printf(_L("Contrast = %d\n"), HALArg);
|
|
838 |
HALGetContrastSupported = ETrue;
|
|
839 |
saved = HALArg;
|
|
840 |
}
|
|
841 |
else
|
|
842 |
{
|
|
843 |
test.Printf(_L("Get Contrast is NOT SUPPORTED by HAL\n"));
|
|
844 |
}
|
|
845 |
|
|
846 |
test.Next(_L("Test contrast is <= maxcontrast"));
|
|
847 |
test(HALArg <= maxContrast);
|
|
848 |
|
|
849 |
test.Next(_L("Set Contrast using HAL"));
|
|
850 |
ret = HAL::Set(screen, HAL::EDisplayContrast, 0);
|
|
851 |
test ((KErrNone == ret) || (KErrNotSupported == ret) || (KErrArgument == ret));
|
|
852 |
if ((KErrNone == ret) || (KErrArgument == ret))
|
|
853 |
HALSetContrastSupported = ETrue;
|
|
854 |
else
|
|
855 |
test.Printf(_L("Set Contrast is NOT SUPPORTED by HAL\n"));
|
|
856 |
|
|
857 |
|
|
858 |
|
|
859 |
//if any of the Contrast funcs are supported, test they all are
|
|
860 |
//we've already tested Ldd/HAL are giving same support
|
|
861 |
if (HALSetContrastSupported && HALGetContrastSupported && HALMaxContrastSupported)
|
|
862 |
{
|
|
863 |
//all supported
|
|
864 |
//do more comprehensive set/gets
|
|
865 |
test.Next(_L("Set Contrast using HAL to saved value"));
|
|
866 |
ret = HAL::Set(screen, HAL::EDisplayContrast, saved);
|
|
867 |
test (KErrNone == ret);
|
|
868 |
|
|
869 |
test.Next(_L("Get Contrast using HAL"));
|
|
870 |
HALArg = -1;
|
|
871 |
ret = HAL::Get(screen, HAL::EDisplayContrast, HALArg);
|
|
872 |
test (KErrNone == ret);
|
|
873 |
test (saved == HALArg);
|
|
874 |
|
|
875 |
test.Next(_L("Set Contrast to the max using HAL"));
|
|
876 |
ret = HAL::Set(screen, HAL::EDisplayContrast, maxContrast);
|
|
877 |
test (KErrNone == ret);
|
|
878 |
|
|
879 |
test.Next(_L("Get Contrast using HAL"));
|
|
880 |
HALArg = 0;
|
|
881 |
ret = HAL::Get(screen, HAL::EDisplayContrast, HALArg);
|
|
882 |
test (KErrNone == ret);
|
|
883 |
test (maxContrast == HALArg);
|
|
884 |
|
|
885 |
test.Next(_L("Set Contrast using HAL"));
|
|
886 |
ret = HAL::Set(screen, HAL::EDisplayContrast, saved);
|
|
887 |
test (KErrNone == ret);
|
|
888 |
|
|
889 |
|
|
890 |
//test some out of range values
|
|
891 |
ret = HAL::Get(screen, HAL::EDisplayContrast, HALArg);
|
|
892 |
test (KErrNone == ret);
|
|
893 |
saved = HALArg;
|
|
894 |
|
|
895 |
test.Next(_L("Set Contrast too large using HAL"));
|
|
896 |
ret = HAL::Set(screen, HAL::EDisplayContrast, maxContrast+1);
|
|
897 |
test (KErrArgument == ret);
|
|
898 |
|
|
899 |
test.Next(_L("Set Contrast too small using HAL"));
|
|
900 |
ret = HAL::Set(screen, HAL::EDisplayContrast, -1);
|
|
901 |
test (KErrArgument == ret);
|
|
902 |
|
|
903 |
}
|
|
904 |
else //check none are supported
|
|
905 |
test(!(HALSetContrastSupported || HALGetContrastSupported || HALMaxContrastSupported));
|
|
906 |
|
|
907 |
|
|
908 |
|
|
909 |
/* BACKLIGHT */
|
|
910 |
|
|
911 |
TBool HALGetBacklightSupported = EFalse;
|
|
912 |
TBool HALSetBacklightSupported = EFalse;
|
|
913 |
TBool lightSupported = EFalse;
|
|
914 |
|
|
915 |
test.Next(_L("check if backlight supported using HAL"));
|
|
916 |
HALArg = -1;
|
|
917 |
ret = HAL::Get(screen, HAL::EBacklight, lightSupported);
|
|
918 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
919 |
test.Printf(_L("Backlight supported = %d"), lightSupported);
|
|
920 |
|
|
921 |
|
|
922 |
|
|
923 |
test.Next(_L("Get Backlight state using HAL"));
|
|
924 |
HALArg = -1;
|
|
925 |
ret = HAL::Get(screen, HAL::EBacklightState, HALArg);
|
|
926 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
927 |
if (KErrNone == ret)
|
|
928 |
{
|
|
929 |
HALGetBacklightSupported = ETrue;
|
|
930 |
test.Printf(_L("Backlight is = %d from HAL\n"), HALArg);
|
|
931 |
}
|
|
932 |
else
|
|
933 |
test.Printf(_L("Get Light is NOT SUPPORTED by HAL\n"));
|
|
934 |
|
|
935 |
|
|
936 |
test.Next(_L("Set Backlight state using HAL"));
|
|
937 |
HALArg = 0;
|
|
938 |
ret = HAL::Set(screen, HAL::EBacklightState, HALArg);
|
|
939 |
test ((KErrNone == ret) || (KErrNotSupported == ret));
|
|
940 |
if (KErrNone == ret)
|
|
941 |
{
|
|
942 |
HALSetBacklightSupported = ETrue;
|
|
943 |
test.Printf(_L("Backlight is set to = %d from HAL\n"), HALArg);
|
|
944 |
}
|
|
945 |
else
|
|
946 |
test.Printf(_L("Set Light is NOT SUPPORTED by HAL\n"));
|
|
947 |
|
|
948 |
|
|
949 |
|
|
950 |
|
|
951 |
if (HALGetBacklightSupported && HALSetBacklightSupported)
|
|
952 |
{
|
|
953 |
|
|
954 |
test.Next(_L("Get Backlight state using HAL (should be off)"));
|
|
955 |
HALArg = -1;
|
|
956 |
ret = HAL::Get(screen, HAL::EBacklightState, HALArg);
|
|
957 |
test (KErrNone == ret);
|
|
958 |
test (0 == HALArg);
|
|
959 |
|
|
960 |
test.Next(_L("Set Backlight state to on using HAL"));
|
|
961 |
ret = HAL::Set(screen, HAL::EBacklightState, 1);
|
|
962 |
test (KErrNone == ret);
|
|
963 |
|
|
964 |
}
|
|
965 |
else
|
|
966 |
test (!HALGetBacklightSupported == !HALSetBacklightSupported);
|
|
967 |
|
|
968 |
|
|
969 |
/* maximum display colors*/
|
|
970 |
test.Next(_L("Display Colors"));
|
|
971 |
ret = HAL::Get(screen, HAL::EDisplayColors, HALArg);
|
|
972 |
test (KErrNone == ret);
|
|
973 |
|
|
974 |
|
|
975 |
/* DISPLAY MODE */
|
|
976 |
test.Next(_L("Display Modes"));
|
|
977 |
TInt totalModes;
|
|
978 |
ret = HAL::Get(screen, HAL::EDisplayNumModes, totalModes);
|
|
979 |
test (KErrNone == ret);
|
|
980 |
|
|
981 |
TInt displayMode;
|
|
982 |
ret = HAL::Get(screen, HAL::EDisplayMode, displayMode);
|
|
983 |
test (KErrNone == ret);
|
|
984 |
|
|
985 |
TInt val;
|
|
986 |
test.Next(_L("Get DisplayXPixels using HAL"));
|
|
987 |
ret = HAL::Get(screen, HAL::EDisplayXPixels, val);
|
|
988 |
test (KErrNone == ret);
|
|
989 |
|
|
990 |
test.Next(_L("Get DisplayYPixels using HAL"));
|
|
991 |
ret = HAL::Get(screen, HAL::EDisplayYPixels, val);
|
|
992 |
test (KErrNone == ret);
|
|
993 |
|
|
994 |
TInt xtwips;
|
|
995 |
test.Next(_L("Get DisplayXTwips using HAL"));
|
|
996 |
ret = HAL::Get(screen, HAL::EDisplayXTwips, xtwips);
|
|
997 |
test (KErrNone == ret);
|
|
998 |
|
|
999 |
TInt ytwips;
|
|
1000 |
test.Next(_L("Get DisplayYTwips using HAL"));
|
|
1001 |
ret = HAL::Get(screen, HAL::EDisplayYTwips, ytwips);
|
|
1002 |
test (KErrNone == ret);
|
|
1003 |
|
|
1004 |
TInt vaddr;
|
|
1005 |
test.Next(_L("Get video address using HAL"));
|
|
1006 |
ret = HAL::Get(screen, HAL::EDisplayMemoryAddress, vaddr);
|
|
1007 |
test (KErrNone == ret);
|
|
1008 |
|
|
1009 |
|
|
1010 |
/* BITS PER PIXEL */
|
|
1011 |
|
|
1012 |
test.Next(_L("Get Bits per pixel for current display mode using HAL"));
|
|
1013 |
|
|
1014 |
HALArg = displayMode;
|
|
1015 |
ret = HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg);
|
|
1016 |
test (KErrNone == ret);
|
|
1017 |
|
|
1018 |
|
|
1019 |
test.Next(_L("Get Bits per pixel with illegal mode using HAL"));
|
|
1020 |
HALArg = -1;
|
|
1021 |
ret = HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg);
|
|
1022 |
test (KErrArgument == ret);
|
|
1023 |
|
|
1024 |
HALArg = totalModes;
|
|
1025 |
ret = HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg);
|
|
1026 |
test (KErrArgument == ret);
|
|
1027 |
|
|
1028 |
|
|
1029 |
/*DISPLAY MODES*/
|
|
1030 |
test.Next(_L("loop through the display modes getting the info"));
|
|
1031 |
|
|
1032 |
TInt count;
|
|
1033 |
|
|
1034 |
for (count = 0; count < totalModes; count++)
|
|
1035 |
{
|
|
1036 |
|
|
1037 |
test.Next(_L("Offset To first pixel"));
|
|
1038 |
HALArg = count;
|
|
1039 |
ret = HAL::Get(screen, HAL::EDisplayOffsetToFirstPixel, HALArg);
|
|
1040 |
test (KErrNone == ret);
|
|
1041 |
test (HALArg >= 0);
|
|
1042 |
|
|
1043 |
test.Next(_L("Test Offset between lines is > 0"));
|
|
1044 |
HALArg = count;
|
|
1045 |
ret = HAL::Get(screen, HAL::EDisplayOffsetBetweenLines, HALArg);
|
|
1046 |
test (KErrNone == ret);
|
|
1047 |
#ifndef __WINS__
|
|
1048 |
test (HALArg > 0);
|
|
1049 |
#else
|
|
1050 |
test.Printf(_L("WINS can return 0 here as it doesn't handle the buffer itself, target hardware must return > 0"));
|
|
1051 |
test (HALArg >= 0);
|
|
1052 |
#endif
|
|
1053 |
test.Next(_L("is display mono"));
|
|
1054 |
HALArg = count;
|
|
1055 |
ret = HAL::Get(screen, HAL::EDisplayIsMono, HALArg);
|
|
1056 |
test (KErrNone == ret);
|
|
1057 |
|
|
1058 |
test.Next(_L("is display palettized"));
|
|
1059 |
HALArg = count;
|
|
1060 |
ret = HAL::Get(screen, HAL::EDisplayIsPalettized, HALArg);
|
|
1061 |
test (KErrNone == ret);
|
|
1062 |
|
|
1063 |
test.Next(_L("bits per pixel"));
|
|
1064 |
HALArg = count;
|
|
1065 |
ret = HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg);
|
|
1066 |
test (KErrNone == ret);
|
|
1067 |
|
|
1068 |
}
|
|
1069 |
|
|
1070 |
|
|
1071 |
test.Next(_L("switch display modes must be supported if > 1 display mode"));
|
|
1072 |
|
|
1073 |
TInt oldMode = displayMode;
|
|
1074 |
#ifndef __X86__
|
|
1075 |
if (totalModes > 1)
|
|
1076 |
{
|
|
1077 |
HALArg = displayMode;
|
|
1078 |
ret = HAL::Set(screen, HAL::EDisplayMode, HALArg);
|
|
1079 |
test.Printf(_L("ret is %d dmode is %d\n"),ret, HALArg);
|
|
1080 |
test (KErrNone == ret);
|
|
1081 |
|
|
1082 |
ret = HAL::Get(screen, HAL::EDisplayMode, HALArg);
|
|
1083 |
test (KErrNone == ret);
|
|
1084 |
test (HALArg == displayMode);
|
|
1085 |
|
|
1086 |
}
|
|
1087 |
#endif
|
|
1088 |
for (count = 0; count < totalModes; count++)
|
|
1089 |
{
|
|
1090 |
|
|
1091 |
#ifndef __X86__
|
|
1092 |
if (totalModes > 1) //we must support mode change
|
|
1093 |
{
|
|
1094 |
test.Printf(_L("Setting Display Mode to %d\n"), count);
|
|
1095 |
|
|
1096 |
ret = HAL::Set(screen, HAL::EDisplayMode, count);
|
|
1097 |
test (KErrNone == ret);
|
|
1098 |
|
|
1099 |
ret = HAL::Get(screen, HAL::EDisplayMode, HALArg);
|
|
1100 |
test (KErrNone == ret);
|
|
1101 |
test (HALArg == count);
|
|
1102 |
}
|
|
1103 |
#endif
|
|
1104 |
|
|
1105 |
/* PALETTE */
|
|
1106 |
|
|
1107 |
//get the palette entries
|
|
1108 |
//set a few to something else
|
|
1109 |
//set them again
|
|
1110 |
|
|
1111 |
TInt palettized = count;
|
|
1112 |
test.Next(_L("Get if we are using a palette using HAL"));
|
|
1113 |
ret = HAL::Get(screen, HAL::EDisplayIsPalettized, palettized);
|
|
1114 |
test (KErrNone == ret);
|
|
1115 |
|
|
1116 |
if (palettized)
|
|
1117 |
{
|
|
1118 |
HALArg = count;
|
|
1119 |
ret = HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg);
|
|
1120 |
test (KErrNone == ret);
|
|
1121 |
test.Printf(_L("Bitsperpixel is %d\n"),HALArg);
|
|
1122 |
test (HALArg <= 8);
|
|
1123 |
|
|
1124 |
TInt max = (1 << HALArg) - 1;
|
|
1125 |
test.Printf(_L("number of palette entries is %d\n"),max);
|
|
1126 |
|
|
1127 |
test.Next(_L("Get legal Palette entries using HAL and driver in loop"));
|
|
1128 |
for (TInt x = 0; x <= max; x++)
|
|
1129 |
{
|
|
1130 |
HALArg = x;
|
|
1131 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1132 |
test.Printf(_L("getting entry %d, ret is %d\n"),x, ret);
|
|
1133 |
test (KErrNone == ret);
|
|
1134 |
|
|
1135 |
}
|
|
1136 |
|
|
1137 |
|
|
1138 |
//try a few sets
|
|
1139 |
TInt saved;
|
|
1140 |
|
|
1141 |
test.Next(_L("Set Palette entry 0 to red using HAL"));
|
|
1142 |
|
|
1143 |
saved = 0;
|
|
1144 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, saved);
|
|
1145 |
test (KErrNone == ret);
|
|
1146 |
|
|
1147 |
HALArg = 0xFF0000;
|
|
1148 |
ret = HAL::Set(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1149 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
1150 |
|
|
1151 |
if (KErrNone == ret)
|
|
1152 |
{
|
|
1153 |
HALArg = 0;
|
|
1154 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1155 |
test (KErrNone == ret);
|
|
1156 |
test (HALArg = 0xFF0000);
|
|
1157 |
|
|
1158 |
ret = HAL::Set(screen, HAL::EDisplayPaletteEntry, saved);
|
|
1159 |
test (KErrNone == ret);
|
|
1160 |
|
|
1161 |
|
|
1162 |
HALArg = 1;
|
|
1163 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1164 |
test (KErrNone == ret);
|
|
1165 |
|
|
1166 |
|
|
1167 |
HALArg = (7 << 24) || 0xFFFF00;
|
|
1168 |
ret = HAL::Set(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1169 |
test (KErrNone == ret);
|
|
1170 |
|
|
1171 |
|
|
1172 |
}
|
|
1173 |
|
|
1174 |
|
|
1175 |
|
|
1176 |
HALArg = count;
|
|
1177 |
test (KErrNone == HAL::Get(screen, HAL::EDisplayBitsPerPixel, HALArg));
|
|
1178 |
|
|
1179 |
if (4 == HALArg)
|
|
1180 |
{
|
|
1181 |
test.Next(_L("Get Illegal palette entry using HAL"));
|
|
1182 |
HALArg = 18;
|
|
1183 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1184 |
test (KErrArgument == ret);
|
|
1185 |
|
|
1186 |
|
|
1187 |
test.Next(_L("Set Illegal palette entry using HAL"));
|
|
1188 |
HALArg = 0x12 << 24 ;
|
|
1189 |
ret = HAL::Set(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1190 |
test (KErrArgument == ret);
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
}
|
|
1194 |
else
|
|
1195 |
{
|
|
1196 |
//not palettized
|
|
1197 |
test.Next(_L("Get palette entry using HAL - should fail"));
|
|
1198 |
HALArg = 0;
|
|
1199 |
ret = HAL::Get(screen, HAL::EDisplayPaletteEntry, HALArg);
|
|
1200 |
test (KErrNotSupported == ret);
|
|
1201 |
}
|
|
1202 |
|
|
1203 |
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
#ifndef __X86__
|
|
1207 |
if (totalModes > 1) //we must support mode change
|
|
1208 |
{
|
|
1209 |
ret = HAL::Set(screen, HAL::EDisplayMode, oldMode);
|
|
1210 |
test (KErrNone == ret);
|
|
1211 |
}
|
|
1212 |
#endif
|
|
1213 |
|
|
1214 |
|
|
1215 |
|
|
1216 |
|
|
1217 |
/* DISPLAY ON/OFF */
|
|
1218 |
|
|
1219 |
|
|
1220 |
// get current display state
|
|
1221 |
TInt curDisplayState;
|
|
1222 |
ret = HAL::Get(screen, HAL::EDisplayState, curDisplayState);
|
|
1223 |
test (KErrNone == ret);
|
|
1224 |
|
|
1225 |
test.Next(_L("Turn Display on using HAL"));
|
|
1226 |
ret = HAL::Set(screen, HAL::EDisplayState, 1);
|
|
1227 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
1228 |
|
|
1229 |
TInt displayState;
|
|
1230 |
|
|
1231 |
test.Next(_L("Check Display is on using HAL"));
|
|
1232 |
displayState = EFalse;
|
|
1233 |
ret = HAL::Get(screen, HAL::EDisplayState, displayState);
|
|
1234 |
test (KErrNone == ret);
|
|
1235 |
test (displayState!=EFalse);
|
|
1236 |
|
|
1237 |
test.Next(_L("Turn Display Off using HAL"));
|
|
1238 |
ret = HAL::Set(screen, HAL::EDisplayState, 0);
|
|
1239 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
1240 |
|
|
1241 |
if (KErrNone == ret)
|
|
1242 |
{
|
|
1243 |
test.Next(_L("Check Display is off using HAL"));
|
|
1244 |
displayState = ETrue;
|
|
1245 |
ret = HAL::Get(screen, HAL::EDisplayState, displayState);
|
|
1246 |
test (KErrNone == ret);
|
|
1247 |
test (displayState==EFalse);
|
|
1248 |
|
|
1249 |
// test.Next(_L("Display On using HAL"));
|
|
1250 |
// ret = HAL::Set(screen, HAL::EDisplayState, 1);
|
|
1251 |
// test (KErrNotSupported == ret);
|
|
1252 |
|
|
1253 |
|
|
1254 |
//need some way of turning on the display!
|
|
1255 |
RTimer timer;
|
|
1256 |
test(timer.CreateLocal()==KErrNone);
|
|
1257 |
TTime now;
|
|
1258 |
now.HomeTime();
|
|
1259 |
TTime wakeup;
|
|
1260 |
wakeup=now+TTimeIntervalSeconds(10);
|
|
1261 |
TRequestStatus done;
|
|
1262 |
timer.At(done,wakeup);
|
|
1263 |
|
|
1264 |
UserHal::SwitchOff();
|
|
1265 |
User::WaitForRequest(done);
|
|
1266 |
|
|
1267 |
TRawEvent switchon;
|
|
1268 |
switchon.Set(TRawEvent::ESwitchOn);
|
|
1269 |
UserSvr::AddEvent(switchon);
|
|
1270 |
}
|
|
1271 |
else
|
|
1272 |
test.Printf(_L("Display On/Off not supported by HAL on this playform\n"));
|
|
1273 |
|
|
1274 |
// restore the original display state
|
|
1275 |
ret = HAL::Set(screen, HAL::EDisplayState, curDisplayState);
|
|
1276 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
1277 |
|
|
1278 |
|
|
1279 |
// !!! Disable platform security tests until we get the new APIs
|
|
1280 |
/*
|
|
1281 |
test.Next(_L("Check if secure screen supported"));
|
|
1282 |
TInt secure = EFalse;
|
|
1283 |
ret = HAL::Get(screen, HAL::ESecureDisplay, secure);
|
|
1284 |
test (KErrNone == ret || KErrNotSupported == ret);
|
|
1285 |
if (KErrNone == ret)
|
|
1286 |
{
|
|
1287 |
//get the secure address
|
|
1288 |
TInt addr = 0;
|
|
1289 |
ret = HAL::Get(screen, HAL::ESecureDisplayMemoryAddress, addr);
|
|
1290 |
test (KErrNone == ret);
|
|
1291 |
|
|
1292 |
//switch to secure screen
|
|
1293 |
ret = HAL::Set(screen, HAL::ESecureDisplay, ETrue);
|
|
1294 |
test (KErrNone == ret);
|
|
1295 |
User::After(2000000);
|
|
1296 |
|
|
1297 |
//switch to insecure screen
|
|
1298 |
ret = HAL::Set(screen, HAL::ESecureDisplay, EFalse);
|
|
1299 |
test (KErrNone == ret);
|
|
1300 |
User::After(2000000);
|
|
1301 |
|
|
1302 |
//switch to secure screen
|
|
1303 |
ret = HAL::Set(screen, HAL::ESecureDisplay, ETrue);
|
|
1304 |
test (KErrNone == ret);
|
|
1305 |
User::After(2000000);
|
|
1306 |
|
|
1307 |
//switch to insecure screen
|
|
1308 |
ret = HAL::Set(screen, HAL::ESecureDisplay, EFalse);
|
|
1309 |
test (KErrNone == ret);
|
|
1310 |
}
|
|
1311 |
else
|
|
1312 |
test.Printf(_L("secure screen not supported on this platform\n"));
|
|
1313 |
*/
|
|
1314 |
|
|
1315 |
}
|
|
1316 |
|
|
1317 |
|
|
1318 |
GLDEF_C TInt E32Main()
|
|
1319 |
//
|
|
1320 |
//
|
|
1321 |
{
|
|
1322 |
|
|
1323 |
test.Title();
|
|
1324 |
//
|
|
1325 |
#if defined(__EPOC32__) && defined(__CPU_X86)
|
|
1326 |
test.Printf(_L("Doesn't run on X86\n"));
|
|
1327 |
#else
|
|
1328 |
|
|
1329 |
test.Start(_L("Testing Video extension"));
|
|
1330 |
|
|
1331 |
RunTests();
|
|
1332 |
TInt screens=1; // assume that we have at least 1 screen in case the HAL attr isn't supported
|
|
1333 |
TInt ret=HAL::Get(HAL::EDisplayNumberOfScreens, screens);
|
|
1334 |
test((ret==KErrNone) || (ret==KErrNotSupported));
|
|
1335 |
|
|
1336 |
TInt i;
|
|
1337 |
for(i=1;i<screens;i++)
|
|
1338 |
RunTestsAdditionalScreens(i);
|
|
1339 |
|
|
1340 |
test.Next(_L("Test more devices than the kernel can handle"));
|
|
1341 |
//this constant should have a value > KMaxHalEntries (defined in the kernel)
|
|
1342 |
const TInt KMoreThanKernelAllocates=10;
|
|
1343 |
for(i=screens;i<KMoreThanKernelAllocates;i++)
|
|
1344 |
{
|
|
1345 |
TInt val;
|
|
1346 |
test.Next(_L("Get DisplayXPixels using HAL"));
|
|
1347 |
ret = HAL::Get(i, HAL::EDisplayXPixels, val);
|
|
1348 |
test (KErrNotSupported == ret);
|
|
1349 |
|
|
1350 |
test.Next(_L("Get DisplayYPixels using HAL"));
|
|
1351 |
ret = HAL::Get(i, HAL::EDisplayYPixels, val);
|
|
1352 |
test (KErrNotSupported == ret);
|
|
1353 |
|
|
1354 |
TInt xtwips;
|
|
1355 |
test.Next(_L("Get DisplayXTwips using HAL"));
|
|
1356 |
ret = HAL::Get(i, HAL::EDisplayXTwips, xtwips);
|
|
1357 |
test (KErrNotSupported == ret);
|
|
1358 |
|
|
1359 |
TInt ytwips;
|
|
1360 |
test.Next(_L("Get DisplayYTwips using HAL"));
|
|
1361 |
ret = HAL::Get(i, HAL::EDisplayYTwips, ytwips);
|
|
1362 |
test (KErrNotSupported == ret);
|
|
1363 |
|
|
1364 |
TInt vaddr;
|
|
1365 |
test.Next(_L("Get video address using HAL"));
|
|
1366 |
ret = HAL::Get(i, HAL::EDisplayMemoryAddress, vaddr);
|
|
1367 |
test (KErrNotSupported == ret);
|
|
1368 |
}
|
|
1369 |
|
|
1370 |
test.Next(_L("Test HAL::GetAll"));
|
|
1371 |
TInt numEntries;
|
|
1372 |
HAL::SEntry* entries;
|
|
1373 |
ret=HAL::GetAll(numEntries, entries);
|
|
1374 |
test(ret==KErrNone);
|
|
1375 |
|
|
1376 |
test(numEntries==screens*(TInt)HAL::ENumHalAttributes);
|
|
1377 |
|
|
1378 |
User::Free(entries);
|
|
1379 |
|
|
1380 |
test.Next(_L("Test TRawEvent for multiple devices (screens)"));
|
|
1381 |
|
|
1382 |
TRawEvent event1;
|
|
1383 |
test(event1.Type()==0);
|
|
1384 |
test(event1.DeviceNumber()==KUndefinedDeviceNumber);
|
|
1385 |
|
|
1386 |
event1.SetDeviceNumber(0);
|
|
1387 |
test(event1.DeviceNumber()==0);
|
|
1388 |
|
|
1389 |
event1.SetDeviceNumber(KUndefinedDeviceNumber);
|
|
1390 |
test(event1.DeviceNumber()==KUndefinedDeviceNumber);
|
|
1391 |
|
|
1392 |
test(event1.Type()==0);
|
|
1393 |
|
|
1394 |
event1.Set(TRawEvent::EKeyDown);
|
|
1395 |
test(event1.Type()==TRawEvent::EKeyDown);
|
|
1396 |
|
|
1397 |
event1.Set(TRawEvent::EKeyUp,10);
|
|
1398 |
test(event1.Type()==TRawEvent::EKeyUp);
|
|
1399 |
|
|
1400 |
event1.Set(TRawEvent::EKeyDown,10,10);
|
|
1401 |
test(event1.Type()==TRawEvent::EKeyDown);
|
|
1402 |
|
|
1403 |
test.End();
|
|
1404 |
test.Close();
|
|
1405 |
|
|
1406 |
#endif
|
|
1407 |
|
|
1408 |
return KErrNone;
|
|
1409 |
}
|
|
1410 |
|