os/graphics/fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2009-2010 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 /**
    17  @file
    18  @internalComponent - Internal Symbian test code
    19 */
    20 
    21 #include <graphics/fbsglyphdataiterator.h>
    22 #include <sgresource/sgimage.h>
    23 
    24 #include "tfbsglyphdataoutlineshadow.h"
    25 
    26 _LIT(KTypefaceName, "DejaVu Sans Condensed");
    27 
    28 //Note: This test must be run with a rasterizer which supports EFourColourBlendGlyphBitmap (e.g. iType)
    29 //otherwise the test will fail.
    30 CTFbsGlyphDataOutlineAndShadow::CTFbsGlyphDataOutlineAndShadow(CTestStep* aStep) :
    31     CTGraphicsBase(aStep)
    32     {
    33     }
    34 
    35 CTFbsGlyphDataOutlineAndShadow::~CTFbsGlyphDataOutlineAndShadow()
    36     {
    37     if (iTs)
    38        {
    39        iTs->ReleaseFont(iFont);
    40        delete iTs;
    41        }
    42     }
    43 
    44 void CTFbsGlyphDataOutlineAndShadow::ConstructL()
    45     {
    46     iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
    47     TFontSpec fontSpec;
    48     fontSpec.iTypeface.iName = KTypefaceName;
    49     fontSpec.iHeight = 15;
    50     fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
    51     fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, EDropShadowOn);
    52     fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, EOutlineOn);
    53     User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, fontSpec));
    54     //now check if the font is what we requested
    55     if(iFont->FontSpecInTwips().iFontStyle.BitmapType()!=EFourColourBlendGlyphBitmap)
    56         {
    57         WARN_PRINTF1(_L("Monotype font is not installed, run iType\\binaries\\ityperast.cmd to install it"));
    58         User::Leave(KErrNotSupported);
    59         }
    60     }
    61 
    62 /**
    63 @SYMTestCaseID      GRAPHICS-FBSERV-0646
    64 @SYMTestPriority    High
    65 @SYMTestType        UT
    66 @SYMTestStatus      Implemented
    67 @SYMPREQ            PREQ2678
    68 
    69 @SYMTestCaseDesc
    70     To ensure that glyph iterator doesn't support outline-and-shadow font
    71 @SYMTestActions
    72     i. Call RFbsGlyphDataIterator::Open() with an outline-and-shadow font.
    73 
    74 @SYMTestExpectedResults
    75     RFbsGlyphDataIterator::Open() returns KErrNotSupported.
    76 */
    77 void CTFbsGlyphDataOutlineAndShadow::RunTestCaseL(TInt /*aCurTestCase*/)
    78     {
    79     INFO_PRINTF1(_L("Ensure that glyph iterator doesn't support outline-and-shadow font"));
    80     ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0646"));
    81     RFbsGlyphDataIterator iter;
    82     const TUint glyphCode = 50;
    83     TInt err = iter.Open(*iFont, &glyphCode, 1);
    84     TESTE(err == KErrNotSupported, err);
    85     iter.Close();
    86 
    87     ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);//_L("GRAPHICS-FBSERV-0645"));
    88     ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->CloseTMSGraphicsStep();
    89     TestComplete();     
    90     ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->RecordTestResultL();
    91     }
    92 
    93 __CONSTRUCT_STEP__(FbsGlyphDataOutlineAndShadow)