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