os/graphics/fbs/fontandbitmapserver/tfbs/tfbsglyphdatapanic.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
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 <test/graphicsfontutils.h>
sl@0
    22
#include <graphics/fbsglyphmetricsarray.h> 
sl@0
    23
#include <graphics/fbsglyphdataiterator.h>
sl@0
    24
#include "tfbsglyphdatapanic.h"
sl@0
    25
sl@0
    26
_LIT(KTypefaceName, "DejaVu Sans Condensed");
sl@0
    27
const TInt KNumGlyphCodes = 96;
sl@0
    28
sl@0
    29
CTFbsGlyphDataPanic::CTFbsGlyphDataPanic(CTestStep* aStep):
sl@0
    30
    CTGraphicsBase(aStep)
sl@0
    31
    {
sl@0
    32
    }
sl@0
    33
sl@0
    34
CTFbsGlyphDataPanic::~CTFbsGlyphDataPanic()
sl@0
    35
    {
sl@0
    36
    iSgDriver.Close();
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 CTFbsGlyphDataPanic::ConstructL()
sl@0
    45
    {
sl@0
    46
    User::LeaveIfNull(iFbs = RFbsSession::GetSession());
sl@0
    47
    User::LeaveIfNull(iTs = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL));
sl@0
    48
    User::LeaveIfError(iTs->GetNearestFontToDesignHeightInPixels((CFont*&)iFont, TFontSpec(KTypefaceName, 15)));
sl@0
    49
    User::LeaveIfError(iSgDriver.Open());
sl@0
    50
    
sl@0
    51
    //initialize the array with ASCII characters from 0020 to 007F
sl@0
    52
    CCharCodeConverter* converter = CCharCodeConverter::NewLC();
sl@0
    53
    converter->UseFontL(iFont);
sl@0
    54
    iGlyphCodes = new(ELeave) TUint[KNumGlyphCodes];
sl@0
    55
    for (TInt i = 0; i < KNumGlyphCodes; ++i)
sl@0
    56
        {
sl@0
    57
        TUint asciiCode = i + 0x20; 
sl@0
    58
        iGlyphCodes[i] = converter->GlyphCodeL(asciiCode);
sl@0
    59
        }
sl@0
    60
    CleanupStack::PopAndDestroy(1); // converter
sl@0
    61
    }
sl@0
    62
sl@0
    63
void CTFbsGlyphDataPanic::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
    64
    {
sl@0
    65
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
    66
    TInt testCase = -1;
sl@0
    67
    _LIT(KCaseNumber, "CaseNumber");
sl@0
    68
    TEST(iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, testCase));
sl@0
    69
    
sl@0
    70
    switch(testCase)
sl@0
    71
        {
sl@0
    72
    case 1:
sl@0
    73
        TestGlyphDataIteratorNotInitializedNext();
sl@0
    74
        break;
sl@0
    75
    case 2:
sl@0
    76
        TestGlyphDataIteratorNotInitializedImage();
sl@0
    77
        break;
sl@0
    78
    case 3:
sl@0
    79
        TestGlyphDataIteratorNotInitializedMetrics();
sl@0
    80
        break;
sl@0
    81
    case 4:
sl@0
    82
        TestGlyphDataIteratorNotInitializedGlyphCode();
sl@0
    83
        break;
sl@0
    84
    case 5:
sl@0
    85
        TestGlyphDataIteratorClosedNext();
sl@0
    86
        break;
sl@0
    87
    case 6:
sl@0
    88
        TestGlyphDataIteratorClosedImage();
sl@0
    89
        break;
sl@0
    90
    case 7:
sl@0
    91
        TestGlyphDataIteratorClosedMetrics();
sl@0
    92
        break;
sl@0
    93
    case 8:
sl@0
    94
        TestGlyphDataIteratorClosedGlyphCode();
sl@0
    95
        break;
sl@0
    96
    case 9:
sl@0
    97
        TestGlyphDataIteratorDiscardUsedFont();
sl@0
    98
        break;
sl@0
    99
    case 10:
sl@0
   100
        TestGlyphMetricsArrayIndexNegative();
sl@0
   101
        break;
sl@0
   102
    case 11:
sl@0
   103
    	TestGlyphMetricsArrayIndexTooHigh();
sl@0
   104
        break;
sl@0
   105
    case 12:
sl@0
   106
    	TestGlyphDataIteratorOpenFailed();
sl@0
   107
    	break;
sl@0
   108
    default:
sl@0
   109
        break;
sl@0
   110
        }
sl@0
   111
    TEST(EFalse); // shouldn't reach this point as the test will panic at the end of each test case function
sl@0
   112
    
sl@0
   113
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
   114
    ((CTFbsGlyphDataPanicStep*)iStep)->CloseTMSGraphicsStep();
sl@0
   115
    TestComplete();     
sl@0
   116
    ((CTFbsGlyphDataPanicStep*)iStep)->RecordTestResultL();
sl@0
   117
    }
sl@0
   118
sl@0
   119
/**
sl@0
   120
@SYMTestCaseID      GRAPHICS-FBSERV-0651
sl@0
   121
@SYMTestPriority    High
sl@0
   122
@SYMTestType        UT
sl@0
   123
@SYMTestStatus      Implemented
sl@0
   124
@SYMPREQ            PREQ2678
sl@0
   125
sl@0
   126
@SYMTestCaseDesc
sl@0
   127
	To ensure that calling Next() on an unopened iterator will panic.
sl@0
   128
sl@0
   129
@SYMTestActions
sl@0
   130
	Call Next() on an RFbsGlyphDataIterator instance without opening it.
sl@0
   131
sl@0
   132
@SYMTestExpectedResults
sl@0
   133
	The call to Next() should panic with FBSCLI 31.
sl@0
   134
*/
sl@0
   135
void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedNext()
sl@0
   136
    {
sl@0
   137
    INFO_PRINTF1(_L("Ensure that Next() operation applied on null iterator will panic"));
sl@0
   138
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0651"));
sl@0
   139
    RFbsGlyphDataIterator iter;
sl@0
   140
    iter.Next(); //expect to panic here
sl@0
   141
    }
sl@0
   142
sl@0
   143
/**
sl@0
   144
@SYMTestCaseID      GRAPHICS-FBSERV-0652
sl@0
   145
@SYMTestPriority    High
sl@0
   146
@SYMTestType        UT
sl@0
   147
@SYMTestStatus      Implemented
sl@0
   148
@SYMPREQ            PREQ2678
sl@0
   149
sl@0
   150
@SYMTestCaseDesc
sl@0
   151
	To ensure that Image() function applied on an unopened iterator will panic.
sl@0
   152
sl@0
   153
@SYMTestActions
sl@0
   154
	Call Image() on an RFbsGlyphDataIterator instance without opening it.
sl@0
   155
sl@0
   156
@SYMTestExpectedResults
sl@0
   157
	The call to Image() should panic with FBSCLI 31.
sl@0
   158
*/
sl@0
   159
void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedImage()
sl@0
   160
    {
sl@0
   161
    INFO_PRINTF1(_L("Ensure that Image() operation applied on null iterator will panic"));
sl@0
   162
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0652"));
sl@0
   163
    RFbsGlyphDataIterator iter;
sl@0
   164
    iter.Image(); //expect to panic here
sl@0
   165
    }
sl@0
   166
sl@0
   167
/**
sl@0
   168
@SYMTestCaseID      GRAPHICS-FBSERV-0653
sl@0
   169
@SYMTestPriority    High
sl@0
   170
@SYMTestType        UT
sl@0
   171
@SYMTestStatus      Implemented
sl@0
   172
@SYMPREQ            PREQ2678
sl@0
   173
sl@0
   174
@SYMTestCaseDesc
sl@0
   175
	To ensure that Metrics() function applied on null iterator will panic.
sl@0
   176
sl@0
   177
@SYMTestActions
sl@0
   178
	Call Metrics() on an RFbsGlyphDataIterator instance without opening it.
sl@0
   179
sl@0
   180
@SYMTestExpectedResults
sl@0
   181
	The call to Metrics() should panic with FBSCLI 31.
sl@0
   182
*/
sl@0
   183
void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedMetrics()
sl@0
   184
    {
sl@0
   185
    INFO_PRINTF1(_L("Ensure that Metrics() operation applied on null iterator will panic"));
sl@0
   186
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0653"));
sl@0
   187
    RFbsGlyphDataIterator iter;
sl@0
   188
    iter.Metrics(); //expect to panic here
sl@0
   189
    }
sl@0
   190
sl@0
   191
/**
sl@0
   192
@SYMTestCaseID      GRAPHICS-FBSERV-0654
sl@0
   193
@SYMTestPriority    High
sl@0
   194
@SYMTestType        UT
sl@0
   195
@SYMTestStatus      Implemented
sl@0
   196
@SYMPREQ            PREQ2678
sl@0
   197
sl@0
   198
@SYMTestCaseDesc
sl@0
   199
	To ensure that calling GlyphCode() on an unopened iterator will panic.
sl@0
   200
sl@0
   201
@SYMTestActions
sl@0
   202
	Call GlyphCode() on an RFbsGlyphDataIterator instance without opening it.
sl@0
   203
sl@0
   204
@SYMTestExpectedResults
sl@0
   205
	The call to GlyphCode() should panic with FBSCLI 31.
sl@0
   206
*/
sl@0
   207
void CTFbsGlyphDataPanic::TestGlyphDataIteratorNotInitializedGlyphCode()
sl@0
   208
    {
sl@0
   209
    INFO_PRINTF1(_L("Ensure that GlyphCode() operation applied on null iterator will panic"));
sl@0
   210
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0654"));
sl@0
   211
    RFbsGlyphDataIterator iter;
sl@0
   212
    iter.GlyphCode(); //expect to panic here
sl@0
   213
    }
sl@0
   214
sl@0
   215
/**
sl@0
   216
@SYMTestCaseID      GRAPHICS-FBSERV-0655
sl@0
   217
@SYMTestPriority    High
sl@0
   218
@SYMTestType        UT
sl@0
   219
@SYMTestStatus      Implemented
sl@0
   220
@SYMPREQ            PREQ2678
sl@0
   221
sl@0
   222
@SYMTestCaseDesc
sl@0
   223
	To ensure that calling Next() on an iterator which has been closed will panic.
sl@0
   224
sl@0
   225
@SYMTestActions
sl@0
   226
	i. Open the glyph data iterator with 1 glyph code.
sl@0
   227
	ii. Call Next() to attempt to move the iterator past the end of the array of glyph codes.
sl@0
   228
	iii. Call Close() and repeat ii.
sl@0
   229
sl@0
   230
@SYMTestExpectedResults
sl@0
   231
	The call to Next() should fail with KErrNotFound, signifying the iterator is still open.
sl@0
   232
	The final call to Next() should panic with FBSCLI 31.
sl@0
   233
*/
sl@0
   234
void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedNext()
sl@0
   235
    {
sl@0
   236
    INFO_PRINTF1(_L("Ensure that Next() operation applied on iterator which has been closed will panic"));
sl@0
   237
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0655"));
sl@0
   238
    RFbsGlyphDataIterator iter;
sl@0
   239
    TESTNOERROR(iter.Open(*iFont, iGlyphCodes, 1));
sl@0
   240
    TInt iterErr = iter.Next();
sl@0
   241
    TESTE(iterErr == KErrNotFound, iterErr);
sl@0
   242
    iter.Close();
sl@0
   243
    iter.Next(); //expect to panic here
sl@0
   244
    }
sl@0
   245
sl@0
   246
/**
sl@0
   247
@SYMTestCaseID      GRAPHICS-FBSERV-0656
sl@0
   248
@SYMTestPriority    High
sl@0
   249
@SYMTestType        UT
sl@0
   250
@SYMTestStatus      Implemented
sl@0
   251
@SYMPREQ            PREQ2678
sl@0
   252
sl@0
   253
@SYMTestCaseDesc
sl@0
   254
	To ensure that calling Image() on an iterator which has been closed will panic.
sl@0
   255
sl@0
   256
@SYMTestActions
sl@0
   257
	i. Open the glyph data iterator.
sl@0
   258
	ii. Close the glyph data iterator.
sl@0
   259
	iii. Call Image() on an RFbsGlyphDataIterator instance which has been closed.
sl@0
   260
sl@0
   261
@SYMTestExpectedResults
sl@0
   262
	The call to Image() should panic with FBSCLI 31.
sl@0
   263
*/
sl@0
   264
void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedImage()
sl@0
   265
    {
sl@0
   266
    INFO_PRINTF1(_L("Ensure that Image() operation applied on iterator which has been closed will panic"));
sl@0
   267
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0656"));
sl@0
   268
    RFbsGlyphDataIterator iter;
sl@0
   269
    OpenAndCloseIterator(iter);
sl@0
   270
    iter.Image(); //expect to panic here
sl@0
   271
    }
sl@0
   272
sl@0
   273
/**
sl@0
   274
@SYMTestCaseID      GRAPHICS-FBSERV-0657
sl@0
   275
@SYMTestPriority    High
sl@0
   276
@SYMTestType        UT
sl@0
   277
@SYMTestStatus      Implemented
sl@0
   278
@SYMPREQ            PREQ2678
sl@0
   279
sl@0
   280
@SYMTestCaseDesc
sl@0
   281
	To ensure that calling Metrics() on an iterator which has been closed will panic.
sl@0
   282
sl@0
   283
@SYMTestActions
sl@0
   284
	i. Open the glyph data iterator.
sl@0
   285
	ii. Close the glyph data iterator.
sl@0
   286
	iii. Call Metrics() on an RFbsGlyphDataIterator instance which has been closed.
sl@0
   287
sl@0
   288
@SYMTestExpectedResults
sl@0
   289
	The call to Metrics() should panic with FBSCLI 31.
sl@0
   290
*/
sl@0
   291
void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedMetrics()
sl@0
   292
    {
sl@0
   293
    INFO_PRINTF1(_L("Ensure that Metrics()operation applied on iterator which has been closed will panic"));
sl@0
   294
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0657"));
sl@0
   295
    RFbsGlyphDataIterator iter;
sl@0
   296
    OpenAndCloseIterator(iter);
sl@0
   297
    iter.Metrics(); //expect to panic here
sl@0
   298
    }
sl@0
   299
sl@0
   300
/**
sl@0
   301
@SYMTestCaseID      GRAPHICS-FBSERV-0658
sl@0
   302
@SYMTestPriority    High
sl@0
   303
@SYMTestType        UT
sl@0
   304
@SYMTestStatus      In development
sl@0
   305
@SYMPREQ            PREQ2678
sl@0
   306
sl@0
   307
@SYMTestCaseDesc
sl@0
   308
	To ensure that calling GlyphCode() on an iterator which has been closed will panic.
sl@0
   309
sl@0
   310
@SYMTestActions
sl@0
   311
	i. Open the glyph data iterator.
sl@0
   312
	ii. Close the glyph data iterator.
sl@0
   313
	iii. Call GlyphCode() on an RFbsGlyphDataIterator instance which has been closed.
sl@0
   314
sl@0
   315
@SYMTestExpectedResults
sl@0
   316
	The call to GlyphCode() should panic with FBSCLI 31.
sl@0
   317
*/
sl@0
   318
void CTFbsGlyphDataPanic::TestGlyphDataIteratorClosedGlyphCode()
sl@0
   319
    {
sl@0
   320
    INFO_PRINTF1(_L("Ensure that GlyphCode() operation applied on iterator which has been closed will panic"));
sl@0
   321
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0658"));
sl@0
   322
    RFbsGlyphDataIterator iter;
sl@0
   323
    OpenAndCloseIterator(iter);
sl@0
   324
    iter.GlyphCode(); //expect to panic here
sl@0
   325
    }
sl@0
   326
sl@0
   327
// the function opens and then closes an iterator
sl@0
   328
void CTFbsGlyphDataPanic::OpenAndCloseIterator(RFbsGlyphDataIterator& aIterator) 
sl@0
   329
    {
sl@0
   330
    TESTNOERROR(aIterator.Open(*iFont, iGlyphCodes, 1));
sl@0
   331
    aIterator.Close();
sl@0
   332
    }
sl@0
   333
sl@0
   334
/**
sl@0
   335
@SYMTestCaseID      GRAPHICS-FBSERV-0647
sl@0
   336
@SYMTestPriority    High
sl@0
   337
@SYMTestType        UT
sl@0
   338
@SYMTestStatus      Implemented
sl@0
   339
@SYMPREQ            PREQ2678
sl@0
   340
sl@0
   341
@SYMTestCaseDesc
sl@0
   342
	To ensure that attempting to use an invalid Font handle will cause a panic when iterating through an RFbsGlyphDataIterator. 
sl@0
   343
sl@0
   344
@SYMTestActions
sl@0
   345
	i. Open the glyph data iterator.
sl@0
   346
	ii. Release the font associated with the iterator.
sl@0
   347
	iii. Attempt to use invalid Font handle by iterating through the iterator.
sl@0
   348
sl@0
   349
@SYMTestExpectedResults
sl@0
   350
	The call to Next() after the associated Font has been released should cause panic FBSERV -8 when the invalid Font handle is passed to FBServ.
sl@0
   351
*/
sl@0
   352
void CTFbsGlyphDataPanic::TestGlyphDataIteratorDiscardUsedFont()
sl@0
   353
    {
sl@0
   354
    INFO_PRINTF1(_L("Ensure that attempting to use an invalid Font handle will cause a panic when iterating through an RFbsGlyphDataIterator"));
sl@0
   355
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0647"));
sl@0
   356
    
sl@0
   357
    RFbsGlyphDataIterator iter;
sl@0
   358
    TESTNOERROR(iter.Open(*iFont, iGlyphCodes, KNumGlyphCodes));
sl@0
   359
    iTs->ReleaseFont(iFont);
sl@0
   360
    
sl@0
   361
    for (TInt i = 0; i < KNumGlyphCodes; i++)
sl@0
   362
        {
sl@0
   363
        //should panic when attempt is made to use invalid Font handle
sl@0
   364
        iter.Next();
sl@0
   365
        }
sl@0
   366
sl@0
   367
    iter.Close(); //shouldn't reach this line. If for some reason the code doesn't panic test should fail.
sl@0
   368
    TEST(EFalse);  
sl@0
   369
    }
sl@0
   370
    
sl@0
   371
sl@0
   372
/**
sl@0
   373
@SYMTestCaseID      GRAPHICS-FBSERV-0648
sl@0
   374
@SYMTestPriority    High
sl@0
   375
@SYMTestType        UT
sl@0
   376
@SYMTestStatus      Implemented
sl@0
   377
@SYMPREQ            PREQ2678
sl@0
   378
sl@0
   379
@SYMTestCaseDesc
sl@0
   380
	To ensure that accessing the glyph metrics entry with negative index will cause a panic.
sl@0
   381
sl@0
   382
@SYMTestActions
sl@0
   383
	i. Retrieve glyph metrics array.
sl@0
   384
	ii. Try to access glyph metrics entry with a negative index.
sl@0
   385
sl@0
   386
@SYMTestExpectedResults
sl@0
   387
	Should panic with FBSCLI 32.
sl@0
   388
*/
sl@0
   389
void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexNegative()
sl@0
   390
    {
sl@0
   391
    INFO_PRINTF1(_L("Ensure that accessing the glyph metrics entry with negative index will cause a panic"));
sl@0
   392
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0648"));
sl@0
   393
    RFbsGlyphMetricsArray glyphMetricsArray;
sl@0
   394
sl@0
   395
    // Retrieve list of metrics
sl@0
   396
    TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodes, 2));
sl@0
   397
    TEST(2 == glyphMetricsArray.Count());
sl@0
   398
    glyphMetricsArray[-1];
sl@0
   399
    }
sl@0
   400
sl@0
   401
/**
sl@0
   402
@SYMTestCaseID      GRAPHICS-FBSERV-0649
sl@0
   403
@SYMTestPriority    High
sl@0
   404
@SYMTestType        UT
sl@0
   405
@SYMTestStatus      Implemented
sl@0
   406
@SYMPREQ            PREQ2678
sl@0
   407
sl@0
   408
@SYMTestCaseDesc
sl@0
   409
	To ensure that accessing the glyph metrics entry with an index greater than number
sl@0
   410
	of elements in array will cause a panic.
sl@0
   411
sl@0
   412
@SYMTestActions
sl@0
   413
	i. Retrieve a glyph metrics array with total number of elements equals 2 
sl@0
   414
	ii. Try to access glyph metrics entry with index equals 2.
sl@0
   415
sl@0
   416
@SYMTestExpectedResults
sl@0
   417
	Should panic with FBSCLI 32.
sl@0
   418
*/
sl@0
   419
void CTFbsGlyphDataPanic::TestGlyphMetricsArrayIndexTooHigh()
sl@0
   420
    {
sl@0
   421
    INFO_PRINTF1(_L("Ensure that accessing the glyph metrics entry with index greater than number of elemnets in array will cause a panic"));
sl@0
   422
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0649"));
sl@0
   423
    RFbsGlyphMetricsArray glyphMetricsArray;
sl@0
   424
sl@0
   425
    // Retrieve list of metrics
sl@0
   426
    TESTNOERROR(glyphMetricsArray.Get(*iFont, iGlyphCodes, 2));
sl@0
   427
    TEST(2 == glyphMetricsArray.Count());
sl@0
   428
    glyphMetricsArray[2]; //expect to panic here as index varies 0..1
sl@0
   429
    }
sl@0
   430
sl@0
   431
/**
sl@0
   432
@SYMTestCaseID      GRAPHICS-FBSERV-0667
sl@0
   433
@SYMTestPriority    High
sl@0
   434
@SYMTestType        UT
sl@0
   435
@SYMTestStatus      Implemented
sl@0
   436
@SYMPREQ            PREQ2678
sl@0
   437
sl@0
   438
@SYMTestCaseDesc
sl@0
   439
	To ensure that if RFbsGlyphDataIterator::Open() fails, it is still in the closed state
sl@0
   440
	and cannot be used.
sl@0
   441
sl@0
   442
@SYMTestActions
sl@0
   443
	i. Open an RFbsGlyphDataIterator on a font.  
sl@0
   444
	ii. Attempt to open a second RFbsGlyphDataIterator on the same font.
sl@0
   445
	ii. Attempt to use the properties of the iterator.
sl@0
   446
sl@0
   447
@SYMTestExpectedResults
sl@0
   448
	The call to GlyphCode() should panic with FBSCLI 31 since the iterator should be in a closed state.
sl@0
   449
*/
sl@0
   450
void CTFbsGlyphDataPanic::TestGlyphDataIteratorOpenFailed()
sl@0
   451
	{
sl@0
   452
    INFO_PRINTF1(_L("Ensure that if RFbsGlyphDataIterator::Open() fails, it is still in the closed state and cannot be used"));
sl@0
   453
    ((CTFbsGlyphDataPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0667"));
sl@0
   454
   
sl@0
   455
    CFbsFont* bitmapFont = NULL;
sl@0
   456
    TInt err = iTs->GetNearestFontToDesignHeightInPixels((CFont*&)bitmapFont, TFontSpec(_L("Digital"), 14));
sl@0
   457
    TESTNOERROR(err);
sl@0
   458
    TEST(!bitmapFont->IsOpenFont());
sl@0
   459
    
sl@0
   460
    RFbsGlyphDataIterator iter;
sl@0
   461
    err = iter.Open(*bitmapFont, iGlyphCodes, 2);
sl@0
   462
    TEST(err == KErrNotSupported);
sl@0
   463
        
sl@0
   464
    iter.GlyphCode(); // Should panic here as iter should be closed.
sl@0
   465
    TEST(EFalse);     //shouldn't reach this line. If for some reason the code doesn't panic test should fail.
sl@0
   466
    
sl@0
   467
	}
sl@0
   468
//--------------
sl@0
   469
__CONSTRUCT_STEP__(FbsGlyphDataPanic)
sl@0
   470