First public contribution.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * This file contains text and glyph data for testing
26 //class used for holding input and output data for the shaper, for testing purposes.
27 class CTestData : public CBase
31 CTestData(): iTypeFaceName(NULL), iFilename(NULL), iTextInput(NULL), iStart(0), iEnd(0),
32 iGlyphCount(0), iGlyphs(NULL), iIndices(NULL), iPositions(NULL)
37 //reads in all the data from the test file
38 void Internalize(TPtrC16 aTestDataFilename);
41 TBuf16<50> iTypeFaceName;
42 TBuf16<100> iFilename;
47 //equivalent expected output
49 CArrayFixFlat<TUint32>* iGlyphs; // note RArray not used for these members as
50 CArrayFixFlat<TUint16>* iIndices; // is aligned to 4byte boundary
51 CArrayFixFlat<TUint16>* iPositions;
56 CTestData::~CTestData(void)
64 void CTestData::Internalize(TPtrC16 aTestDataFilename)
68 User::LeaveIfError(fs.Connect());
69 CleanupClosePushL(fs);
73 file.Open(fs, aTestDataFilename, EFileRead);
75 // set up file buf and read stream
78 CleanupClosePushL(buf);
79 RReadStream stream(&buf);
80 CleanupClosePushL(stream);
88 //FIRST THE INPUT DATA
90 //number of input chars
91 count = stream.ReadInt16L();
94 stream.ReadL(iTypeFaceName,delimiter);
95 iTypeFaceName.Delete(iTypeFaceName.Length() - 1, 1);
98 stream.ReadL(iFilename,delimiter);
99 iFilename.Delete(iFilename.Length() - 1, 1);
102 iStart = stream.ReadInt16L();
103 stream.ReadL(tempBuf,delimiter);
106 iEnd = stream.ReadInt16L();
107 stream.ReadL(tempBuf,delimiter);
110 iTextInput = new(ELeave) TBuf16<1500>;
111 stream.ReadL(*iTextInput,count);
112 stream.ReadL(tempBuf,delimiter);
114 //NOW THE OUTPUT DATA
116 //firt the glyph count
117 iGlyphCount = stream.ReadInt16L();
120 iGlyphs = new(ELeave) CArrayFixFlat<TUint32>(1);
121 for (i=0; i<iGlyphCount; i++)
123 iGlyphs->AppendL(stream.ReadInt32L());
126 //then the x and y positions
127 iPositions = new(ELeave) CArrayFixFlat<TUint16>(1);
128 for (i=0; i<iGlyphCount*2; i++)
130 iPositions->AppendL(stream.ReadInt16L());
134 iAdvance.iX = stream.ReadInt16L();
135 iAdvance.iY = stream.ReadInt16L();
137 //and finally the indices
138 iIndices = new(ELeave) CArrayFixFlat<TUint16>(1);
139 for (i=0; i<iGlyphCount; i++)
142 iIndices->AppendL(stream.ReadInt16L());
145 //and the character count
146 iCharacterCount = stream.ReadInt16L();
148 CleanupStack::PopAndDestroy(3); //buf, fs