Update contrib.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 TestPicture::TestPicture(CTTypes* aTest):
21 iPicture((CTestPicture*)User::Alloc(sizeof(CTestPicture))),
24 iTest->TEST(iPicture!=NULL);
25 new(iPicture) CTestPicture;
28 TestPicture::~TestPicture()
36 Method to test the functionality of the TPictureCapability class (Scalability, Croppable, GetSize, NativePixelSize)
37 Called from the TTypes test script
39 void TestPicture::Test()
43 TPictureCapability pc(TPictureCapability::ENotScaleable,EFalse);
44 pc=iPicture->Capability();
45 iTest->TEST(pc.iScalingType==TPictureCapability::ENotScaleable);
46 iTest->TEST(!pc.iIsCroppable);
47 iTest->TEST(iPicture->ScaleFactorWidth()==1000);
48 iTest->TEST(iPicture->ScaleFactorHeight()==1000);
50 iPicture->GetSizeInTwips(size);
51 iTest->TEST(size.iWidth==100);
52 iTest->TEST(size.iHeight==100);
53 iPicture->GetSizeInPixels(&map,size);
54 iTest->TEST(size.iWidth==100);
55 iTest->TEST(size.iHeight==100);
57 iPicture->SetSizeInPixels(&map,TSize(50,50));
58 iPicture->GetSizeInTwips(size);
59 iTest->TEST(size.iWidth==100);
60 iTest->TEST(size.iHeight==100);
62 CTestPicture2 picture;
63 iTest->TEST(!picture.NativePixelSize(size));
65 iPicture->iSize = TSize(1000,2000);
66 CPicture*pic=iPicture; // don't need this but feel more comfident
67 // seeing the virtual func work through the base class
68 iTest->TEST(pic->NativePixelSize(size));
69 iTest->TEST(size.iWidth==1000);
70 iTest->TEST(size.iHeight==2000);