os/textandloc/textrendering/textformatting/test/src/TTextView.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2000-2009 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
* TTextView.cpp test file for UndoSystem classes
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#include <e32test.h>
sl@0
    21
sl@0
    22
#include <coemain.h>
sl@0
    23
#include <frmtview.h>
sl@0
    24
#include <txtrich.h>
sl@0
    25
#include <conpics.h>
sl@0
    26
#include <e32math.h>
sl@0
    27
sl@0
    28
#include "form_and_etext_editor.h"
sl@0
    29
#include "UndoSystem.h"
sl@0
    30
#include "EditorUndo.h"
sl@0
    31
#include "FRMPAGE.H"
sl@0
    32
sl@0
    33
_LIT(KHello, "hello world");
sl@0
    34
const TInt KPaginatePriority = -100;
sl@0
    35
const TInt KGranularity = 10;
sl@0
    36
sl@0
    37
using namespace UndoSystem;
sl@0
    38
sl@0
    39
LOCAL_C TInt GetNumber(TInt aMin, TInt aMax)
sl@0
    40
	{
sl@0
    41
	__ASSERT_ALWAYS(aMin <= aMax, User::Invariant());
sl@0
    42
sl@0
    43
	TInt64 seed = Math::Random();
sl@0
    44
	TReal randomReal = Math::FRand(seed);
sl@0
    45
sl@0
    46
	TReal maxReal = randomReal * ((aMax-aMin)+1);
sl@0
    47
	TReal rounded = 0;
sl@0
    48
	User::LeaveIfError(Math::Round(rounded, maxReal, 0));
sl@0
    49
sl@0
    50
	TInt result = rounded + aMin;
sl@0
    51
	
sl@0
    52
	if(result> aMax)
sl@0
    53
		{
sl@0
    54
		return aMax;
sl@0
    55
		}
sl@0
    56
	return result;
sl@0
    57
	}
sl@0
    58
sl@0
    59
void ManipulateText(CTextView* aView, CRichText* aText)
sl@0
    60
	{
sl@0
    61
	_LIT(KStartText, "The quick brown fox jumped over the lazy dog.");
sl@0
    62
	aText->InsertL(0, KStartText);
sl@0
    63
	aView->HandleInsertDeleteL(TCursorSelection(0, KStartText().Length()), 0);
sl@0
    64
	aText->InsertL(19, TChar(CEditableText::EParagraphDelimiter));
sl@0
    65
	aView->HandleCharEditL();
sl@0
    66
	TCharFormat format;
sl@0
    67
	TCharFormatMask mask;
sl@0
    68
	format.iFontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
sl@0
    69
	mask.ClearAll();
sl@0
    70
	mask.SetAttrib(EAttFontStrokeWeight);
sl@0
    71
	aText->ApplyCharFormatL(format, mask, 41, 3);
sl@0
    72
	aView->HandleRangeFormatChangeL(TCursorSelection(41, 44));
sl@0
    73
	aView->SetDocPosL(42);
sl@0
    74
	TInt length = aText->DocumentLength();
sl@0
    75
	aText->DeleteL(0, length);
sl@0
    76
	aView->HandleInsertDeleteL(TCursorSelection(0, 0), length);
sl@0
    77
	}
sl@0
    78
sl@0
    79
void ManipulateText1(CTextView* aView, CRichText* aText)
sl@0
    80
	{
sl@0
    81
	TInt testaYPos = 0;
sl@0
    82
	_LIT(KText, "The weather is quite good today, but it's a bit too cold");
sl@0
    83
	aText->InsertL(0, KText);
sl@0
    84
	aView->HandleInsertDeleteL(TCursorSelection(0, KText().Length()), 0);
sl@0
    85
	aView->SetDocPosL(10); //56 is the position of the last character d
sl@0
    86
	aView->SetViewLineAtTopL(1);
sl@0
    87
	aView->SetViewL(50, testaYPos);
sl@0
    88
	aView->HandleAdditionalCharactersAtEndL();
sl@0
    89
	}
sl@0
    90
sl@0
    91
inline TBool IsSurrogate(TText16 aInt16)
sl@0
    92
/**
sl@0
    93
@return True, if aText16 is high surrogate or low surrogate; false, otherwise.
sl@0
    94
*/
sl@0
    95
	{
sl@0
    96
	return (aInt16 & 0xF800) == 0xD800;
sl@0
    97
	}
sl@0
    98
sl@0
    99
class CMyTestPicture : public CPicture
sl@0
   100
	{
sl@0
   101
public:
sl@0
   102
	static CMyTestPicture* NewL(TSize aSize);
sl@0
   103
	void Draw(CGraphicsContext&,const TPoint&,const TRect&,MGraphicsDeviceMap*) const {}
sl@0
   104
	void ExternalizeL(RWriteStream& /*aStream*/) const {}
sl@0
   105
	void GetOriginalSizeInTwips(TSize& aSize) const {aSize=iSizeOfPicture;}
sl@0
   106
private:
sl@0
   107
	CMyTestPicture(TSize aSize);
sl@0
   108
private:
sl@0
   109
	TSize iSizeOfPicture;
sl@0
   110
	};
sl@0
   111
sl@0
   112
CMyTestPicture* CMyTestPicture::NewL(TSize aSize)
sl@0
   113
	{
sl@0
   114
	return new(ELeave) CMyTestPicture(aSize);
sl@0
   115
	}
sl@0
   116
sl@0
   117
sl@0
   118
CMyTestPicture::CMyTestPicture(TSize aSize):iSizeOfPicture(aSize)
sl@0
   119
	{}
sl@0
   120
sl@0
   121
sl@0
   122
class CTextViewTest : public CBase
sl@0
   123
	{
sl@0
   124
public:
sl@0
   125
	CTextViewTest(CCoeEnv& aEnv)
sl@0
   126
		: iEnv(aEnv), 	iWindowRect(10, 10, 110, 110), iWindow(aEnv.WsSession()),
sl@0
   127
		test(_L("TTextView - Some tests for CTextView")) {}
sl@0
   128
	void ConstructL();
sl@0
   129
	void InitializeL();
sl@0
   130
	void AddTextL(const TDesC&);
sl@0
   131
	void Destroy();
sl@0
   132
	~CTextViewTest();
sl@0
   133
	void TestL();
sl@0
   134
	void Test1L();
sl@0
   135
	void TestCancelSelectionL();
sl@0
   136
	void TestHandleAdditionalCharactersAtEndL();
sl@0
   137
	void TestFinishBackgroundFormattingL();
sl@0
   138
	void TestSetCursorVisibilityL();
sl@0
   139
	void TestSetSelectionVisibilityL();
sl@0
   140
	void TestEnablePictureFrameL();
sl@0
   141
	void TestSetCursorWidthTypeL();
sl@0
   142
	void TestParagraphRectL();
sl@0
   143
	void TestSetDocPosL();
sl@0
   144
	void TestSetViewLineAtTopL();
sl@0
   145
	void TestDrawL();
sl@0
   146
	void TestFormatTextL();
sl@0
   147
	void TestHandleCharEditL();
sl@0
   148
	void TestHandleRangeFormatChangeL();
sl@0
   149
	void TestHandleInsertDeleteL();
sl@0
   150
	void TestHandleGlobalChangeL();
sl@0
   151
	void TestHandleGlobalChangeNoRedrawL();
sl@0
   152
	void TestScrollDisplayL();
sl@0
   153
    void TestScrollDisplayPixelsL();
sl@0
   154
    void TestScrollDisplayPixelsNoLimitBordersL(TInt aOffset);
sl@0
   155
    void TestForDEF142286BounceScrollingL();
sl@0
   156
	void TestScrollDisplayLinesL();
sl@0
   157
	void TestScrollDisplayParagraphsL();
sl@0
   158
	void TestSetViewL();
sl@0
   159
	void TestMoveCursorL();
sl@0
   160
	void TestSetSelectionL();
sl@0
   161
	void TestMatchCursorHeightL();
sl@0
   162
	void TestCalculateHorizontalExtremesL();
sl@0
   163
	void TestXyPosToDocPosL();
sl@0
   164
//	void TestDrawL1();
sl@0
   165
	void TestGetPictureRectangleL();
sl@0
   166
	void TestGetPictureRectangle1L();
sl@0
   167
	void TestSetDisplayContextL();
sl@0
   168
	void TestGetPictureRectangleDefectL();
sl@0
   169
	void TestGetLineRectL(); // Test for defect WEP-567K9C Form panics when picture
sl@0
   170
							 // inserted in CRichText and alignmnent is set to bottom
sl@0
   171
	void TestForDEF003426L();
sl@0
   172
	void TestForDEF038488L();
sl@0
   173
	void InitializeDiffCharFormatL();
sl@0
   174
	void TestGetParaFormatL();
sl@0
   175
	// Function to test the Class TFormAndEtextEditor
sl@0
   176
	void FormAndEtextTestL();
sl@0
   177
	void TestForINC092725L();
sl@0
   178
	void TestForPDEF108443L();
sl@0
   179
	void TestForPDEF113755L();
sl@0
   180
	void TestForPDEF115165L();
sl@0
   181
	void TestForPDEF118443L();
sl@0
   182
	void TestForPDEF121798L();
sl@0
   183
	void TestForPDEF120239L();
sl@0
   184
	void TestForDEF124989L();
sl@0
   185
	void TestForDEF124975L();
sl@0
   186
	
sl@0
   187
	struct STestDataTInt4
sl@0
   188
		{
sl@0
   189
		TInt iDoc1;
sl@0
   190
		TInt iDoc2; 
sl@0
   191
		TInt iPos1;
sl@0
   192
		TInt iPos2;		
sl@0
   193
		};
sl@0
   194
	
sl@0
   195
private:
sl@0
   196
	CCoeEnv& iEnv;
sl@0
   197
	TRect iWindowRect;
sl@0
   198
	CParaFormatLayer* iParaLayer;
sl@0
   199
	CCharFormatLayer* iCharLayer;
sl@0
   200
	CRichText* iEtext;
sl@0
   201
	CTextLayout* iLayout;
sl@0
   202
	RWindow iWindow;
sl@0
   203
	CTextView* iView;
sl@0
   204
	RTest test;
sl@0
   205
	TCursorSelection select;
sl@0
   206
	TInt testDeltaY;
sl@0
   207
	TInt testDeltaLines;
sl@0
   208
	TInt testDeltaParas;
sl@0
   209
	TInt testaYPos;
sl@0
   210
	TCursorPosition::TMovementType testaMovement;
sl@0
   211
	TFontSpec testaFontSpec;
sl@0
   212
	TInt testaLeft;
sl@0
   213
	TInt testaRight;
sl@0
   214
	TPoint testaPoint;
sl@0
   215
	TBool testaCanScaleOrCrop;
sl@0
   216
	CBitmapContext* testaGc;
sl@0
   217
	TPoint testaXyPos;
sl@0
   218
	CBitmapDevice* testaGd;
sl@0
   219
	RWindowGroup testaGroupWin;
sl@0
   220
	RWsSession testaSession;
sl@0
   221
	};
sl@0
   222
sl@0
   223
void CTextViewTest::ConstructL()
sl@0
   224
	{
sl@0
   225
	iWindow.Construct(iEnv.RootWin(), 12345);
sl@0
   226
	iParaLayer = CParaFormatLayer::NewL();
sl@0
   227
	iCharLayer = CCharFormatLayer::NewL();
sl@0
   228
	test.Title();
sl@0
   229
	test.Start(_L("CTextView Tests:"));
sl@0
   230
	}
sl@0
   231
sl@0
   232
void CTextViewTest::InitializeL()
sl@0
   233
	{
sl@0
   234
	Destroy();
sl@0
   235
	iEtext = CRichText::NewL(iParaLayer, iCharLayer);
sl@0
   236
	iLayout = CTextLayout::NewL(iEtext, iWindowRect.Width());
sl@0
   237
	iView = CTextView::NewL(iLayout, iWindowRect, iEnv.ScreenDevice(),
sl@0
   238
		iEnv.SystemGc().Device(), &iWindow, &iEnv.RootWin(), &iEnv.WsSession());
sl@0
   239
	testaGd=(CBitmapDevice*) iEnv.SystemGc().Device();
sl@0
   240
	}
sl@0
   241
sl@0
   242
void CTextViewTest::AddTextL(const TDesC& aText)
sl@0
   243
	{
sl@0
   244
	iEtext->InsertL(0, aText);
sl@0
   245
	TCursorSelection s(0, aText.Length());
sl@0
   246
	iView->HandleInsertDeleteL(s, 0);
sl@0
   247
	}
sl@0
   248
sl@0
   249
void CTextViewTest::InitializeDiffCharFormatL()
sl@0
   250
	{
sl@0
   251
	Destroy();
sl@0
   252
	delete iCharLayer;
sl@0
   253
	iCharLayer=0;
sl@0
   254
	TCharFormat charFormat;
sl@0
   255
	TCharFormatMask charFormatMask;
sl@0
   256
	charFormat.iFontPresentation.iPictureAlignment=TFontPresentation::EAlignBottom;
sl@0
   257
	charFormatMask.SetAttrib(EAttFontPictureAlignment);
sl@0
   258
	iCharLayer = CCharFormatLayer::NewL(charFormat,charFormatMask);
sl@0
   259
	iEtext = CRichText::NewL(iParaLayer, iCharLayer);
sl@0
   260
	iLayout = CTextLayout::NewL(iEtext, iWindowRect.Width());
sl@0
   261
	iView = CTextView::NewL(iLayout, iWindowRect, iEnv.ScreenDevice(),
sl@0
   262
		iEnv.SystemGc().Device(), &iWindow, &iEnv.RootWin(), &iEnv.WsSession());
sl@0
   263
	testaGd=(CBitmapDevice*) iEnv.SystemGc().Device();
sl@0
   264
	}
sl@0
   265
sl@0
   266
void CTextViewTest::Destroy()
sl@0
   267
	{
sl@0
   268
	delete iView;
sl@0
   269
	iView = 0;
sl@0
   270
	delete iLayout;
sl@0
   271
	iLayout = 0;
sl@0
   272
	delete iEtext;
sl@0
   273
	iEtext = 0;
sl@0
   274
	}
sl@0
   275
sl@0
   276
sl@0
   277
void CTextViewTest::TestL()
sl@0
   278
	{
sl@0
   279
	// Test for fix to ASR-4UYHZX: ETEXT panic 12 (ECharPosBeyondDocument) when
sl@0
   280
	// out of memory
sl@0
   281
	InitializeL();
sl@0
   282
	ManipulateText(iView, iEtext);
sl@0
   283
	Destroy();
sl@0
   284
	TInt consecutiveSuccesses = 0;
sl@0
   285
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   286
		{
sl@0
   287
		__UHEAP_MARK;
sl@0
   288
		InitializeL();
sl@0
   289
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   290
		TRAPD(err, ManipulateText(iView, iEtext));
sl@0
   291
		Destroy();
sl@0
   292
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   293
		__UHEAP_MARKENDC(0);
sl@0
   294
		if (err == KErrNone)
sl@0
   295
			++consecutiveSuccesses;
sl@0
   296
		else
sl@0
   297
			consecutiveSuccesses = 0;
sl@0
   298
		}
sl@0
   299
	}
sl@0
   300
sl@0
   301
sl@0
   302
void CTextViewTest::Test1L()
sl@0
   303
	{
sl@0
   304
	// testing functions SetViewL, SetViewLineAtTopL,
sl@0
   305
	// SetDocPosL & HandleAdditionalCharactersAtEndL
sl@0
   306
	// - should work but need some kind
sl@0
   307
	// of pre-settings and initialization before they can all be proved
sl@0
   308
	// that there is no memory leak
sl@0
   309
	InitializeL();
sl@0
   310
	ManipulateText1(iView, iEtext); //where all pre-settings have been done
sl@0
   311
	Destroy();
sl@0
   312
	TInt consecutiveSuccesses = 0;
sl@0
   313
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   314
		{
sl@0
   315
		__UHEAP_MARK;
sl@0
   316
		InitializeL();
sl@0
   317
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   318
		TRAPD(err, ManipulateText1(iView, iEtext));
sl@0
   319
		Destroy();
sl@0
   320
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   321
		__UHEAP_MARKENDC(0);
sl@0
   322
		if (err == KErrNone)
sl@0
   323
			++consecutiveSuccesses;
sl@0
   324
		else
sl@0
   325
			consecutiveSuccesses = 0;
sl@0
   326
		}
sl@0
   327
	}
sl@0
   328
sl@0
   329
sl@0
   330
void CTextViewTest::TestCancelSelectionL()
sl@0
   331
	{
sl@0
   332
	InitializeL();
sl@0
   333
	iView->CancelSelectionL();
sl@0
   334
	Destroy();
sl@0
   335
	TInt consecutiveSuccesses = 0;
sl@0
   336
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   337
		{
sl@0
   338
		__UHEAP_MARK;
sl@0
   339
		InitializeL();
sl@0
   340
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   341
		TRAPD(err, iView->CancelSelectionL());
sl@0
   342
		Destroy();
sl@0
   343
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   344
		__UHEAP_MARKENDC(0);
sl@0
   345
		if (err == KErrNone)
sl@0
   346
			++consecutiveSuccesses;
sl@0
   347
		else
sl@0
   348
			consecutiveSuccesses = 0;
sl@0
   349
		}
sl@0
   350
	}
sl@0
   351
sl@0
   352
sl@0
   353
void CTextViewTest::TestFinishBackgroundFormattingL()
sl@0
   354
	{
sl@0
   355
	InitializeL();
sl@0
   356
	iView->FinishBackgroundFormattingL();
sl@0
   357
	Destroy();
sl@0
   358
	TInt consecutiveSuccesses = 0;
sl@0
   359
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   360
		{
sl@0
   361
		__UHEAP_MARK;
sl@0
   362
		InitializeL();
sl@0
   363
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   364
		TRAPD(err, iView->FinishBackgroundFormattingL());
sl@0
   365
		Destroy();
sl@0
   366
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   367
		__UHEAP_MARKENDC(0);
sl@0
   368
		if (err == KErrNone)
sl@0
   369
			++consecutiveSuccesses;
sl@0
   370
		else
sl@0
   371
			consecutiveSuccesses = 0;
sl@0
   372
		}
sl@0
   373
	}
sl@0
   374
sl@0
   375
sl@0
   376
void CTextViewTest::TestFormatTextL()
sl@0
   377
	{
sl@0
   378
	InitializeL();
sl@0
   379
	iView->FormatTextL();
sl@0
   380
	Destroy();
sl@0
   381
	TInt consecutiveSuccesses = 0;
sl@0
   382
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   383
		{
sl@0
   384
		__UHEAP_MARK;
sl@0
   385
		InitializeL();
sl@0
   386
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   387
		TRAPD(err, iView->FormatTextL());
sl@0
   388
		Destroy();
sl@0
   389
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   390
		__UHEAP_MARKENDC(0);
sl@0
   391
		if (err == KErrNone)
sl@0
   392
			++consecutiveSuccesses;
sl@0
   393
		else
sl@0
   394
			consecutiveSuccesses = 0;
sl@0
   395
		}
sl@0
   396
	}
sl@0
   397
sl@0
   398
sl@0
   399
void CTextViewTest::TestSetCursorVisibilityL()
sl@0
   400
	{
sl@0
   401
	InitializeL();
sl@0
   402
	iView->SetCursorVisibilityL(1,1);
sl@0
   403
	Destroy();
sl@0
   404
	TInt consecutiveSuccesses = 0;
sl@0
   405
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   406
		{
sl@0
   407
		__UHEAP_MARK;
sl@0
   408
		InitializeL();
sl@0
   409
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   410
		TRAPD(err, iView->SetCursorVisibilityL(1,1)); //TInt aLineCursor, TInt aTextCursor
sl@0
   411
		Destroy();
sl@0
   412
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   413
		__UHEAP_MARKENDC(0);
sl@0
   414
		if (err == KErrNone)
sl@0
   415
			++consecutiveSuccesses;
sl@0
   416
		else
sl@0
   417
			consecutiveSuccesses = 0;
sl@0
   418
		}
sl@0
   419
	}
sl@0
   420
sl@0
   421
sl@0
   422
void CTextViewTest::TestSetSelectionVisibilityL()
sl@0
   423
	{
sl@0
   424
	InitializeL();
sl@0
   425
	iView->SetSelectionVisibilityL(1);
sl@0
   426
	Destroy();
sl@0
   427
	TInt consecutiveSuccesses = 0;
sl@0
   428
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   429
		{
sl@0
   430
		__UHEAP_MARK;
sl@0
   431
		InitializeL();
sl@0
   432
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   433
		TRAPD(err, iView->SetSelectionVisibilityL(1)); //TBool aSelectionVisible
sl@0
   434
		Destroy();
sl@0
   435
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   436
		__UHEAP_MARKENDC(0);
sl@0
   437
		if (err == KErrNone)
sl@0
   438
			++consecutiveSuccesses;
sl@0
   439
		else
sl@0
   440
			consecutiveSuccesses = 0;
sl@0
   441
		}
sl@0
   442
	}
sl@0
   443
sl@0
   444
sl@0
   445
void CTextViewTest::TestEnablePictureFrameL()
sl@0
   446
	{
sl@0
   447
	InitializeL();
sl@0
   448
	iView->EnablePictureFrameL(1);
sl@0
   449
	Destroy();
sl@0
   450
	TInt consecutiveSuccesses = 0;
sl@0
   451
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   452
		{
sl@0
   453
		__UHEAP_MARK;
sl@0
   454
		InitializeL();
sl@0
   455
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   456
		TRAPD(err, iView->EnablePictureFrameL(1)); //TBool aEnabled
sl@0
   457
		Destroy();
sl@0
   458
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   459
		__UHEAP_MARKENDC(0);
sl@0
   460
		if (err == KErrNone)
sl@0
   461
			++consecutiveSuccesses;
sl@0
   462
		else
sl@0
   463
			consecutiveSuccesses = 0;
sl@0
   464
		}
sl@0
   465
	}
sl@0
   466
sl@0
   467
sl@0
   468
void CTextViewTest::TestSetCursorWidthTypeL()
sl@0
   469
	{
sl@0
   470
	InitializeL();
sl@0
   471
	iView->SetCursorWidthTypeL(TTextCursor::ETypeRectangle,0);
sl@0
   472
	Destroy();
sl@0
   473
	TInt consecutiveSuccesses = 0;
sl@0
   474
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   475
		{
sl@0
   476
		__UHEAP_MARK;
sl@0
   477
		InitializeL();
sl@0
   478
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   479
		TRAPD(err, iView->SetCursorWidthTypeL(TTextCursor::ETypeRectangle,0)); //TTextCursor::EType aType, TInt aWidth=0
sl@0
   480
		Destroy();
sl@0
   481
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   482
		__UHEAP_MARKENDC(0);
sl@0
   483
		if (err == KErrNone)
sl@0
   484
			++consecutiveSuccesses;
sl@0
   485
		else
sl@0
   486
			consecutiveSuccesses = 0;
sl@0
   487
		}
sl@0
   488
	}
sl@0
   489
sl@0
   490
sl@0
   491
void CTextViewTest::TestParagraphRectL()
sl@0
   492
	{
sl@0
   493
	InitializeL();
sl@0
   494
	iView->ParagraphRectL(1);
sl@0
   495
	Destroy();
sl@0
   496
	TInt consecutiveSuccesses = 0;
sl@0
   497
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   498
		{
sl@0
   499
		__UHEAP_MARK;
sl@0
   500
		InitializeL();
sl@0
   501
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   502
		TRAPD(err, iView->ParagraphRectL(1)); //TInt aDocPos
sl@0
   503
		Destroy();
sl@0
   504
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   505
		__UHEAP_MARKENDC(0);
sl@0
   506
		if (err == KErrNone)
sl@0
   507
			++consecutiveSuccesses;
sl@0
   508
		else
sl@0
   509
			consecutiveSuccesses = 0;
sl@0
   510
		}
sl@0
   511
	}
sl@0
   512
sl@0
   513
sl@0
   514
void CTextViewTest::TestDrawL()
sl@0
   515
	{
sl@0
   516
	InitializeL();
sl@0
   517
	iView->DrawL(iWindowRect);
sl@0
   518
	Destroy();
sl@0
   519
	TInt consecutiveSuccesses = 0;
sl@0
   520
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   521
		{
sl@0
   522
		__UHEAP_MARK;
sl@0
   523
		InitializeL();
sl@0
   524
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   525
		TRAPD(err, iView->DrawL(iWindowRect)); //TRect aRect
sl@0
   526
		Destroy();
sl@0
   527
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   528
		__UHEAP_MARKENDC(0);
sl@0
   529
		if (err == KErrNone)
sl@0
   530
			++consecutiveSuccesses;
sl@0
   531
		else
sl@0
   532
			consecutiveSuccesses = 0;
sl@0
   533
		}
sl@0
   534
	}
sl@0
   535
sl@0
   536
sl@0
   537
void CTextViewTest::TestHandleRangeFormatChangeL()
sl@0
   538
	{
sl@0
   539
	InitializeL();
sl@0
   540
	iView->HandleRangeFormatChangeL(select, EFalse);
sl@0
   541
	Destroy();
sl@0
   542
	TInt consecutiveSuccesses = 0;
sl@0
   543
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   544
		{
sl@0
   545
		__UHEAP_MARK;
sl@0
   546
		InitializeL();
sl@0
   547
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   548
		TRAPD(err, iView->HandleRangeFormatChangeL(select, EFalse));
sl@0
   549
		Destroy();
sl@0
   550
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   551
		__UHEAP_MARKENDC(0);
sl@0
   552
		if (err == KErrNone)
sl@0
   553
			++consecutiveSuccesses;
sl@0
   554
		else
sl@0
   555
			consecutiveSuccesses = 0;
sl@0
   556
		}
sl@0
   557
	}
sl@0
   558
sl@0
   559
sl@0
   560
void CTextViewTest::TestHandleInsertDeleteL()
sl@0
   561
	{
sl@0
   562
	InitializeL();
sl@0
   563
	iView->HandleInsertDeleteL(select, 1, EFalse);
sl@0
   564
	Destroy();
sl@0
   565
	TInt consecutiveSuccesses = 0;
sl@0
   566
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   567
		{
sl@0
   568
		__UHEAP_MARK;
sl@0
   569
		InitializeL();
sl@0
   570
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   571
		TRAPD(err, iView->HandleInsertDeleteL(select, 1, EFalse));
sl@0
   572
		Destroy();
sl@0
   573
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   574
		__UHEAP_MARKENDC(0);
sl@0
   575
		if (err == KErrNone)
sl@0
   576
			++consecutiveSuccesses;
sl@0
   577
		else
sl@0
   578
			consecutiveSuccesses = 0;
sl@0
   579
		}
sl@0
   580
	}
sl@0
   581
sl@0
   582
sl@0
   583
void CTextViewTest::TestHandleGlobalChangeL()
sl@0
   584
	{
sl@0
   585
	InitializeL();
sl@0
   586
	iView->HandleGlobalChangeL(TViewYPosQualifier());
sl@0
   587
	Destroy();
sl@0
   588
	TInt consecutiveSuccesses = 0;
sl@0
   589
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   590
		{
sl@0
   591
		__UHEAP_MARK;
sl@0
   592
		InitializeL();
sl@0
   593
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   594
		TRAPD(err, iView->HandleGlobalChangeL(TViewYPosQualifier()));
sl@0
   595
		Destroy();
sl@0
   596
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   597
		__UHEAP_MARKENDC(0);
sl@0
   598
		if (err == KErrNone)
sl@0
   599
			++consecutiveSuccesses;
sl@0
   600
		else
sl@0
   601
			consecutiveSuccesses = 0;
sl@0
   602
		}
sl@0
   603
	}
sl@0
   604
sl@0
   605
sl@0
   606
void CTextViewTest::TestHandleGlobalChangeNoRedrawL()
sl@0
   607
	{
sl@0
   608
	InitializeL();
sl@0
   609
	iView->HandleGlobalChangeNoRedrawL(TViewYPosQualifier());
sl@0
   610
	Destroy();
sl@0
   611
	TInt consecutiveSuccesses = 0;
sl@0
   612
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   613
		{
sl@0
   614
		__UHEAP_MARK;
sl@0
   615
		InitializeL();
sl@0
   616
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   617
		TRAPD(err, iView->HandleGlobalChangeNoRedrawL(TViewYPosQualifier()));
sl@0
   618
		Destroy();
sl@0
   619
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   620
		__UHEAP_MARKENDC(0);
sl@0
   621
		if (err == KErrNone)
sl@0
   622
			++consecutiveSuccesses;
sl@0
   623
		else
sl@0
   624
			consecutiveSuccesses = 0;
sl@0
   625
		}
sl@0
   626
	}
sl@0
   627
sl@0
   628
sl@0
   629
void CTextViewTest::TestScrollDisplayL()
sl@0
   630
	{
sl@0
   631
	InitializeL();
sl@0
   632
	iView->ScrollDisplayL(TCursorPosition::EFLeft);
sl@0
   633
	Destroy();
sl@0
   634
	TInt consecutiveSuccesses = 0;
sl@0
   635
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   636
		{
sl@0
   637
		__UHEAP_MARK;
sl@0
   638
		InitializeL();
sl@0
   639
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   640
		TRAPD(err, iView->ScrollDisplayL(TCursorPosition::EFLeft));
sl@0
   641
		Destroy();
sl@0
   642
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   643
		__UHEAP_MARKENDC(0);
sl@0
   644
		if (err == KErrNone)
sl@0
   645
			++consecutiveSuccesses;
sl@0
   646
		else
sl@0
   647
			consecutiveSuccesses = 0;
sl@0
   648
		}
sl@0
   649
	}
sl@0
   650
sl@0
   651
sl@0
   652
void CTextViewTest::TestScrollDisplayPixelsL()
sl@0
   653
	{
sl@0
   654
	InitializeL();
sl@0
   655
	iView->ScrollDisplayPixelsL(testDeltaY);
sl@0
   656
	Destroy();
sl@0
   657
	TInt consecutiveSuccesses = 0;
sl@0
   658
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   659
		{
sl@0
   660
		__UHEAP_MARK;
sl@0
   661
		InitializeL();
sl@0
   662
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   663
		TRAPD(err, iView->ScrollDisplayPixelsL(testDeltaY));
sl@0
   664
		Destroy();
sl@0
   665
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   666
		__UHEAP_MARKENDC(0);
sl@0
   667
		if (err == KErrNone)
sl@0
   668
			++consecutiveSuccesses;
sl@0
   669
		else
sl@0
   670
			consecutiveSuccesses = 0;
sl@0
   671
		}
sl@0
   672
	}
sl@0
   673
sl@0
   674
sl@0
   675
void CTextViewTest::TestScrollDisplayPixelsNoLimitBordersL(TInt aOffset)
sl@0
   676
    { 
sl@0
   677
    /*
sl@0
   678
     * This test case is for new added function ScrollDisplayPixelsNoLimitBorderL() which support
sl@0
   679
     * no limit scrolling, using this function text view can be scrolled beyond the top and bottom 
sl@0
   680
     * border.
sl@0
   681
     * Text view will be firstly scrolled to border using ScrollDisplayPixelsL() which can't scroll
sl@0
   682
     * text view beyond the top or bottom border.
sl@0
   683
     * Then text view will be scrolled using ScrollDisplayPixelsNoLimitBorderL() to same direction.
sl@0
   684
     * Code will test this step that if text view is really scrolled beyond the border by checking 
sl@0
   685
     * the iBandTop position before and after the scrolling operation.*/
sl@0
   686
    
sl@0
   687
    InitializeL();
sl@0
   688
    _LIT(KTestParagraph, "This is a piece of text which is used to test the bounce scrolling feature made by s60.");
sl@0
   689
    for (TInt i=0;i<=20;i++)
sl@0
   690
        AddTextL(KTestParagraph);
sl@0
   691
    
sl@0
   692
    TInt firstBandTop, secondBandTop;
sl@0
   693
    TInt offset = aOffset;
sl@0
   694
    while( offset!=0 )
sl@0
   695
        {
sl@0
   696
        iView->ScrollDisplayPixelsL(offset);
sl@0
   697
        }
sl@0
   698
    offset = aOffset;
sl@0
   699
    firstBandTop = iLayout->PixelsAboveBand();
sl@0
   700
    iView->ScrollDisplayPixelsNoLimitBorderL(offset);
sl@0
   701
    secondBandTop = iLayout->PixelsAboveBand();
sl@0
   702
    test(firstBandTop - secondBandTop == offset);
sl@0
   703
sl@0
   704
    offset = 0 - aOffset;
sl@0
   705
    while( offset!=0 )
sl@0
   706
        {
sl@0
   707
        iView->ScrollDisplayPixelsL(offset);
sl@0
   708
        }
sl@0
   709
    offset = 0 - aOffset;
sl@0
   710
    firstBandTop = iLayout->PixelsAboveBand();
sl@0
   711
    iView->ScrollDisplayPixelsNoLimitBorderL(offset);
sl@0
   712
    secondBandTop = iLayout->PixelsAboveBand();
sl@0
   713
    test(firstBandTop - secondBandTop == offset);
sl@0
   714
    
sl@0
   715
    Destroy();
sl@0
   716
    }
sl@0
   717
sl@0
   718
sl@0
   719
void CTextViewTest::TestScrollDisplayLinesL()
sl@0
   720
	{
sl@0
   721
	InitializeL();
sl@0
   722
	iView->ScrollDisplayLinesL(testDeltaLines);
sl@0
   723
	Destroy();
sl@0
   724
	TInt consecutiveSuccesses = 0;
sl@0
   725
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   726
		{
sl@0
   727
		__UHEAP_MARK;
sl@0
   728
		InitializeL();
sl@0
   729
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   730
		TRAPD(err, iView->ScrollDisplayLinesL(testDeltaLines));
sl@0
   731
		Destroy();
sl@0
   732
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   733
		__UHEAP_MARKENDC(0);
sl@0
   734
		if (err == KErrNone)
sl@0
   735
			++consecutiveSuccesses;
sl@0
   736
		else
sl@0
   737
			consecutiveSuccesses = 0;
sl@0
   738
		}
sl@0
   739
	}
sl@0
   740
sl@0
   741
sl@0
   742
void CTextViewTest::TestScrollDisplayParagraphsL()
sl@0
   743
	{
sl@0
   744
	InitializeL();
sl@0
   745
	AddTextL(KHello);
sl@0
   746
	iView->ScrollDisplayParagraphsL(testDeltaParas);
sl@0
   747
	Destroy();
sl@0
   748
	TInt consecutiveSuccesses = 0;
sl@0
   749
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   750
		{
sl@0
   751
		__UHEAP_MARK;
sl@0
   752
		InitializeL();
sl@0
   753
		AddTextL(KHello);
sl@0
   754
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   755
		TRAPD(err, iView->ScrollDisplayParagraphsL(testDeltaParas));
sl@0
   756
		Destroy();
sl@0
   757
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   758
		__UHEAP_MARKENDC(0);
sl@0
   759
		if (err == KErrNone)
sl@0
   760
			++consecutiveSuccesses;
sl@0
   761
		else
sl@0
   762
			consecutiveSuccesses = 0;
sl@0
   763
		}
sl@0
   764
	}
sl@0
   765
sl@0
   766
sl@0
   767
void CTextViewTest::TestSetViewL()
sl@0
   768
	{
sl@0
   769
	InitializeL();
sl@0
   770
	iView->SetViewL(1, testaYPos);
sl@0
   771
	Destroy();
sl@0
   772
	TInt consecutiveSuccesses = 0;
sl@0
   773
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   774
		{
sl@0
   775
		__UHEAP_MARK;
sl@0
   776
		InitializeL();
sl@0
   777
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   778
		TRAPD(err, iView->SetViewL(1, testaYPos));
sl@0
   779
		Destroy();
sl@0
   780
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   781
		__UHEAP_MARKENDC(0);
sl@0
   782
		if (err == KErrNone)
sl@0
   783
			++consecutiveSuccesses;
sl@0
   784
		else
sl@0
   785
			consecutiveSuccesses = 0;
sl@0
   786
		}
sl@0
   787
	}
sl@0
   788
sl@0
   789
sl@0
   790
void CTextViewTest::TestMoveCursorL()
sl@0
   791
	{
sl@0
   792
	InitializeL();
sl@0
   793
	AddTextL(KHello);
sl@0
   794
	iView->MoveCursorL(testaMovement, EFalse);
sl@0
   795
	Destroy();
sl@0
   796
	TInt consecutiveSuccesses = 0;
sl@0
   797
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   798
		{
sl@0
   799
		__UHEAP_MARK;
sl@0
   800
		InitializeL();
sl@0
   801
		AddTextL(KHello);
sl@0
   802
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   803
		TRAPD(err, iView->MoveCursorL(testaMovement, EFalse));
sl@0
   804
		Destroy();
sl@0
   805
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   806
		__UHEAP_MARKENDC(0);
sl@0
   807
		if (err == KErrNone)
sl@0
   808
			++consecutiveSuccesses;
sl@0
   809
		else
sl@0
   810
			consecutiveSuccesses = 0;
sl@0
   811
		}
sl@0
   812
	}
sl@0
   813
sl@0
   814
sl@0
   815
void CTextViewTest::TestSetSelectionL()
sl@0
   816
	{
sl@0
   817
	InitializeL();
sl@0
   818
	iView->SetSelectionL(select);
sl@0
   819
	Destroy();
sl@0
   820
	TInt consecutiveSuccesses = 0;
sl@0
   821
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   822
		{
sl@0
   823
		__UHEAP_MARK;
sl@0
   824
		InitializeL();
sl@0
   825
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   826
		TRAPD(err, iView->SetSelectionL(select));
sl@0
   827
		Destroy();
sl@0
   828
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   829
		__UHEAP_MARKENDC(0);
sl@0
   830
		if (err == KErrNone)
sl@0
   831
			++consecutiveSuccesses;
sl@0
   832
		else
sl@0
   833
			consecutiveSuccesses = 0;
sl@0
   834
		}
sl@0
   835
	}
sl@0
   836
sl@0
   837
sl@0
   838
void CTextViewTest::TestMatchCursorHeightL()
sl@0
   839
	{
sl@0
   840
	InitializeL();
sl@0
   841
	iView->MatchCursorHeightL(testaFontSpec);
sl@0
   842
	Destroy();
sl@0
   843
	TInt consecutiveSuccesses = 0;
sl@0
   844
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   845
		{
sl@0
   846
		__UHEAP_MARK;
sl@0
   847
		InitializeL();
sl@0
   848
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   849
		TRAPD(err, iView->MatchCursorHeightL(testaFontSpec));
sl@0
   850
		Destroy();
sl@0
   851
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   852
		__UHEAP_MARKENDC(0);
sl@0
   853
		if (err == KErrNone)
sl@0
   854
			++consecutiveSuccesses;
sl@0
   855
		else
sl@0
   856
			consecutiveSuccesses = 0;
sl@0
   857
		}
sl@0
   858
	}
sl@0
   859
sl@0
   860
sl@0
   861
void CTextViewTest::TestCalculateHorizontalExtremesL()
sl@0
   862
	{
sl@0
   863
	InitializeL();
sl@0
   864
	iView->CalculateHorizontalExtremesL(testaLeft, testaRight, EFalse);
sl@0
   865
	Destroy();
sl@0
   866
	TInt consecutiveSuccesses = 0;
sl@0
   867
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   868
		{
sl@0
   869
		__UHEAP_MARK;
sl@0
   870
		InitializeL();
sl@0
   871
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   872
		TRAPD(err, iView->CalculateHorizontalExtremesL(testaLeft, testaRight, EFalse));
sl@0
   873
		Destroy();
sl@0
   874
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   875
		__UHEAP_MARKENDC(0);
sl@0
   876
		if (err == KErrNone)
sl@0
   877
			++consecutiveSuccesses;
sl@0
   878
		else
sl@0
   879
			consecutiveSuccesses = 0;
sl@0
   880
		}
sl@0
   881
	}
sl@0
   882
sl@0
   883
sl@0
   884
void CTextViewTest::TestXyPosToDocPosL()
sl@0
   885
	{
sl@0
   886
	InitializeL();
sl@0
   887
	iView->XyPosToDocPosL(testaPoint);
sl@0
   888
	Destroy();
sl@0
   889
	TInt consecutiveSuccesses = 0;
sl@0
   890
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   891
		{
sl@0
   892
		__UHEAP_MARK;
sl@0
   893
		InitializeL();
sl@0
   894
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   895
		TRAPD(err, iView->XyPosToDocPosL(testaPoint));
sl@0
   896
		Destroy();
sl@0
   897
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   898
		__UHEAP_MARKENDC(0);
sl@0
   899
		if (err == KErrNone)
sl@0
   900
			++consecutiveSuccesses;
sl@0
   901
		else
sl@0
   902
			consecutiveSuccesses = 0;
sl@0
   903
		}
sl@0
   904
	}
sl@0
   905
sl@0
   906
/*
sl@0
   907
void CTextViewTest::TestDrawL1()
sl@0
   908
	{
sl@0
   909
	InitializeL();
sl@0
   910
	iView->DrawL(iWindowRect, testaGc);
sl@0
   911
	Destroy();
sl@0
   912
	TInt consecutiveSuccesses = 0;
sl@0
   913
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   914
		{
sl@0
   915
		__UHEAP_MARK;
sl@0
   916
		InitializeL();
sl@0
   917
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   918
		TRAPD(err, iView->DrawL(iWindowRect, testaGc));
sl@0
   919
		Destroy();
sl@0
   920
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   921
		__UHEAP_MARKENDC(0);
sl@0
   922
		if (err == KErrNone)
sl@0
   923
			++consecutiveSuccesses;
sl@0
   924
		else
sl@0
   925
			consecutiveSuccesses = 0;
sl@0
   926
		}
sl@0
   927
	}
sl@0
   928
*/
sl@0
   929
sl@0
   930
sl@0
   931
void CTextViewTest::TestGetPictureRectangleL()
sl@0
   932
	{
sl@0
   933
	InitializeL();
sl@0
   934
	iView->GetPictureRectangleL(1, iWindowRect, &testaCanScaleOrCrop);
sl@0
   935
	Destroy();
sl@0
   936
	TInt consecutiveSuccesses = 0;
sl@0
   937
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   938
		{
sl@0
   939
		__UHEAP_MARK;
sl@0
   940
		InitializeL();
sl@0
   941
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   942
		TRAPD(err, iView->GetPictureRectangleL(1, iWindowRect, &testaCanScaleOrCrop));
sl@0
   943
		Destroy();
sl@0
   944
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   945
		__UHEAP_MARKENDC(0);
sl@0
   946
		if (err == KErrNone)
sl@0
   947
			++consecutiveSuccesses;
sl@0
   948
		else
sl@0
   949
			consecutiveSuccesses = 0;
sl@0
   950
		}
sl@0
   951
	}
sl@0
   952
sl@0
   953
sl@0
   954
void CTextViewTest::TestGetPictureRectangle1L()
sl@0
   955
	{
sl@0
   956
	InitializeL();
sl@0
   957
	iView->GetPictureRectangleL(testaXyPos, iWindowRect, &testaCanScaleOrCrop);
sl@0
   958
	Destroy();
sl@0
   959
	TInt consecutiveSuccesses = 0;
sl@0
   960
	for (TInt i = 1; consecutiveSuccesses != 100; ++i)
sl@0
   961
		{
sl@0
   962
		__UHEAP_MARK;
sl@0
   963
		InitializeL();
sl@0
   964
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   965
		TRAPD(err, iView->GetPictureRectangleL(testaXyPos, iWindowRect, &testaCanScaleOrCrop));
sl@0
   966
		Destroy();
sl@0
   967
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
   968
		__UHEAP_MARKENDC(0);
sl@0
   969
		if (err == KErrNone)
sl@0
   970
			++consecutiveSuccesses;
sl@0
   971
		else
sl@0
   972
			consecutiveSuccesses = 0;
sl@0
   973
		}
sl@0
   974
	}
sl@0
   975
sl@0
   976
sl@0
   977
void CTextViewTest::TestSetDisplayContextL()
sl@0
   978
	{
sl@0
   979
	CBitmapContext* atestGc;
sl@0
   980
	CBitmapContext* anotherGc;
sl@0
   981
	InitializeL();
sl@0
   982
	iView->SetDisplayContextL(testaGd, &iWindow, &testaGroupWin, &testaSession);
sl@0
   983
	Destroy();
sl@0
   984
	TInt consecutiveSuccesses = 0;
sl@0
   985
	for (TInt i = 1; consecutiveSuccesses != 1; ++i)
sl@0
   986
		{
sl@0
   987
		__UHEAP_MARK;
sl@0
   988
		InitializeL();
sl@0
   989
		__UHEAP_SETFAIL(RHeap::EDeterministic, i);
sl@0
   990
		atestGc=iView->BitmapContext();
sl@0
   991
		TRAPD(err, iView->SetDisplayContextL(testaGd, &iWindow, &testaGroupWin, &testaSession));
sl@0
   992
		anotherGc=iView->BitmapContext();
sl@0
   993
		if (err)
sl@0
   994
			{
sl@0
   995
			test(atestGc==anotherGc);
sl@0
   996
			}
sl@0
   997
		else
sl@0
   998
			{
sl@0
   999
			test(atestGc!=anotherGc);
sl@0
  1000
			}
sl@0
  1001
		Destroy();
sl@0
  1002
		__UHEAP_SETFAIL(RHeap::ENone, 0);
sl@0
  1003
		__UHEAP_MARKENDC(0);
sl@0
  1004
		if (err == KErrNone)
sl@0
  1005
			++consecutiveSuccesses;
sl@0
  1006
		else
sl@0
  1007
			consecutiveSuccesses = 0;
sl@0
  1008
		}
sl@0
  1009
	}
sl@0
  1010
sl@0
  1011
sl@0
  1012
void CTextViewTest::TestGetPictureRectangleDefectL()
sl@0
  1013
	{
sl@0
  1014
	/*
sl@0
  1015
	_LIT(KParagraphAverage,"Some text to test that the Picture returned is in the correct position. The size of this paragraph should be reasonable, not too long not too short.");
sl@0
  1016
	_LIT(KParagraphBigger,"Moulin Rouge: a film review. I don't know what I was expecting from Oulin Rouge, but what I got came as an even more of a surprise. The movie is a visual feast, a sing along extravaganza. The choices of songs is refreshing, with mix of Nirvan-Smells like teen spirit- to Madonna-Like a virgin-. Who knew that Ewan and Nicole could sing so well together.");
sl@0
  1017
	_LIT(KParagraphSmall,"CBusBase is an abstract base class for dynamic memory buffers. You can read or write bytes.");
sl@0
  1018
	InitializeL();
sl@0
  1019
	TInt length;
sl@0
  1020
	iEtext->InsertL(0,KParagraphAverage);
sl@0
  1021
	iView->HandleInsertDeleteL(TCursorSelection(0, KParagraphAverage().Length()), 0);
sl@0
  1022
	iEtext->InsertL(KParagraphAverage().Length(),TChar(CEditableText::EParagraphDelimiter));
sl@0
  1023
	iView->HandleCharEditL();
sl@0
  1024
sl@0
  1025
	length=iEtext->LdDocumentLength();
sl@0
  1026
	iEtext->InsertL(iEtext->LdDocumentLength(),KParagraphBigger);
sl@0
  1027
	iView->HandleInsertDeleteL(TCursorSelection(length,KParagraphBigger().Length()), 0);
sl@0
  1028
sl@0
  1029
	length=iEtext->LdDocumentLength();
sl@0
  1030
	iEtext->InsertL(iEtext->LdDocumentLength(),KParagraphSmall);
sl@0
  1031
	iView->HandleInsertDeleteL(TCursorSelection(length,KParagraphSmall().Length()), 0);
sl@0
  1032
sl@0
  1033
	TSize size(100,100);
sl@0
  1034
	TPoint xypos;
sl@0
  1035
	CMyTestPicture* testpicture1 = CMyTestPicture::NewL(size);
sl@0
  1036
	CMyTestPicture* testpicture2 = CMyTestPicture::NewL(size);
sl@0
  1037
	CMyTestPicture* testpicture3 = CMyTestPicture::NewL(size);
sl@0
  1038
	size.SetSize(200,200);
sl@0
  1039
	CMyTestPicture* testpicture4 = CMyTestPicture::NewL(size);
sl@0
  1040
	CMyTestPicture* testpicture5 = CMyTestPicture::NewL(size);
sl@0
  1041
	CMyTestPicture* testpicture6 = CMyTestPicture::NewL(size);
sl@0
  1042
	TPictureHeader mypic;
sl@0
  1043
	TPictureHeader mypic2;
sl@0
  1044
	//mypic.iPictureType = KUidXzePictureType;
sl@0
  1045
	mypic.iPicture=testpicture1;
sl@0
  1046
	mypic2.iPicture=testpicture2;
sl@0
  1047
	// Testing the picture
sl@0
  1048
sl@0
  1049
	iEtext->InsertL(10,mypic2);
sl@0
  1050
	mypic2.iPicture=testpicture1;
sl@0
  1051
	iEtext->InsertL(40,mypic2);
sl@0
  1052
	iView->DocPosToXyPosL(200,xypos);
sl@0
  1053
	test.Printf(_L("The xy coords are %d & %d\n"),xypos.iX,xypos.iY);
sl@0
  1054
	xypos.SetXY(78,55);
sl@0
  1055
	TInt docpos;
sl@0
  1056
	docpos=iView->XyPosToDocPosL(xypos);
sl@0
  1057
	test.Printf(_L("The new docpos is %d\n"),docpos);
sl@0
  1058
	TRect rect;
sl@0
  1059
	TBool boo;
sl@0
  1060
	boo=iView->GetPictureRectangleL(40,rect);
sl@0
  1061
	test.Printf(_L("%d & %d \n"),rect.Size().iHeight,rect.Size().iWidth);
sl@0
  1062
	if (boo)
sl@0
  1063
		test.Printf(_L("Yes!"));
sl@0
  1064
	else
sl@0
  1065
		test.Printf(_L("Noo!"));
sl@0
  1066
	*/
sl@0
  1067
	}
sl@0
  1068
sl@0
  1069
void CTextViewTest::TestGetLineRectL()
sl@0
  1070
	{
sl@0
  1071
sl@0
  1072
	_LIT(KSomeText,"Empty. Well this text has to now be something else. Maybe this will increase the height of the CTextLayout and if it does then");
sl@0
  1073
	// calls the initializeDiffCharFormatL to set the new CharFormatLayer
sl@0
  1074
	// which sets the picture alignment to be Bottom.
sl@0
  1075
	InitializeDiffCharFormatL();
sl@0
  1076
	// create test pictures to be inserted into the richtext object
sl@0
  1077
	TSize size(100,100);
sl@0
  1078
	CMyTestPicture* testpicture1 = CMyTestPicture::NewL(size);
sl@0
  1079
	TPictureHeader tPicHeader;
sl@0
  1080
	tPicHeader.iPictureType = KUidXzePictureType;
sl@0
  1081
	tPicHeader.iPicture = testpicture1;
sl@0
  1082
	test.Printf(_L("Created a picture\n"));
sl@0
  1083
sl@0
  1084
	// inserting some text & picture into the richtext object
sl@0
  1085
	iEtext->InsertL(0,KSomeText);
sl@0
  1086
	TInt startOfPicture;
sl@0
  1087
	startOfPicture=iEtext->DocumentLength();
sl@0
  1088
	iEtext->InsertL(startOfPicture,tPicHeader);
sl@0
  1089
	test.Printf(_L("Inserted the picture in CRichText object \n"));
sl@0
  1090
sl@0
  1091
	//Call the guilty function
sl@0
  1092
	TRect resultingRect;
sl@0
  1093
	TInt endOfDocument = iEtext->DocumentLength();
sl@0
  1094
	iView->FormatTextL();
sl@0
  1095
	resultingRect=iLayout->GetLineRectL(startOfPicture,endOfDocument);
sl@0
  1096
	}
sl@0
  1097
sl@0
  1098
void CTextViewTest::TestGetParaFormatL()
sl@0
  1099
	{
sl@0
  1100
	test.Next(_L("Starting GetParaFormatL test"));
sl@0
  1101
	_LIT(KSomeText,"Empty. Well this text has to now be something else. Maybe this will increase the height of the CTextLayout and if it does then");
sl@0
  1102
	InitializeL();
sl@0
  1103
	// create the CParaFormat & TparaFormatMask
sl@0
  1104
	// and set that in the iParaFormatLayer
sl@0
  1105
	CParaFormat* paraFormat = CParaFormat::NewL();
sl@0
  1106
	TParaFormatMask paraFormatMask;
sl@0
  1107
	iParaLayer->SetL(paraFormat,paraFormatMask);
sl@0
  1108
	iEtext->SetGlobalParaFormat(iParaLayer);
sl@0
  1109
	iEtext->InsertL(0,KSomeText);
sl@0
  1110
	iView->FormatTextL();
sl@0
  1111
	// Create another CParaFormat & TParaFormatMask and set
sl@0
  1112
	// some attributes to be different from the default.
sl@0
  1113
	CParaFormat* anotherParaFormat = CParaFormat::NewL();
sl@0
  1114
	TParaFormatMask anotherParaFormatMask;
sl@0
  1115
	anotherParaFormat->iRightMarginInTwips=200;
sl@0
  1116
	anotherParaFormatMask.SetAttrib(EAttRightMargin);
sl@0
  1117
	anotherParaFormat->iLeftMarginInTwips=400;
sl@0
  1118
	anotherParaFormatMask.SetAttrib(EAttLeftMargin);
sl@0
  1119
	anotherParaFormat->iLineSpacingInTwips=300;
sl@0
  1120
	anotherParaFormatMask.SetAttrib(EAttLineSpacing);
sl@0
  1121
	anotherParaFormat->iHorizontalAlignment=CParaFormat::ERightAlign;
sl@0
  1122
	anotherParaFormatMask.SetAttrib(EAttAlignment);
sl@0
  1123
sl@0
  1124
	//Now call CRichText::GetParaFormat using anotherParaFormat * Mask
sl@0
  1125
	// and test that it is the same as paraFormat.
sl@0
  1126
 	iEtext->GetParaFormatL(anotherParaFormat,anotherParaFormatMask,0,10);
sl@0
  1127
sl@0
  1128
	TInt result = anotherParaFormat->iRightMarginInTwips;
sl@0
  1129
	test (result==0);
sl@0
  1130
sl@0
  1131
	result = anotherParaFormat->iLeftMarginInTwips;
sl@0
  1132
	test (result==0);
sl@0
  1133
	result = anotherParaFormat->iLineSpacingInTwips;
sl@0
  1134
	test (result==200); // default value for iLineSpacingInTwips set in paraFormat is 200
sl@0
  1135
	test (anotherParaFormat->iHorizontalAlignment == CParaFormat::ELeftAlign);
sl@0
  1136
sl@0
  1137
	TBool testresult;
sl@0
  1138
	testresult=anotherParaFormat->IsEqual(*paraFormat);
sl@0
  1139
	test(testresult);
sl@0
  1140
sl@0
  1141
	}
sl@0
  1142
sl@0
  1143
sl@0
  1144
void CTextViewTest::TestForDEF003426L()
sl@0
  1145
	{
sl@0
  1146
	// Initialise CTextViewTest object for next test.
sl@0
  1147
	InitializeL();
sl@0
  1148
	test.Next(_L("Verifying CTextView::XyPosToDosPosL() WRT DEF003426"));
sl@0
  1149
sl@0
  1150
	// Insert a one line paragraph into EText object and reformat view.
sl@0
  1151
	_LIT(KTestParagraph, "This is a piece of text to test the character positioning API based in X,Y cocordinates.");
sl@0
  1152
	iEtext->InsertL(0, KTestParagraph);
sl@0
  1153
	TCursorSelection sel(0, KTestParagraph().Length());
sl@0
  1154
	(void) iView->HandleInsertDeleteL(sel, 0, EFalse);
sl@0
  1155
sl@0
  1156
	// Test XyPosToDocPosL() with coordinates beyond top left corner
sl@0
  1157
	TInt docPos = -1;
sl@0
  1158
	docPos = iView->XyPosToDocPosL(testaPoint);
sl@0
  1159
	test(docPos == 0); // Should give char position of 0
sl@0
  1160
sl@0
  1161
	// Test XyPosToDocPosL() with coordinates beyond bottom right corner
sl@0
  1162
	TRect viewRect = iView->ViewRect();
sl@0
  1163
	viewRect.iBr.iX += 300;
sl@0
  1164
	viewRect.iBr.iY += 111;
sl@0
  1165
    docPos = iView->XyPosToDocPosL(viewRect.iBr);
sl@0
  1166
	test(docPos != 0); // Should give char position of 88
sl@0
  1167
sl@0
  1168
	// Clean up test object
sl@0
  1169
	Destroy();
sl@0
  1170
	}
sl@0
  1171
sl@0
  1172
/*** Test code for DEF038858
sl@0
  1173
	 " It isn't poss. to set via CTextView a TTmDocPos of iPos = 0; iLeadingEdge=false"
sl@0
  1174
 */
sl@0
  1175
void CTextViewTest::TestForDEF038488L()
sl@0
  1176
	{
sl@0
  1177
	// Initialise CTextViewTest object for next test.
sl@0
  1178
	InitializeL();
sl@0
  1179
	test.Next(_L("Verifying CTextView::SetDocPosL() DEF038858"));
sl@0
  1180
sl@0
  1181
	_LIT(KText, "This is the test for DEF038488");
sl@0
  1182
	iEtext->InsertL(0, KText);
sl@0
  1183
	iView->HandleInsertDeleteL(TCursorSelection(0, KText().Length()), 0);
sl@0
  1184
sl@0
  1185
	// Test SetDocPosL() with coordinates -1
sl@0
  1186
	iView->SetDocPosL(-1);
sl@0
  1187
sl@0
  1188
	// check the value of iLeadingEdge
sl@0
  1189
	TTmDocPos RawDocPos;
sl@0
  1190
	iView->GetCursorPos(RawDocPos);
sl@0
  1191
	test(RawDocPos.iLeadingEdge == EFalse);
sl@0
  1192
sl@0
  1193
	}
sl@0
  1194
sl@0
  1195
CTextViewTest::~CTextViewTest()
sl@0
  1196
	{
sl@0
  1197
	test.End();
sl@0
  1198
	test.Close();
sl@0
  1199
	delete iView;
sl@0
  1200
	iWindow.Close();
sl@0
  1201
	delete iLayout;
sl@0
  1202
	delete iEtext;
sl@0
  1203
	delete iCharLayer;
sl@0
  1204
	delete iParaLayer;
sl@0
  1205
	}
sl@0
  1206
sl@0
  1207
/**
sl@0
  1208
@SYMTestCaseID          SYSLIB-FORM-UT-1888
sl@0
  1209
@SYMTestCaseDesc        Testing the Class TFormAndEtextEditor
sl@0
  1210
@SYMTestPriority        Low
sl@0
  1211
@SYMTestActions         Tests the API's of TFormAndEtextEditor by inserting the text, applying specific format and style to the text, getting the text,format and style and also deleting the same(text,format and style)
sl@0
  1212
@SYMTestExpectedResults Tests must not fail
sl@0
  1213
@SYMREQ                 REQ0000
sl@0
  1214
*/
sl@0
  1215
void CTextViewTest::FormAndEtextTestL()
sl@0
  1216
	{
sl@0
  1217
	InitializeL();
sl@0
  1218
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-1888 Testing TFormAndEtextEditor "));
sl@0
  1219
	TCharFormatMask charMask;
sl@0
  1220
    TCharFormat charFormat;
sl@0
  1221
	charFormat.iFontSpec.iTypeface.iName = _S("Arial");
sl@0
  1222
    charFormat.iFontSpec.iHeight = 240;
sl@0
  1223
    charMask.SetAttrib(EAttFontTypeface);
sl@0
  1224
    charMask.SetAttrib(EAttFontHeight);
sl@0
  1225
    CCharFormatLayer* charFormatLayer = CCharFormatLayer::NewL();
sl@0
  1226
    charFormatLayer->SetL(charFormat,charMask);
sl@0
  1227
	TParaFormatMask paraFormatMask;
sl@0
  1228
    CParaFormatLayer* paraFormatLayer=CParaFormatLayer::NewL((CParaFormat*)NULL,paraFormatMask);
sl@0
  1229
    CParagraphStyle* paraStyle = CParagraphStyle::NewL(*paraFormatLayer,*charFormatLayer);
sl@0
  1230
    CStyleList* styleList = CStyleList::NewL();
sl@0
  1231
    RParagraphStyleInfo paraStyleInfo(paraStyle,paraStyle);
sl@0
  1232
    paraStyleInfo.iStyle->iName=_L("Arial");
sl@0
  1233
    paraStyleInfo.iStyleForNextPara->iName=_L("Arial");
sl@0
  1234
    // Appending the new style to stylelist
sl@0
  1235
    styleList->AppendL(&paraStyleInfo);
sl@0
  1236
sl@0
  1237
	iEtext->SetStyleListExternallyOwned(*styleList);
sl@0
  1238
	iEtext->Reset();
sl@0
  1239
	TFormAndEtextEditor newEditor(*iView,*iEtext);
sl@0
  1240
sl@0
  1241
	TTmCharFormatLayer charLayer;
sl@0
  1242
	TTmCharFormatLayer charLayer1;
sl@0
  1243
	TTmCharFormatMask charIMask;
sl@0
  1244
	TTmCharFormat charI;
sl@0
  1245
	RTmParFormatLayer parLayer;
sl@0
  1246
	RTmParFormatLayer parLayer1;
sl@0
  1247
	TTmParFormatMask parNMask;
sl@0
  1248
	charIMask.iFlags = TTmCharFormatMask::EItalic;
sl@0
  1249
	TOpenFontFaceAttribBase attrib;
sl@0
  1250
	attrib.SetBold(EFalse);
sl@0
  1251
	charI.iFontSpec.SetAttrib(attrib);
sl@0
  1252
	parNMask.iFlags = TTmParFormatMask::EKeepWithNext;
sl@0
  1253
	RTmParFormat parN;
sl@0
  1254
	parN.iFlags = RTmParFormat::EKeepWithNext;
sl@0
  1255
	charLayer.iMask = charIMask;
sl@0
  1256
	charLayer.iFormat = charI;
sl@0
  1257
	charLayer1=charLayer;
sl@0
  1258
	parLayer.iMask = parNMask;
sl@0
  1259
sl@0
  1260
	parLayer.iFormat.CopyL(parN);
sl@0
  1261
	TPtrC ptr1(_L("Arial"));
sl@0
  1262
	// Inserting the text and applying the style specified(Arial)
sl@0
  1263
	newEditor.InsertTextL(0, _L("Hello World"),&ptr1);
sl@0
  1264
sl@0
  1265
	// Setting the paragraph and character format explicitly
sl@0
  1266
	newEditor.SetParFormatL(0,11,parLayer);
sl@0
  1267
	newEditor.SetCharFormatL(0,11,charLayer);
sl@0
  1268
sl@0
  1269
	MUnifiedEditor::TFormatLevel level = MUnifiedEditor::EEffective;
sl@0
  1270
	TInt runLen=11;
sl@0
  1271
	// Getting the paragraph and character format
sl@0
  1272
	newEditor.GetParFormatL(0,level,parLayer1,runLen);
sl@0
  1273
	newEditor.GetCharFormat(0,level,charLayer1,runLen);
sl@0
  1274
sl@0
  1275
	// Deleting first 6 characters
sl@0
  1276
	newEditor.DeleteTextL(0,6);
sl@0
  1277
	// Deleting the paragraph and character format for the remaining text
sl@0
  1278
	newEditor.DeleteParFormatL(0,5);
sl@0
  1279
	newEditor.DeleteCharFormatL(0,5);
sl@0
  1280
sl@0
  1281
	TPtrC ptr;
sl@0
  1282
	// Get the text into ptr. A paragraph seperator(\x2029) gets appended at the end of text.
sl@0
  1283
	newEditor.GetText(0,ptr);
sl@0
  1284
	test(ptr==_L("World\x2029"));
sl@0
  1285
sl@0
  1286
	RTmStyle style1;
sl@0
  1287
	RParagraphStyleInfo paraStyleInfo1(paraStyle,paraStyle);
sl@0
  1288
	paraStyleInfo1.iStyle->iName=_L("NewStyle");
sl@0
  1289
	paraStyleInfo1.iStyleForNextPara->iName=_L("NewStyle");
sl@0
  1290
	style1.CopyL(paraStyleInfo1);
sl@0
  1291
	// Creating a new style and changing the current style to the new one.
sl@0
  1292
	newEditor.StyleSupport()->CreateStyleL(style1);
sl@0
  1293
	newEditor.StyleSupport()->ChangeStyleL(style1);
sl@0
  1294
sl@0
  1295
	RTmStyle style2;
sl@0
  1296
	// Get the style by Name
sl@0
  1297
	TInt retVal = newEditor.StyleSupport()->GetStyleByNameL(_L("Arial"),style2);
sl@0
  1298
	retVal = newEditor.StyleSupport()->GetStyleByNameL(_L("NewStyle"),style2);
sl@0
  1299
	// Get the style for a particular length of text
sl@0
  1300
	newEditor.StyleSupport()->GetStyle(0,ptr,runLen);
sl@0
  1301
	// Get the style by index
sl@0
  1302
	retVal = newEditor.StyleSupport()->GetStyleByIndexL(1,style1);
sl@0
  1303
	// Deleting the style
sl@0
  1304
	newEditor.StyleSupport()->DeleteStyleL(_L("NewStyle"));
sl@0
  1305
	retVal = newEditor.StyleCount();
sl@0
  1306
	test(retVal==1);
sl@0
  1307
	style1.Close();
sl@0
  1308
	style2.Close();
sl@0
  1309
	delete charFormatLayer;
sl@0
  1310
    delete paraFormatLayer;
sl@0
  1311
    delete styleList;
sl@0
  1312
	}
sl@0
  1313
sl@0
  1314
/**
sl@0
  1315
@SYMTestCaseID          SYSLIB-FORM-UT-3347
sl@0
  1316
@SYMTestCaseDesc        Testing the fix for INC092725: RF S60 3.2 Help: Touch and
sl@0
  1317
						scrolling a topic down closing the program
sl@0
  1318
@SYMTestPriority        High
sl@0
  1319
@SYMTestActions         Run affected APIs passing scroll values that would put the display
sl@0
  1320
						outside the formatted range.
sl@0
  1321
@SYMTestExpectedResults First of all, the calls should not panic the process.
sl@0
  1322
						Secondly, that the calls leave with the correct error code.
sl@0
  1323
@SYMDEF                 INC092725
sl@0
  1324
*/
sl@0
  1325
void CTextViewTest::TestForINC092725L()
sl@0
  1326
	{
sl@0
  1327
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-3347 Testing fix for INC092725 "));
sl@0
  1328
	TInt err = KErrNone;
sl@0
  1329
	InitializeL();
sl@0
  1330
	AddTextL(KHello);
sl@0
  1331
sl@0
  1332
	//Scroll up
sl@0
  1333
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteRightAlign);
sl@0
  1334
	TRAP(err, iView->ScrollDisplayL(TCursorPosition::EFLineUp, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1335
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1336
	err=KErrNone;
sl@0
  1337
sl@0
  1338
	//Scroll down
sl@0
  1339
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteLeftAlign);
sl@0
  1340
	TRAP(err, iView->ScrollDisplayL(TCursorPosition::EFLineDown, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1341
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1342
	err=KErrNone;
sl@0
  1343
sl@0
  1344
	//Line scroll up
sl@0
  1345
	TInt i = 105;
sl@0
  1346
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteRightAlign);
sl@0
  1347
	TRAP(err, iView->ScrollDisplayLinesL(i, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1348
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1349
	err=KErrNone;
sl@0
  1350
sl@0
  1351
	//Line scroll down
sl@0
  1352
	i = -105;
sl@0
  1353
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteLeftAlign);
sl@0
  1354
	TRAP(err, iView->ScrollDisplayLinesL(i, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1355
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1356
	err=KErrNone;
sl@0
  1357
sl@0
  1358
	//Paragraph scroll up
sl@0
  1359
	i = 105;
sl@0
  1360
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteRightAlign);
sl@0
  1361
	TRAP(err, iView->ScrollDisplayParagraphsL(i, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1362
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1363
	err=KErrNone;
sl@0
  1364
sl@0
  1365
	//Paragraph scroll down
sl@0
  1366
	i = -105;
sl@0
  1367
	iLayout->AdjustVerticalAlignment(CParaFormat::EAbsoluteLeftAlign);
sl@0
  1368
	TRAP(err, iView->ScrollDisplayParagraphsL(i, CTextLayout::EFAllowScrollingBlankSpace));
sl@0
  1369
	test(err==CTextLayout::EPosNotFormatted);
sl@0
  1370
	Destroy();
sl@0
  1371
	}
sl@0
  1372
sl@0
  1373
sl@0
  1374
class CTestScreenDevice : public CPrinterDevice
sl@0
  1375
	{
sl@0
  1376
public:
sl@0
  1377
    CTestScreenDevice(CWsScreenDevice* aDevice,RDrawableWindow& aWin);
sl@0
  1378
	TDisplayMode DisplayMode() const {return iDevice->DisplayMode();}
sl@0
  1379
	TSize SizeInPixels() const {return iDevice->SizeInPixels();}
sl@0
  1380
	TSize SizeInTwips() const {return iDevice->SizeInTwips();}
sl@0
  1381
    TInt NumTypefaces() const {return iDevice->NumTypefaces();}
sl@0
  1382
    void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const
sl@0
  1383
										{iDevice->TypefaceSupport(aTypefaceSupport,aTypefaceIndex);}
sl@0
  1384
	TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const
sl@0
  1385
									{return iDevice->FontHeightInTwips(aTypefaceIndex,aHeightIndex);}
sl@0
  1386
	void PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const
sl@0
  1387
												{iDevice->PaletteAttributes(aModifiable,aNumEntries);}
sl@0
  1388
	void SetPalette(CPalette* aPalette) {iDevice->SetPalette(aPalette);}
sl@0
  1389
	TInt GetPalette(CPalette*& aPalette) const {return iDevice->GetPalette(aPalette);}
sl@0
  1390
 	TInt CreateContext(CGraphicsContext *&aGc);
sl@0
  1391
	TInt HorizontalTwipsToPixels(TInt aTwips) const {return iDevice->HorizontalTwipsToPixels(aTwips);};
sl@0
  1392
	TInt VerticalTwipsToPixels(TInt aTwips) const {return iDevice->VerticalTwipsToPixels(aTwips);};
sl@0
  1393
	TInt HorizontalPixelsToTwips(TInt aPixels) const {return iDevice->HorizontalPixelsToTwips(aPixels);};
sl@0
  1394
	TInt VerticalPixelsToTwips(TInt aPixels) const {return iDevice->VerticalPixelsToTwips(aPixels);};
sl@0
  1395
	TInt GetNearestFontInTwips(CFont*& aFont,const TFontSpec& aFontSpec) {return iDevice->GetNearestFontInTwips(aFont,aFontSpec);};
sl@0
  1396
	void ReleaseFont(CFont* aFont) {iDevice->ReleaseFont(aFont);};
sl@0
  1397
	TPrinterModelName ModelName() const {return _L("");}
sl@0
  1398
	TUid ModelUid() const {TUid dummy; return dummy;}
sl@0
  1399
	void CreateControlL(CPrinterPort* /*aPrinterPort*/) {}
sl@0
  1400
	TPrinterModelEntry Model() const {return iModel;}
sl@0
  1401
	TInt SetModel(const TPrinterModelHeader& /*aModel*/,CStreamStore& /*aStore*/) {return KErrNone;}
sl@0
  1402
	TBool RequiresPrinterPort() {return EFalse;}
sl@0
  1403
private:
sl@0
  1404
	RDrawableWindow& iWin;
sl@0
  1405
	CWsScreenDevice* iDevice;
sl@0
  1406
	TPrinterModelEntry iModel;
sl@0
  1407
	};
sl@0
  1408
sl@0
  1409
CTestScreenDevice::CTestScreenDevice(CWsScreenDevice* aDevice,RDrawableWindow& aWin):
sl@0
  1410
	iWin(aWin)
sl@0
  1411
	{
sl@0
  1412
	iDevice=aDevice;
sl@0
  1413
	iModel.iUid=TUid::Null();
sl@0
  1414
	}
sl@0
  1415
sl@0
  1416
TInt CTestScreenDevice::CreateContext(CGraphicsContext*& aGc)
sl@0
  1417
	{
sl@0
  1418
sl@0
  1419
	TInt ret=iDevice->CreateContext(aGc);
sl@0
  1420
	((CWindowGc *) aGc)->Activate(iWin);
sl@0
  1421
	return ret;
sl@0
  1422
	}
sl@0
  1423
sl@0
  1424
/**
sl@0
  1425
@SYMTestCaseID          SYSLIB-FORM-UT-3496
sl@0
  1426
@SYMTestCaseDesc        Testing the fix for PDEF108443: Two same content pages are printed when contact fields are exactly one page long
sl@0
  1427
@SYMTestPriority        Medium
sl@0
  1428
@SYMTestActions         Creates text paginators and tests resulting number of pages when there is text to 'full page - 1 line', full page and full page + 1 line of text.
sl@0
  1429
@SYMTestExpectedResults Results should be 1 page, 1 page and 2 pages respectively.
sl@0
  1430
@SYMDEF                 PDEF108443
sl@0
  1431
*/
sl@0
  1432
void CTextViewTest::TestForPDEF108443L()
sl@0
  1433
	{
sl@0
  1434
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-3496 Testing fix for PDEF108443 "));
sl@0
  1435
	CTestScreenDevice* screenDevice = new(ELeave) CTestScreenDevice(iEnv.ScreenDevice(),iWindow);
sl@0
  1436
sl@0
  1437
	TMargins margins;
sl@0
  1438
	margins.iTop = 1440;
sl@0
  1439
	margins.iBottom = 1440;
sl@0
  1440
	margins.iLeft = 1440;
sl@0
  1441
	margins.iRight = 1440;
sl@0
  1442
	TSize s(11906,16838);
sl@0
  1443
	TPageSpec p(TPageSpec::EPortrait, s);
sl@0
  1444
sl@0
  1445
	CArrayFixFlat<TInt>* charsPerPage1 = new(ELeave) CArrayFixFlat<TInt>(KGranularity);
sl@0
  1446
	CTextPaginator* paginator1 = CTextPaginator::NewL(screenDevice, charsPerPage1, KPaginatePriority);
sl@0
  1447
	paginator1->SetPageMarginsInTwips(margins);
sl@0
  1448
	paginator1->SetPageSpecInTwips(p);
sl@0
  1449
sl@0
  1450
	CArrayFixFlat<TInt>* charsPerPage2 = new(ELeave) CArrayFixFlat<TInt>(KGranularity);
sl@0
  1451
	CTextPaginator* paginator2 = CTextPaginator::NewL(screenDevice, charsPerPage2, KPaginatePriority);
sl@0
  1452
	paginator2->SetPageMarginsInTwips(margins);
sl@0
  1453
	paginator2->SetPageSpecInTwips(p);
sl@0
  1454
sl@0
  1455
	CArrayFixFlat<TInt>* charsPerPage3 = new(ELeave) CArrayFixFlat<TInt>(KGranularity);
sl@0
  1456
	CTextPaginator* paginator3 = CTextPaginator::NewL(screenDevice, charsPerPage3, KPaginatePriority);
sl@0
  1457
	paginator3->SetPageMarginsInTwips(margins);
sl@0
  1458
	paginator3->SetPageSpecInTwips(p);
sl@0
  1459
sl@0
  1460
sl@0
  1461
	// We need to find out the height of lines and print area of the page.
sl@0
  1462
	// From this we determine how many lines *should* appear on the page.
sl@0
  1463
	// This differs between devices(ie. hw and winscw).
sl@0
  1464
	TRect textRect;
sl@0
  1465
	textRect.iTl.iX=margins.iLeft;
sl@0
  1466
	textRect.iTl.iY=margins.iTop;
sl@0
  1467
	textRect.iBr.iX=s.iWidth-margins.iRight;
sl@0
  1468
	textRect.iBr.iY=s.iHeight-margins.iBottom;
sl@0
  1469
	
sl@0
  1470
	textRect = screenDevice->TwipsToPixels(textRect);  //defect 131765, call the same func as paginator
sl@0
  1471
	TInt pageHeight =  textRect.Height();
sl@0
  1472
	_LIT(KDummyString,"AAAAAA");
sl@0
  1473
	InitializeL();
sl@0
  1474
	AddTextL(KDummyString);
sl@0
  1475
	TInt lineHeight = 0;
sl@0
  1476
	CParaFormat* paraFormat = CParaFormat::NewL();
sl@0
  1477
	iEtext->GetParagraphFormatL(paraFormat,0);
sl@0
  1478
	TBool pageBreakChar = EFalse;
sl@0
  1479
	TInt docPos = 0;
sl@0
  1480
	iLayout->FormatLineL(paraFormat,docPos,lineHeight,pageBreakChar);
sl@0
  1481
sl@0
  1482
sl@0
  1483
	TInt numLines = pageHeight/lineHeight; // Number of lines expected on a page with paginator settings defined above and line height = 21
sl@0
  1484
	TChar simpleChar('A');
sl@0
  1485
	TBuf<200> string1;
sl@0
  1486
	for (TInt i = 0; i < numLines-2; i++) // ...numlines - 1
sl@0
  1487
		{
sl@0
  1488
		string1.Append(simpleChar);
sl@0
  1489
		string1.Append(CEditableText::EParagraphDelimiter);
sl@0
  1490
		}
sl@0
  1491
		string1.Append(simpleChar); // final line
sl@0
  1492
	TBuf<200> string2;
sl@0
  1493
	for (TInt i = 0; i < numLines-1; i++) // ...numlines
sl@0
  1494
		{
sl@0
  1495
		string2.Append(simpleChar);
sl@0
  1496
		string2.Append(CEditableText::EParagraphDelimiter);
sl@0
  1497
		}
sl@0
  1498
		string2.Append(simpleChar); // final line
sl@0
  1499
	TBuf<200> string3;
sl@0
  1500
	for (TInt i = 0; i < numLines; i++) // ...numlines + 1
sl@0
  1501
		{
sl@0
  1502
		string3.Append(simpleChar);
sl@0
  1503
		string3.Append(CEditableText::EParagraphDelimiter);
sl@0
  1504
		}
sl@0
  1505
		string3.Append(simpleChar); // final line
sl@0
  1506
sl@0
  1507
	InitializeL();
sl@0
  1508
	AddTextL(string1);
sl@0
  1509
	paginator1->SetDocumentL(iEtext);
sl@0
  1510
	docPos=0;
sl@0
  1511
	paginator1->AppendTextL(docPos);
sl@0
  1512
	TInt numPages=paginator1->PaginationCompletedL();
sl@0
  1513
	test(numPages==1);
sl@0
  1514
	InitializeL();
sl@0
  1515
	AddTextL(string2);
sl@0
  1516
	paginator2->SetDocumentL(iEtext);
sl@0
  1517
	docPos=0;
sl@0
  1518
	paginator2->AppendTextL(docPos);
sl@0
  1519
	numPages=paginator2->PaginationCompletedL();
sl@0
  1520
	test(numPages==1);
sl@0
  1521
	InitializeL();
sl@0
  1522
	AddTextL(string3);
sl@0
  1523
	paginator3->SetDocumentL(iEtext);
sl@0
  1524
	docPos=0;
sl@0
  1525
	paginator3->AppendTextL(docPos);
sl@0
  1526
	numPages=paginator3->PaginationCompletedL();
sl@0
  1527
	test(numPages==2);
sl@0
  1528
sl@0
  1529
	delete charsPerPage1;
sl@0
  1530
	delete charsPerPage2;
sl@0
  1531
	delete charsPerPage3;
sl@0
  1532
	delete screenDevice;
sl@0
  1533
	delete paraFormat;
sl@0
  1534
	Destroy();
sl@0
  1535
	}
sl@0
  1536
sl@0
  1537
/**
sl@0
  1538
@SYMTestCaseID          SYSLIB-FORM-UT-4002
sl@0
  1539
@SYMTestCaseDesc	    Test to ensure the CTextView::SetSelectionVisibilityL will not panic when EFTextVisible
sl@0
  1540
						is set off.
sl@0
  1541
@SYMTestPriority 	    Normal
sl@0
  1542
@SYMTestActions  	    Create a CTextView instance with EFTextVisible set off. Call SetSelectionVisibilityL(ETrue)
sl@0
  1543
						and SetSelectionVisibilityL(EFalse).
sl@0
  1544
@SYMTestExpectedResults	Given conditions in test actions, calling SetSelectionVisibilityL should not panic.
sl@0
  1545
@SYMDEF                 PDEF113755
sl@0
  1546
*/
sl@0
  1547
void CTextViewTest::TestForPDEF113755L()
sl@0
  1548
	{
sl@0
  1549
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-4002 Testing fix for PDEF113755 "));
sl@0
  1550
	InitializeL();
sl@0
  1551
sl@0
  1552
	TCursorSelection selection(0,8); // length of selection must be >0
sl@0
  1553
	iView->SetSelectionL(selection);
sl@0
  1554
sl@0
  1555
	iView->MakeVisible(ETrue);	//Test if the EFSelectionVisible flag is set correctly
sl@0
  1556
	iView->SetSelectionVisibilityL(ETrue);
sl@0
  1557
	test(iView->SelectionVisible());
sl@0
  1558
	iView->SetSelectionVisibilityL(EFalse);
sl@0
  1559
	test(!iView->SelectionVisible());
sl@0
  1560
sl@0
  1561
	iView->MakeVisible(EFalse);
sl@0
  1562
	iView->SetSelectionVisibilityL(ETrue); //Should never panic form::1200 here
sl@0
  1563
	iView->SetSelectionVisibilityL(EFalse);
sl@0
  1564
sl@0
  1565
	Destroy();
sl@0
  1566
	}
sl@0
  1567
sl@0
  1568
/**
sl@0
  1569
@SYMTestCaseID          SYSLIB-FORM-UT-4004
sl@0
  1570
@SYMTestCaseDesc	    Test for INC113143, to ensure CTextLayout::GetLineRectL returns the correct rectangle
sl@0
  1571
						regarding the writting direction of text. Depend on Platform: WINSCW/H4/H6(DEF131765).
sl@0
  1572
@SYMTestPriority 	    Normal
sl@0
  1573
@SYMTestActions  	    Tested 16 scenarios that the CTextLayout::GetLineRectL could be call, also tested for
sl@0
  1574
						edge cases such as 1 char, whole line, DocPos2 < DocPos1, etc..
sl@0
  1575
@SYMTestExpectedResults CTextLayout::GetLineRectL should return expected rectangles.
sl@0
  1576
@SYMDEF                 PDEF115165
sl@0
  1577
*/
sl@0
  1578
void CTextViewTest::TestForPDEF115165L()
sl@0
  1579
	{
sl@0
  1580
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-4004 Testing fix for PDEF115165 "));
sl@0
  1581
	InitializeL();
sl@0
  1582
sl@0
  1583
	TCharFormat charFormat = TCharFormat(_L("Arial"),100);
sl@0
  1584
	TCharFormatMask charFormatMask;
sl@0
  1585
	charFormatMask.SetAll();
sl@0
  1586
	iCharLayer->SetL(charFormat, charFormatMask);
sl@0
  1587
	iEtext->SetGlobalCharFormat(iCharLayer);
sl@0
  1588
	_LIT(KLtoRChar,"a");
sl@0
  1589
	_LIT(KRtoLChar,"\x6B2");
sl@0
  1590
	_LIT(KLtoRText,"aaa");
sl@0
  1591
	_LIT(KRtoLText,"\x6B2\x6B2\x6B2");
sl@0
  1592
	_LIT(KParaSep, "\x2029");
sl@0
  1593
sl@0
  1594
	TRect rect;
sl@0
  1595
sl@0
  1596
//  Test for 16 scenarios of Bidi texts..
sl@0
  1597
//	Sample text for test
sl@0
  1598
//	Doc_Pos:    | 0| 1| 2| 5| 4| 3| 6| 7| 8|11|10| 9|
sl@0
  1599
//	X-Coords:  |0| 5|10|15|20|25|30|35|40|45|50|55|60|  in case w=5
sl@0
  1600
sl@0
  1601
	iEtext->Reset();
sl@0
  1602
	iEtext->InsertL(0,KLtoRText);
sl@0
  1603
	iEtext->InsertL(iEtext->DocumentLength(),KRtoLText);
sl@0
  1604
	iEtext->InsertL(iEtext->DocumentLength(),KLtoRText);
sl@0
  1605
	iEtext->InsertL(iEtext->DocumentLength(),KRtoLText);
sl@0
  1606
	iEtext->InsertL(iEtext->DocumentLength(),KParaSep);
sl@0
  1607
	iView->FormatTextL();
sl@0
  1608
sl@0
  1609
	TPoint point1,point2;
sl@0
  1610
	iLayout->DocPosToXyPosL(0,point1);
sl@0
  1611
	iLayout->DocPosToXyPosL(1,point2);
sl@0
  1612
sl@0
  1613
	TInt wLTR = point2.iX - point1.iX;		//It depends on platform. WINSCW/H4 w=5; H6 w=4
sl@0
  1614
	
sl@0
  1615
	iLayout->DocPosToXyPosL(5,point1);
sl@0
  1616
	iLayout->DocPosToXyPosL(4,point2);
sl@0
  1617
	TInt wRTL = point2.iX - point1.iX;        //It depends on platform. WINSCW/H4 w=5; H6 w=4
sl@0
  1618
	RDebug::Print(_L("wLTR %d,wRTL %d"), wLTR,wRTL);
sl@0
  1619
sl@0
  1620
	//  DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL
sl@0
  1621
    rect = iLayout->GetLineRectL(0,2);
sl@0
  1622
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1623
    test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR);
sl@0
  1624
sl@0
  1625
    //  DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL
sl@0
  1626
    rect = iLayout->GetLineRectL(0,4);
sl@0
  1627
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1628
    test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + 2*wRTL);
sl@0
  1629
sl@0
  1630
    //  DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR
sl@0
  1631
    rect = iLayout->GetLineRectL(0,5);
sl@0
  1632
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1633
    test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + wRTL);
sl@0
  1634
    
sl@0
  1635
    //	DocPos1 is LTR, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR
sl@0
  1636
	rect = iLayout->GetLineRectL(0,7);
sl@0
  1637
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1638
	test(rect.iTl.iX == 0 && rect.iBr.iX == 3*wLTR + 3*wRTL + 2*wLTR);
sl@0
  1639
	
sl@0
  1640
//	DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR
sl@0
  1641
	rect = iLayout->GetLineRectL(2,7);
sl@0
  1642
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1643
	test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 3*wRTL + 2*wLTR);
sl@0
  1644
sl@0
  1645
//	DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL
sl@0
  1646
	rect = iLayout->GetLineRectL(2,8);
sl@0
  1647
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1648
	test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 3*wRTL + 3*wLTR);
sl@0
  1649
sl@0
  1650
//	DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR
sl@0
  1651
	rect = iLayout->GetLineRectL(2,5);
sl@0
  1652
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1653
	test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + wRTL);
sl@0
  1654
sl@0
  1655
//	DocPos1 is LTR, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL
sl@0
  1656
	rect = iLayout->GetLineRectL(2,4);
sl@0
  1657
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1658
	test(rect.iTl.iX == 2*wLTR && rect.iBr.iX == 3*wLTR + 2*wRTL);
sl@0
  1659
sl@0
  1660
//	Sample text for test
sl@0
  1661
//	Doc_Pos:     | 9|10|11| 8| 7| 6| 3| 4| 5| 2| 1| 0|
sl@0
  1662
//	X-Coords:  |40|45|50|55|60|65|70|75|80|85|90|95|100|     in case w=5
sl@0
  1663
sl@0
  1664
	iEtext->Reset();
sl@0
  1665
	iEtext->InsertL(0,KRtoLText);
sl@0
  1666
	iEtext->InsertL(iEtext->DocumentLength(),KLtoRText);
sl@0
  1667
	iEtext->InsertL(iEtext->DocumentLength(),KRtoLText);
sl@0
  1668
	iEtext->InsertL(iEtext->DocumentLength(),KLtoRText);
sl@0
  1669
	iEtext->InsertL(iEtext->DocumentLength(),KParaSep);
sl@0
  1670
	iView->FormatTextL();
sl@0
  1671
	
sl@0
  1672
//	DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is LTR
sl@0
  1673
	rect = iLayout->GetLineRectL(2,4);
sl@0
  1674
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1675
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 2*wLTR && rect.iBr.iX == iWindowRect.Width() - 2*wRTL);
sl@0
  1676
			
sl@0
  1677
//	DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is LTR, DocPos2+1 is RTL
sl@0
  1678
	rect = iLayout->GetLineRectL(2,5);
sl@0
  1679
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1680
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - wLTR && rect.iBr.iX == iWindowRect.Width() - 2*wRTL);
sl@0
  1681
sl@0
  1682
//	DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is LTR
sl@0
  1683
	rect = iLayout->GetLineRectL(2,8);
sl@0
  1684
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1685
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 3*wRTL && rect.iBr.iX == iWindowRect.Width() - 2*wRTL);
sl@0
  1686
sl@0
  1687
//	DocPos1 is RTL, DocPos1+1 is LTR, DocPos2 is RTL, DocPos2+1 is RTL
sl@0
  1688
	rect = iLayout->GetLineRectL(2,7);
sl@0
  1689
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1690
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 2*wRTL && rect.iBr.iX == iWindowRect.Width() - 2*wRTL);
sl@0
  1691
sl@0
  1692
//	DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is LTR
sl@0
  1693
	rect = iLayout->GetLineRectL(0,4);
sl@0
  1694
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1695
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 2*wLTR && rect.iBr.iX == 100);
sl@0
  1696
sl@0
  1697
//	DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is LTR, DocPos2+1 is RTL
sl@0
  1698
	rect = iLayout->GetLineRectL(0,5);
sl@0
  1699
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1700
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - wLTR && rect.iBr.iX == 100);
sl@0
  1701
sl@0
  1702
//	DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is LTR
sl@0
  1703
	rect = iLayout->GetLineRectL(0,8);
sl@0
  1704
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1705
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 3*wRTL && rect.iBr.iX == 100);
sl@0
  1706
sl@0
  1707
//	DocPos1 is RTL, DocPos1+1 is RTL, DocPos2 is RTL, DocPos2+1 is RTL
sl@0
  1708
	rect = iLayout->GetLineRectL(0,7);
sl@0
  1709
	RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);	
sl@0
  1710
	test(rect.iTl.iX == iWindowRect.Width() - 3*wRTL - 3*wLTR - 2*wRTL && rect.iBr.iX == 100);
sl@0
  1711
	
sl@0
  1712
sl@0
  1713
	
sl@0
  1714
//	Edge case tests
sl@0
  1715
//	Sample text
sl@0
  1716
//	1st Line:    | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|19|18|17|16|15|14|13|12|
sl@0
  1717
//	X-Coords:  | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100|   in case w=5
sl@0
  1718
//	2nd Line:    |23|22|21|20|
sl@0
  1719
	
sl@0
  1720
//	Edge case tests
sl@0
  1721
//	Sample text
sl@0
  1722
//	1st Line:    | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|24|23|22|21|20|19|18|17|16|15|
sl@0
  1723
//	X-Coords:  | 0| 4| 8|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100|  w=4
sl@0
  1724
//	2nd Line:    |29|28|27|26|25|24|23|22|21|20|
sl@0
  1725
	
sl@0
  1726
	TInt LtoRLength = (iWindowRect.Width() - 5*wRTL)/wLTR;
sl@0
  1727
	TInt RtoLLength = 10;
sl@0
  1728
	TInt RtoLinLine1= (iWindowRect.Width() - LtoRLength * wLTR)/wRTL;
sl@0
  1729
	TInt Line2Start = LtoRLength + RtoLinLine1;
sl@0
  1730
	
sl@0
  1731
	iEtext->Reset();
sl@0
  1732
	for(TInt i=0;i<LtoRLength;i++)
sl@0
  1733
        {
sl@0
  1734
        iEtext->InsertL(iEtext->DocumentLength(),KLtoRChar);
sl@0
  1735
        }
sl@0
  1736
	
sl@0
  1737
	for(TInt i=0;i<RtoLLength;i++)
sl@0
  1738
	    {
sl@0
  1739
	    iEtext->InsertL(iEtext->DocumentLength(),KRtoLChar);
sl@0
  1740
	    }	
sl@0
  1741
	iEtext->InsertL(iEtext->DocumentLength(),KParaSep);
sl@0
  1742
	iView->FormatTextL();
sl@0
  1743
sl@0
  1744
    for(TInt i=0;i<LtoRLength + RtoLLength;i++)
sl@0
  1745
    {
sl@0
  1746
        rect = iLayout->GetLineRectL(i,i+1);
sl@0
  1747
        RDebug::Print(_L("%d: iTl.iX %d,iY %d, iBr.iX %d,iY %d"), i,rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1748
    }          
sl@0
  1749
    
sl@0
  1750
    rect = iLayout->GetLineRectL(0,LtoRLength);
sl@0
  1751
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1752
    test(rect.iTl.iX == 0 && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL ); //Line 1
sl@0
  1753
  
sl@0
  1754
    rect = iLayout->GetLineRectL(Line2Start, LtoRLength + RtoLLength);
sl@0
  1755
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1756
    test(rect.iTl.iX == 0 && rect.iBr.iX == (RtoLLength - RtoLinLine1)*wRTL); //Line 2
sl@0
  1757
sl@0
  1758
    rect = iLayout->GetLineRectL(0,0);
sl@0
  1759
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1760
    test(rect.iTl.iX == 0 && rect.iBr.iX == wLTR); //first char
sl@0
  1761
    
sl@0
  1762
    //firt char of RTL
sl@0
  1763
    rect = iLayout->GetLineRectL(LtoRLength,LtoRLength);
sl@0
  1764
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1765
    test(rect.iTl.iX == LtoRLength*wLTR + (RtoLinLine1-1)*wRTL && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); //end of line 1
sl@0
  1766
sl@0
  1767
    //middle of L to R
sl@0
  1768
    rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength/2);
sl@0
  1769
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1770
    test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == (LtoRLength/2+1) * wLTR);
sl@0
  1771
      
sl@0
  1772
    //middle of LTR to first of RTL
sl@0
  1773
    rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength);
sl@0
  1774
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1775
    test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL);
sl@0
  1776
 
sl@0
  1777
    //second of RTL to start of 2nd line ??
sl@0
  1778
    rect = iLayout->GetLineRectL(LtoRLength+1,Line2Start);
sl@0
  1779
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1780
    test(rect.iTl.iX == LtoRLength*wLTR + (RtoLinLine1-1)*wRTL && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL); //end of line 1
sl@0
  1781
  
sl@0
  1782
    //middle of L to R
sl@0
  1783
    rect = iLayout->GetLineRectL(LtoRLength/2,LtoRLength/2-1);
sl@0
  1784
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);    
sl@0
  1785
    test(rect.iTl.iX == LtoRLength/2 * wLTR && rect.iBr.iX == LtoRLength*wLTR + RtoLinLine1*wRTL);
sl@0
  1786
    
sl@0
  1787
		
sl@0
  1788
//	Test for edge cases while two lines are in different direction
sl@0
  1789
//	Sample text
sl@0
  1790
//	1st Line:    | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|
sl@0
  1791
//	X-Coords:  | 0| 5|10|15|20|25|30|35|40|45|50|55|60|65|70|75|80|85|90|95|100|  in case w=5
sl@0
  1792
//	2nd Line:    |39|38|37|36|35|34|33|32|31|30|29|28|27|26|25|24|23|22|21|20|
sl@0
  1793
		
sl@0
  1794
//	Test for edge cases while two lines are in different direction
sl@0
  1795
//  Sample text
sl@0
  1796
//	1st Line:    | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|
sl@0
  1797
//	X-Coords:  | 0| 4| 8| 12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96|100|  w=4
sl@0
  1798
//	2nd Line:    |49|48|47|46|45|44|43|42|41|40|39|38|37|36|35|34|33|32|31|30|29|28|27|26|25|
sl@0
  1799
    
sl@0
  1800
    LtoRLength = iWindowRect.Width()/wLTR;
sl@0
  1801
    RtoLLength = iWindowRect.Width()/wRTL;
sl@0
  1802
        
sl@0
  1803
    iEtext->Reset();
sl@0
  1804
    for(TInt i=0;i<LtoRLength;i++)
sl@0
  1805
        {
sl@0
  1806
        iEtext->InsertL(iEtext->DocumentLength(),KLtoRChar);
sl@0
  1807
        }
sl@0
  1808
    
sl@0
  1809
    for(TInt i=0;i<RtoLLength;i++)
sl@0
  1810
        {
sl@0
  1811
        iEtext->InsertL(iEtext->DocumentLength(),KRtoLChar);
sl@0
  1812
        }       
sl@0
  1813
	iEtext->InsertL(iEtext->DocumentLength(),KParaSep);
sl@0
  1814
	iView->FormatTextL();
sl@0
  1815
sl@0
  1816
    for(TInt i=0;i<LtoRLength + RtoLLength;i++)
sl@0
  1817
    {
sl@0
  1818
        rect = iLayout->GetLineRectL(i,i+1);
sl@0
  1819
        RDebug::Print(_L("%d: iTl.iX %d,iY %d, iBr.iX %d,iY %d"), i,rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1820
    }  
sl@0
  1821
 
sl@0
  1822
    
sl@0
  1823
    //1st line
sl@0
  1824
    rect = iLayout->GetLineRectL(3, LtoRLength-1);
sl@0
  1825
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1826
    test(rect.iTl.iX == 3*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2
sl@0
  1827
sl@0
  1828
    //2nd line
sl@0
  1829
    rect = iLayout->GetLineRectL(LtoRLength,LtoRLength + RtoLLength -2);
sl@0
  1830
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1831
    test(rect.iTl.iX == wRTL && rect.iBr.iX == RtoLLength*wRTL); //Line 2
sl@0
  1832
sl@0
  1833
    //end of 1st line
sl@0
  1834
    rect = iLayout->GetLineRectL(LtoRLength-1, LtoRLength-1);
sl@0
  1835
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1836
    test(rect.iTl.iX == (LtoRLength-1)*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2
sl@0
  1837
sl@0
  1838
    //start of 2nd line
sl@0
  1839
    rect = iLayout->GetLineRectL(LtoRLength, LtoRLength);
sl@0
  1840
    RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1841
    test(rect.iTl.iX == (RtoLLength-1)*wRTL && rect.iBr.iX == RtoLLength*wRTL); //Line 2
sl@0
  1842
sl@0
  1843
     //1st line to 2nd line
sl@0
  1844
     rect = iLayout->GetLineRectL(LtoRLength-1, LtoRLength);
sl@0
  1845
     RDebug::Print(_L("iTl.iX %d,iY %d, iBr.iX %d,iY %d"), rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
sl@0
  1846
     test(rect.iTl.iX == (LtoRLength-1)*wLTR && rect.iBr.iX == LtoRLength*wLTR); //Line 2
sl@0
  1847
sl@0
  1848
sl@0
  1849
	}
sl@0
  1850
sl@0
  1851
/**
sl@0
  1852
@SYMTestCaseID          SYSLIB-FORM-UT-4007
sl@0
  1853
@SYMTestCaseDesc	    Test for PDEF118443
sl@0
  1854
@SYMTestPriority 	    Normal
sl@0
  1855
@SYMTestActions			Use test cases in form of "text + ZWJ + non-text characters", format the line,
sl@0
  1856
 						then use CTmTextLayout::FindAdjacentChunks() to find text Chunks surrounding
sl@0
  1857
 						the ZWJ. then verify if the text is broken at the correct place.
sl@0
  1858
@SYMTestExpectedResults CTmTextLayout::FindAdjacentChunks() should return:
sl@0
  1859
						- Left chunk = "text + ZWJ",
sl@0
  1860
						- Right chunk = "non-text characters".
sl@0
  1861
@SYMDEF                 PDEF118443
sl@0
  1862
*/
sl@0
  1863
void CTextViewTest::TestForPDEF118443L()
sl@0
  1864
	{
sl@0
  1865
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-4007 Testing fix for PDEF118443 "));
sl@0
  1866
	InitializeL();
sl@0
  1867
sl@0
  1868
	TCharFormat charFormat = TCharFormat(_L("ClearlyU"),10);
sl@0
  1869
	TCharFormatMask charFormatMask;
sl@0
  1870
	charFormatMask.SetAll();
sl@0
  1871
	iCharLayer->SetL(charFormat, charFormatMask);
sl@0
  1872
	iEtext->SetGlobalCharFormat(iCharLayer);
sl@0
  1873
sl@0
  1874
	// Note: a 'W' is added at the front to make the text chunk have side-bearings, so that it won't be amalgamated
sl@0
  1875
	// with the following chunk. This is to make the test case be as same as the original use case that caused the defect.
sl@0
  1876
	_LIT(KScriptEndWithZWJ,"W\x0931\x094d\x200d");	// Scripte end with ZWJ (a 'W' in the front)
sl@0
  1877
	_LIT(KTextTestCase0,"\x2029");	// Paragraph seperator (Bidi Category: B)
sl@0
  1878
	_LIT(KTextTestCase1,"0");		// Digit 0 (Bidi Category: EN)
sl@0
  1879
	_LIT(KTextTestCase2,"+");		// Plus sign (Bidi Category: ES)
sl@0
  1880
	_LIT(KTextTestCase3,"\u00A3");		// Pound symbol (Bidi Category: ET)
sl@0
  1881
	_LIT(KTextTestCase4,".");		// Period (Bidi Category: CS)
sl@0
  1882
	_LIT(KTextTestCase5,"\x0009");	// Tab (Bidi Category: S)
sl@0
  1883
	_LIT(KTextTestCase6,"\x0020");	// Space (Bidi Category: WS)
sl@0
  1884
	_LIT(KTextTestCase7,"\x000C");	// Form feed (Bidi Category: WS)
sl@0
  1885
	_LIT(KTextTestCase8,"\x2028");	// Line breaker (Bidi Category: WS)
sl@0
  1886
sl@0
  1887
	TTmDocPosSpec pos(4, TTmDocPosSpec::ETrailing);
sl@0
  1888
	CTmTextLayout::TTmChunkDescription left;
sl@0
  1889
	CTmTextLayout::TTmChunkDescription right;
sl@0
  1890
sl@0
  1891
	// Test case 0: ZWJ + Paragraph seperater
sl@0
  1892
	iEtext->Reset();
sl@0
  1893
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1894
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase0);
sl@0
  1895
	iView->FormatTextL();
sl@0
  1896
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1897
	test(left.iStart == 0);
sl@0
  1898
	test(left.iEnd == 4);
sl@0
  1899
	test(left.iRightToLeft == EFalse);
sl@0
  1900
	test(right.iStart == 4);
sl@0
  1901
	test(right.iRightToLeft == EFalse);
sl@0
  1902
sl@0
  1903
	// Test case 1: ZWJ + Digit '0'
sl@0
  1904
	iEtext->Reset();
sl@0
  1905
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1906
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase1);
sl@0
  1907
	iView->FormatTextL();
sl@0
  1908
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1909
	test(left.iStart == 0);
sl@0
  1910
	test(left.iEnd == 4);
sl@0
  1911
	test(left.iRightToLeft == EFalse);
sl@0
  1912
	test(right.iStart == 4);
sl@0
  1913
	test(right.iRightToLeft == EFalse);
sl@0
  1914
sl@0
  1915
	// Test case 2: ZWJ + Plus sign '+'
sl@0
  1916
	iEtext->Reset();
sl@0
  1917
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1918
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase2);
sl@0
  1919
	iView->FormatTextL();
sl@0
  1920
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1921
	test(left.iStart == 0);
sl@0
  1922
	test(left.iEnd == 4);
sl@0
  1923
	test(left.iRightToLeft == EFalse);
sl@0
  1924
	test(right.iStart == 4);
sl@0
  1925
	test(right.iRightToLeft == EFalse);
sl@0
  1926
sl@0
  1927
	// Test case 3: ZWJ + Pound symbol '??'
sl@0
  1928
	iEtext->Reset();
sl@0
  1929
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1930
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase3);
sl@0
  1931
	iView->FormatTextL();
sl@0
  1932
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1933
	test(left.iStart == 0);
sl@0
  1934
	test(left.iEnd == 4);
sl@0
  1935
	test(left.iRightToLeft == EFalse);
sl@0
  1936
	test(right.iStart == 4);
sl@0
  1937
	test(right.iRightToLeft == EFalse);
sl@0
  1938
sl@0
  1939
	// Test case 0: ZWJ + Period '.'
sl@0
  1940
	iEtext->Reset();
sl@0
  1941
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1942
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase4);
sl@0
  1943
	iView->FormatTextL();
sl@0
  1944
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1945
	test(left.iStart == 0);
sl@0
  1946
	test(left.iEnd == 4);
sl@0
  1947
	test(left.iRightToLeft == EFalse);
sl@0
  1948
	test(right.iStart == 4);
sl@0
  1949
	test(right.iRightToLeft == EFalse);
sl@0
  1950
sl@0
  1951
	// Test case 0: ZWJ + Tab Character
sl@0
  1952
	iEtext->Reset();
sl@0
  1953
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1954
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase5);
sl@0
  1955
	iView->FormatTextL();
sl@0
  1956
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1957
	test(left.iStart == 0);
sl@0
  1958
	test(left.iEnd == 4);
sl@0
  1959
	test(left.iRightToLeft == EFalse);
sl@0
  1960
	test(right.iStart == 4);
sl@0
  1961
	test(right.iRightToLeft == EFalse);
sl@0
  1962
sl@0
  1963
	// Test case 0: ZWJ + Space
sl@0
  1964
	iEtext->Reset();
sl@0
  1965
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1966
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase6);
sl@0
  1967
	iView->FormatTextL();
sl@0
  1968
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1969
	test(left.iStart == 0);
sl@0
  1970
	test(left.iEnd == 4);
sl@0
  1971
	test(left.iRightToLeft == EFalse);
sl@0
  1972
	test(right.iStart == 4);
sl@0
  1973
	test(right.iRightToLeft == EFalse);
sl@0
  1974
sl@0
  1975
	// Test case 0: ZWJ + Form feed
sl@0
  1976
	iEtext->Reset();
sl@0
  1977
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1978
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase7);
sl@0
  1979
	iView->FormatTextL();
sl@0
  1980
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1981
	test(left.iStart == 0);
sl@0
  1982
	test(left.iEnd == 4);
sl@0
  1983
	test(left.iRightToLeft == EFalse);
sl@0
  1984
	test(right.iStart == 4);
sl@0
  1985
	test(right.iRightToLeft == EFalse);
sl@0
  1986
sl@0
  1987
	// Test case 0: ZWJ + Line breaker
sl@0
  1988
	iEtext->Reset();
sl@0
  1989
	iEtext->InsertL(0,KScriptEndWithZWJ);
sl@0
  1990
	iEtext->InsertL(iEtext->DocumentLength(),KTextTestCase8);
sl@0
  1991
	iView->FormatTextL();
sl@0
  1992
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  1993
	test(left.iStart == 0);
sl@0
  1994
	test(left.iEnd == 4);
sl@0
  1995
	test(left.iRightToLeft == EFalse);
sl@0
  1996
	test(right.iStart == 4);
sl@0
  1997
	test(right.iRightToLeft == EFalse);
sl@0
  1998
sl@0
  1999
	Destroy();
sl@0
  2000
	}
sl@0
  2001
sl@0
  2002
/**
sl@0
  2003
@SYMTestCaseID          SYSLIB-FORM-UT-4016
sl@0
  2004
@SYMTestCaseDesc        Testing the fix for PDEF121798 Printing: Email is printed only two pages 
sl@0
  2005
@SYMTestPriority        Medium
sl@0
  2006
@SYMTestActions         Paginates random amounts of text and checks whether the correct number of pages are returned from pagination.
sl@0
  2007
@SYMTestExpectedResults The amount of pages produced by the paginator should match the expected number of pages based on lines of text, page size, etc.
sl@0
  2008
@SYMDEF                 PDEF121798
sl@0
  2009
*/
sl@0
  2010
void CTextViewTest::TestForPDEF121798L()
sl@0
  2011
	{
sl@0
  2012
	test.Next(_L("Testing fix for PDEF121798"));
sl@0
  2013
	CTestScreenDevice* screenDevice = new(ELeave) CTestScreenDevice(iEnv.ScreenDevice(),iWindow);
sl@0
  2014
		
sl@0
  2015
	TMargins margins;
sl@0
  2016
	margins.iTop = 1440;
sl@0
  2017
	margins.iBottom = 1440;
sl@0
  2018
	margins.iLeft = 1440;
sl@0
  2019
	margins.iRight = 1440;
sl@0
  2020
	TSize s(11906,16838);
sl@0
  2021
	TPageSpec p(TPageSpec::EPortrait, s);
sl@0
  2022
		
sl@0
  2023
	// We need to find out the height of lines and print area of the page.
sl@0
  2024
	// From this we determine how many lines *should* appear on the page.
sl@0
  2025
	// This differs between devices(ie. hw and winscw).
sl@0
  2026
	TInt pageHeight = screenDevice->VerticalTwipsToPixels(s.iHeight - margins.iTop - margins.iBottom);
sl@0
  2027
	_LIT(KDummyString,"this is used by dummy paginator to find out line height and page size");
sl@0
  2028
	InitializeL();
sl@0
  2029
	AddTextL(KDummyString);
sl@0
  2030
	TInt lineHeight = 0;	
sl@0
  2031
	CParaFormat* paraFormat = CParaFormat::NewL();
sl@0
  2032
	iEtext->GetParagraphFormatL(paraFormat,0);
sl@0
  2033
	TBool pageBreakChar = EFalse;
sl@0
  2034
	TInt docPos = 0;
sl@0
  2035
	iLayout->FormatLineL(paraFormat,docPos,lineHeight,pageBreakChar);
sl@0
  2036
	
sl@0
  2037
	CArrayFixFlat<TInt>* charsPerPage = new(ELeave) CArrayFixFlat<TInt>(KGranularity);
sl@0
  2038
	TInt numLines = pageHeight/lineHeight; // Number of lines expected on a page with paginator settings defined above and line height.
sl@0
  2039
	
sl@0
  2040
	
sl@0
  2041
	
sl@0
  2042
	// Perform 50 random pagination tests.
sl@0
  2043
	for(TInt numTests = 0; numTests < 50; numTests++)
sl@0
  2044
		{
sl@0
  2045
		// Generate the number of lines in this document.
sl@0
  2046
		TBuf<512> testString;
sl@0
  2047
		TInt randomNum = (Math::Random() % 512);
sl@0
  2048
		// Calculate the expected number of pages based on page size and line height
sl@0
  2049
		TInt expectedPages = randomNum/numLines;
sl@0
  2050
		// If it's not an exact fit there will be another page lost in the integer division.
sl@0
  2051
		if ((numLines * expectedPages != randomNum) || randomNum == 0)
sl@0
  2052
			{
sl@0
  2053
			++expectedPages;
sl@0
  2054
			}
sl@0
  2055
		// Append the random number of lines to the test string
sl@0
  2056
		for (TInt i = 0; i < randomNum-1; i++) // randomNum -1 because we add a character after the loop.
sl@0
  2057
			{
sl@0
  2058
			// Empty lines will do.
sl@0
  2059
			testString.Append(CEditableText::EParagraphDelimiter);
sl@0
  2060
			}
sl@0
  2061
		// End the text with a character rather than a paragraph delim.
sl@0
  2062
		testString.Append(_L("A"));
sl@0
  2063
		
sl@0
  2064
		
sl@0
  2065
		InitializeL();
sl@0
  2066
		AddTextL(testString);
sl@0
  2067
		// Set up the paginator.
sl@0
  2068
		CTextPaginator* paginator = CTextPaginator::NewL(screenDevice, charsPerPage, KPaginatePriority);
sl@0
  2069
		paginator->SetPageMarginsInTwips(margins);
sl@0
  2070
		paginator->SetPageSpecInTwips(p);
sl@0
  2071
		paginator->SetDocumentL(iEtext);
sl@0
  2072
		docPos=0;
sl@0
  2073
		paginator->AppendTextL(docPos);
sl@0
  2074
		TInt numPages=paginator->PaginationCompletedL();
sl@0
  2075
		RDebug::Printf("%d lines: Expected %d pages, got %d pages", randomNum, expectedPages, numPages);
sl@0
  2076
		test(expectedPages == numPages);
sl@0
  2077
		delete paginator;
sl@0
  2078
		}
sl@0
  2079
	delete charsPerPage;
sl@0
  2080
	delete screenDevice;
sl@0
  2081
	delete paraFormat;
sl@0
  2082
	Destroy();
sl@0
  2083
	}
sl@0
  2084
sl@0
  2085
/**
sl@0
  2086
@SYMTestCaseID          SYSLIB-FORM-UT-4015
sl@0
  2087
@SYMTestCaseDesc	    Test for PDEF120239
sl@0
  2088
@SYMTestPriority 	    Normal
sl@0
  2089
@SYMTestActions			Use text consist of "LTR text + ZWJ + RTL Text", format the line, then:
sl@0
  2090
						1) use CTmTextLayout::FindAdjacentChunks() to find chunks around overlapped doc pos.
sl@0
  2091
						2) use CTextView::MoveCursorL to move cursor through out the line.
sl@0
  2092
@SYMTestExpectedResults 1) FindAdjacentChunks() returns correct chunks
sl@0
  2093
						2) Cursor should moves Left to Right and Right to Left correctly
sl@0
  2094
@SYMDEF                 PDEF120239
sl@0
  2095
*/
sl@0
  2096
void CTextViewTest::TestForPDEF120239L()
sl@0
  2097
	{
sl@0
  2098
	test.Next(_L("Testing fix for PDEF120239L"));
sl@0
  2099
	InitializeL();
sl@0
  2100
	
sl@0
  2101
	TCharFormat charFormat = TCharFormat(_L("NewTimes"),10);
sl@0
  2102
	TCharFormatMask charFormatMask;
sl@0
  2103
	charFormatMask.SetAll();
sl@0
  2104
	iCharLayer->SetL(charFormat, charFormatMask);
sl@0
  2105
	iEtext->SetGlobalCharFormat(iCharLayer);
sl@0
  2106
 	
sl@0
  2107
	_LIT(KTestScript,"\x0931\x094d\x200d\x684");	// Test script (LTR text + ZWJ + RTL Text)
sl@0
  2108
	
sl@0
  2109
	iEtext->Reset();
sl@0
  2110
	iEtext->InsertL(0,KTestScript);
sl@0
  2111
	iView->FormatTextL();
sl@0
  2112
	
sl@0
  2113
	// 1) use CTmTextLayout::FindAdjacentChunks()
sl@0
  2114
	CTmTextLayout::TTmChunkDescription left;
sl@0
  2115
	CTmTextLayout::TTmChunkDescription right;
sl@0
  2116
	
sl@0
  2117
	TTmDocPosSpec pos(3, TTmDocPosSpec::ETrailing);
sl@0
  2118
sl@0
  2119
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  2120
	test(left.iStart == 0);
sl@0
  2121
	test(left.iEnd == 3);
sl@0
  2122
	test(!left.iRightToLeft);
sl@0
  2123
	test(right.iStart == 2);
sl@0
  2124
	test(right.iEnd == 4);
sl@0
  2125
	test(right.iRightToLeft);
sl@0
  2126
	
sl@0
  2127
	pos.iPos = 2;
sl@0
  2128
	pos.iType = TTmDocPosSpec::ELeading;
sl@0
  2129
	
sl@0
  2130
	iLayout->TagmaTextLayout().FindAdjacentChunks(pos, left, right);
sl@0
  2131
	test(left.iStart == 2);
sl@0
  2132
	test(left.iEnd == 4);
sl@0
  2133
	test(left.iRightToLeft);
sl@0
  2134
	test(right.iStart == 4);
sl@0
  2135
	test(right.iEnd == 5);
sl@0
  2136
	test(!right.iRightToLeft);
sl@0
  2137
	
sl@0
  2138
	// 2) use CTextView::MoveCursorL to move cursor
sl@0
  2139
	TTmDocPos cursorPos;
sl@0
  2140
	TTmDocPos targetPos1 (0, ETrue);
sl@0
  2141
	TTmDocPos targetPos2 (0, EFalse);
sl@0
  2142
	TCursorPosition::TMovementType move = TCursorPosition::EFRight;
sl@0
  2143
	
sl@0
  2144
	TCursorSelection selection(0,0);
sl@0
  2145
	iView->SetSelectionL(selection);
sl@0
  2146
	iView->GetCursorPos(cursorPos);
sl@0
  2147
	test(cursorPos == targetPos1 || cursorPos == targetPos2);
sl@0
  2148
	
sl@0
  2149
	targetPos1.iPos = 3;
sl@0
  2150
	targetPos1.iLeadingEdge = EFalse;
sl@0
  2151
	targetPos2.iPos = 4;
sl@0
  2152
	targetPos2.iLeadingEdge = EFalse;
sl@0
  2153
	iView->MoveCursorL(move, EFalse);
sl@0
  2154
	iView->GetCursorPos(cursorPos);
sl@0
  2155
	test(cursorPos == targetPos1 || cursorPos == targetPos2);
sl@0
  2156
	
sl@0
  2157
	targetPos1.iPos = 2;
sl@0
  2158
	targetPos1.iLeadingEdge = ETrue;
sl@0
  2159
	targetPos2.iPos = 4;
sl@0
  2160
	targetPos2.iLeadingEdge = ETrue;
sl@0
  2161
	iView->MoveCursorL(move, EFalse);
sl@0
  2162
	iView->GetCursorPos(cursorPos);
sl@0
  2163
	test(cursorPos == targetPos1 || cursorPos == targetPos2);
sl@0
  2164
	
sl@0
  2165
	move = TCursorPosition::EFLeft;
sl@0
  2166
	
sl@0
  2167
	targetPos1.iPos = 3;
sl@0
  2168
	targetPos1.iLeadingEdge = EFalse;
sl@0
  2169
	targetPos2.iPos = 4;
sl@0
  2170
	targetPos2.iLeadingEdge = EFalse;
sl@0
  2171
	iView->MoveCursorL(move, EFalse);
sl@0
  2172
	iView->GetCursorPos(cursorPos);
sl@0
  2173
	test(cursorPos == targetPos1 || cursorPos == targetPos2);
sl@0
  2174
	
sl@0
  2175
	targetPos1.iPos = 0;
sl@0
  2176
	targetPos1.iLeadingEdge = EFalse;
sl@0
  2177
	targetPos2.iPos = 0;
sl@0
  2178
	targetPos2.iLeadingEdge = ETrue;
sl@0
  2179
	iView->MoveCursorL(move, EFalse);
sl@0
  2180
	iView->GetCursorPos(cursorPos);
sl@0
  2181
	test(cursorPos == targetPos1 || cursorPos == targetPos2);
sl@0
  2182
sl@0
  2183
	Destroy();
sl@0
  2184
	}
sl@0
  2185
sl@0
  2186
/**
sl@0
  2187
@SYMTestCaseID          SYSLIB-FORM-UT-4021
sl@0
  2188
@SYMTestCaseDesc	    Test for DEF124989, to ensure TFormAndEtextEditor::SetStyleHelperL has no 
sl@0
  2189
                        NULL-dereference issue.
sl@0
  2190
@SYMTestPriority 	    Normal
sl@0
  2191
@SYMTestActions  	    Call TFormAndEtextEditor::InsertTextL and pass in a style name which could 
sl@0
  2192
						not be found in styleList.Then a NULL is generated.
sl@0
  2193
@SYMTestExpectedResults No panic(KERN-EXEC 3) raised from this case.
sl@0
  2194
@SYMDEF                 DEF124989
sl@0
  2195
*/
sl@0
  2196
void CTextViewTest::TestForDEF124989L()
sl@0
  2197
	{
sl@0
  2198
	// Initialise CTextViewTest object for next test.
sl@0
  2199
	InitializeL();
sl@0
  2200
	test.Next(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-4021 Testing fix for DEF124989 "));
sl@0
  2201
sl@0
  2202
	// Insert a one line paragraph into EText object and reformat view.
sl@0
  2203
	_LIT(KTestParagraph, "This is a piece of text to test the character positioning API based in X,Y cocordinates.");
sl@0
  2204
	iEtext->InsertL(0, KTestParagraph);
sl@0
  2205
	
sl@0
  2206
	TFormAndEtextEditor newEditor(*iView,*iEtext);
sl@0
  2207
	
sl@0
  2208
	CStyleList* styleList = CStyleList::NewL();
sl@0
  2209
	CleanupStack::PushL(styleList);
sl@0
  2210
	RParagraphStyleInfo paraStyleInfo(NULL,NULL);
sl@0
  2211
sl@0
  2212
	// Appending the new style to stylelist
sl@0
  2213
	styleList->AppendL(&paraStyleInfo);
sl@0
  2214
	iEtext->SetStyleListExternallyOwned(*styleList);
sl@0
  2215
	
sl@0
  2216
	TPtrC ptr1(_L("Arial3"));
sl@0
  2217
	// Inserting the text and applying the style specified(Arial3) 
sl@0
  2218
	// which is not in syleList.  
sl@0
  2219
	newEditor.InsertTextL(0, _L("Hello World"),&ptr1);
sl@0
  2220
	
sl@0
  2221
	// Clean up test object
sl@0
  2222
	CleanupStack::PopAndDestroy();
sl@0
  2223
	Destroy();
sl@0
  2224
	}
sl@0
  2225
sl@0
  2226
/**
sl@0
  2227
@SYMTestCaseID                      SYSLIB-FORM-UT-4022
sl@0
  2228
@SYMTestCaseDesc	    Test for DEF124975
sl@0
  2229
@SYMTestPriority                       Normal
sl@0
  2230
@SYMTestActions                      1) Call CTextLayout::AdjustVerticalAlignment() when there is no content
sl@0
  2231
                                                   2) Add Some random text and then call CTextLayout::AdjustVerticalAlignment()@SYMTestExpectedResults       There should be no panic during the process
sl@0
  2232
@SYMDEF                                 DEF124975
sl@0
  2233
*/
sl@0
  2234
void CTextViewTest::TestForDEF124975L()
sl@0
  2235
	{
sl@0
  2236
	test.Next(_L(" @SYMTestCaseID: Testing fix for coverity DEF124975 "));
sl@0
  2237
	InitializeL();
sl@0
  2238
	
sl@0
  2239
	const TInt MaxTestCount = 50;
sl@0
  2240
	const TInt MaxStringCount = 100;
sl@0
  2241
	TInt TestCount = GetNumber(1, MaxTestCount);
sl@0
  2242
	TInt StringCount = GetNumber(1, MaxStringCount);
sl@0
  2243
	
sl@0
  2244
	for(TInt i=0; i<TestCount; i++)
sl@0
  2245
		{
sl@0
  2246
		iLayout->AdjustVerticalAlignment(CParaFormat::ECustomAlign);
sl@0
  2247
		}
sl@0
  2248
	
sl@0
  2249
	for(TInt i=0; i<TestCount; i++)
sl@0
  2250
		{
sl@0
  2251
		RBuf testString;
sl@0
  2252
		testString.Create(StringCount);
sl@0
  2253
		for(int i=0; i<testString.MaxLength(); i++)
sl@0
  2254
			{
sl@0
  2255
			TInt c = GetNumber(0, 0xffff);
sl@0
  2256
			while ( IsSurrogate(c) )
sl@0
  2257
			    c = GetNumber(0, 0xffff);
sl@0
  2258
			testString.Append( c );
sl@0
  2259
			}
sl@0
  2260
		AddTextL(testString);
sl@0
  2261
		iLayout->AdjustVerticalAlignment(CParaFormat::ECustomAlign);
sl@0
  2262
		testString.Close();
sl@0
  2263
		}
sl@0
  2264
	
sl@0
  2265
	Destroy();
sl@0
  2266
	}
sl@0
  2267
sl@0
  2268
void CTextViewTest::TestForDEF142286BounceScrollingL()
sl@0
  2269
    {
sl@0
  2270
    test.Next(_L(" Testing fix for DEF142286 which supports bounce scrolling feature "));
sl@0
  2271
    TestScrollDisplayPixelsNoLimitBordersL(10);
sl@0
  2272
    TestScrollDisplayPixelsNoLimitBordersL(50);
sl@0
  2273
    TestScrollDisplayPixelsNoLimitBordersL(100);
sl@0
  2274
    }
sl@0
  2275
sl@0
  2276
void RunTestsL(CCoeEnv& aEnv)
sl@0
  2277
	{
sl@0
  2278
	CTextViewTest* t = new(ELeave) CTextViewTest(aEnv);
sl@0
  2279
	CleanupStack::PushL(t);
sl@0
  2280
	t->ConstructL();
sl@0
  2281
	t->TestL();
sl@0
  2282
	t->Test1L();
sl@0
  2283
	t->TestCancelSelectionL();
sl@0
  2284
	t->TestFinishBackgroundFormattingL();
sl@0
  2285
	t->TestSetCursorVisibilityL();
sl@0
  2286
	t->TestSetSelectionVisibilityL();
sl@0
  2287
	t->TestEnablePictureFrameL();
sl@0
  2288
	t->TestSetCursorWidthTypeL();
sl@0
  2289
	t->TestParagraphRectL();
sl@0
  2290
	t->TestDrawL();
sl@0
  2291
	t->TestFormatTextL();
sl@0
  2292
	t->TestHandleRangeFormatChangeL();
sl@0
  2293
	t->TestHandleInsertDeleteL();
sl@0
  2294
	t->TestHandleGlobalChangeL();
sl@0
  2295
	t->TestHandleGlobalChangeNoRedrawL();
sl@0
  2296
	t->TestScrollDisplayL();
sl@0
  2297
	t->TestScrollDisplayPixelsL();
sl@0
  2298
	t->TestScrollDisplayLinesL();
sl@0
  2299
	t->TestScrollDisplayParagraphsL();
sl@0
  2300
	t->TestMoveCursorL();
sl@0
  2301
	t->TestSetSelectionL();
sl@0
  2302
	t->TestMatchCursorHeightL();
sl@0
  2303
	t->TestCalculateHorizontalExtremesL();
sl@0
  2304
	t->TestXyPosToDocPosL();
sl@0
  2305
	t->TestGetPictureRectangleL();
sl@0
  2306
	t->TestGetPictureRectangle1L();
sl@0
  2307
	//t->TestGetPictureRectangleDefectL();
sl@0
  2308
	t->TestSetDisplayContextL();
sl@0
  2309
	t->TestGetParaFormatL();
sl@0
  2310
	t->TestGetLineRectL();
sl@0
  2311
	t->TestForDEF003426L();
sl@0
  2312
	t->TestForDEF038488L();
sl@0
  2313
	t->FormAndEtextTestL();
sl@0
  2314
	t->TestForINC092725L();
sl@0
  2315
	t->TestForPDEF108443L();
sl@0
  2316
	t->TestForPDEF113755L();
sl@0
  2317
	t->TestForPDEF115165L();
sl@0
  2318
	t->TestForPDEF118443L();
sl@0
  2319
	t->TestForPDEF121798L();
sl@0
  2320
	t->TestForDEF124989L();
sl@0
  2321
	t->TestForPDEF120239L();
sl@0
  2322
	t->TestForDEF124975L();
sl@0
  2323
    t->TestForDEF142286BounceScrollingL();
sl@0
  2324
	CleanupStack::PopAndDestroy(t);
sl@0
  2325
}
sl@0
  2326
sl@0
  2327
TInt E32Main()
sl@0
  2328
	{
sl@0
  2329
	CCoeEnv* env=new CCoeEnv;
sl@0
  2330
	TRAPD(err,
sl@0
  2331
		env->ConstructL();
sl@0
  2332
		RunTestsL(*env);
sl@0
  2333
		);
sl@0
  2334
	return err;
sl@0
  2335
	}
sl@0
  2336
sl@0
  2337
#if defined(__WINS__)
sl@0
  2338
EXPORT_C TInt EntryPoint(TAny*) {return E32Main();}
sl@0
  2339
#endif