131
|
1 |
// Copyright (c) 2010 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 |
//
|
|
15 |
|
|
16 |
#define __E32TEST_EXTENSION__
|
|
17 |
#include <e32test.h>
|
|
18 |
#include <e32svr.h>
|
|
19 |
#include <e32cmn.h>
|
|
20 |
#include <e32cmn_private.h>
|
|
21 |
#include <hal.h>
|
|
22 |
|
|
23 |
LOCAL_D RTest test(_L("T_HalDefect Testcases"));
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
void DoTestRC_361803()
|
|
28 |
{
|
|
29 |
__UHEAP_MARK;
|
|
30 |
test.Start(_L("DoTestRC_361803 tests"));
|
|
31 |
|
|
32 |
TInt origValue = 0;
|
|
33 |
TInt r = HAL::Get(HALData::EDisplayMemoryHandle, origValue);
|
|
34 |
// Standard base emulator PSL without "-1 check", HAL::Get, r==KErrArgument
|
|
35 |
// Standard base emulator PSL, no mods, HAL::GetAll, r==KErrNone, origValue==0
|
|
36 |
// NaviEngine PSL, no mods, r==KErrNotSupported
|
|
37 |
// Platforms that support it: r==KErrNone, origValue==+ve
|
|
38 |
if ((r == KErrNotSupported) || (r == KErrArgument) ||
|
|
39 |
(origValue == 0)) // Skip test if not supported
|
|
40 |
{
|
|
41 |
test.Printf(_L("Platform doesn't support EDigitiserOrientation, skipping, (%d, %d)\n"), r, origValue);
|
|
42 |
test.End();
|
|
43 |
__UHEAP_MARKEND;
|
|
44 |
return;
|
|
45 |
}
|
|
46 |
// Attribute supported
|
|
47 |
test_KErrNone(r);
|
|
48 |
RHandleBase handle;
|
|
49 |
handle.SetHandle(origValue);
|
|
50 |
handle.Close();
|
|
51 |
test.Printf(_L("Platform DOES support EDigitiserOrientation, handle closed\n"));
|
|
52 |
|
|
53 |
HAL::SEntry* pE = 0;
|
|
54 |
TInt pC = 0;
|
|
55 |
r = HAL::GetAll(pC, pE);
|
|
56 |
test_KErrNone(r);
|
|
57 |
|
|
58 |
const HAL::SEntry* pS=pE;
|
|
59 |
const HAL::SEntry* pEnd=pS + pC;
|
|
60 |
TBool displayMemHandleFound = EFalse;
|
|
61 |
|
|
62 |
test.Printf(_L("ENumHalAttributes == %d, nEntries == %d\n"), HALData::ENumHalAttributes, pC);
|
|
63 |
for (TInt s = 0; pS<pEnd; ++pS, ++s)
|
|
64 |
{
|
|
65 |
// Following line only needed for development and debug of test case.
|
|
66 |
// test.Printf(_L("Attr: %d; Prop: %x; Value: %x\n"), s, pS->iProperties, pS->iValue );
|
|
67 |
|
|
68 |
if ((pS->iProperties & HAL::EEntryValid ) &&
|
|
69 |
((s%HAL::ENumHalAttributes) == HALData::EDisplayMemoryHandle))
|
|
70 |
{
|
|
71 |
// Note, GetAll on Emulator PSL will set r==KErrNone and value to 0
|
|
72 |
// So check value to ensure a handle has been allocated.
|
|
73 |
if( pS->iValue >= 0 )
|
|
74 |
{
|
|
75 |
displayMemHandleFound++;
|
|
76 |
RHandleBase handle;
|
|
77 |
handle.SetHandle(pS->iValue);
|
|
78 |
handle.Close();
|
|
79 |
break;
|
|
80 |
}
|
|
81 |
}
|
|
82 |
}
|
|
83 |
|
|
84 |
test.Printf(_L("HAL::GetAll() DisplayMemHandle should not have been found (0), result == (%d)\n"), displayMemHandleFound );
|
|
85 |
test_Equal(displayMemHandleFound, 0);
|
|
86 |
|
|
87 |
test.Printf(_L("DoTestRC_361803 - complete\n"));
|
|
88 |
test.End();
|
|
89 |
__UHEAP_MARKEND;
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
GLDEF_C TInt E32Main()
|
|
94 |
{
|
|
95 |
__UHEAP_MARK;
|
|
96 |
|
|
97 |
test.Title();
|
|
98 |
test.Start(_L("User-side HAL Defect Test Cases"));
|
|
99 |
|
|
100 |
DoTestRC_361803(); // ox1cimx1#361803
|
|
101 |
|
|
102 |
test.Printf(_L("\n"));
|
|
103 |
test.End();
|
|
104 |
test.Close();
|
|
105 |
|
|
106 |
__UHEAP_MARKEND;
|
|
107 |
return KErrNone;
|
|
108 |
}
|
|
109 |
|