Update contrib.
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 "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include <graphics/gdi/gdiconsts.h>
18 #include "tmultiplescreens.h"
20 CTMultipleScreens::CTMultipleScreens(CTestStep* aStep):
21 CTGraphicsBase(aStep),
27 CTMultipleScreens::~CTMultipleScreens()
30 DeleteGraphicsContext();
34 void CTMultipleScreens::ConstructL()
38 void CTMultipleScreens::RunTestCaseL(TInt aCurTestCase)
40 ((CTMultipleScreensStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
41 _LIT(KTest1,"SubTest %d: Create multiple screens");
45 ((CTMultipleScreensStep*)iStep)->SetTestStepID(_L("GRAPHICS-BITGDI-0072"));
46 INFO_PRINTF2(KTest1,aCurTestCase);
47 CreateScreenDeviceL();
50 ((CTMultipleScreensStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
51 ((CTMultipleScreensStep*)iStep)->CloseTMSGraphicsStep();
55 ((CTMultipleScreensStep*)iStep)->RecordTestResultL();
60 @SYMTestCaseID GRAPHICS-BITGDI-0072
64 @SYMTestCaseDesc Multiple screen test
68 @SYMTestStatus Implemented
70 @SYMTestActions creates some screens in different modes then writes some rotated text to them and test.
72 @SYMTestExpectedResults Test should perform graphics operations succesfully.
74 void CTMultipleScreens::CreateScreenDeviceL()
76 TDisplayMode testMode[] = {EColor4K, EColor64K, EColor16M, EColor16MU, EColor256, EColor16MA, EColor16MAP};//tested display modes
77 for(TInt ii=0;ii<TInt(sizeof(testMode)/sizeof(testMode[0]));ii++)
80 TEST(HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCnt) == KErrNone);
81 for(TInt screenNo=0;screenNo<screenCnt;++screenNo)
83 TInt err = CreateScrDevAndContext(screenNo, testMode[ii]);
88 DeleteGraphicsContext();
94 void CTMultipleScreens::DoRotateMoveTextL()
96 __ASSERT_ALWAYS(iScrDev, User::Invariant());
97 __ASSERT_ALWAYS(iGc, User::Invariant());
101 const CFbsBitGc::TGraphicsOrientation KOrientation[] =
103 CFbsBitGc::EGraphicsOrientationNormal,
104 CFbsBitGc::EGraphicsOrientationRotated90,
105 CFbsBitGc::EGraphicsOrientationRotated180,
106 CFbsBitGc::EGraphicsOrientationRotated270
109 for(TInt ii=0;ii<TInt(sizeof(KOrientation)/sizeof(KOrientation[0]));++ii)
111 if(!iGc->SetOrientation(KOrientation[ii]))
115 _LIT(KRotation,"===EOrientation%S===");
116 INFO_PRINTF2(KRotation,&RotationName(KOrientation[ii]));
118 TSize size = iScrDev->SizeInPixels();
119 RDebug::Print(_L("Size: %d, %d\r\n"), size.iWidth, size.iHeight);
120 for(TInt x=-40;x<(size.iWidth+30);x+=27)
122 for(TInt y=-40;y<(size.iHeight+30);y+=23)
125 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
126 iGc->SetPenColor(TRgb(0x00, 0x00, 0x00));
127 iGc->SetPenSize(TSize(1, 1));
129 iGc->DrawText(_L("Test text"), TPoint(x, y));
135 iGc->SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
140 TInt CTMultipleScreens::CreateScrDevAndContext(TInt aScreenNo, TDisplayMode aDisplayMode)
142 DeleteGraphicsContext();
143 DeleteScreenDevice();
144 TRAPD(err, iScrDev = CFbsScreenDevice::NewL(aScreenNo, aDisplayMode));
147 TESTE( err == KErrNotSupported, err );
150 TEST(err == KErrNone);
151 TEST(iScrDev->ScreenNo() == aScreenNo);
152 err = iScrDev->CreateContext((CGraphicsContext*&)iGc);
157 TEST(err == KErrNone);
158 iGc->SetUserDisplayMode(aDisplayMode);
159 iScrDev->ChangeScreenDevice(NULL);
160 iScrDev->SetAutoUpdate(EFalse);
164 TInt CTMultipleScreens::CreateScrDevAndContext(TDisplayMode aDisplayMode)
166 return CreateScrDevAndContext(KDefaultScreenNo,aDisplayMode);
169 void CTMultipleScreens::DeleteScreenDevice()
175 void CTMultipleScreens::DeleteGraphicsContext()
181 void CTMultipleScreens::CreateFontL()
183 CFbsFont* font = NULL;
184 TFontSpec fs(_L("Swiss"), 12);
185 User::LeaveIfError(iScrDev->GetNearestFontToDesignHeightInPixels(font, fs));
189 void CTMultipleScreens::DestroyFont()
202 __CONSTRUCT_STEP__(MultipleScreens)
204 void CTMultipleScreensStep::TestSetupL()
208 void CTMultipleScreensStep::TestClose()