1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +// Copyright (c) 2009-2010 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 +/**
1.20 + @file
1.21 + @internalComponent - Internal Symbian test code
1.22 +*/
1.23 +
1.24 +#include <graphics/fbsglyphdataiterator.h>
1.25 +#include <sgresource/sgimage.h>
1.26 +
1.27 +#include "tfbsglyphdataoutlineshadow.h"
1.28 +
1.29 +_LIT(KTypefaceName, "DejaVu Sans Condensed");
1.30 +
1.31 +//Note: This test must be run with a rasterizer which supports EFourColourBlendGlyphBitmap (e.g. iType)
1.32 +//otherwise the test will fail.
1.33 +CTFbsGlyphDataOutlineAndShadow::CTFbsGlyphDataOutlineAndShadow(CTestStep* aStep) :
1.34 + CTGraphicsBase(aStep)
1.35 + {
1.36 + }
1.37 +
1.38 +CTFbsGlyphDataOutlineAndShadow::~CTFbsGlyphDataOutlineAndShadow()
1.39 + {
1.40 + if (iTs)
1.41 + {
1.42 + iTs->ReleaseFont(iFont);
1.43 + delete iTs;
1.44 + }
1.45 + }
1.46 +
1.47 +void CTFbsGlyphDataOutlineAndShadow::ConstructL()
1.48 + {
1.49 + iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
1.50 + TFontSpec fontSpec;
1.51 + fontSpec.iTypeface.iName = KTypefaceName;
1.52 + fontSpec.iHeight = 15;
1.53 + fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
1.54 + fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, EDropShadowOn);
1.55 + fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, EOutlineOn);
1.56 + User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, fontSpec));
1.57 + //now check if the font is what we requested
1.58 + if(iFont->FontSpecInTwips().iFontStyle.BitmapType()!=EFourColourBlendGlyphBitmap)
1.59 + {
1.60 + WARN_PRINTF1(_L("Monotype font is not installed, run iType\\binaries\\ityperast.cmd to install it"));
1.61 + User::Leave(KErrNotSupported);
1.62 + }
1.63 + }
1.64 +
1.65 +/**
1.66 +@SYMTestCaseID GRAPHICS-FBSERV-0646
1.67 +@SYMTestPriority High
1.68 +@SYMTestType UT
1.69 +@SYMTestStatus Implemented
1.70 +@SYMPREQ PREQ2678
1.71 +
1.72 +@SYMTestCaseDesc
1.73 + To ensure that glyph iterator doesn't support outline-and-shadow font
1.74 +@SYMTestActions
1.75 + i. Call RFbsGlyphDataIterator::Open() with an outline-and-shadow font.
1.76 +
1.77 +@SYMTestExpectedResults
1.78 + RFbsGlyphDataIterator::Open() returns KErrNotSupported.
1.79 +*/
1.80 +void CTFbsGlyphDataOutlineAndShadow::RunTestCaseL(TInt /*aCurTestCase*/)
1.81 + {
1.82 + INFO_PRINTF1(_L("Ensure that glyph iterator doesn't support outline-and-shadow font"));
1.83 + ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0646"));
1.84 + RFbsGlyphDataIterator iter;
1.85 + const TUint glyphCode = 50;
1.86 + TInt err = iter.Open(*iFont, &glyphCode, 1);
1.87 + TESTE(err == KErrNotSupported, err);
1.88 + iter.Close();
1.89 +
1.90 + ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);//_L("GRAPHICS-FBSERV-0645"));
1.91 + ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->CloseTMSGraphicsStep();
1.92 + TestComplete();
1.93 + ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->RecordTestResultL();
1.94 + }
1.95 +
1.96 +__CONSTRUCT_STEP__(FbsGlyphDataOutlineAndShadow)