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