os/ossrv/lowlevellibsandfws/apputils/tsrc/T_RSREAD2.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) 2003-2009 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
// Tests resource reader
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32std.h>
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <e32test.h>
sl@0
    21
#include <f32file.h>
sl@0
    22
#include <barsc2.h>
sl@0
    23
#include <barsread2.h>
sl@0
    24
#include <badesca.h>
sl@0
    25
#include <trsc.rsg>
sl@0
    26
#include "T_RSC.H"
sl@0
    27
sl@0
    28
RTest TheTest(_L("T_RSREAD2"));
sl@0
    29
RFs TheFs;
sl@0
    30
CResourceFile* TheResourceFile = NULL;
sl@0
    31
sl@0
    32
//
sl@0
    33
//
sl@0
    34
//Test macroses and functions
sl@0
    35
LOCAL_C void Check(TInt aValue, TInt aLine)
sl@0
    36
	{
sl@0
    37
	if(!aValue)
sl@0
    38
		{
sl@0
    39
		TheTest(EFalse, aLine);
sl@0
    40
		}
sl@0
    41
	}
sl@0
    42
LOCAL_C void Check(TInt aValue, TInt aExpected, TInt aLine)
sl@0
    43
	{
sl@0
    44
	if(aValue != aExpected)
sl@0
    45
		{
sl@0
    46
		RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue);
sl@0
    47
		TheTest(EFalse, aLine);
sl@0
    48
		}
sl@0
    49
	}
sl@0
    50
#define TEST(arg) ::Check((arg), __LINE__)
sl@0
    51
#define TEST2(aValue, aExpected) ::Check(aValue, aExpected, __LINE__)
sl@0
    52
sl@0
    53
//
sl@0
    54
//
sl@0
    55
sl@0
    56
//Opens aReader using RResourceReader::OpenLC(CResourceFile*, TInt)
sl@0
    57
static void OpenResourceReaderLC(RResourceReader& aReader, TInt aResourceId)
sl@0
    58
    {
sl@0
    59
    TEST(TheResourceFile != NULL);
sl@0
    60
    aReader.OpenLC(TheResourceFile, aResourceId);
sl@0
    61
    }
sl@0
    62
sl@0
    63
//Opens aReader using RResourceReader::OpenL(const TDesC8&)
sl@0
    64
static void OpenResourceReader2LC(RResourceReader& aReader, TInt aResourceId)
sl@0
    65
    {
sl@0
    66
    TEST(TheResourceFile != NULL);
sl@0
    67
    HBufC8* rscData = TheResourceFile->AllocReadLC(aResourceId);
sl@0
    68
    aReader.OpenL(rscData->Des());
sl@0
    69
    CleanupStack::PopAndDestroy(rscData);
sl@0
    70
    CleanupClosePushL(aReader);
sl@0
    71
    }
sl@0
    72
sl@0
    73
//This enum describes how to obtain the resource buffer for
sl@0
    74
//RResourceReader objects: from the resource file or from a buffer
sl@0
    75
enum TRscBufAllocation
sl@0
    76
    {
sl@0
    77
    EFromRscFile,
sl@0
    78
    EFromRscBuf,
sl@0
    79
    ERscBufLast
sl@0
    80
    };
sl@0
    81
sl@0
    82
typedef void (*FTOpenResourceReaderLC)(RResourceReader& aReader, TInt aResourceId);
sl@0
    83
sl@0
    84
static FTOpenResourceReaderLC OpenResourceReaderFuncLC[ERscBufLast] =
sl@0
    85
    {
sl@0
    86
    &OpenResourceReaderLC,
sl@0
    87
    &OpenResourceReader2LC
sl@0
    88
    };
sl@0
    89
sl@0
    90
//Opens aReader either from a resource file ot from a resource buffer
sl@0
    91
static void OpenResourceReaderLC(RResourceReader& aReader, TInt aResourceId, TRscBufAllocation aRscBufAllocation)
sl@0
    92
    {
sl@0
    93
    OpenResourceReaderFuncLC[aRscBufAllocation](aReader, aResourceId);
sl@0
    94
    }
sl@0
    95
sl@0
    96
class TRsReadTester
sl@0
    97
	{
sl@0
    98
public:
sl@0
    99
	void TestButtonL(RResourceReader& aReader);
sl@0
   100
	void TestArrayL(RResourceReader& aReader);
sl@0
   101
	void TestFlPtEdL(RResourceReader& aReader);
sl@0
   102
	void TestMenuBarL(RResourceReader& aReader);
sl@0
   103
    void TestAlignment1L(RResourceReader& aReader, TInt aIndex);
sl@0
   104
    void TestAlignment2L(RResourceReader& aReader);
sl@0
   105
    void TimingTestsL(TRscBufAllocation aRscBufAllocation);
sl@0
   106
private:
sl@0
   107
    void DumpBytes(const TAny* aPtr,TInt aLen);
sl@0
   108
    TUint8 DumpByte(TUint aVal);
sl@0
   109
	};
sl@0
   110
sl@0
   111
/**
sl@0
   112
@SYMTestCaseID          SYSLIB-BAFL-CT-1289
sl@0
   113
@SYMTestCaseDesc        Tests for reading data from a BUTTON resource file
sl@0
   114
@SYMTestPriority        High
sl@0
   115
@SYMTestActions         Tests for RResourceReader::ReadInt16L(),RResourceReader::ReadUInt16L(),
sl@0
   116
                        RResourceReader::ReadTPtrCL() functions
sl@0
   117
@SYMTestExpectedResults Tests must not fail
sl@0
   118
@SYMREQ                 REQ0000
sl@0
   119
*/
sl@0
   120
void TRsReadTester::TestButtonL(RResourceReader& aReader)
sl@0
   121
	{
sl@0
   122
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1289 Test reading BUTTON resource "));
sl@0
   123
    TEST(aReader.ReadInt16L()==3);
sl@0
   124
    TEST(aReader.ReadUint16L()==5);
sl@0
   125
    TPtrC ptr=aReader.ReadTPtrCL();
sl@0
   126
    TEST(ptr==_L("Text"));
sl@0
   127
    ptr.Set(aReader.ReadTPtrCL());
sl@0
   128
    TEST(ptr.Length()==0);
sl@0
   129
    HBufC* hBuf=aReader.ReadHBufCL();
sl@0
   130
    TEST(*hBuf==_L("Bitmap placeholder"));
sl@0
   131
    delete(hBuf);
sl@0
   132
	}
sl@0
   133
sl@0
   134
/**
sl@0
   135
@SYMTestCaseID          SYSLIB-BAFL-CT-1290
sl@0
   136
@SYMTestCaseDesc        Tests for RResourceReader::ReadDesCArrayL() function
sl@0
   137
@SYMTestPriority        High
sl@0
   138
@SYMTestActions         Attempt to interpret data from an ARRAY resource file
sl@0
   139
@SYMTestExpectedResults Tests must not fail
sl@0
   140
@SYMREQ                 REQ0000
sl@0
   141
*/
sl@0
   142
void TRsReadTester::TestArrayL(RResourceReader& aReader)
sl@0
   143
	{
sl@0
   144
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1290 Test reading ARRAY resource "));
sl@0
   145
    CDesCArray* desArray=aReader.ReadDesCArrayL();
sl@0
   146
    TEST(desArray->Count()==5);
sl@0
   147
sl@0
   148
    TEST((*desArray)[0]==_L("Esc"));
sl@0
   149
    TEST((*desArray)[1]==_L("Enter"));
sl@0
   150
    TEST((*desArray)[2]==_L("Tab"));
sl@0
   151
    TEST((*desArray)[3]==_L("Del"));
sl@0
   152
    TEST((*desArray)[4]==_L("Space"));
sl@0
   153
sl@0
   154
    delete(desArray);
sl@0
   155
	}
sl@0
   156
sl@0
   157
/**
sl@0
   158
@SYMTestCaseID          SYSLIB-BAFL-CT-1291
sl@0
   159
@SYMTestCaseDesc        Tests for reading FLPTED resource
sl@0
   160
@SYMTestPriority        High
sl@0
   161
@SYMTestActions         Tests for RResourceReader::ReadReal64L() function
sl@0
   162
@SYMTestExpectedResults Tests must not fail
sl@0
   163
@SYMREQ                 REQ0000
sl@0
   164
*/
sl@0
   165
void TRsReadTester::TestFlPtEdL(RResourceReader& aReader)
sl@0
   166
	{
sl@0
   167
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1291 Test reading FLPTED resource "));
sl@0
   168
    TEST(aReader.ReadInt16L()==18);
sl@0
   169
    TReal little=aReader.ReadReal64L();
sl@0
   170
    TEST(little==0.0);
sl@0
   171
    TReal big=aReader.ReadReal64L();
sl@0
   172
    TEST(big>9.89e99);
sl@0
   173
    TEST(big<9.91e99);
sl@0
   174
	}
sl@0
   175
sl@0
   176
/**
sl@0
   177
@SYMTestCaseID          SYSLIB-BAFL-CT-1292
sl@0
   178
@SYMTestCaseDesc        Tests for reading MENU_BAR resource
sl@0
   179
@SYMTestPriority        High
sl@0
   180
@SYMTestActions         Tests for RResourceReader::ReadInt16L() function
sl@0
   181
@SYMTestExpectedResults Tests must not fail
sl@0
   182
@SYMREQ                 REQ0000
sl@0
   183
*/
sl@0
   184
void TRsReadTester::TestMenuBarL(RResourceReader& aReader)
sl@0
   185
	{
sl@0
   186
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1292 Test reading MENU_BAR resource "));
sl@0
   187
    TEST(aReader.ReadInt16L()==8); // how many items following
sl@0
   188
    TPtrC ref=_L("abcdefgh");
sl@0
   189
    for (TInt ii=1; ii<=8; ii++)
sl@0
   190
        {
sl@0
   191
        TEST(aReader.ReadInt32L()==ii);
sl@0
   192
        TEST(aReader.ReadTPtrCL()==ref.Left(ii));
sl@0
   193
        }
sl@0
   194
	}
sl@0
   195
sl@0
   196
/**
sl@0
   197
@SYMTestCaseID          SYSLIB-BAFL-CT-1293
sl@0
   198
@SYMTestCaseDesc        Tests for reading ALIGNMENT_HORROR resources
sl@0
   199
@SYMTestPriority        High
sl@0
   200
@SYMTestActions         Tests for RResourceReader::ReadTPtrC8L(),RResourceReader::ReadTPtrC16L() functions
sl@0
   201
@SYMTestExpectedResults Tests must not fail
sl@0
   202
@SYMREQ                 REQ0000
sl@0
   203
*/
sl@0
   204
void TRsReadTester::TestAlignment1L(RResourceReader& aReader, TInt aIndex)
sl@0
   205
	{
sl@0
   206
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1293 Test reading ALIGNMENT_HORROR resources "));
sl@0
   207
	TPtrC8  ref8 =_L8("xyz");
sl@0
   208
	TPtrC16 ref16=_L16("xyz");
sl@0
   209
	TEST(aReader.ReadTPtrC8L() == ref8.Left(aIndex));
sl@0
   210
	TEST(aReader.ReadTPtrC16L()== ref16.Left(aIndex));
sl@0
   211
	}
sl@0
   212
sl@0
   213
/**
sl@0
   214
@SYMTestCaseID          SYSLIB-BAFL-CT-1294
sl@0
   215
@SYMTestCaseDesc        Tests for reading ALIGNMENT_HORROR_ARRAY resource
sl@0
   216
@SYMTestPriority        High
sl@0
   217
@SYMTestActions         Tests for RResourceReader::ReadTPtrC8L(),RResourceReader::ReadTPtrC16L() functions
sl@0
   218
@SYMTestExpectedResults Tests must not fail
sl@0
   219
@SYMREQ                 REQ0000
sl@0
   220
*/
sl@0
   221
void TRsReadTester::TestAlignment2L(RResourceReader& aReader)
sl@0
   222
	{
sl@0
   223
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1294 Test reading ALIGNMENT_HORROR_ARRAY resource "));
sl@0
   224
    TEST(aReader.ReadInt16L()==7); // how many items following
sl@0
   225
    TPtrC8  ref8 =_L8("abcdef");
sl@0
   226
    TPtrC16 ref16=_L16("abcdef");
sl@0
   227
    for (TInt ii=0; ii<=6; ii++)
sl@0
   228
        {
sl@0
   229
        TEST(aReader.ReadTPtrC8L() ==ref8.Left(ii));
sl@0
   230
        TEST(aReader.ReadTPtrC16L()==ref16.Mid(ii));
sl@0
   231
        }
sl@0
   232
    }
sl@0
   233
sl@0
   234
/**
sl@0
   235
@SYMTestCaseID          SYSLIB-BAFL-CT-1295
sl@0
   236
@SYMTestCaseDesc        Tests for time required to load a resource file around 100 times
sl@0
   237
@SYMTestPriority        High
sl@0
   238
@SYMTestActions         Tests for time taken to load resource files repeatedly
sl@0
   239
@SYMTestExpectedResults Tests must not fail
sl@0
   240
@SYMREQ                 REQ0000
sl@0
   241
*/
sl@0
   242
void TRsReadTester::TimingTestsL(TRscBufAllocation aRscBufAllocation)
sl@0
   243
	{
sl@0
   244
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-1295 Timing tests "));
sl@0
   245
	TheTest.Next(_L("BUTTON and FLPTED"));
sl@0
   246
	TUint time = User::TickCount();
sl@0
   247
	for (TInt ii=0; ii<100; ii++)
sl@0
   248
		{
sl@0
   249
    	RResourceReader reader;
sl@0
   250
        ::OpenResourceReaderLC(reader, SYS_BUTTON_ONE, aRscBufAllocation);
sl@0
   251
	    CleanupStack::PopAndDestroy(&reader);
sl@0
   252
        ::OpenResourceReaderLC(reader, SYS_FLPTED_ONE, aRscBufAllocation);
sl@0
   253
    	CleanupStack::PopAndDestroy(&reader);
sl@0
   254
		}
sl@0
   255
	time = User::TickCount() - time;
sl@0
   256
	TheTest.Printf(_L("Time to load 100 times: %d\n"),time);
sl@0
   257
sl@0
   258
	TheTest.Next(_L("BUTTON and ARRAY"));
sl@0
   259
	time = User::TickCount();
sl@0
   260
	for (TInt jj=0; jj<100; jj++)
sl@0
   261
		{
sl@0
   262
    	RResourceReader reader;
sl@0
   263
        ::OpenResourceReaderLC(reader, SYS_BUTTON_ONE, aRscBufAllocation);
sl@0
   264
	    CleanupStack::PopAndDestroy(&reader);
sl@0
   265
        ::OpenResourceReaderLC(reader, SYS_ARRAY_ONE, aRscBufAllocation);
sl@0
   266
    	CleanupStack::PopAndDestroy(&reader);
sl@0
   267
		}
sl@0
   268
	time = User::TickCount() - time;
sl@0
   269
	TheTest.Printf(_L("Time to load 100 times: %d\n"),time);
sl@0
   270
	}
sl@0
   271
sl@0
   272
sl@0
   273
TUint8 TRsReadTester::DumpByte(TUint aVal)
sl@0
   274
    {
sl@0
   275
    return(aVal>9? TUint8(aVal-10+'a'): TUint8(aVal+'0'));
sl@0
   276
    }
sl@0
   277
sl@0
   278
void TRsReadTester::DumpBytes(const TAny* aPtr,TInt aLen)
sl@0
   279
    {
sl@0
   280
    TUint8* src=(TUint8*)aPtr;
sl@0
   281
    TBuf<100> whole;
sl@0
   282
    TUint8* tar=(TUint8*)whole.Ptr();
sl@0
   283
    TInt len=0;
sl@0
   284
    while (aLen--)
sl@0
   285
        {
sl@0
   286
        TUint val=(*src++);
sl@0
   287
        TUint top=val/16;
sl@0
   288
        TUint bottom=val%16;
sl@0
   289
        *tar++=DumpByte(top);
sl@0
   290
        *tar++=DumpByte(bottom);
sl@0
   291
        *tar++=' ';
sl@0
   292
        len+=3;
sl@0
   293
        }
sl@0
   294
    whole.SetLength(len);
sl@0
   295
    TheTest.Printf(whole);
sl@0
   296
    TheTest.Printf(_L("\r\n"));
sl@0
   297
    }
sl@0
   298
sl@0
   299
/**
sl@0
   300
@SYMTestCaseID          SYSLIB-BAFL-CT-0474
sl@0
   301
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   302
@SYMTestPriority        High
sl@0
   303
@SYMTestActions         Open a resource file and test for the reading the data
sl@0
   304
@SYMTestExpectedResults Tests must not fail
sl@0
   305
@SYMREQ                 REQ0000
sl@0
   306
*/
sl@0
   307
static void TestButtonL(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   308
    {
sl@0
   309
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0474 "));
sl@0
   310
    RResourceReader reader;
sl@0
   311
    ::OpenResourceReaderLC(reader, SYS_BUTTON_ONE, aRscBufAllocation);
sl@0
   312
	TRAPD(errCode, aTest.TestButtonL(reader));
sl@0
   313
    CleanupStack::PopAndDestroy(&reader);
sl@0
   314
	TEST2(errCode, KErrNone);
sl@0
   315
    }
sl@0
   316
sl@0
   317
/**
sl@0
   318
@SYMTestCaseID          SYSLIB-BAFL-CT-0475
sl@0
   319
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   320
@SYMTestPriority        High
sl@0
   321
@SYMTestActions         Tests for reading descriptor array.
sl@0
   322
@SYMTestExpectedResults Tests must not fail
sl@0
   323
@SYMREQ                 REQ0000
sl@0
   324
*/
sl@0
   325
static void TestArrayL(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   326
    {
sl@0
   327
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0475 "));
sl@0
   328
    RResourceReader reader;
sl@0
   329
    ::OpenResourceReaderLC(reader, SYS_ARRAY_ONE, aRscBufAllocation);
sl@0
   330
	TRAPD(errCode, aTest.TestArrayL(reader));
sl@0
   331
    CleanupStack::PopAndDestroy(&reader);
sl@0
   332
	TEST2(errCode, KErrNone);
sl@0
   333
    }
sl@0
   334
sl@0
   335
/**
sl@0
   336
@SYMTestCaseID          SYSLIB-BAFL-CT-0476
sl@0
   337
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   338
@SYMTestPriority        High
sl@0
   339
@SYMTestActions         Tests for reading real values
sl@0
   340
@SYMTestExpectedResults Tests must not fail
sl@0
   341
@SYMREQ                 REQ0000
sl@0
   342
*/
sl@0
   343
static void TestFlPtEdL(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   344
    {
sl@0
   345
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0476 "));
sl@0
   346
    RResourceReader reader;
sl@0
   347
    ::OpenResourceReaderLC(reader, SYS_FLPTED_ONE, aRscBufAllocation);
sl@0
   348
	TRAPD(errCode, aTest.TestFlPtEdL(reader));
sl@0
   349
    CleanupStack::PopAndDestroy(&reader);
sl@0
   350
	TEST2(errCode, KErrNone);
sl@0
   351
    }
sl@0
   352
sl@0
   353
/**
sl@0
   354
@SYMTestCaseID          SYSLIB-BAFL-CT-0477
sl@0
   355
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   356
@SYMTestPriority        High
sl@0
   357
@SYMTestActions         Tests for reading menu_bar resource
sl@0
   358
@SYMTestExpectedResults Tests must not fail
sl@0
   359
@SYMREQ                 REQ0000
sl@0
   360
*/
sl@0
   361
static void TestMenuBarL(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   362
    {
sl@0
   363
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0477 "));
sl@0
   364
    RResourceReader reader;
sl@0
   365
    ::OpenResourceReaderLC(reader, SYS_MENUBAR_ONE, aRscBufAllocation);
sl@0
   366
	TRAPD(errCode, aTest.TestMenuBarL(reader));
sl@0
   367
    CleanupStack::PopAndDestroy(&reader);
sl@0
   368
	TEST2(errCode, KErrNone);
sl@0
   369
    }
sl@0
   370
sl@0
   371
/**
sl@0
   372
@SYMTestCaseID          SYSLIB-BAFL-CT-0478
sl@0
   373
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   374
@SYMTestPriority        High
sl@0
   375
@SYMTestActions         Tests for reading descriptors and checks for alignment
sl@0
   376
@SYMTestExpectedResults Tests must not fail
sl@0
   377
@SYMREQ                 REQ0000
sl@0
   378
*/
sl@0
   379
static void TestAlignment1L(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   380
    {
sl@0
   381
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0478 "));
sl@0
   382
    const TInt TheHorrors[] =
sl@0
   383
        {
sl@0
   384
	    SYS_ALIGNMENT_HORROR0, SYS_ALIGNMENT_HORROR1,
sl@0
   385
	    SYS_ALIGNMENT_HORROR2, SYS_ALIGNMENT_HORROR3,
sl@0
   386
	    0
sl@0
   387
	    };
sl@0
   388
sl@0
   389
	for(TInt i=0;TheHorrors[i]!=0;++i)
sl@0
   390
        {
sl@0
   391
        RResourceReader reader;
sl@0
   392
        ::OpenResourceReaderLC(reader, TheHorrors[i], aRscBufAllocation);
sl@0
   393
	    TRAPD(errCode, aTest.TestAlignment1L(reader, i));
sl@0
   394
        CleanupStack::PopAndDestroy(&reader);
sl@0
   395
	    TEST2(errCode, KErrNone);
sl@0
   396
        }
sl@0
   397
    }
sl@0
   398
sl@0
   399
/**
sl@0
   400
@SYMTestCaseID          SYSLIB-BAFL-CT-0479
sl@0
   401
@SYMTestCaseDesc        Tests for the functionality of RResourceReader class
sl@0
   402
@SYMTestPriority        High
sl@0
   403
@SYMTestActions         Tests for reading descriptors and checks for alignment
sl@0
   404
@SYMTestExpectedResults Tests must not fail
sl@0
   405
@SYMREQ                 REQ0000
sl@0
   406
*/
sl@0
   407
static void TestAlignment2L(TRsReadTester& aTest, TRscBufAllocation aRscBufAllocation)
sl@0
   408
    {
sl@0
   409
	TheTest.Next(_L(" @SYMTestCaseID:SYSLIB-BAFL-CT-0479 "));
sl@0
   410
    RResourceReader reader;
sl@0
   411
    ::OpenResourceReaderLC(reader, SYS_ALIGNMENT_HORROR_ARRAY, aRscBufAllocation);
sl@0
   412
	TRAPD(errCode, aTest.TestAlignment2L(reader));
sl@0
   413
    CleanupStack::PopAndDestroy(&reader);
sl@0
   414
	TEST2(errCode, KErrNone);
sl@0
   415
    }
sl@0
   416
sl@0
   417
static void RunTestsL()
sl@0
   418
    {
sl@0
   419
	TheTest.Start(_L("Resource reader"));
sl@0
   420
	CleanupClosePushL(TheFs);
sl@0
   421
	User::LeaveIfError(TheFs.Connect());
sl@0
   422
    TheResourceFile = CResourceFile::NewLC(TheFs,KRomResourceFile, 0, 0);
sl@0
   423
sl@0
   424
	TRsReadTester lt;
sl@0
   425
sl@0
   426
    ::TestButtonL(lt, EFromRscFile);
sl@0
   427
    ::TestButtonL(lt, EFromRscBuf);
sl@0
   428
sl@0
   429
    ::TestArrayL(lt, EFromRscFile);
sl@0
   430
    ::TestArrayL(lt, EFromRscBuf);
sl@0
   431
sl@0
   432
    ::TestFlPtEdL(lt, EFromRscFile);
sl@0
   433
    ::TestFlPtEdL(lt, EFromRscBuf);
sl@0
   434
sl@0
   435
    ::TestMenuBarL(lt, EFromRscFile);
sl@0
   436
    ::TestMenuBarL(lt, EFromRscBuf);
sl@0
   437
sl@0
   438
    ::TestAlignment1L(lt, EFromRscFile);
sl@0
   439
    ::TestAlignment1L(lt, EFromRscBuf);
sl@0
   440
sl@0
   441
    ::TestAlignment2L(lt, EFromRscFile);
sl@0
   442
    ::TestAlignment2L(lt, EFromRscBuf);
sl@0
   443
sl@0
   444
    TRAPD(errCode, lt.TimingTestsL(EFromRscFile));
sl@0
   445
	TEST2(errCode, KErrNone);
sl@0
   446
sl@0
   447
    TRAP(errCode, lt.TimingTestsL(EFromRscBuf));
sl@0
   448
	TEST2(errCode, KErrNone);
sl@0
   449
sl@0
   450
	CleanupStack::PopAndDestroy(TheResourceFile);
sl@0
   451
	CleanupStack::PopAndDestroy(1, &TheFs);
sl@0
   452
    }
sl@0
   453
sl@0
   454
TInt E32Main()
sl@0
   455
	{
sl@0
   456
	__UHEAP_MARK;
sl@0
   457
    CTrapCleanup *cleanup=CTrapCleanup::New();
sl@0
   458
	TheTest.Title();
sl@0
   459
    TRAPD(err,::RunTestsL());
sl@0
   460
	TEST2(err, KErrNone);
sl@0
   461
	TheTest.Next(_L("/n"));
sl@0
   462
	TheTest.End();
sl@0
   463
	TheTest.Close();
sl@0
   464
    delete(cleanup);
sl@0
   465
	__UHEAP_MARKEND;
sl@0
   466
    return(0);
sl@0
   467
	}