fbs/fontandbitmapserver/tfbs/tfbsglyphdataoutlineshadow.cpp
author hgs
Fri, 30 Jul 2010 11:41:40 +0300
changeset 136 62bb7c97884c
parent 121 d72fc2aace31
permissions -rw-r--r--
201030_2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
121
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     1
// Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     2
// All rights reserved.
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     7
//
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     8
// Initial Contributors:
d72fc2aace31 201027_1
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    10
//
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    11
// Contributors:
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    12
//
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    13
// Description:
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    14
//
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    15
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    16
/**
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    17
 @file
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    18
 @internalComponent - Internal Symbian test code
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    19
*/
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    20
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    21
#include <graphics/fbsglyphdataiterator.h>
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    22
#include <sgresource/sgimage.h>
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    23
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    24
#include "tfbsglyphdataoutlineshadow.h"
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    25
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    26
_LIT(KTypefaceName, "DejaVu Sans Condensed");
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    27
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    28
//Note: This test must be run with a rasterizer which supports EFourColourBlendGlyphBitmap (e.g. iType)
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    29
//otherwise the test will fail.
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    30
CTFbsGlyphDataOutlineAndShadow::CTFbsGlyphDataOutlineAndShadow(CTestStep* aStep) :
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    31
    CTGraphicsBase(aStep)
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    32
    {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    33
    }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    34
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    35
CTFbsGlyphDataOutlineAndShadow::~CTFbsGlyphDataOutlineAndShadow()
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    36
    {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    37
    if (iTs)
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    38
       {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    39
       iTs->ReleaseFont(iFont);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    40
       delete iTs;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    41
       }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    42
    }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    43
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    44
void CTFbsGlyphDataOutlineAndShadow::ConstructL()
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    45
    {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    46
    iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    47
    TFontSpec fontSpec;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    48
    fontSpec.iTypeface.iName = KTypefaceName;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    49
    fontSpec.iHeight = 15;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    50
    fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    51
    fontSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, EDropShadowOn);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    52
    fontSpec.iFontStyle.SetEffects(FontEffect::EOutline, EOutlineOn);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    53
    User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, fontSpec));
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    54
    //now check if the font is what we requested
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    55
    if(iFont->FontSpecInTwips().iFontStyle.BitmapType()!=EFourColourBlendGlyphBitmap)
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    56
        {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    57
        WARN_PRINTF1(_L("Monotype font is not installed, run iType\\binaries\\ityperast.cmd to install it"));
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    58
        User::Leave(KErrNotSupported);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    59
        }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    60
    }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    61
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    62
/**
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    63
@SYMTestCaseID      GRAPHICS-FBSERV-0646
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    64
@SYMTestPriority    High
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    65
@SYMTestType        UT
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    66
@SYMTestStatus      Implemented
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    67
@SYMPREQ            PREQ2678
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    68
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    69
@SYMTestCaseDesc
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    70
    To ensure that glyph iterator doesn't support outline-and-shadow font
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    71
@SYMTestActions
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    72
    i. Call RFbsGlyphDataIterator::Open() with an outline-and-shadow font.
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    73
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    74
@SYMTestExpectedResults
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    75
    RFbsGlyphDataIterator::Open() returns KErrNotSupported.
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    76
*/
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    77
void CTFbsGlyphDataOutlineAndShadow::RunTestCaseL(TInt /*aCurTestCase*/)
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    78
    {
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    79
    INFO_PRINTF1(_L("Ensure that glyph iterator doesn't support outline-and-shadow font"));
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    80
    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0646"));
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    81
    RFbsGlyphDataIterator iter;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    82
    const TUint glyphCode = 50;
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    83
    TInt err = iter.Open(*iFont, &glyphCode, 1);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    84
    TESTE(err == KErrNotSupported, err);
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    85
    iter.Close();
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    86
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    87
    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);//_L("GRAPHICS-FBSERV-0645"));
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    88
    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->CloseTMSGraphicsStep();
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    89
    TestComplete();     
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    90
    ((CTFbsGlyphDataOutlineAndShadowStep*)iStep)->RecordTestResultL();
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    91
    }
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    92
d72fc2aace31 201027_1
hgs
parents:
diff changeset
    93
__CONSTRUCT_STEP__(FbsGlyphDataOutlineAndShadow)