os/graphics/graphicsdeviceinterface/gdi/tgdi/TPICTURE.CPP
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #include <e32test.h>
    17 #include <s32file.h>
    18 #include "TTYPES.H"
    19 
    20 TestPicture::TestPicture(CTTypes* aTest):
    21 	iPicture((CTestPicture*)User::Alloc(sizeof(CTestPicture))),
    22 	iTest(aTest)
    23 	{
    24 	iTest->TEST(iPicture!=NULL);
    25 	new(iPicture) CTestPicture;
    26 	}
    27 
    28 TestPicture::~TestPicture()
    29 	{
    30 	delete iPicture;
    31 	}
    32 
    33 /** 
    34 	TestPicture::Test
    35 	
    36 	Method to test the functionality of the TPictureCapability class (Scalability, Croppable, GetSize, NativePixelSize)
    37 	Called from the TTypes test script
    38 */
    39 void TestPicture::Test()
    40 	{
    41 	MTestMap map;
    42 //
    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);
    49 	TSize size;
    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);
    56 // SetSizeInPixels
    57 	iPicture->SetSizeInPixels(&map,TSize(50,50));
    58 	iPicture->GetSizeInTwips(size);
    59 	iTest->TEST(size.iWidth==100);
    60 	iTest->TEST(size.iHeight==100);
    61 
    62 	CTestPicture2 picture;
    63 	iTest->TEST(!picture.NativePixelSize(size));
    64 
    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);
    71 
    72 	}
    73