sl@0
|
1 |
// Copyright (c) 2004-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 |
// Note that this tests emulator-specific functionality. The test does not apply to GCE mode.
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "TRWindows.h"
|
sl@0
|
19 |
#include <hal.h>
|
sl@0
|
20 |
#include <bitdraw.h>
|
sl@0
|
21 |
#ifdef __WINS__
|
sl@0
|
22 |
#include "_WININC.H"
|
sl@0
|
23 |
#include <winsdef.h>
|
sl@0
|
24 |
#endif
|
sl@0
|
25 |
|
sl@0
|
26 |
CTRWindows::CTRWindows(CTestStep* aStep) :
|
sl@0
|
27 |
CTGraphicsBase(aStep)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
INFO_PRINTF1(_L("Test for RWindows"));
|
sl@0
|
30 |
}
|
sl@0
|
31 |
|
sl@0
|
32 |
GLDEF_C void Panic(TScreenDriverPanic aPanicCode)
|
sl@0
|
33 |
{
|
sl@0
|
34 |
_LIT(KSCDVPanicCategory,"SCDV");
|
sl@0
|
35 |
User::Panic(KSCDVPanicCategory,aPanicCode);
|
sl@0
|
36 |
}
|
sl@0
|
37 |
|
sl@0
|
38 |
//This function is used to test the changes made in the RWindows class
|
sl@0
|
39 |
//which will allow creating a screen size with the ScanLinebyte not multiple of
|
sl@0
|
40 |
//12 bytes. E.g a 250 * 250 pixels would have scanlinebyte=250*3(RGB)=750 bytes
|
sl@0
|
41 |
//(not a multiple of 12 bytes) which will cause the panic in the previous RWindows
|
sl@0
|
42 |
//settings. For more details please refer to INC042143
|
sl@0
|
43 |
|
sl@0
|
44 |
#ifdef __WINS__
|
sl@0
|
45 |
void CTRWindows::TestCreatingWindowsL(TSize aSize)
|
sl@0
|
46 |
{
|
sl@0
|
47 |
TInt screenNo=0;
|
sl@0
|
48 |
TInt maxScreenNo=0;
|
sl@0
|
49 |
TInt err=HAL::Get(screenNo, HALData::EDisplayNumberOfScreens,maxScreenNo);
|
sl@0
|
50 |
User::LeaveIfError(err);
|
sl@0
|
51 |
TEST(maxScreenNo!=0);
|
sl@0
|
52 |
TInt pixelDepth=0;
|
sl@0
|
53 |
err=HAL::Get(0, HALData::EDisplayMode,pixelDepth);
|
sl@0
|
54 |
|
sl@0
|
55 |
#if defined(SYMBIAN_GRAPHICS_GCE)
|
sl@0
|
56 |
if (!(pixelDepth&KEmulIsBitMask))
|
sl@0
|
57 |
{
|
sl@0
|
58 |
INFO_PRINTF1(_L("Native Wins mode not detected (Mode is not a bit field) Test skipped."));
|
sl@0
|
59 |
}
|
sl@0
|
60 |
else
|
sl@0
|
61 |
#endif //SYMBIAN_GRAPHICS_GCE
|
sl@0
|
62 |
{
|
sl@0
|
63 |
for (screenNo=0;screenNo<maxScreenNo;screenNo++)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
TBuf<128> buf;
|
sl@0
|
66 |
buf.Format(_L("INC042143 fix. Screen size: %03d x %03d, screen %i"), aSize.iWidth, aSize.iHeight,screenNo);
|
sl@0
|
67 |
INFO_PRINTF1(buf);
|
sl@0
|
68 |
TInt address=NULL;
|
sl@0
|
69 |
TInt err=HAL::Get(screenNo, HALData::EDisplayMemoryAddress,address);
|
sl@0
|
70 |
User::LeaveIfError(err);
|
sl@0
|
71 |
RWindows* theWindow=RWindows::GetWindow(screenNo, REINTERPRET_CAST(TAny*,address),aSize);
|
sl@0
|
72 |
TEST(theWindow!=NULL);
|
sl@0
|
73 |
RWindows::ReleaseWindow(screenNo);
|
sl@0
|
74 |
}
|
sl@0
|
75 |
}
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
#endif
|
sl@0
|
79 |
|
sl@0
|
80 |
void CTRWindows::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
81 |
{
|
sl@0
|
82 |
((CTRWindowsStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
83 |
switch(aCurTestCase)
|
sl@0
|
84 |
{
|
sl@0
|
85 |
#ifdef __WINS__
|
sl@0
|
86 |
case 1:
|
sl@0
|
87 |
/**
|
sl@0
|
88 |
@SYMTestCaseID GRAPHICS-SCREENDRIVER-0019
|
sl@0
|
89 |
*/
|
sl@0
|
90 |
((CTRWindowsStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0019"));
|
sl@0
|
91 |
TestCreatingWindowsL(TSize(250,250));
|
sl@0
|
92 |
break;
|
sl@0
|
93 |
case 2:
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
@SYMTestCaseID GRAPHICS-SCREENDRIVER-0020
|
sl@0
|
96 |
*/
|
sl@0
|
97 |
((CTRWindowsStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0020"));
|
sl@0
|
98 |
TestCreatingWindowsL(TSize(121,121));
|
sl@0
|
99 |
break;
|
sl@0
|
100 |
case 3:
|
sl@0
|
101 |
/**
|
sl@0
|
102 |
@SYMTestCaseID GRAPHICS-SCREENDRIVER-0021
|
sl@0
|
103 |
*/
|
sl@0
|
104 |
((CTRWindowsStep*)iStep)->SetTestStepID(_L("GRAPHICS-SCREENDRIVER-0021"));
|
sl@0
|
105 |
TestCreatingWindowsL(TSize(301,301));
|
sl@0
|
106 |
break;
|
sl@0
|
107 |
#endif
|
sl@0
|
108 |
case 4:
|
sl@0
|
109 |
((CTRWindowsStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
110 |
((CTRWindowsStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
111 |
TestComplete();
|
sl@0
|
112 |
break;
|
sl@0
|
113 |
}
|
sl@0
|
114 |
#ifdef __WINS__
|
sl@0
|
115 |
((CTRWindowsStep*)iStep)->RecordTestResultL();
|
sl@0
|
116 |
#endif
|
sl@0
|
117 |
}
|
sl@0
|
118 |
|
sl@0
|
119 |
//--------------
|
sl@0
|
120 |
__CONSTRUCT_STEP__(RWindows)
|
sl@0
|
121 |
|