os/graphics/graphicsdeviceinterface/gdi/tgdi/TPICTURE.CPP
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1998-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
//
sl@0
    15
sl@0
    16
#include <e32test.h>
sl@0
    17
#include <s32file.h>
sl@0
    18
#include "TTYPES.H"
sl@0
    19
sl@0
    20
TestPicture::TestPicture(CTTypes* aTest):
sl@0
    21
	iPicture((CTestPicture*)User::Alloc(sizeof(CTestPicture))),
sl@0
    22
	iTest(aTest)
sl@0
    23
	{
sl@0
    24
	iTest->TEST(iPicture!=NULL);
sl@0
    25
	new(iPicture) CTestPicture;
sl@0
    26
	}
sl@0
    27
sl@0
    28
TestPicture::~TestPicture()
sl@0
    29
	{
sl@0
    30
	delete iPicture;
sl@0
    31
	}
sl@0
    32
sl@0
    33
/** 
sl@0
    34
	TestPicture::Test
sl@0
    35
	
sl@0
    36
	Method to test the functionality of the TPictureCapability class (Scalability, Croppable, GetSize, NativePixelSize)
sl@0
    37
	Called from the TTypes test script
sl@0
    38
*/
sl@0
    39
void TestPicture::Test()
sl@0
    40
	{
sl@0
    41
	MTestMap map;
sl@0
    42
//
sl@0
    43
	TPictureCapability pc(TPictureCapability::ENotScaleable,EFalse);
sl@0
    44
	pc=iPicture->Capability();
sl@0
    45
	iTest->TEST(pc.iScalingType==TPictureCapability::ENotScaleable);
sl@0
    46
	iTest->TEST(!pc.iIsCroppable);
sl@0
    47
	iTest->TEST(iPicture->ScaleFactorWidth()==1000);
sl@0
    48
	iTest->TEST(iPicture->ScaleFactorHeight()==1000);
sl@0
    49
	TSize size;
sl@0
    50
	iPicture->GetSizeInTwips(size);
sl@0
    51
	iTest->TEST(size.iWidth==100);
sl@0
    52
	iTest->TEST(size.iHeight==100);
sl@0
    53
	iPicture->GetSizeInPixels(&map,size);
sl@0
    54
	iTest->TEST(size.iWidth==100);
sl@0
    55
	iTest->TEST(size.iHeight==100);
sl@0
    56
// SetSizeInPixels
sl@0
    57
	iPicture->SetSizeInPixels(&map,TSize(50,50));
sl@0
    58
	iPicture->GetSizeInTwips(size);
sl@0
    59
	iTest->TEST(size.iWidth==100);
sl@0
    60
	iTest->TEST(size.iHeight==100);
sl@0
    61
sl@0
    62
	CTestPicture2 picture;
sl@0
    63
	iTest->TEST(!picture.NativePixelSize(size));
sl@0
    64
sl@0
    65
	iPicture->iSize = TSize(1000,2000);
sl@0
    66
	CPicture*pic=iPicture; // don't need this but feel more comfident
sl@0
    67
                           // seeing the virtual func work through the base class
sl@0
    68
	iTest->TEST(pic->NativePixelSize(size));
sl@0
    69
	iTest->TEST(size.iWidth==1000);
sl@0
    70
	iTest->TEST(size.iHeight==2000);
sl@0
    71
sl@0
    72
	}
sl@0
    73