kerneltest/e32test/digitiser/t_kerneldigitisertest.cpp
author hgs
Mon, 11 Oct 2010 17:54:41 +0100
changeset 286 48e57fb1237e
parent 271 dc268b18d709
permissions -rw-r--r--
201039_11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
271
dc268b18d709 201037_07
hgs
parents:
diff changeset
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
dc268b18d709 201037_07
hgs
parents:
diff changeset
     2
// All rights reserved.
dc268b18d709 201037_07
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
dc268b18d709 201037_07
hgs
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
dc268b18d709 201037_07
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
dc268b18d709 201037_07
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
dc268b18d709 201037_07
hgs
parents:
diff changeset
     7
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
     8
// Initial Contributors:
dc268b18d709 201037_07
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
dc268b18d709 201037_07
hgs
parents:
diff changeset
    10
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    11
// Contributors:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    12
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    13
// Description:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    14
// e32test\digitiser\t_kerneldigitisertest.cpp
dc268b18d709 201037_07
hgs
parents:
diff changeset
    15
// Overview:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    16
// Test the TRawEvent APIS and events associated with the Digitiser and also verify the BTRACEs (manually)
dc268b18d709 201037_07
hgs
parents:
diff changeset
    17
// Tests kernel side functions
dc268b18d709 201037_07
hgs
parents:
diff changeset
    18
// API Information:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    19
// TRawEvent
dc268b18d709 201037_07
hgs
parents:
diff changeset
    20
// Details:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    21
// - Test the following 6  Events types 
dc268b18d709 201037_07
hgs
parents:
diff changeset
    22
// 1.	EPointerMove
dc268b18d709 201037_07
hgs
parents:
diff changeset
    23
// 2.	EPointer3DInRange,
dc268b18d709 201037_07
hgs
parents:
diff changeset
    24
// 3.	EPointer3DOutOfRange,
dc268b18d709 201037_07
hgs
parents:
diff changeset
    25
// 4.	EPointer3DTilt,
dc268b18d709 201037_07
hgs
parents:
diff changeset
    26
// 5.	EPointer3DRotation,
dc268b18d709 201037_07
hgs
parents:
diff changeset
    27
// 6.	EPointer3DTiltAndMove,
dc268b18d709 201037_07
hgs
parents:
diff changeset
    28
// Platforms/Drives/Compatibility:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    29
// All.
dc268b18d709 201037_07
hgs
parents:
diff changeset
    30
// Assumptions/Requirement/Pre-requisites: 
dc268b18d709 201037_07
hgs
parents:
diff changeset
    31
// Failures and causes:
dc268b18d709 201037_07
hgs
parents:
diff changeset
    32
// 
dc268b18d709 201037_07
hgs
parents:
diff changeset
    33
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    34
#define __E32TEST_EXTENSION__
dc268b18d709 201037_07
hgs
parents:
diff changeset
    35
dc268b18d709 201037_07
hgs
parents:
diff changeset
    36
#include <e32test.h>
dc268b18d709 201037_07
hgs
parents:
diff changeset
    37
#include <e32svr.h>
dc268b18d709 201037_07
hgs
parents:
diff changeset
    38
#include <e32cmn.h>
dc268b18d709 201037_07
hgs
parents:
diff changeset
    39
#include <e32cmn_private.h>
dc268b18d709 201037_07
hgs
parents:
diff changeset
    40
#include "d_kerneldigitisertest.h"
dc268b18d709 201037_07
hgs
parents:
diff changeset
    41
dc268b18d709 201037_07
hgs
parents:
diff changeset
    42
LOCAL_D RTest test(_L("T_KernelDigitiserTest"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    43
dc268b18d709 201037_07
hgs
parents:
diff changeset
    44
RTestDigitiserLdd gLdd;
dc268b18d709 201037_07
hgs
parents:
diff changeset
    45
dc268b18d709 201037_07
hgs
parents:
diff changeset
    46
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    47
// class TestTRawDigitiserEvent user side constructor
dc268b18d709 201037_07
hgs
parents:
diff changeset
    48
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    49
dc268b18d709 201037_07
hgs
parents:
diff changeset
    50
TestTRawDigitiserEvent::TestTRawDigitiserEvent(TRawEvent::TType aType,TInt aX,TInt aY,TInt aZ,TInt aScanCode,TInt aPhi,TInt aTheta,TInt aAlpha,TUint8 aPointerNumber,TUint8 aTip)
dc268b18d709 201037_07
hgs
parents:
diff changeset
    51
:iType(aType),iX(aX),iY(aY),iZ(aZ),iScanCode(aScanCode),iPhi(aPhi),iTheta(aTheta),iAlpha(aAlpha),iPointerNumber(aPointerNumber),iTip(aTip)
dc268b18d709 201037_07
hgs
parents:
diff changeset
    52
	{}
dc268b18d709 201037_07
hgs
parents:
diff changeset
    53
dc268b18d709 201037_07
hgs
parents:
diff changeset
    54
dc268b18d709 201037_07
hgs
parents:
diff changeset
    55
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    56
// other functions
dc268b18d709 201037_07
hgs
parents:
diff changeset
    57
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    58
void LoadDeviceDriver()
dc268b18d709 201037_07
hgs
parents:
diff changeset
    59
	{
dc268b18d709 201037_07
hgs
parents:
diff changeset
    60
	test_KErrNone(User::LoadLogicalDevice(KLddName));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    61
	test_KErrNone(gLdd.Open());
dc268b18d709 201037_07
hgs
parents:
diff changeset
    62
	}
dc268b18d709 201037_07
hgs
parents:
diff changeset
    63
dc268b18d709 201037_07
hgs
parents:
diff changeset
    64
void UnloadDeviceDriver()
dc268b18d709 201037_07
hgs
parents:
diff changeset
    65
	{
dc268b18d709 201037_07
hgs
parents:
diff changeset
    66
	gLdd.Close();
dc268b18d709 201037_07
hgs
parents:
diff changeset
    67
	test_KErrNone(User::FreeLogicalDevice(KLddName));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    68
	}
dc268b18d709 201037_07
hgs
parents:
diff changeset
    69
dc268b18d709 201037_07
hgs
parents:
diff changeset
    70
dc268b18d709 201037_07
hgs
parents:
diff changeset
    71
GLDEF_C TInt E32Main()
dc268b18d709 201037_07
hgs
parents:
diff changeset
    72
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    73
//
dc268b18d709 201037_07
hgs
parents:
diff changeset
    74
    {
dc268b18d709 201037_07
hgs
parents:
diff changeset
    75
	__UHEAP_MARK;
dc268b18d709 201037_07
hgs
parents:
diff changeset
    76
 	test.Title();
dc268b18d709 201037_07
hgs
parents:
diff changeset
    77
dc268b18d709 201037_07
hgs
parents:
diff changeset
    78
	test.Start(_L("Testing kernel side digitiser events"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    79
	
dc268b18d709 201037_07
hgs
parents:
diff changeset
    80
	TestTRawDigitiserEvent kDigitiserEvent1(TRawEvent::EPointerMove, -890,-123, -823,455,2563,156,62,3,1);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    81
	TestTRawDigitiserEvent kDigitiserEvent2(TRawEvent::EPointer3DInRange, 23,45,23,1,2,6,4,2,1);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    82
	TestTRawDigitiserEvent kDigitiserEvent3(TRawEvent::EPointer3DOutOfRange, 23,45,23,1,2,6,4,2,0);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    83
	TestTRawDigitiserEvent kDigitiserEvent4(TRawEvent::EPointer3DTilt, 23,45,23,1,2,6,4,2,1);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    84
	TestTRawDigitiserEvent kDigitiserEvent5(TRawEvent::EPointer3DRotation, 23,45,23,1,2,6,4,2,1);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    85
	TestTRawDigitiserEvent kDigitiserEvent6(TRawEvent::EPointer3DTiltAndMove, 23,45,23,1,2,6,4,2,0);
dc268b18d709 201037_07
hgs
parents:
diff changeset
    86
dc268b18d709 201037_07
hgs
parents:
diff changeset
    87
	LoadDeviceDriver();
dc268b18d709 201037_07
hgs
parents:
diff changeset
    88
dc268b18d709 201037_07
hgs
parents:
diff changeset
    89
	test.Printf(_L("kDigitiserEvent1"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    90
	test_KErrNone(gLdd.StartTest(kDigitiserEvent1));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    91
dc268b18d709 201037_07
hgs
parents:
diff changeset
    92
	test.Printf(_L("kDigitiserEvent2"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    93
	test_KErrNone(gLdd.StartTest(kDigitiserEvent2));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    94
dc268b18d709 201037_07
hgs
parents:
diff changeset
    95
	test.Printf(_L("kDigitiserEvent3"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    96
	test_KErrNone(gLdd.StartTest(kDigitiserEvent3));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    97
dc268b18d709 201037_07
hgs
parents:
diff changeset
    98
	test.Printf(_L("kDigitiserEvent4"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
    99
	test_KErrNone(gLdd.StartTest(kDigitiserEvent4));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   100
dc268b18d709 201037_07
hgs
parents:
diff changeset
   101
	test.Printf(_L("kDigitiserEvent5"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   102
	test_KErrNone(gLdd.StartTest(kDigitiserEvent5));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   103
dc268b18d709 201037_07
hgs
parents:
diff changeset
   104
	test.Printf(_L("kDigitiserEvent6"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   105
	test_KErrNone(gLdd.StartTest(kDigitiserEvent6));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   106
dc268b18d709 201037_07
hgs
parents:
diff changeset
   107
	UnloadDeviceDriver();
dc268b18d709 201037_07
hgs
parents:
diff changeset
   108
dc268b18d709 201037_07
hgs
parents:
diff changeset
   109
	test.Printf(_L("T_KERNELDIGITISERTEST: Successfully Completed\n"));
dc268b18d709 201037_07
hgs
parents:
diff changeset
   110
dc268b18d709 201037_07
hgs
parents:
diff changeset
   111
	test.End();
dc268b18d709 201037_07
hgs
parents:
diff changeset
   112
	test.Close();
dc268b18d709 201037_07
hgs
parents:
diff changeset
   113
dc268b18d709 201037_07
hgs
parents:
diff changeset
   114
	__UHEAP_MARKEND;
dc268b18d709 201037_07
hgs
parents:
diff changeset
   115
    return KErrNone;
dc268b18d709 201037_07
hgs
parents:
diff changeset
   116
    }