1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/gdi/tgdi/TPICTURE.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,73 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include <e32test.h>
1.20 +#include <s32file.h>
1.21 +#include "TTYPES.H"
1.22 +
1.23 +TestPicture::TestPicture(CTTypes* aTest):
1.24 + iPicture((CTestPicture*)User::Alloc(sizeof(CTestPicture))),
1.25 + iTest(aTest)
1.26 + {
1.27 + iTest->TEST(iPicture!=NULL);
1.28 + new(iPicture) CTestPicture;
1.29 + }
1.30 +
1.31 +TestPicture::~TestPicture()
1.32 + {
1.33 + delete iPicture;
1.34 + }
1.35 +
1.36 +/**
1.37 + TestPicture::Test
1.38 +
1.39 + Method to test the functionality of the TPictureCapability class (Scalability, Croppable, GetSize, NativePixelSize)
1.40 + Called from the TTypes test script
1.41 +*/
1.42 +void TestPicture::Test()
1.43 + {
1.44 + MTestMap map;
1.45 +//
1.46 + TPictureCapability pc(TPictureCapability::ENotScaleable,EFalse);
1.47 + pc=iPicture->Capability();
1.48 + iTest->TEST(pc.iScalingType==TPictureCapability::ENotScaleable);
1.49 + iTest->TEST(!pc.iIsCroppable);
1.50 + iTest->TEST(iPicture->ScaleFactorWidth()==1000);
1.51 + iTest->TEST(iPicture->ScaleFactorHeight()==1000);
1.52 + TSize size;
1.53 + iPicture->GetSizeInTwips(size);
1.54 + iTest->TEST(size.iWidth==100);
1.55 + iTest->TEST(size.iHeight==100);
1.56 + iPicture->GetSizeInPixels(&map,size);
1.57 + iTest->TEST(size.iWidth==100);
1.58 + iTest->TEST(size.iHeight==100);
1.59 +// SetSizeInPixels
1.60 + iPicture->SetSizeInPixels(&map,TSize(50,50));
1.61 + iPicture->GetSizeInTwips(size);
1.62 + iTest->TEST(size.iWidth==100);
1.63 + iTest->TEST(size.iHeight==100);
1.64 +
1.65 + CTestPicture2 picture;
1.66 + iTest->TEST(!picture.NativePixelSize(size));
1.67 +
1.68 + iPicture->iSize = TSize(1000,2000);
1.69 + CPicture*pic=iPicture; // don't need this but feel more comfident
1.70 + // seeing the virtual func work through the base class
1.71 + iTest->TEST(pic->NativePixelSize(size));
1.72 + iTest->TEST(size.iWidth==1000);
1.73 + iTest->TEST(size.iHeight==2000);
1.74 +
1.75 + }
1.76 +