sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include "TCustomWrap.h"
|
sl@0
|
20 |
#include "TGraphicsContext.h"
|
sl@0
|
21 |
#include <e32std.h>
|
sl@0
|
22 |
#include <e32test.h>
|
sl@0
|
23 |
#include <frmtlay.h>
|
sl@0
|
24 |
#include <frmtview.h>
|
sl@0
|
25 |
#include <txtlaydc.h>
|
sl@0
|
26 |
#include <fbs.h>
|
sl@0
|
27 |
#include <w32std.h>
|
sl@0
|
28 |
#include <txtrich.h>
|
sl@0
|
29 |
#include <e32math.h>
|
sl@0
|
30 |
#include <f32file.h>
|
sl@0
|
31 |
#include <flogger.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
34 |
#include "TAGMA_INTERNAL.H"
|
sl@0
|
35 |
#endif
|
sl@0
|
36 |
|
sl@0
|
37 |
#include "tformbenchmark.h"
|
sl@0
|
38 |
|
sl@0
|
39 |
namespace LocalToTFormBenchmark
|
sl@0
|
40 |
{
|
sl@0
|
41 |
CTFormBenchmarkStep* TestStep = NULL;
|
sl@0
|
42 |
#define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
|
sl@0
|
43 |
#define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
|
sl@0
|
44 |
}
|
sl@0
|
45 |
using namespace LocalToTFormBenchmark;
|
sl@0
|
46 |
|
sl@0
|
47 |
RFs fs;
|
sl@0
|
48 |
RFile fileTimeStamps;
|
sl@0
|
49 |
|
sl@0
|
50 |
_LIT(KFormBenchmark, "TFormBenchmark");
|
sl@0
|
51 |
|
sl@0
|
52 |
#if ((defined (__WINS__)) || (defined (__X86GCC__)))
|
sl@0
|
53 |
_LIT(KLogTimeStampsName, "c:\\formtimestamps.csv");
|
sl@0
|
54 |
#else
|
sl@0
|
55 |
_LIT(KLogTimeStampsName, "e:\\formtimestamps.csv");
|
sl@0
|
56 |
#endif
|
sl@0
|
57 |
|
sl@0
|
58 |
_LIT(KEnglish, "Whereas recognition of the inherent dignity and of the equal \
|
sl@0
|
59 |
and inalienable rights of all members of the human family is the foundation \
|
sl@0
|
60 |
of freedom, justice and peace in the world, ");
|
sl@0
|
61 |
const TInt KEnglishRepeats = 119;
|
sl@0
|
62 |
_LIT(KArabic, "\x644\x645\x651\x627 \x643\x627\x646 \x627\x644\x627\x639\x62A\
|
sl@0
|
63 |
\x631\x627\x641 \x628\x627\x644\x643\x631\x627\x645\x629 \x627\x644\x645\x62A\
|
sl@0
|
64 |
\x623\x635\x644\x629 \x641\x64A \x62C\x645\x64A\x639 \x623\x639\x636\x627\
|
sl@0
|
65 |
\x621 \x627\x644\x623\x633\x631\x629 \x627\x644\x628\x634\x631\x64A\x629\
|
sl@0
|
66 |
\x648\x628\x62D\x642\x648\x642\x647\x645 \x627\x644\x645\x62A\x633\x627\
|
sl@0
|
67 |
\x648\x64A\x629 \x627\x644\x62B\x627\x628\x62A\x629 \x647\x648 \x623\x633\
|
sl@0
|
68 |
\x627\x633 \x627\x644\x62D\x631\x64A\x629 \x648\x627\x644\x639\x62F\x644\
|
sl@0
|
69 |
\x648\x627\x644\x633\x644\x627\x645 \x641\x64A \x627\x644\x639\x627\x644\
|
sl@0
|
70 |
\x645. ");
|
sl@0
|
71 |
const TInt KArabicRepeats = 156;
|
sl@0
|
72 |
_LIT(KJapanese, "\x4EBA\x985E\x793E\x4F1A\x306E\x3059\x3079\x3066\x306E\x69CB\
|
sl@0
|
73 |
\x6210\x54E1\x306E\x56FA\x6709\x306E\x5C0A\x53B3\x3068\x5E73\x7B49\x3067\x8B72\
|
sl@0
|
74 |
\x308B\x3053\x3068\x306E\x3067\x304D\x306A\x3044\x6A29\x5229\x3068\x3092\
|
sl@0
|
75 |
\x627F\x8A8D\x3059\x308B\x3053\x3068\x306F\x3001\x4E16\x754C\x306B\x304A\
|
sl@0
|
76 |
\x3051\x308B\x81EA\x7531\x3001\x6B63\x7FA9\x53CA\x3073\x5E73\x548C\x306E\
|
sl@0
|
77 |
\x57FA\x790E\x3067\x3042\x308B\x306E\x3067\x3001 ");
|
sl@0
|
78 |
const TInt KJapaneseRepeats = 357;
|
sl@0
|
79 |
const TInt KDisplayWidth = 100;
|
sl@0
|
80 |
const TInt KDisplayHeight = 120;
|
sl@0
|
81 |
|
sl@0
|
82 |
const TInt KInsertDisplayWidth = 200;
|
sl@0
|
83 |
const TInt KChangedDisplayWidth = 150;
|
sl@0
|
84 |
|
sl@0
|
85 |
_LIT(KEnglishToInsert1, "Whereas recognition of the inherent dignity");
|
sl@0
|
86 |
_LIT(KEnglishToInsert2, " and of the equal and inalienable rights of all... and so on");
|
sl@0
|
87 |
|
sl@0
|
88 |
const TInt KEnglishInsertRepeats = 400;
|
sl@0
|
89 |
const TInt KEnglishScrollRepeats = 100;
|
sl@0
|
90 |
|
sl@0
|
91 |
const TInt KDeleteTextInterval = 10;//we measure delete text once for each 10 deletes, to make the output smaller
|
sl@0
|
92 |
|
sl@0
|
93 |
_LIT8(KDeleteTextFromStart, "Delete text from start\r\n");
|
sl@0
|
94 |
_LIT8(KInsertTextAtStart, "Insert text at start\r\n");
|
sl@0
|
95 |
_LIT8(KScrollingUp, "Scrolling up\r\n");
|
sl@0
|
96 |
_LIT8(KScrollingDown, "Scrolling down\r\n");
|
sl@0
|
97 |
|
sl@0
|
98 |
struct TDocInfo
|
sl@0
|
99 |
{
|
sl@0
|
100 |
TDocInfo():iDocLength(0), iDocParaCount(0), iLineCount(0){}
|
sl@0
|
101 |
TInt iDocLength;
|
sl@0
|
102 |
TInt iDocParaCount;
|
sl@0
|
103 |
TInt iLineCount;
|
sl@0
|
104 |
};
|
sl@0
|
105 |
|
sl@0
|
106 |
struct TTFTimeStamp
|
sl@0
|
107 |
{
|
sl@0
|
108 |
TInt64 iTime;
|
sl@0
|
109 |
TInt iIteration;
|
sl@0
|
110 |
};
|
sl@0
|
111 |
|
sl@0
|
112 |
struct TFormattingObjects
|
sl@0
|
113 |
{
|
sl@0
|
114 |
TRect* iDisplayRect;
|
sl@0
|
115 |
CParaFormatLayer* iParFormat;
|
sl@0
|
116 |
CCharFormatLayer* iCharFormat;
|
sl@0
|
117 |
CRichText* iRichText;
|
sl@0
|
118 |
CTextLayout* iLayout;
|
sl@0
|
119 |
CTestGraphicsDevice* iDevice;
|
sl@0
|
120 |
CTextView* iView;
|
sl@0
|
121 |
};
|
sl@0
|
122 |
|
sl@0
|
123 |
/*
|
sl@0
|
124 |
Functions for writing benchmarking data to the CSV
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
void WriteSampleDocInfo(TDocInfo aDocInfo, RFile aDest)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
TBuf8<128> buf;
|
sl@0
|
129 |
buf.Format(_L8("Sample text: %d characters: %d paras: %d lines\r\n"), aDocInfo.iDocLength, aDocInfo.iDocParaCount, aDocInfo.iLineCount);
|
sl@0
|
130 |
aDest.Write(buf);
|
sl@0
|
131 |
}
|
sl@0
|
132 |
|
sl@0
|
133 |
void WriteTimeStampsL(const TDesC8& aTitle, RArray<TTFTimeStamp>& aTimeStamps)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
fileTimeStamps.Write(aTitle);
|
sl@0
|
136 |
for (TInt i = 0; i < aTimeStamps.Count(); i++)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
TTFTimeStamp timestamp = aTimeStamps[i];
|
sl@0
|
139 |
TBuf8<128> buf;
|
sl@0
|
140 |
buf.Format(_L8("%d, %Ld\r\n"), timestamp.iIteration, timestamp.iTime/1000);
|
sl@0
|
141 |
fileTimeStamps.Write(buf);
|
sl@0
|
142 |
}
|
sl@0
|
143 |
}
|
sl@0
|
144 |
|
sl@0
|
145 |
TDocInfo GetSampleDocInfoL(TFormattingObjects& aFormattingObjects)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
TDocInfo docInfo;
|
sl@0
|
148 |
const CTmTextLayout& layout = aFormattingObjects.iView->Layout()->TagmaTextLayout();
|
sl@0
|
149 |
docInfo.iDocLength = layout.Source()->DocumentLength();
|
sl@0
|
150 |
docInfo.iDocParaCount = aFormattingObjects.iRichText->ParagraphCount();
|
sl@0
|
151 |
//very peculiar way to count the lines...
|
sl@0
|
152 |
TCursorPosition::TMovementType move = TCursorPosition::EFLineDown;
|
sl@0
|
153 |
while (move == TCursorPosition::EFLineDown)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
aFormattingObjects.iView->MoveCursorL(move, EFalse);
|
sl@0
|
156 |
}
|
sl@0
|
157 |
move = TCursorPosition::EFLineUp;
|
sl@0
|
158 |
while (move == TCursorPosition::EFLineUp)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
docInfo.iLineCount++;
|
sl@0
|
161 |
aFormattingObjects.iView->MoveCursorL(move, EFalse);
|
sl@0
|
162 |
}
|
sl@0
|
163 |
return docInfo;
|
sl@0
|
164 |
}
|
sl@0
|
165 |
|
sl@0
|
166 |
/*
|
sl@0
|
167 |
Set up the test document
|
sl@0
|
168 |
*/
|
sl@0
|
169 |
void SetTextL(CRichText& aText, const TDesC& aSample, TInt aRepeats, TInt aRepeatsPerPara)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
TInt repeatsInThisPar = 0;
|
sl@0
|
172 |
aText.Reset();
|
sl@0
|
173 |
for (; aRepeats != 0; --aRepeats)
|
sl@0
|
174 |
{
|
sl@0
|
175 |
aText.InsertL(0, aSample);
|
sl@0
|
176 |
repeatsInThisPar ++;
|
sl@0
|
177 |
if (repeatsInThisPar > aRepeatsPerPara)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
TChar paragraphDelimiter(0x2029);
|
sl@0
|
180 |
aText.InsertL(0, paragraphDelimiter);
|
sl@0
|
181 |
repeatsInThisPar = 0;
|
sl@0
|
182 |
}
|
sl@0
|
183 |
}
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
_LIT(KOneWord, "blahblahblahblahblahblahblahblah");
|
sl@0
|
187 |
|
sl@0
|
188 |
void BigBufLC(RBuf& aBigBuf)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
aBigBuf.CreateL(16384);
|
sl@0
|
191 |
aBigBuf.CleanupClosePushL();
|
sl@0
|
192 |
while(aBigBuf.Length()+KOneWord().Length() < aBigBuf.MaxLength())
|
sl@0
|
193 |
{
|
sl@0
|
194 |
aBigBuf.Append(KOneWord);
|
sl@0
|
195 |
}
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
TTimeIntervalMicroSeconds MeasureOpeningL(CTextView& aView)
|
sl@0
|
199 |
{
|
sl@0
|
200 |
TCursorSelection zero(0, 0);
|
sl@0
|
201 |
aView.SetPendingSelection(zero);
|
sl@0
|
202 |
TTime start;
|
sl@0
|
203 |
TTime end;
|
sl@0
|
204 |
start.UniversalTime();
|
sl@0
|
205 |
aView.HandleGlobalChangeL();
|
sl@0
|
206 |
end.UniversalTime();
|
sl@0
|
207 |
return end.MicroSecondsFrom(start);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
|
sl@0
|
210 |
TTimeIntervalMicroSeconds MeasureRmsCursorDownL(CTextView& aView)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
TInt mem;
|
sl@0
|
213 |
TInt cells = User::AllocSize(mem);
|
sl@0
|
214 |
TReal totalOfSquares = 0;
|
sl@0
|
215 |
TTime start;
|
sl@0
|
216 |
TTime end;
|
sl@0
|
217 |
TCursorPosition::TMovementType move = TCursorPosition::EFLineDown;
|
sl@0
|
218 |
while (move == TCursorPosition::EFLineDown)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
start.UniversalTime();
|
sl@0
|
221 |
aView.MoveCursorL(move, EFalse);
|
sl@0
|
222 |
end.UniversalTime();
|
sl@0
|
223 |
TReal us = end.MicroSecondsFrom(start).Int64();
|
sl@0
|
224 |
totalOfSquares += us*us;
|
sl@0
|
225 |
}
|
sl@0
|
226 |
TReal rms;
|
sl@0
|
227 |
Math::Sqrt(rms, totalOfSquares);
|
sl@0
|
228 |
cells = User::AllocSize(mem);
|
sl@0
|
229 |
return TTimeIntervalMicroSeconds(static_cast<TInt64>(rms));
|
sl@0
|
230 |
}
|
sl@0
|
231 |
|
sl@0
|
232 |
TInt NumberOfLines(CTextLayout& aLayout)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
TTmDocPosSpec dp(aLayout.DocumentLength(), TTmDocPosSpec::ETrailing);
|
sl@0
|
235 |
TTmPosInfo2 posInfo;
|
sl@0
|
236 |
TTmLineInfo lineInfo;
|
sl@0
|
237 |
aLayout.FindDocPos(dp, posInfo, &lineInfo);
|
sl@0
|
238 |
return lineInfo.iLineNumber;
|
sl@0
|
239 |
}
|
sl@0
|
240 |
|
sl@0
|
241 |
TTimeIntervalMicroSeconds MeasureFormattingL(CTextView& aView)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
// This looks to me like a defect.
|
sl@0
|
244 |
// We have to set the actual doc pos to prevent a crash, even
|
sl@0
|
245 |
// though we are setting a pending selection.
|
sl@0
|
246 |
// Probably not too serious, though.
|
sl@0
|
247 |
aView.SetDocPosL(0, ETrue);
|
sl@0
|
248 |
TCursorSelection zero(0, 0);
|
sl@0
|
249 |
aView.SetPendingSelection(zero);
|
sl@0
|
250 |
TTime start;
|
sl@0
|
251 |
TTime end;
|
sl@0
|
252 |
start.UniversalTime();
|
sl@0
|
253 |
aView.HandleGlobalChangeL();
|
sl@0
|
254 |
aView.FinishBackgroundFormattingL();
|
sl@0
|
255 |
end.UniversalTime();
|
sl@0
|
256 |
end.UniversalTime();
|
sl@0
|
257 |
return end.MicroSecondsFrom(start);
|
sl@0
|
258 |
}
|
sl@0
|
259 |
|
sl@0
|
260 |
void MeasureDeleteTextFromStartL(RArray<TTFTimeStamp>& aTimeStamps,
|
sl@0
|
261 |
TFormattingObjects& aFormattingObjects, TInt64& aSlowest)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
const CTmTextLayout& tmLayout = aFormattingObjects.iLayout->TagmaTextLayout();
|
sl@0
|
264 |
aTimeStamps.Close();
|
sl@0
|
265 |
TTime start;
|
sl@0
|
266 |
TTime end;
|
sl@0
|
267 |
TInt iteration = 0;
|
sl@0
|
268 |
TInt64 total = 0;
|
sl@0
|
269 |
|
sl@0
|
270 |
TInt step = 0;
|
sl@0
|
271 |
while(aFormattingObjects.iRichText->DocumentLength() > 0)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
aFormattingObjects.iRichText->DeleteL(0, 1);
|
sl@0
|
274 |
TCursorSelection cursor(0,0);
|
sl@0
|
275 |
start.UniversalTime();
|
sl@0
|
276 |
aFormattingObjects.iView->HandleInsertDeleteL(cursor, 1, EFalse);
|
sl@0
|
277 |
end.UniversalTime();
|
sl@0
|
278 |
|
sl@0
|
279 |
TInt64 us = end.MicroSecondsFrom(start).Int64();
|
sl@0
|
280 |
|
sl@0
|
281 |
if(us > aSlowest)
|
sl@0
|
282 |
{
|
sl@0
|
283 |
aSlowest = us;
|
sl@0
|
284 |
}
|
sl@0
|
285 |
|
sl@0
|
286 |
total += us;
|
sl@0
|
287 |
step++;
|
sl@0
|
288 |
if(step == KDeleteTextInterval)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
TInt64 average = total/KDeleteTextInterval;
|
sl@0
|
291 |
TTFTimeStamp timestamp;
|
sl@0
|
292 |
timestamp.iTime = average;
|
sl@0
|
293 |
timestamp.iIteration = iteration;
|
sl@0
|
294 |
User::LeaveIfError(aTimeStamps.Append(timestamp));
|
sl@0
|
295 |
iteration++;
|
sl@0
|
296 |
step = 0;
|
sl@0
|
297 |
total = 0;
|
sl@0
|
298 |
}
|
sl@0
|
299 |
}
|
sl@0
|
300 |
}
|
sl@0
|
301 |
|
sl@0
|
302 |
void MeasureInsertTextAtStartL(TInt aRepeats, TInt aRepeatsPerPara, RArray<TTFTimeStamp>& aTimeStamps,
|
sl@0
|
303 |
TFormattingObjects& aFormattingObjects, TInt64& aSlowest)
|
sl@0
|
304 |
{
|
sl@0
|
305 |
aTimeStamps.Close();
|
sl@0
|
306 |
TTime start;
|
sl@0
|
307 |
TTime end;
|
sl@0
|
308 |
TInt repeatsInThisPar = 0;
|
sl@0
|
309 |
TViewRectChanges changes;
|
sl@0
|
310 |
aFormattingObjects.iRichText->Reset();
|
sl@0
|
311 |
for (TInt i = 0; i < aRepeats; i++)
|
sl@0
|
312 |
{
|
sl@0
|
313 |
TBuf<128> sample;
|
sl@0
|
314 |
if ((i%2)==0)
|
sl@0
|
315 |
{
|
sl@0
|
316 |
sample = KEnglishToInsert1;
|
sl@0
|
317 |
}
|
sl@0
|
318 |
else
|
sl@0
|
319 |
{
|
sl@0
|
320 |
sample = KEnglishToInsert2;
|
sl@0
|
321 |
}
|
sl@0
|
322 |
aFormattingObjects.iRichText->InsertL(0, sample);
|
sl@0
|
323 |
TCursorSelection cursor(0, sample.Length());
|
sl@0
|
324 |
|
sl@0
|
325 |
start.UniversalTime();
|
sl@0
|
326 |
aFormattingObjects.iLayout->HandleBlockChangeL(cursor, 0, changes, 0);
|
sl@0
|
327 |
end.UniversalTime();
|
sl@0
|
328 |
|
sl@0
|
329 |
TInt64 us = end.MicroSecondsFrom(start).Int64();
|
sl@0
|
330 |
repeatsInThisPar ++;
|
sl@0
|
331 |
TTFTimeStamp timestamp;
|
sl@0
|
332 |
timestamp.iTime = us;
|
sl@0
|
333 |
timestamp.iIteration = i;
|
sl@0
|
334 |
User::LeaveIfError(aTimeStamps.Append(timestamp));
|
sl@0
|
335 |
if(us > aSlowest)
|
sl@0
|
336 |
{
|
sl@0
|
337 |
aSlowest = us;
|
sl@0
|
338 |
}
|
sl@0
|
339 |
if (repeatsInThisPar > aRepeatsPerPara)
|
sl@0
|
340 |
{
|
sl@0
|
341 |
TChar paragraphDelimiter(0x2029);
|
sl@0
|
342 |
aFormattingObjects.iRichText->InsertL(0, paragraphDelimiter);
|
sl@0
|
343 |
repeatsInThisPar = 0;
|
sl@0
|
344 |
}
|
sl@0
|
345 |
}
|
sl@0
|
346 |
}
|
sl@0
|
347 |
|
sl@0
|
348 |
void MeasureCursorL(RArray<TTFTimeStamp>& aTimeStamps, TCursorPosition::TMovementType aType,
|
sl@0
|
349 |
TFormattingObjects& aFormattingObjects, TInt64& aSlowest)
|
sl@0
|
350 |
{
|
sl@0
|
351 |
aTimeStamps.Close();
|
sl@0
|
352 |
TTime start;
|
sl@0
|
353 |
TTime end;
|
sl@0
|
354 |
TInt lines = 0;
|
sl@0
|
355 |
TCursorPosition::TMovementType move = aType;
|
sl@0
|
356 |
|
sl@0
|
357 |
while (move == aType)
|
sl@0
|
358 |
{
|
sl@0
|
359 |
lines++;
|
sl@0
|
360 |
start.UniversalTime();
|
sl@0
|
361 |
aFormattingObjects.iView->MoveCursorL(move, EFalse);
|
sl@0
|
362 |
end.UniversalTime();
|
sl@0
|
363 |
TInt64 us = end.MicroSecondsFrom(start).Int64();
|
sl@0
|
364 |
TTFTimeStamp timestamp;
|
sl@0
|
365 |
timestamp.iTime = us;
|
sl@0
|
366 |
timestamp.iIteration = lines;
|
sl@0
|
367 |
User::LeaveIfError(aTimeStamps.Append(timestamp));
|
sl@0
|
368 |
if(us > aSlowest)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
aSlowest = us;
|
sl@0
|
371 |
}
|
sl@0
|
372 |
const CTmTextLayout& tmLayout = aFormattingObjects.iLayout->TagmaTextLayout();
|
sl@0
|
373 |
}
|
sl@0
|
374 |
}
|
sl@0
|
375 |
|
sl@0
|
376 |
void CreateFormattingObjectsLC(TFormattingObjects& aFormattingObjects)
|
sl@0
|
377 |
{
|
sl@0
|
378 |
TRect* displayRect = new(ELeave) TRect(0, 0, KDisplayWidth, KDisplayHeight);
|
sl@0
|
379 |
CleanupStack::PushL(displayRect);
|
sl@0
|
380 |
CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
|
sl@0
|
381 |
CleanupStack::PushL(paraFormat);
|
sl@0
|
382 |
CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
|
sl@0
|
383 |
CleanupStack::PushL(charFormat);
|
sl@0
|
384 |
CRichText* text = CRichText::NewL(paraFormat, charFormat);
|
sl@0
|
385 |
CleanupStack::PushL(text);
|
sl@0
|
386 |
CTextLayout* layout = CTextLayout::NewL(text, displayRect->Width());
|
sl@0
|
387 |
CleanupStack::PushL(layout);
|
sl@0
|
388 |
CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect->Size(), 0);
|
sl@0
|
389 |
CleanupStack::PushL(device);
|
sl@0
|
390 |
// Prevent the line array from using up the memory
|
sl@0
|
391 |
device->LineArray().Disable();
|
sl@0
|
392 |
CTextView* view = CTextView::NewL(layout, *displayRect,
|
sl@0
|
393 |
device, device, 0, 0, 0);
|
sl@0
|
394 |
CleanupStack::PushL(view);
|
sl@0
|
395 |
// must disable flicker-free redraw or Form will try to use
|
sl@0
|
396 |
// the test font with an off-screen (i.e. real) graphics context,
|
sl@0
|
397 |
// which will panic.
|
sl@0
|
398 |
view->DisableFlickerFreeRedraw();
|
sl@0
|
399 |
|
sl@0
|
400 |
aFormattingObjects.iDisplayRect = displayRect;
|
sl@0
|
401 |
aFormattingObjects.iParFormat = paraFormat;
|
sl@0
|
402 |
aFormattingObjects.iCharFormat = charFormat;
|
sl@0
|
403 |
aFormattingObjects.iRichText = text;
|
sl@0
|
404 |
aFormattingObjects.iLayout = layout;
|
sl@0
|
405 |
aFormattingObjects.iDevice = device;
|
sl@0
|
406 |
aFormattingObjects.iView = view;
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
void DestroyFormattingObjects(TFormattingObjects& aFormattingObjects)
|
sl@0
|
410 |
{
|
sl@0
|
411 |
CleanupStack::PopAndDestroy(aFormattingObjects.iView);
|
sl@0
|
412 |
CleanupStack::PopAndDestroy(aFormattingObjects.iDevice);
|
sl@0
|
413 |
CleanupStack::PopAndDestroy(aFormattingObjects.iLayout);
|
sl@0
|
414 |
CleanupStack::PopAndDestroy(aFormattingObjects.iRichText);
|
sl@0
|
415 |
CleanupStack::PopAndDestroy(aFormattingObjects.iCharFormat);
|
sl@0
|
416 |
CleanupStack::PopAndDestroy(aFormattingObjects.iParFormat);
|
sl@0
|
417 |
CleanupStack::PopAndDestroy(aFormattingObjects.iDisplayRect);
|
sl@0
|
418 |
}
|
sl@0
|
419 |
|
sl@0
|
420 |
/**
|
sl@0
|
421 |
@SYMTestCaseID SYSLIB-FORMA-UT-1897
|
sl@0
|
422 |
@SYMTestCaseDesc Benchmarks scrolling text
|
sl@0
|
423 |
@SYMTestPriority High
|
sl@0
|
424 |
@SYMTestActions creates document and scrolls it
|
sl@0
|
425 |
@SYMTestExpectedResults The test must not fail or panic .
|
sl@0
|
426 |
@SYMDEF DEF092140, DEF092139
|
sl@0
|
427 |
*/
|
sl@0
|
428 |
void RunScrollingTestL(TInt aRepeats, TInt aRepeatsPerParagraph,
|
sl@0
|
429 |
RArray<TTFTimeStamp>& aTimeStampsDown, RArray<TTFTimeStamp>& aTimeStampsUp,
|
sl@0
|
430 |
TDocInfo& aDocInfo)
|
sl@0
|
431 |
{
|
sl@0
|
432 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1897 "));
|
sl@0
|
433 |
TInt docLength = KEnglish().Length() * aRepeats;
|
sl@0
|
434 |
TInt paragraphs = aRepeats/aRepeatsPerParagraph;
|
sl@0
|
435 |
|
sl@0
|
436 |
TFormattingObjects o;
|
sl@0
|
437 |
CreateFormattingObjectsLC(o);
|
sl@0
|
438 |
o.iLayout->SetWrapWidth(KInsertDisplayWidth);
|
sl@0
|
439 |
o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
|
sl@0
|
440 |
SetTextL(*(o.iRichText), KEnglish, aRepeats, aRepeatsPerParagraph);
|
sl@0
|
441 |
|
sl@0
|
442 |
TTimeIntervalMicroSeconds opening = MeasureOpeningL(*(o.iView));
|
sl@0
|
443 |
TInt64 slowest = 0;
|
sl@0
|
444 |
MeasureCursorL(aTimeStampsDown, TCursorPosition::EFLineDown, o, slowest);
|
sl@0
|
445 |
MeasureCursorL(aTimeStampsUp, TCursorPosition::EFLineUp, o, slowest);
|
sl@0
|
446 |
|
sl@0
|
447 |
TBuf<256> buf;
|
sl@0
|
448 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_Scrolling_Slowest_Doc_with_%d_characters_%d_paragraphs;microseconds: %Ld"), docLength, paragraphs, slowest);
|
sl@0
|
449 |
TESTPRINT(buf);
|
sl@0
|
450 |
|
sl@0
|
451 |
aDocInfo = GetSampleDocInfoL(o);
|
sl@0
|
452 |
DestroyFormattingObjects(o);
|
sl@0
|
453 |
}
|
sl@0
|
454 |
|
sl@0
|
455 |
/**
|
sl@0
|
456 |
@SYMTestCaseID SYSLIB-FORMA-UT-1898
|
sl@0
|
457 |
@SYMTestCaseDesc Benchmarks inserting, deleting and formatting text
|
sl@0
|
458 |
@SYMTestPriority High
|
sl@0
|
459 |
@SYMTestActions creates documents in each language and performs edits and reformats
|
sl@0
|
460 |
@SYMTestExpectedResults The test must not fail or panic .
|
sl@0
|
461 |
@SYMDEF DEF092140, DEF092139
|
sl@0
|
462 |
*/
|
sl@0
|
463 |
void RunEnglishArabicJapaneseBenchmarksL(TFormattingObjects& aFormattingObjects)
|
sl@0
|
464 |
{
|
sl@0
|
465 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1898 "));
|
sl@0
|
466 |
SetTextL(*aFormattingObjects.iRichText, KEnglish, KEnglishRepeats, KEnglishRepeats);
|
sl@0
|
467 |
TTimeIntervalMicroSeconds opening = MeasureOpeningL(*aFormattingObjects.iView);
|
sl@0
|
468 |
TTimeIntervalMicroSeconds rmsCursorDown = MeasureRmsCursorDownL(*aFormattingObjects.iView);
|
sl@0
|
469 |
TTimeIntervalMicroSeconds englishFormatting = MeasureFormattingL(*aFormattingObjects.iView);
|
sl@0
|
470 |
TInt englishLines = NumberOfLines(*aFormattingObjects.iLayout);
|
sl@0
|
471 |
SetTextL(*aFormattingObjects.iRichText, KArabic, KArabicRepeats, KArabicRepeats);
|
sl@0
|
472 |
TTimeIntervalMicroSeconds arabicFormatting = MeasureFormattingL(*aFormattingObjects.iView);
|
sl@0
|
473 |
TInt arabicLines = NumberOfLines(*aFormattingObjects.iLayout);
|
sl@0
|
474 |
SetTextL(*aFormattingObjects.iRichText, KJapanese, KJapaneseRepeats, KJapaneseRepeats);
|
sl@0
|
475 |
TTimeIntervalMicroSeconds japaneseFormatting = MeasureFormattingL(*aFormattingObjects.iView);
|
sl@0
|
476 |
TInt japaneseLines = NumberOfLines(*aFormattingObjects.iLayout);
|
sl@0
|
477 |
|
sl@0
|
478 |
// Check that the results are fair
|
sl@0
|
479 |
TInt minLines;
|
sl@0
|
480 |
TInt maxLines;
|
sl@0
|
481 |
if (arabicLines < englishLines)
|
sl@0
|
482 |
{
|
sl@0
|
483 |
minLines = arabicLines;
|
sl@0
|
484 |
maxLines = englishLines;
|
sl@0
|
485 |
}
|
sl@0
|
486 |
else
|
sl@0
|
487 |
{
|
sl@0
|
488 |
minLines = englishLines;
|
sl@0
|
489 |
maxLines = arabicLines;
|
sl@0
|
490 |
}
|
sl@0
|
491 |
if (japaneseLines < minLines)
|
sl@0
|
492 |
minLines = japaneseLines;
|
sl@0
|
493 |
else if (maxLines < japaneseLines)
|
sl@0
|
494 |
maxLines = japaneseLines;
|
sl@0
|
495 |
|
sl@0
|
496 |
//Tests that the number of lines in each test is more or less balanced
|
sl@0
|
497 |
TESTPOINT(maxLines * 100 <= minLines * 105);
|
sl@0
|
498 |
|
sl@0
|
499 |
TBuf<256> buf;
|
sl@0
|
500 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_OpeningLargeParagraph;microseconds: %d"),
|
sl@0
|
501 |
static_cast<TInt>(opening.Int64()));
|
sl@0
|
502 |
TESTPRINT(buf);
|
sl@0
|
503 |
buf.Zero();
|
sl@0
|
504 |
|
sl@0
|
505 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_RmsCursorDown;microseconds: %d"),
|
sl@0
|
506 |
static_cast<TInt>(rmsCursorDown.Int64()));
|
sl@0
|
507 |
TESTPRINT(buf);
|
sl@0
|
508 |
buf.Zero();
|
sl@0
|
509 |
|
sl@0
|
510 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingEnglish;microseconds: %d"),
|
sl@0
|
511 |
static_cast<TInt>(englishFormatting.Int64()));
|
sl@0
|
512 |
TESTPRINT(buf);
|
sl@0
|
513 |
buf.Zero();
|
sl@0
|
514 |
|
sl@0
|
515 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingArabic;microseconds: %d"),
|
sl@0
|
516 |
static_cast<TInt>(arabicFormatting.Int64()));
|
sl@0
|
517 |
TESTPRINT(buf);
|
sl@0
|
518 |
buf.Zero();
|
sl@0
|
519 |
|
sl@0
|
520 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormattingJapanese;microseconds: %d"),
|
sl@0
|
521 |
static_cast<TInt>(japaneseFormatting.Int64()));
|
sl@0
|
522 |
TESTPRINT(buf);
|
sl@0
|
523 |
}
|
sl@0
|
524 |
|
sl@0
|
525 |
/**
|
sl@0
|
526 |
@SYMTestCaseID SYSLIB-FORMA-UT-1896
|
sl@0
|
527 |
@SYMTestCaseDesc Benchmarks inserting text from the beginning of a paragraph
|
sl@0
|
528 |
@SYMTestPriority High
|
sl@0
|
529 |
@SYMTestActions creates a large paragraph containg just one word and inserts text iteratively from
|
sl@0
|
530 |
the beginning
|
sl@0
|
531 |
@SYMTestExpectedResults The test must not fail or panic .
|
sl@0
|
532 |
@SYMDEF DEF092140, DEF092139
|
sl@0
|
533 |
*/
|
sl@0
|
534 |
void RunInsertTextTestsL(TInt aRepeats, TInt aRepeatsPerParagraph,
|
sl@0
|
535 |
RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
|
sl@0
|
536 |
{
|
sl@0
|
537 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1896 "));
|
sl@0
|
538 |
TFormattingObjects o;
|
sl@0
|
539 |
CreateFormattingObjectsLC(o);
|
sl@0
|
540 |
TInt64 slowest = 0;
|
sl@0
|
541 |
o.iLayout->SetWrapWidth(KInsertDisplayWidth);
|
sl@0
|
542 |
o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
|
sl@0
|
543 |
MeasureInsertTextAtStartL(aRepeats, aRepeatsPerParagraph, aTimeStamps, o, slowest);
|
sl@0
|
544 |
aDocInfo = GetSampleDocInfoL(o);
|
sl@0
|
545 |
|
sl@0
|
546 |
TBuf<256> buf;
|
sl@0
|
547 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_InsertText_Slowest;microseconds: %Ld"), slowest);
|
sl@0
|
548 |
TESTPRINT(buf);
|
sl@0
|
549 |
|
sl@0
|
550 |
DestroyFormattingObjects(o);
|
sl@0
|
551 |
}
|
sl@0
|
552 |
|
sl@0
|
553 |
/**
|
sl@0
|
554 |
@SYMTestCaseID SYSLIB-FORMA-UT-1895
|
sl@0
|
555 |
@SYMTestCaseDesc Benchmarks deleting text from the beginning of a paragraph
|
sl@0
|
556 |
@SYMTestPriority High
|
sl@0
|
557 |
@SYMTestActions creates a large paragraph containg just one word and deletes text iteratively from
|
sl@0
|
558 |
the beginning
|
sl@0
|
559 |
@SYMTestExpectedResults The test must not fail or panic .
|
sl@0
|
560 |
@SYMDEF DEF092140, DEF092139
|
sl@0
|
561 |
*/
|
sl@0
|
562 |
void RunDeleteTextFromStartTest(RArray<TTFTimeStamp>& aTimeStamps, TDocInfo& aDocInfo)
|
sl@0
|
563 |
{
|
sl@0
|
564 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
|
sl@0
|
565 |
TFormattingObjects o;
|
sl@0
|
566 |
CreateFormattingObjectsLC(o);
|
sl@0
|
567 |
TInt64 slowest = 0;
|
sl@0
|
568 |
o.iLayout->SetWrapWidth(KInsertDisplayWidth);
|
sl@0
|
569 |
o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
|
sl@0
|
570 |
RBuf bigbuf;
|
sl@0
|
571 |
BigBufLC(bigbuf);
|
sl@0
|
572 |
SetTextL(*o.iRichText, bigbuf, 1, 1);
|
sl@0
|
573 |
TTimeIntervalMicroSeconds opening = MeasureOpeningL(*o.iView);
|
sl@0
|
574 |
|
sl@0
|
575 |
MeasureDeleteTextFromStartL(aTimeStamps, o, slowest);
|
sl@0
|
576 |
aDocInfo = GetSampleDocInfoL(o);
|
sl@0
|
577 |
|
sl@0
|
578 |
TBuf<256> buf;
|
sl@0
|
579 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_DeleteText_Slowest;microseconds: %Ld"), slowest);
|
sl@0
|
580 |
TESTPRINT(buf);
|
sl@0
|
581 |
|
sl@0
|
582 |
CleanupStack::PopAndDestroy();//bigbuf
|
sl@0
|
583 |
DestroyFormattingObjects(o);
|
sl@0
|
584 |
}
|
sl@0
|
585 |
|
sl@0
|
586 |
void GetFormattingBenchmarkL(TInt aNumberOfIterations, TInt& aNumberOfCharacters, TInt64& aNormalisedBenchmark)
|
sl@0
|
587 |
{
|
sl@0
|
588 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1895 "));
|
sl@0
|
589 |
TFormattingObjects o;
|
sl@0
|
590 |
CreateFormattingObjectsLC(o);
|
sl@0
|
591 |
o.iLayout->SetWrapWidth(KInsertDisplayWidth);
|
sl@0
|
592 |
o.iLayout->SetAmountToFormat(CTextLayout::EFFormatBand);
|
sl@0
|
593 |
|
sl@0
|
594 |
SetTextL(*(o.iRichText), KEnglish, aNumberOfIterations, aNumberOfIterations);
|
sl@0
|
595 |
|
sl@0
|
596 |
TTimeIntervalMicroSeconds ignore = MeasureOpeningL(*(o.iView));
|
sl@0
|
597 |
o.iView->SetDocPosL(o.iRichText->DocumentLength());
|
sl@0
|
598 |
//make a global change
|
sl@0
|
599 |
o.iLayout->SetWrapWidth(KChangedDisplayWidth);
|
sl@0
|
600 |
//measure time to reformat for it
|
sl@0
|
601 |
TTime start;
|
sl@0
|
602 |
TTime end;
|
sl@0
|
603 |
start.UniversalTime();
|
sl@0
|
604 |
o.iView->HandleGlobalChangeL();
|
sl@0
|
605 |
end.UniversalTime();
|
sl@0
|
606 |
|
sl@0
|
607 |
TTimeIntervalMicroSeconds formattingTime = end.MicroSecondsFrom(start);
|
sl@0
|
608 |
|
sl@0
|
609 |
aNumberOfCharacters = o.iRichText->DocumentLength();
|
sl@0
|
610 |
aNormalisedBenchmark = formattingTime.Int64()/aNumberOfIterations;
|
sl@0
|
611 |
|
sl@0
|
612 |
DestroyFormattingObjects(o);
|
sl@0
|
613 |
}
|
sl@0
|
614 |
|
sl@0
|
615 |
/**
|
sl@0
|
616 |
@SYMTestCaseID SYSLIB-FORMA-UT-1894
|
sl@0
|
617 |
@SYMTestCaseDesc Benchmarks formatting text
|
sl@0
|
618 |
@SYMTestPriority High
|
sl@0
|
619 |
@SYMTestActions for a series of documents of increasing size consisting of a single paragraph,
|
sl@0
|
620 |
sets the cursor position to the end of the document, makes a global change and formats it.
|
sl@0
|
621 |
@SYMTestExpectedResults The test must not fail or panic. The increase in time taken should be
|
sl@0
|
622 |
roughly linear with the document size.
|
sl@0
|
623 |
@SYMDEF DEF095401
|
sl@0
|
624 |
*/
|
sl@0
|
625 |
void RunFormattingBenchmarksL()
|
sl@0
|
626 |
{
|
sl@0
|
627 |
TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORMA-UT-1894 "));
|
sl@0
|
628 |
TInt numberOfCharacters = 0;
|
sl@0
|
629 |
TInt numberOfIterations;
|
sl@0
|
630 |
TInt64 normalisedBenchmark = 0;
|
sl@0
|
631 |
|
sl@0
|
632 |
TBuf<256> buf;
|
sl@0
|
633 |
|
sl@0
|
634 |
numberOfIterations = 1;
|
sl@0
|
635 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
636 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
637 |
TESTPRINT(buf);
|
sl@0
|
638 |
|
sl@0
|
639 |
buf.Zero();
|
sl@0
|
640 |
numberOfIterations = 5;
|
sl@0
|
641 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
642 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
643 |
TESTPRINT(buf);
|
sl@0
|
644 |
|
sl@0
|
645 |
buf.Zero();
|
sl@0
|
646 |
numberOfIterations = 10;
|
sl@0
|
647 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
648 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
649 |
TESTPRINT(buf);
|
sl@0
|
650 |
|
sl@0
|
651 |
buf.Zero();
|
sl@0
|
652 |
numberOfIterations = 50;
|
sl@0
|
653 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
654 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
655 |
TESTPRINT(buf);
|
sl@0
|
656 |
|
sl@0
|
657 |
buf.Zero();
|
sl@0
|
658 |
numberOfIterations = 100;
|
sl@0
|
659 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
660 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
661 |
TESTPRINT(buf);
|
sl@0
|
662 |
|
sl@0
|
663 |
buf.Zero();
|
sl@0
|
664 |
numberOfIterations = 250;
|
sl@0
|
665 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
666 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
667 |
TESTPRINT(buf);
|
sl@0
|
668 |
|
sl@0
|
669 |
buf.Zero();
|
sl@0
|
670 |
numberOfIterations = 500;
|
sl@0
|
671 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
672 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
673 |
TESTPRINT(buf);
|
sl@0
|
674 |
|
sl@0
|
675 |
buf.Zero();
|
sl@0
|
676 |
numberOfIterations = 750;
|
sl@0
|
677 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
678 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
679 |
TESTPRINT(buf);
|
sl@0
|
680 |
|
sl@0
|
681 |
buf.Zero();
|
sl@0
|
682 |
numberOfIterations = 1000;
|
sl@0
|
683 |
GetFormattingBenchmarkL(numberOfIterations, numberOfCharacters, normalisedBenchmark);
|
sl@0
|
684 |
buf.AppendFormat(_L("PERFORMANCE: Syslibs;Form_FormatText;document contains %d characters: %Ld microseconds per iteration"), numberOfCharacters, normalisedBenchmark);
|
sl@0
|
685 |
TESTPRINT(buf);
|
sl@0
|
686 |
}
|
sl@0
|
687 |
|
sl@0
|
688 |
void RunBenchmarksL()
|
sl@0
|
689 |
{
|
sl@0
|
690 |
CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
|
sl@0
|
691 |
CleanupStack::PushL(scheduler);
|
sl@0
|
692 |
CActiveScheduler::Install(scheduler);
|
sl@0
|
693 |
|
sl@0
|
694 |
RunFormattingBenchmarksL();
|
sl@0
|
695 |
|
sl@0
|
696 |
TDocInfo docInfo;
|
sl@0
|
697 |
RArray<TTFTimeStamp> timestampsDown;
|
sl@0
|
698 |
RArray<TTFTimeStamp> timestampsUp;
|
sl@0
|
699 |
CleanupClosePushL(timestampsDown);
|
sl@0
|
700 |
CleanupClosePushL(timestampsUp);
|
sl@0
|
701 |
|
sl@0
|
702 |
RunDeleteTextFromStartTest(timestampsUp, docInfo);
|
sl@0
|
703 |
WriteSampleDocInfo(docInfo, fileTimeStamps);
|
sl@0
|
704 |
WriteTimeStampsL(KDeleteTextFromStart, timestampsUp);
|
sl@0
|
705 |
|
sl@0
|
706 |
RunInsertTextTestsL(KEnglishInsertRepeats, KEnglishInsertRepeats, timestampsUp, docInfo);
|
sl@0
|
707 |
WriteSampleDocInfo(docInfo, fileTimeStamps);
|
sl@0
|
708 |
WriteTimeStampsL(KInsertTextAtStart, timestampsUp);
|
sl@0
|
709 |
|
sl@0
|
710 |
RunScrollingTestL(KEnglishScrollRepeats, KEnglishScrollRepeats, timestampsDown, timestampsUp, docInfo);
|
sl@0
|
711 |
WriteSampleDocInfo(docInfo, fileTimeStamps);
|
sl@0
|
712 |
WriteTimeStampsL(KScrollingDown, timestampsDown);
|
sl@0
|
713 |
WriteTimeStampsL(KScrollingUp, timestampsUp);
|
sl@0
|
714 |
|
sl@0
|
715 |
RunScrollingTestL(KEnglishScrollRepeats, KEnglishScrollRepeats/2, timestampsDown, timestampsUp, docInfo);
|
sl@0
|
716 |
WriteSampleDocInfo(docInfo, fileTimeStamps);
|
sl@0
|
717 |
WriteTimeStampsL(KScrollingDown, timestampsDown);
|
sl@0
|
718 |
WriteTimeStampsL(KScrollingUp, timestampsUp);
|
sl@0
|
719 |
|
sl@0
|
720 |
RunScrollingTestL(KEnglishScrollRepeats, KEnglishScrollRepeats/10, timestampsDown, timestampsUp, docInfo);
|
sl@0
|
721 |
WriteSampleDocInfo(docInfo, fileTimeStamps);
|
sl@0
|
722 |
WriteTimeStampsL(KScrollingDown, timestampsDown);
|
sl@0
|
723 |
WriteTimeStampsL(KScrollingUp, timestampsUp);
|
sl@0
|
724 |
|
sl@0
|
725 |
TFormattingObjects o;
|
sl@0
|
726 |
CreateFormattingObjectsLC(o);
|
sl@0
|
727 |
RunEnglishArabicJapaneseBenchmarksL(o);
|
sl@0
|
728 |
DestroyFormattingObjects(o);
|
sl@0
|
729 |
|
sl@0
|
730 |
CleanupStack::PopAndDestroy(2);
|
sl@0
|
731 |
CleanupStack::PopAndDestroy(scheduler);
|
sl@0
|
732 |
|
sl@0
|
733 |
}
|
sl@0
|
734 |
|
sl@0
|
735 |
TVerdict CTFormBenchmarkStep::doTestStepL()
|
sl@0
|
736 |
{
|
sl@0
|
737 |
SetTestStepResult(EPass);
|
sl@0
|
738 |
TestStep = this;
|
sl@0
|
739 |
|
sl@0
|
740 |
TESTPRINT(KFormBenchmark);
|
sl@0
|
741 |
TESTPRINT(_L("Start Font/Bitmap Server"));
|
sl@0
|
742 |
|
sl@0
|
743 |
TInt error = RFbsSession::Connect();
|
sl@0
|
744 |
if (error == KErrNotFound)
|
sl@0
|
745 |
{
|
sl@0
|
746 |
FbsStartup();
|
sl@0
|
747 |
error = RFbsSession::Connect();
|
sl@0
|
748 |
}
|
sl@0
|
749 |
// Tests that FBServ actually starts
|
sl@0
|
750 |
TESTPOINT(error == KErrNone);
|
sl@0
|
751 |
error = fs.Connect();
|
sl@0
|
752 |
TESTPOINT(error == KErrNone);
|
sl@0
|
753 |
|
sl@0
|
754 |
error = fileTimeStamps.Replace(fs, KLogTimeStampsName, EFileWrite);
|
sl@0
|
755 |
|
sl@0
|
756 |
TBuf<256> buf;
|
sl@0
|
757 |
buf.AppendFormat(_L("> fileTimeStamps.Replace %d"), error);
|
sl@0
|
758 |
TESTPRINT(buf);
|
sl@0
|
759 |
|
sl@0
|
760 |
TESTPOINT(error == KErrNone);
|
sl@0
|
761 |
|
sl@0
|
762 |
TESTPRINT(_L("Run Benchmarks"));
|
sl@0
|
763 |
TRAP(error, RunBenchmarksL());
|
sl@0
|
764 |
// Tests that the Benchmarks did not run out of memory
|
sl@0
|
765 |
// or otherwise leave
|
sl@0
|
766 |
TESTPOINT(error == KErrNone);
|
sl@0
|
767 |
|
sl@0
|
768 |
fileTimeStamps.Close();
|
sl@0
|
769 |
fs.Close();
|
sl@0
|
770 |
RFbsSession::Disconnect();
|
sl@0
|
771 |
|
sl@0
|
772 |
return TestStepResult();
|
sl@0
|
773 |
}
|
sl@0
|
774 |
|