os/textandloc/textrendering/textformatting/test/src/TInlineText.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
//#include "TCustomWrap.h"
sl@0
    19
#include "TGraphicsContext.h"
sl@0
    20
#include <e32std.h>
sl@0
    21
#include <e32test.h>
sl@0
    22
#include <frmtlay.h>
sl@0
    23
#include <frmtview.h>
sl@0
    24
#include <txtlaydc.h>
sl@0
    25
#include <fbs.h>
sl@0
    26
#include <w32std.h>
sl@0
    27
#include <inlinetext.h>
sl@0
    28
#include "tinlinetext.h"
sl@0
    29
sl@0
    30
namespace LocalToTInlineText
sl@0
    31
{
sl@0
    32
sl@0
    33
_LIT(KTInlineText, "TInlineText");
sl@0
    34
const TInt KDisplayWidthWide = 202;
sl@0
    35
const TInt KDisplayWidthThin = 102;
sl@0
    36
const TInt KDisplayHeight = 100;
sl@0
    37
const TInt KPictureCharacter = 0xFFFC;
sl@0
    38
sl@0
    39
CTInLineTextStep* TestStep = NULL;
sl@0
    40
#define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
sl@0
    41
#define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
sl@0
    42
sl@0
    43
sl@0
    44
enum TInlineTextPanic { EAccessOutsideText = 1 };
sl@0
    45
void Panic(TInlineTextPanic)
sl@0
    46
    {
sl@0
    47
    User::Panic(_L("TInlineText"), EAccessOutsideText);
sl@0
    48
    }
sl@0
    49
sl@0
    50
class CPinkSquare : public CPicture
sl@0
    51
	{
sl@0
    52
public:
sl@0
    53
	// Size of square in twips.
sl@0
    54
	// 600 is 15 pixels using the standard test graphics device at
sl@0
    55
	// its default resolution.
sl@0
    56
	enum { KWidth = 600, KHeight = 600 };
sl@0
    57
	CPinkSquare()
sl@0
    58
		{}
sl@0
    59
	void Draw(CGraphicsContext& aGc, const TPoint& aTopLeft, const TRect& aClipRect, MGraphicsDeviceMap* aMap) const
sl@0
    60
		{
sl@0
    61
		// This picture is a magenta square
sl@0
    62
		TPoint size(KWidth, KHeight);
sl@0
    63
		if (aMap)
sl@0
    64
			size = aMap->TwipsToPixels(size);
sl@0
    65
		TRect rect(aTopLeft, aTopLeft + size);
sl@0
    66
		aGc.SetClippingRect(aClipRect);
sl@0
    67
		aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
    68
		aGc.SetPenColor(KRgbMagenta);
sl@0
    69
		aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
    70
		aGc.SetBrushColor(KRgbMagenta);
sl@0
    71
		aGc.DrawRect(rect);
sl@0
    72
		}
sl@0
    73
	void ExternalizeL(RWriteStream&) const
sl@0
    74
		{}
sl@0
    75
	void GetOriginalSizeInTwips(TSize& a) const
sl@0
    76
		{
sl@0
    77
		a.iWidth = CPinkSquare::KWidth;
sl@0
    78
		a.iHeight = CPinkSquare::KHeight;
sl@0
    79
		}
sl@0
    80
	};
sl@0
    81
sl@0
    82
_LIT(KEnd, "\x2029");
sl@0
    83
class TDocModel : public MLayDoc
sl@0
    84
	{
sl@0
    85
public:
sl@0
    86
	TDocModel(const TDesC& aDes)
sl@0
    87
	 :	iDes(&aDes), iParagraphFormat(0)
sl@0
    88
		{}
sl@0
    89
	void SetParagraphFormat(CParaFormat* a)
sl@0
    90
		{
sl@0
    91
		iParagraphFormat = a;
sl@0
    92
		}
sl@0
    93
	// From MLayDoc
sl@0
    94
	TInt LdDocumentLength() const
sl@0
    95
		{ return iDes->Length(); }
sl@0
    96
	TInt LdToParagraphStart(TInt& a) const
sl@0
    97
		{
sl@0
    98
		TInt curr = a;
sl@0
    99
		if (a < LdDocumentLength())
sl@0
   100
			{
sl@0
   101
			a = iDes->Left(a).LocateReverse(0x2029);
sl@0
   102
			a = a < 0? 0 : a + 1;
sl@0
   103
			}
sl@0
   104
		return curr - a;
sl@0
   105
		}
sl@0
   106
	void GetParagraphFormatL(CParaFormat* aFormat, TInt) const
sl@0
   107
		{
sl@0
   108
		if (iParagraphFormat)
sl@0
   109
			{
sl@0
   110
			aFormat->CopyL(*iParagraphFormat);
sl@0
   111
			return;
sl@0
   112
			}
sl@0
   113
		aFormat->Reset();
sl@0
   114
		TTabStop tabStop;
sl@0
   115
		tabStop.iTwipsPosition = 1000;
sl@0
   116
		tabStop.iType = TTabStop::ELeftTab;
sl@0
   117
		aFormat->StoreTabL(tabStop);
sl@0
   118
		}
sl@0
   119
	void GetChars(TPtrC& aView,TCharFormat& aFormat, TInt aStartPos)const
sl@0
   120
		{
sl@0
   121
        __ASSERT_ALWAYS(aStartPos <= LdDocumentLength(), Panic(EAccessOutsideText));
sl@0
   122
        __ASSERT_ALWAYS(aStartPos >= 0, Panic(EAccessOutsideText));
sl@0
   123
        
sl@0
   124
		TCharFormat cf;
sl@0
   125
		aFormat = cf;
sl@0
   126
		if (aStartPos == LdDocumentLength())
sl@0
   127
			aView.Set(KEnd);
sl@0
   128
		else
sl@0
   129
			aView.Set(iDes->Mid(aStartPos));
sl@0
   130
		}
sl@0
   131
	TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos) const
sl@0
   132
		{
sl@0
   133
		if ((*iDes)[aPos] != KPictureCharacter)
sl@0
   134
			return KErrNotFound;
sl@0
   135
		aSize.iWidth = CPinkSquare::KWidth;
sl@0
   136
		aSize.iHeight = CPinkSquare::KHeight;
sl@0
   137
		return KErrNone;
sl@0
   138
		}
sl@0
   139
	CPicture* PictureHandleL(TInt aPos, TForcePictureLoad) const
sl@0
   140
		{
sl@0
   141
		if ((*iDes)[aPos] != KPictureCharacter)
sl@0
   142
			return 0;
sl@0
   143
		return new(ELeave) CPinkSquare;
sl@0
   144
		}
sl@0
   145
	TBool EnquirePageBreak(TInt aPos, TInt aLength)const
sl@0
   146
		{
sl@0
   147
		return iDes->Mid(aPos, aLength).Locate(0x000C) < 0?
sl@0
   148
			EFalse : ETrue;
sl@0
   149
		}
sl@0
   150
	TBool SelectParagraphLabel(TInt)
sl@0
   151
		{ return EFalse; }
sl@0
   152
	void CancelSelectLabel()
sl@0
   153
		{}
sl@0
   154
private:
sl@0
   155
	const TDesC* iDes;
sl@0
   156
	CParaFormat* iParagraphFormat;
sl@0
   157
	};
sl@0
   158
}
sl@0
   159
using namespace LocalToTInlineText;
sl@0
   160
sl@0
   161
class CTestTextView	// slightly naughty
sl@0
   162
	{
sl@0
   163
public:
sl@0
   164
	static void SetContextForFlickerFreeRedraw(CTextView* aView, CBitmapContext* aContext)
sl@0
   165
		{
sl@0
   166
		aView->iOffScreenContext = aContext;
sl@0
   167
		}
sl@0
   168
	};
sl@0
   169
sl@0
   170
// Utility functions to show contents of test data using test.Printf
sl@0
   171
sl@0
   172
_LIT(KAddressMarker, "> ");
sl@0
   173
_LIT(KSpace, " ");
sl@0
   174
_LIT(KLength, ", Length of Data = %d 16-bit words\r\n");
sl@0
   175
_LIT(KSpaces, "                                                                      ");
sl@0
   176
_LIT(KPeriod, ".");
sl@0
   177
_LIT(KSingleString, "%S\r\n");
sl@0
   178
//_LIT(KDoubleString, "%s <%s>\r\n");
sl@0
   179
//_LIT(KLinefeed, "\r\n");
sl@0
   180
sl@0
   181
void PrintTestData (const TDesC& aTitle , const TDesC16& aData)
sl@0
   182
	{
sl@0
   183
sl@0
   184
	TInt i;
sl@0
   185
	TInt j;
sl@0
   186
	TInt end;
sl@0
   187
sl@0
   188
	TInt length = aData.Length();
sl@0
   189
sl@0
   190
	TBuf<80> buffer;
sl@0
   191
sl@0
   192
	buffer.Zero();
sl@0
   193
	buffer.Append(aTitle);
sl@0
   194
	buffer.Append(KLength);
sl@0
   195
sl@0
   196
	TBuf<256> buf;
sl@0
   197
	buf.AppendFormat(buffer, length);
sl@0
   198
	TESTPRINT(buf);
sl@0
   199
sl@0
   200
	for (i = 0 ; i < length ; i += 8)
sl@0
   201
		{
sl@0
   202
		buffer.Zero();
sl@0
   203
		buffer.AppendNumFixedWidth(i, EHex, 8);
sl@0
   204
		buffer += KAddressMarker;
sl@0
   205
sl@0
   206
		end = ((length-i) >= 8) ? i+8 : length;
sl@0
   207
sl@0
   208
		for (j = i ; j < end ; ++j)
sl@0
   209
			{
sl@0
   210
			buffer.AppendNumFixedWidth(aData[j], EHex, 4);
sl@0
   211
			buffer += KSpace;
sl@0
   212
			}
sl@0
   213
		buffer += TPtrC(KSpaces().Ptr(), ((8-(j-i))*5)+4);
sl@0
   214
sl@0
   215
		for (j = i ; j < end ; ++j)
sl@0
   216
			{
sl@0
   217
			if (aData[j] >= 32)
sl@0
   218
				{
sl@0
   219
				buffer.Append(aData[j]);
sl@0
   220
				}
sl@0
   221
			else
sl@0
   222
				{
sl@0
   223
				buffer += KPeriod;
sl@0
   224
				}
sl@0
   225
			}
sl@0
   226
		buffer.ZeroTerminate();
sl@0
   227
		buf.Zero();
sl@0
   228
		buf.AppendFormat(KSingleString,buffer.Ptr());
sl@0
   229
		TESTPRINT(buf);		
sl@0
   230
		}
sl@0
   231
sl@0
   232
	}
sl@0
   233
sl@0
   234
void PrintTestData(const TDesC& aTitle, const TText16* aDataBuffer, const TInt aSize)
sl@0
   235
	{
sl@0
   236
	PrintTestData(aTitle, TPtrC16(aDataBuffer, aSize));
sl@0
   237
	}
sl@0
   238
sl@0
   239
class CTestInlineTextSource : public CBase, public MTmInlineTextSource
sl@0
   240
	{
sl@0
   241
public:
sl@0
   242
	static CTestInlineTextSource* NewL(TPtrC aText, TInt aNumChar);
sl@0
   243
	~CTestInlineTextSource();
sl@0
   244
sl@0
   245
public: // From MTmInlineTextSource
sl@0
   246
sl@0
   247
	/**
sl@0
   248
	Reports the next position into which inline text should be inserted
sl@0
   249
	@param aFrom
sl@0
   250
		The document position and character edge to start from.
sl@0
   251
	@param aMaxLength
sl@0
   252
		The maximum length within which to report inline text.
sl@0
   253
		It means that inline text at position X should be reported if
sl@0
   254
		aFrom <= X && X < aFrom + aMaxLength.
sl@0
   255
		Also report trailing inline text at position aFrom + aMaxLength
sl@0
   256
		because it is really attached to the preceding character.
sl@0
   257
		Always report only the first inline text position >= aFrom.
sl@0
   258
	@param aNext
sl@0
   259
		On exit the position of the next bit of inline text to be inserted.
sl@0
   260
		N.B. The position of trailing text following position N and the
sl@0
   261
		position of leading text preceding position N+1 are both
sl@0
   262
		considered to be N+1 - and the trailing text comes first so if
sl@0
   263
		aFrom specifies a leading edge do not report trailing edge
sl@0
   264
		inline text unless its position is greater than aFrom.
sl@0
   265
		A panic EBadReturnValue will result otherwise.
sl@0
   266
	@return
sl@0
   267
		KErrNone if a position is found within the specified range,
sl@0
   268
		KErrNotFound otherwise.
sl@0
   269
	@post
sl@0
   270
		if KErrNone returned then aFrom <= aNext
sl@0
   271
		&& GetInlineText(aNext).Length() != 0
sl@0
   272
		&& (GetInlineText(X).Length() == 0 for all
sl@0
   273
		TTmDocPos X such that aFrom < X && X < aNext)
sl@0
   274
		else if KErrNotFound returned
sl@0
   275
		GetInlineText(X).Length() == 0 for all
sl@0
   276
		TTmDocPos X such that aFrom <= X && X < aFrom + aMaxLength
sl@0
   277
	*/
sl@0
   278
	virtual TInt GetNextInlineTextPosition(const TTmDocPos& aFrom, TInt aMaxLength, TTmDocPos& aNext);
sl@0
   279
sl@0
   280
	/**
sl@0
   281
	Gets a view of the text to be inserted at aAt.
sl@0
   282
	@param aAt
sl@0
   283
		Document position, including character edge, being queried.
sl@0
   284
	@return
sl@0
   285
		Any inline text that should be attached to the specified character edge at aAt.
sl@0
   286
	*/
sl@0
   287
	virtual TPtrC GetInlineText(const TTmDocPos& aAt);
sl@0
   288
sl@0
   289
private:
sl@0
   290
	CTestInlineTextSource();
sl@0
   291
	void Construct(TPtrC aText, TInt aNumChar);
sl@0
   292
	TPtrC iNullText;
sl@0
   293
	TPtrC iText;
sl@0
   294
	TInt iNumChar;
sl@0
   295
	};
sl@0
   296
sl@0
   297
CTestInlineTextSource::CTestInlineTextSource()
sl@0
   298
	{
sl@0
   299
	}
sl@0
   300
sl@0
   301
CTestInlineTextSource* CTestInlineTextSource::NewL(TPtrC aText, TInt aNumChar)
sl@0
   302
	{
sl@0
   303
	CTestInlineTextSource* self= new(ELeave) CTestInlineTextSource();
sl@0
   304
	self->Construct(aText, aNumChar);
sl@0
   305
	return self;
sl@0
   306
	}
sl@0
   307
sl@0
   308
CTestInlineTextSource::~CTestInlineTextSource()
sl@0
   309
	{
sl@0
   310
	}
sl@0
   311
sl@0
   312
void CTestInlineTextSource::Construct(TPtrC aText, TInt aNumChar)
sl@0
   313
	{
sl@0
   314
	iText.Set(aText);
sl@0
   315
	iNumChar = aNumChar;
sl@0
   316
	}
sl@0
   317
sl@0
   318
// This takes two inputs, each of which is either a real position,
sl@0
   319
// greater than or equal to 0, or KErrNotFound. If both are real
sl@0
   320
// positions then it should return the lower. If one is a real position
sl@0
   321
// then it should be returned. If neither are a real position then
sl@0
   322
// KErrNone is returned. It is all done with pointers to TInts so that
sl@0
   323
// when I get the result I can tell which one it is.
sl@0
   324
TInt* CustomMin(TInt* aPtrPos1, TInt* aPtrPos2)
sl@0
   325
	{
sl@0
   326
	if (*aPtrPos2 == KErrNotFound)
sl@0
   327
		return aPtrPos1;
sl@0
   328
	if (*aPtrPos1 == KErrNotFound)
sl@0
   329
		return aPtrPos2;
sl@0
   330
	if (*aPtrPos1 <= *aPtrPos2)
sl@0
   331
		return aPtrPos1;
sl@0
   332
	else
sl@0
   333
		return aPtrPos2;
sl@0
   334
	}
sl@0
   335
sl@0
   336
TInt CTestInlineTextSource::GetNextInlineTextPosition(const TTmDocPos& aFrom, TInt aMaxLength, TTmDocPos& aNext)
sl@0
   337
	{
sl@0
   338
	if (iNumChar == 0)
sl@0
   339
		return KErrNotFound;
sl@0
   340
	_LIT(KSS1, "A");
sl@0
   341
	_LIT(KSS2, "B");
sl@0
   342
    _LIT(KSS3, "C");
sl@0
   343
    _LIT(KSS4, "\x05c0");//Hebrew character to test right-to-left text
sl@0
   344
	TInt from = aFrom.iPos;
sl@0
   345
	TInt from2 = from;
sl@0
   346
	if ((from > 0) && (!aFrom.iLeadingEdge))
sl@0
   347
		from2--; // adjustment takes care of not returning trailing edge if at start pos
sl@0
   348
	TInt pos1 = iText.Mid(from).Find(KSS1);
sl@0
   349
	TInt pos2 = iText.Mid(from2).Find(KSS2);
sl@0
   350
	TInt pos3 = iText.Mid(from).Find(KSS3);
sl@0
   351
    TInt pos4 = iText.Mid(from2).Find(KSS3);
sl@0
   352
    TInt pos5 = iText.Mid(from2).Find(KSS4);
sl@0
   353
	if (pos1 >= 0 ) // adjustments so we compare like for like
sl@0
   354
		pos1 += from - from2;
sl@0
   355
	if (pos3 >= 0 )
sl@0
   356
		pos3 += from - from2;
sl@0
   357
	// get the smallest real position, if any
sl@0
   358
	TInt* ptrPos = CustomMin(CustomMin(&pos1, &pos3), CustomMin(CustomMin(&pos2, &pos4),&pos5));
sl@0
   359
	if (pos1 > 0 ) // now adjust back
sl@0
   360
		pos1 -= from - from2;
sl@0
   361
	if (pos3 > 0 )
sl@0
   362
		pos3 -= from - from2;
sl@0
   363
	if (*ptrPos == KErrNotFound)
sl@0
   364
		return KErrNotFound;
sl@0
   365
	if ((ptrPos == &pos1) || (ptrPos == &pos3))
sl@0
   366
		{ // it was an A or C with leading text
sl@0
   367
		aNext.iPos = *ptrPos + from;
sl@0
   368
		aNext.iLeadingEdge = ETrue;
sl@0
   369
		}
sl@0
   370
	else if ((ptrPos == &pos2) || (ptrPos == &pos4))
sl@0
   371
		{ // it was an B oD with trailing text
sl@0
   372
		aNext.iPos = *ptrPos + from2 + 1;
sl@0
   373
		aNext.iLeadingEdge = EFalse;
sl@0
   374
		}
sl@0
   375
    else if (ptrPos == &pos5)
sl@0
   376
        { // it was an Hebrew char with trailing text
sl@0
   377
        aNext.iPos = *ptrPos + from2 + 1;
sl@0
   378
        aNext.iLeadingEdge = EFalse;
sl@0
   379
        }
sl@0
   380
	else
sl@0
   381
		{
sl@0
   382
		// something has gone horribly wrong
sl@0
   383
		return KErrNotFound;
sl@0
   384
		}
sl@0
   385
	if (aNext.iPos - aFrom.iPos > aMaxLength + (aNext.iLeadingEdge ? 0 : 1))
sl@0
   386
		return KErrNotFound;
sl@0
   387
	return KErrNone;
sl@0
   388
	}
sl@0
   389
sl@0
   390
TPtrC CTestInlineTextSource::GetInlineText(const TTmDocPos& aAt)
sl@0
   391
	{
sl@0
   392
	if (iNumChar == 0)
sl@0
   393
		return iNullText;
sl@0
   394
	if ((aAt.iPos == 0) && (!aAt.iLeadingEdge))
sl@0
   395
		return iNullText;
sl@0
   396
	_LIT(KSS1, "A");
sl@0
   397
	_LIT(KSS2, "B");
sl@0
   398
	_LIT(KSS3, "C");
sl@0
   399
    _LIT(KSS4, "\x05c0");//Hebrew character to test right-to-left text
sl@0
   400
	TInt at = aAt.iPos;
sl@0
   401
	TInt at2 = at;
sl@0
   402
	if ((at2 > 0) && (!aAt.iLeadingEdge))
sl@0
   403
		at2--; // adjustment takes care of not returning trailing edge if at start pos
sl@0
   404
sl@0
   405
	TInt pos1 = iText.Mid(at).Find(KSS1);
sl@0
   406
	TInt pos2 = iText.Mid(at2).Find(KSS2);
sl@0
   407
	TInt pos3 = iText.Mid(at).Find(KSS3);
sl@0
   408
	TInt pos4 = iText.Mid(at2).Find(KSS3);
sl@0
   409
    TInt pos5 = iText.Mid(at2).Find(KSS4);
sl@0
   410
	if (pos1 == 0)
sl@0
   411
		{
sl@0
   412
		pos1 += at;
sl@0
   413
		if ((pos1 == aAt.iPos) && aAt.iLeadingEdge)
sl@0
   414
			{
sl@0
   415
			TPtrC tPtrC;
sl@0
   416
			if (iNumChar == 1)
sl@0
   417
				{
sl@0
   418
				_LIT(KIS11, "a");
sl@0
   419
				tPtrC.Set(KIS11);
sl@0
   420
				}
sl@0
   421
			else if (iNumChar == 2)
sl@0
   422
				{
sl@0
   423
				_LIT(KIS12, "aa");
sl@0
   424
				tPtrC.Set(KIS12);
sl@0
   425
				}
sl@0
   426
			return tPtrC;
sl@0
   427
			}
sl@0
   428
		}
sl@0
   429
	if (pos2 == 0)
sl@0
   430
		{
sl@0
   431
		pos2 += at2;
sl@0
   432
		if ((pos2 + 1 == aAt.iPos) && !aAt.iLeadingEdge)
sl@0
   433
			{
sl@0
   434
			TPtrC tPtrC;
sl@0
   435
			if (iNumChar == 1)
sl@0
   436
				{
sl@0
   437
				_LIT(KIS21, "b");
sl@0
   438
				tPtrC.Set(KIS21);
sl@0
   439
				}
sl@0
   440
			else if (iNumChar == 2)
sl@0
   441
				{
sl@0
   442
				_LIT(KIS22, "bb");
sl@0
   443
				tPtrC.Set(KIS22);
sl@0
   444
				}
sl@0
   445
			return tPtrC;
sl@0
   446
			}
sl@0
   447
		}
sl@0
   448
	if ((pos3 == 0) || (pos4 == 0))
sl@0
   449
		{
sl@0
   450
		if (((pos3 + at == aAt.iPos) && aAt.iLeadingEdge) || ((pos4 + at2 + 1 == aAt.iPos) && !aAt.iLeadingEdge))
sl@0
   451
			{
sl@0
   452
			TPtrC tPtrC;
sl@0
   453
			if (iNumChar == 1)
sl@0
   454
				{
sl@0
   455
				_LIT(KIS31, "c");
sl@0
   456
				tPtrC.Set(KIS31);
sl@0
   457
				}
sl@0
   458
			else if (iNumChar == 2)
sl@0
   459
				{
sl@0
   460
				_LIT(KIS32, "cc");
sl@0
   461
				tPtrC.Set(KIS32);
sl@0
   462
				}
sl@0
   463
			return tPtrC;
sl@0
   464
			}
sl@0
   465
		}
sl@0
   466
    if (pos5 == 0)
sl@0
   467
        {
sl@0
   468
        pos5 += at2;
sl@0
   469
        if ((pos5 + 1 == aAt.iPos) && !aAt.iLeadingEdge)
sl@0
   470
            {
sl@0
   471
            TPtrC tPtrC;
sl@0
   472
            if (iNumChar == 1)
sl@0
   473
                {
sl@0
   474
                _LIT(KIS41, "\05be");
sl@0
   475
                tPtrC.Set(KIS41);
sl@0
   476
                }
sl@0
   477
            else if (iNumChar == 2)
sl@0
   478
                {
sl@0
   479
                _LIT(KIS42, "\05be\05be");
sl@0
   480
                tPtrC.Set(KIS42);
sl@0
   481
                }
sl@0
   482
            return tPtrC;
sl@0
   483
            }
sl@0
   484
        }
sl@0
   485
	return iNullText;
sl@0
   486
	}
sl@0
   487
sl@0
   488
class CTestFormExtendedInterfaceProvider: public CBase, public MFormCustomInterfaceProvider
sl@0
   489
	{
sl@0
   490
public:
sl@0
   491
	static CTestFormExtendedInterfaceProvider* NewL(TPtrC aText, TInt aNumChar);
sl@0
   492
	~CTestFormExtendedInterfaceProvider();
sl@0
   493
	TAny* GetExtendedInterface(const TUid& aInterfaceId);
sl@0
   494
sl@0
   495
private:
sl@0
   496
	CTestFormExtendedInterfaceProvider();
sl@0
   497
	void ConstructL(TPtrC aText, TInt aNumChar);
sl@0
   498
sl@0
   499
private:
sl@0
   500
	CTestInlineTextSource* iTestInlineTextSource; // Owned
sl@0
   501
	};
sl@0
   502
sl@0
   503
sl@0
   504
CTestFormExtendedInterfaceProvider::CTestFormExtendedInterfaceProvider()
sl@0
   505
	{
sl@0
   506
	}
sl@0
   507
sl@0
   508
CTestFormExtendedInterfaceProvider* CTestFormExtendedInterfaceProvider::NewL(TPtrC aText, TInt aNumChar)
sl@0
   509
	{
sl@0
   510
	CTestFormExtendedInterfaceProvider* self= new(ELeave) CTestFormExtendedInterfaceProvider();
sl@0
   511
	CleanupStack::PushL(self);
sl@0
   512
	self->ConstructL(aText, aNumChar);
sl@0
   513
	CleanupStack::Pop(); // self
sl@0
   514
	return self;
sl@0
   515
	}
sl@0
   516
sl@0
   517
CTestFormExtendedInterfaceProvider::~CTestFormExtendedInterfaceProvider()
sl@0
   518
	{
sl@0
   519
	delete iTestInlineTextSource;
sl@0
   520
	}
sl@0
   521
sl@0
   522
void CTestFormExtendedInterfaceProvider::ConstructL(TPtrC aText, TInt aNumChar)
sl@0
   523
	{
sl@0
   524
	iTestInlineTextSource = CTestInlineTextSource::NewL(aText, aNumChar);
sl@0
   525
	}
sl@0
   526
sl@0
   527
TAny* CTestFormExtendedInterfaceProvider::GetExtendedInterface( const TUid& aInterfaceId )
sl@0
   528
	{
sl@0
   529
	if (aInterfaceId == KInlineTextApiExtensionUid)
sl@0
   530
		{
sl@0
   531
		return static_cast<MTmInlineTextSource*>(iTestInlineTextSource);
sl@0
   532
		}
sl@0
   533
	else
sl@0
   534
		{
sl@0
   535
		return NULL;
sl@0
   536
		}
sl@0
   537
	}
sl@0
   538
sl@0
   539
// When referring to test cases the following shorthand is used:
sl@0
   540
// P  Primary text that has inline text (leading and/or trailing) attached
sl@0
   541
//    to it
sl@0
   542
// L  Leading inline text attached to primary text
sl@0
   543
// T  Trailing inline text attached to primary text
sl@0
   544
// X  Secondary text that precedes primary text
sl@0
   545
// Y  Secondary text that follows primary text
sl@0
   546
// S  A special case of P where the primary text is a single character
sl@0
   547
//    which has both leading and trailing inline text attached to it
sl@0
   548
//
sl@0
   549
// So, for example, X L-P will indicate some normal secondary text,
sl@0
   550
// followed by a <space>, followed by some primary text which will get
sl@0
   551
// leading text added to the start of it.
sl@0
   552
//
sl@0
   553
// When defining a test string the following are significant characters:
sl@0
   554
// A  An 'A' will get zero or more 'a's of leading text attached to it
sl@0
   555
// B  A 'B' will get zero or more 'b's of trailing text attached to it
sl@0
   556
// C  A 'C' will get zero or more 'c's of both leading and trailing text
sl@0
   557
//    attached to it
sl@0
   558
//
sl@0
   559
// All other characters are used normally.
sl@0
   560
// N.B. Spaces have significance as potential line-breaking points.
sl@0
   561
//
sl@0
   562
// So the example X L-P could be implemented as "ij Axyz". The 'A'
sl@0
   563
// indicating that leading inline text should be attatched to it.
sl@0
   564
//
sl@0
   565
// All test are carried out 3 times, once with inline text set to add zero
sl@0
   566
// characters for each inline text (i.e. switched off), once with inline
sl@0
   567
// text set to add one character for each inline text and once with inline
sl@0
   568
// text set to add two characters for each inline text.
sl@0
   569
//
sl@0
   570
// All tests use a special test graphics device and test graphics context
sl@0
   571
// to enable us to catch the output and use a special "pseudo" test font
sl@0
   572
// where all characters are exactly 10 pixels wide and 10 pixels high (to
sl@0
   573
// make the calculations easier).
sl@0
   574
//
sl@0
   575
// General combination tests
sl@0
   576
//
sl@0
   577
// These are simple tests, which would take a single line of input on the
sl@0
   578
// display and produce a single line of output on the display (if we
sl@0
   579
// weren't using a special CTestGraphicsContext to catch the output).
sl@0
   580
// These tests check that, without the complications of line-breaking,
sl@0
   581
// inline text is inserted where we expect it to be. This is why a display
sl@0
   582
// that is capable of taking 20 chars on a line is used for these tests.
sl@0
   583
//
sl@0
   584
// Future extensions:
sl@0
   585
// These tests could be extended to do similar tests using Right-to-Left
sl@0
   586
// (RtoL) text. This would require the inline text mechanism to be
sl@0
   587
// extended to also use RtoL trigger characters (and inserts). The
sl@0
   588
// expected results would need to take account of the fact that the output
sl@0
   589
// would be in display order rather than buffer order.
sl@0
   590
//
sl@0
   591
// Specific tests
sl@0
   592
//
sl@0
   593
// These tests check specific cases that involve line-breaking. They
sl@0
   594
// produce more than one line of output, apart from some (not all) cases
sl@0
   595
// when inline text is switched off. To force the line-breaking these
sl@0
   596
// tests use a display that is obly capable of taking 10 chars on a line
sl@0
   597
// is used. Detailed info for each test is given in comments in the test
sl@0
   598
// data.
sl@0
   599
//
sl@0
   600
// Future extensions:
sl@0
   601
// These tests could be extended to check the behaviour of truncation and
sl@0
   602
// the insertion of an ellipsis. These tests could also be extended to
sl@0
   603
// include some RtoL examples.
sl@0
   604
sl@0
   605
static const TInt KTestCases = 18;
sl@0
   606
static const TInt KInlineTextOptions = 3;
sl@0
   607
static const TInt KVariants = 6;
sl@0
   608
sl@0
   609
static const TPtrC KTestStrings[KTestCases][KInlineTextOptions][KVariants] =
sl@0
   610
	{	// Start of General Combination tests
sl@0
   611
		{	// Test L-P
sl@0
   612
			{
sl@0
   613
			_S("Axyz"),
sl@0
   614
			_S("Axyz"),
sl@0
   615
			_S(""),
sl@0
   616
			_S(""),
sl@0
   617
			_S(""),
sl@0
   618
			_S("")
sl@0
   619
			},
sl@0
   620
			{
sl@0
   621
			_S("Axyz"),
sl@0
   622
			_S("a"),
sl@0
   623
			_S("Axyz"),
sl@0
   624
			_S(""),
sl@0
   625
			_S(""),
sl@0
   626
			_S("")
sl@0
   627
			},
sl@0
   628
			{
sl@0
   629
			_S("Axyz"),
sl@0
   630
			_S("aa"),
sl@0
   631
			_S("Axyz"),
sl@0
   632
			_S(""),
sl@0
   633
			_S(""),
sl@0
   634
			_S("")
sl@0
   635
			}
sl@0
   636
		},
sl@0
   637
		{	// Test X L-P
sl@0
   638
			{
sl@0
   639
			_S("ij Axyz"),
sl@0
   640
			_S("ij Axyz"),
sl@0
   641
			_S(""),
sl@0
   642
			_S(""),
sl@0
   643
			_S(""),
sl@0
   644
			_S("")
sl@0
   645
			},
sl@0
   646
			{
sl@0
   647
			_S("ij Axyz"),
sl@0
   648
			_S("ij "),
sl@0
   649
			_S("a"),
sl@0
   650
			_S("Axyz"),
sl@0
   651
			_S(""),
sl@0
   652
			_S("")
sl@0
   653
			},
sl@0
   654
			{
sl@0
   655
			_S("ij Axyz"),
sl@0
   656
			_S("ij "),
sl@0
   657
			_S("aa"),
sl@0
   658
			_S("Axyz"),
sl@0
   659
			_S(""),
sl@0
   660
			_S("")
sl@0
   661
			}
sl@0
   662
		},
sl@0
   663
		{	// Test P-T
sl@0
   664
			{
sl@0
   665
			_S("xyzB"),
sl@0
   666
			_S("xyzB"),
sl@0
   667
			_S(""),
sl@0
   668
			_S(""),
sl@0
   669
			_S(""),
sl@0
   670
			_S("")
sl@0
   671
			},
sl@0
   672
			{
sl@0
   673
			_S("xyzB"),
sl@0
   674
			_S("xyzB"),
sl@0
   675
			_S("b"),
sl@0
   676
			_S(""),
sl@0
   677
			_S(""),
sl@0
   678
			_S("")
sl@0
   679
			},
sl@0
   680
			{
sl@0
   681
			_S("xyzB"),
sl@0
   682
			_S("xyzB"),
sl@0
   683
			_S("bb"),
sl@0
   684
			_S(""),
sl@0
   685
			_S(""),
sl@0
   686
			_S("")
sl@0
   687
			}
sl@0
   688
		},
sl@0
   689
		{	// Test P-T Y
sl@0
   690
			{
sl@0
   691
			_S("xyzB pq"),
sl@0
   692
			_S("xyzB pq"),
sl@0
   693
			_S(""),
sl@0
   694
			_S(""),
sl@0
   695
			_S(""),
sl@0
   696
			_S("")
sl@0
   697
			},
sl@0
   698
			{
sl@0
   699
			_S("xyzB pq"),
sl@0
   700
			_S("xyzB"),
sl@0
   701
			_S("b"),
sl@0
   702
			_S(" pq"),
sl@0
   703
			_S(""),
sl@0
   704
			_S("")
sl@0
   705
			},
sl@0
   706
			{
sl@0
   707
			_S("xyzB pq"),
sl@0
   708
			_S("xyzB"),
sl@0
   709
			_S("bb"),
sl@0
   710
			_S(" pq"),
sl@0
   711
			_S(""),
sl@0
   712
			_S("")
sl@0
   713
			}
sl@0
   714
		},
sl@0
   715
		{	// Test L-P-T
sl@0
   716
			{
sl@0
   717
			_S("AxyzB"),
sl@0
   718
			_S("AxyzB"),
sl@0
   719
			_S(""),
sl@0
   720
			_S(""),
sl@0
   721
			_S(""),
sl@0
   722
			_S("")
sl@0
   723
			},
sl@0
   724
			{
sl@0
   725
			_S("AxyzB"),
sl@0
   726
			_S("a"),
sl@0
   727
			_S("AxyzB"),
sl@0
   728
			_S("b"),
sl@0
   729
			_S(""),
sl@0
   730
			_S("")
sl@0
   731
			},
sl@0
   732
			{
sl@0
   733
			_S("AxyzB"),
sl@0
   734
			_S("aa"),
sl@0
   735
			_S("AxyzB"),
sl@0
   736
			_S("bb"),
sl@0
   737
			_S(""),
sl@0
   738
			_S("")
sl@0
   739
			}
sl@0
   740
		},
sl@0
   741
		{	// Test L-C-T
sl@0
   742
			{
sl@0
   743
			_S("C"),
sl@0
   744
			_S("C"),
sl@0
   745
			_S(""),
sl@0
   746
			_S(""),
sl@0
   747
			_S(""),
sl@0
   748
			_S("")
sl@0
   749
			},
sl@0
   750
			{
sl@0
   751
			_S("C"),
sl@0
   752
			_S("c"),
sl@0
   753
			_S("C"),
sl@0
   754
			_S("c"),
sl@0
   755
			_S(""),
sl@0
   756
			_S("")
sl@0
   757
			},
sl@0
   758
			{
sl@0
   759
			_S("C"),
sl@0
   760
			_S("cc"),
sl@0
   761
			_S("C"),
sl@0
   762
			_S("cc"),
sl@0
   763
			_S(""),
sl@0
   764
			_S("")
sl@0
   765
			}
sl@0
   766
		},
sl@0
   767
		{	// Test X L-P-T
sl@0
   768
			{
sl@0
   769
			_S("ij AxyzB"),
sl@0
   770
			_S("ij AxyzB"),
sl@0
   771
			_S(""),
sl@0
   772
			_S(""),
sl@0
   773
			_S(""),
sl@0
   774
			_S("")
sl@0
   775
			},
sl@0
   776
			{
sl@0
   777
			_S("ij AxyzB"),
sl@0
   778
			_S("ij "),
sl@0
   779
			_S("a"),
sl@0
   780
			_S("AxyzB"),
sl@0
   781
			_S("b"),
sl@0
   782
			_S("")
sl@0
   783
			},
sl@0
   784
			{
sl@0
   785
			_S("ij AxyzB"),
sl@0
   786
			_S("ij "),
sl@0
   787
			_S("aa"),
sl@0
   788
			_S("AxyzB"),
sl@0
   789
			_S("bb"),
sl@0
   790
			_S("")
sl@0
   791
			}
sl@0
   792
		},
sl@0
   793
		{	// Test X L-C-T
sl@0
   794
			{
sl@0
   795
			_S("ij C"),
sl@0
   796
			_S("ij C"),
sl@0
   797
			_S(""),
sl@0
   798
			_S(""),
sl@0
   799
			_S(""),
sl@0
   800
			_S("")
sl@0
   801
			},
sl@0
   802
			{
sl@0
   803
			_S("ij C"),
sl@0
   804
			_S("ij "),
sl@0
   805
			_S("c"),
sl@0
   806
			_S("C"),
sl@0
   807
			_S("c"),
sl@0
   808
			_S("")
sl@0
   809
			},
sl@0
   810
			{
sl@0
   811
			_S("ij C"),
sl@0
   812
			_S("ij "),
sl@0
   813
			_S("cc"),
sl@0
   814
			_S("C"),
sl@0
   815
			_S("cc"),
sl@0
   816
			_S("")
sl@0
   817
			}
sl@0
   818
		},
sl@0
   819
		{	// Test L-P-T Y
sl@0
   820
			{
sl@0
   821
			_S("AxyzB pq"),
sl@0
   822
			_S("AxyzB pq"),
sl@0
   823
			_S(""),
sl@0
   824
			_S(""),
sl@0
   825
			_S(""),
sl@0
   826
			_S("")
sl@0
   827
			},
sl@0
   828
			{
sl@0
   829
			_S("AxyzB pq"),
sl@0
   830
			_S("a"),
sl@0
   831
			_S("AxyzB"),
sl@0
   832
			_S("b"),
sl@0
   833
			_S(" pq"),
sl@0
   834
			_S("")
sl@0
   835
			},
sl@0
   836
			{
sl@0
   837
			_S("AxyzB pq"),
sl@0
   838
			_S("aa"),
sl@0
   839
			_S("AxyzB"),
sl@0
   840
			_S("bb"),
sl@0
   841
			_S(" pq"),
sl@0
   842
			_S("")
sl@0
   843
			}
sl@0
   844
		},
sl@0
   845
		{	// Test L-C-T Y
sl@0
   846
			{
sl@0
   847
			_S("C pq"),
sl@0
   848
			_S("C pq"),
sl@0
   849
			_S(""),
sl@0
   850
			_S(""),
sl@0
   851
			_S(""),
sl@0
   852
			_S("")
sl@0
   853
			},
sl@0
   854
			{
sl@0
   855
			_S("C pq"),
sl@0
   856
			_S("c"),
sl@0
   857
			_S("C"),
sl@0
   858
			_S("c"),
sl@0
   859
			_S(" pq"),
sl@0
   860
			_S("")
sl@0
   861
			},
sl@0
   862
			{
sl@0
   863
			_S("C pq"),
sl@0
   864
			_S("cc"),
sl@0
   865
			_S("C"),
sl@0
   866
			_S("cc"),
sl@0
   867
			_S(" pq"),
sl@0
   868
			_S("")
sl@0
   869
			}
sl@0
   870
		},
sl@0
   871
		{	// Test X L-P-T Y
sl@0
   872
			{
sl@0
   873
			_S("ij AxyzB pq"),
sl@0
   874
			_S("ij AxyzB pq"),
sl@0
   875
			_S(""),
sl@0
   876
			_S(""),
sl@0
   877
			_S(""),
sl@0
   878
			_S("")
sl@0
   879
			},
sl@0
   880
			{
sl@0
   881
			_S("ij AxyzB pq"),
sl@0
   882
			_S("ij "),
sl@0
   883
			_S("a"),
sl@0
   884
			_S("AxyzB"),
sl@0
   885
			_S("b"),
sl@0
   886
			_S(" pq")
sl@0
   887
			},
sl@0
   888
			{
sl@0
   889
			_S("ij AxyzB pq"),
sl@0
   890
			_S("ij "),
sl@0
   891
			_S("aa"),
sl@0
   892
			_S("AxyzB"),
sl@0
   893
			_S("bb"),
sl@0
   894
			_S(" pq")
sl@0
   895
			}
sl@0
   896
		},
sl@0
   897
		{	// Test X L-C-T Y
sl@0
   898
			{
sl@0
   899
			_S("ij C pq"),
sl@0
   900
			_S("ij C pq"),
sl@0
   901
			_S(""),
sl@0
   902
			_S(""),
sl@0
   903
			_S(""),
sl@0
   904
			_S("")
sl@0
   905
			},
sl@0
   906
			{
sl@0
   907
			_S("ij C pq"),
sl@0
   908
			_S("ij "),
sl@0
   909
			_S("c"),
sl@0
   910
			_S("C"),
sl@0
   911
			_S("c"),
sl@0
   912
			_S(" pq")
sl@0
   913
			},
sl@0
   914
			{
sl@0
   915
			_S("ij C pq"),
sl@0
   916
			_S("ij "),
sl@0
   917
			_S("cc"),
sl@0
   918
			_S("C"),
sl@0
   919
			_S("cc"),
sl@0
   920
			_S(" pq")
sl@0
   921
			}
sl@0
   922
		},	// End of General Combination tests
sl@0
   923
		{	// Start of Specific tests
sl@0
   924
			{	// Test P-T Y
sl@0
   925
				// primary text with trailing inline text, secondary text secondary
sl@0
   926
				// text won't fit on line
sl@0
   927
			_S("wxyzB pqrstuv"),
sl@0
   928
			_S("wxyzB"),
sl@0
   929
			_S(" "),
sl@0
   930
			_S("pqrstuv"),
sl@0
   931
			_S(""),
sl@0
   932
			_S("")
sl@0
   933
			},
sl@0
   934
			{
sl@0
   935
			_S("wxyzB pqrstuv"),
sl@0
   936
			_S("wxyzB"),
sl@0
   937
			_S("b"),
sl@0
   938
			_S(" "),
sl@0
   939
			_S("pqrstuv"),
sl@0
   940
			_S("")
sl@0
   941
			},
sl@0
   942
			{
sl@0
   943
			_S("wxyzB pqrstuv"),
sl@0
   944
			_S("wxyzB"),
sl@0
   945
			_S("bb"),
sl@0
   946
			_S(" "),
sl@0
   947
			_S("pqrstuv"),
sl@0
   948
			_S("")
sl@0
   949
			}
sl@0
   950
		},
sl@0
   951
		{	// Test X P-T one
sl@0
   952
			// secondary text, primary text with trailing inline text trailing
sl@0
   953
			// text won't fit and there is no line breaking point inside primary
sl@0
   954
			// text and the primary text plus trailing text will fit on next line
sl@0
   955
			{
sl@0
   956
			_S("ijklm xyzB"),
sl@0
   957
			_S("ijklm xyzB"),
sl@0
   958
			_S(""),
sl@0
   959
			_S(""),
sl@0
   960
			_S(""),
sl@0
   961
			_S("")
sl@0
   962
			},
sl@0
   963
			{
sl@0
   964
			_S("ijklm xyzB"),
sl@0
   965
			_S("ijklm"),
sl@0
   966
			_S(" "),
sl@0
   967
			_S("xyzB"),
sl@0
   968
			_S("b"),
sl@0
   969
			_S("")
sl@0
   970
			},
sl@0
   971
			{
sl@0
   972
			_S("ijklm xyzB"),
sl@0
   973
			_S("ijklm"),
sl@0
   974
			_S(" "),
sl@0
   975
			_S("xyzB"),
sl@0
   976
			_S("bb"),
sl@0
   977
			_S("")
sl@0
   978
			}
sl@0
   979
		},
sl@0
   980
		{	// Test X P-T two
sl@0
   981
			// secondary text, primary text with trailing inline text primary
sl@0
   982
			// text won't fit and there is no line breaking point inside primary
sl@0
   983
			// text and the primary text plus trailing text will fit on next line
sl@0
   984
			{
sl@0
   985
			_S("ijklm uvwxyzB"),
sl@0
   986
			_S("ijklm"),
sl@0
   987
			_S(" "),
sl@0
   988
			_S("uvwxyzB"),
sl@0
   989
			_S(""),
sl@0
   990
			_S("")
sl@0
   991
			},
sl@0
   992
			{
sl@0
   993
			_S("ijklm uvwxyzB"),
sl@0
   994
			_S("ijklm"),
sl@0
   995
			_S(" "),
sl@0
   996
			_S("uvwxyzB"),
sl@0
   997
			_S("b"),
sl@0
   998
			_S("")
sl@0
   999
			},
sl@0
  1000
			{
sl@0
  1001
			_S("ijklm uvwxyzB"),
sl@0
  1002
			_S("ijklm"),
sl@0
  1003
			_S(" "),
sl@0
  1004
			_S("uvwxyzB"),
sl@0
  1005
			_S("bb"),
sl@0
  1006
			_S("")
sl@0
  1007
			}
sl@0
  1008
		},
sl@0
  1009
		{	// Test X L-P-T one
sl@0
  1010
			// secondary text, primary text with leading and trailing inline text trailing
sl@0
  1011
			// text won't fit and there is no line breaking point inside primary text and
sl@0
  1012
			// the leading text plus primary text plus trailing text will fit on the next line
sl@0
  1013
			{
sl@0
  1014
			_S("ij AwxyzB"),
sl@0
  1015
			_S("ij AwxyzB"),
sl@0
  1016
			_S(""),
sl@0
  1017
			_S(""),
sl@0
  1018
			_S(""),
sl@0
  1019
			_S("")
sl@0
  1020
			},
sl@0
  1021
			{
sl@0
  1022
			_S("ij AwxyzB"),
sl@0
  1023
			_S("ij"),
sl@0
  1024
			_S(" "),
sl@0
  1025
			_S("a"),
sl@0
  1026
			_S("AwxyzB"),
sl@0
  1027
			_S("b")
sl@0
  1028
			},
sl@0
  1029
			{
sl@0
  1030
			_S("ij AwxyzB"),
sl@0
  1031
			_S("ij"),
sl@0
  1032
			_S(" "),
sl@0
  1033
			_S("aa"),
sl@0
  1034
			_S("AwxyzB"),
sl@0
  1035
			_S("bb")
sl@0
  1036
			}
sl@0
  1037
		},
sl@0
  1038
		{	// Test X L-P-T two
sl@0
  1039
			// secondary text, primary text with leading and trailing inline text primary
sl@0
  1040
			// text won't fit and there is no line breaking point inside primary text and
sl@0
  1041
			// the leading text plus primary text plus trailing text will fit on the next line
sl@0
  1042
			{
sl@0
  1043
			_S("ijkl AxyzB"),
sl@0
  1044
			_S("ijkl AxyzB"),
sl@0
  1045
			_S(""),
sl@0
  1046
			_S(""),
sl@0
  1047
			_S(""),
sl@0
  1048
			_S("")
sl@0
  1049
			},
sl@0
  1050
			{
sl@0
  1051
			_S("ijkl AxyzB"),
sl@0
  1052
			_S("ijkl"),
sl@0
  1053
			_S(" "),
sl@0
  1054
			_S("a"),
sl@0
  1055
			_S("AxyzB"),
sl@0
  1056
			_S("b")
sl@0
  1057
			},
sl@0
  1058
			{
sl@0
  1059
			_S("ijkl AxyzB"),
sl@0
  1060
			_S("ijkl"),
sl@0
  1061
			_S(" "),
sl@0
  1062
			_S("aa"),
sl@0
  1063
			_S("AxyzB"),
sl@0
  1064
			_S("bb"),
sl@0
  1065
			}
sl@0
  1066
		},
sl@0
  1067
		{	// Test X L-P-T three
sl@0
  1068
			//secondary text, primary text with leading and trailing inline text leading
sl@0
  1069
			// text won't fit and the leading text plus primary text plus trailing text
sl@0
  1070
			// will fit on the next line
sl@0
  1071
			{
sl@0
  1072
			_S("ijklmnop AxyzB"),
sl@0
  1073
			_S("ijklmnop"),
sl@0
  1074
			_S(" "),
sl@0
  1075
			_S("AxyzB"),
sl@0
  1076
			_S(""),
sl@0
  1077
			_S("")
sl@0
  1078
			},
sl@0
  1079
			{
sl@0
  1080
			_S("ijklmnop AxyzB"),
sl@0
  1081
			_S("ijklmnop"),
sl@0
  1082
			_S(" "),
sl@0
  1083
			_S("a"),
sl@0
  1084
			_S("AxyzB"),
sl@0
  1085
			_S("b")
sl@0
  1086
			},
sl@0
  1087
			{
sl@0
  1088
			_S("ijklmnop AxyzB"),
sl@0
  1089
			_S("ijklmnop"),
sl@0
  1090
			_S(" "),
sl@0
  1091
			_S("aa"),
sl@0
  1092
			_S("AxyzB"),
sl@0
  1093
			_S("bb")
sl@0
  1094
			}
sl@0
  1095
		}	// End of Specific tests
sl@0
  1096
	};
sl@0
  1097
sl@0
  1098
static const TInt KTestCount[KTestCases][KInlineTextOptions] =
sl@0
  1099
	{
sl@0
  1100
		{	// Start of General Combination tests
sl@0
  1101
		1,	// Test L-P
sl@0
  1102
		2,
sl@0
  1103
		2
sl@0
  1104
		},
sl@0
  1105
		{
sl@0
  1106
		1,	// Test X L-P
sl@0
  1107
		3,
sl@0
  1108
		3
sl@0
  1109
		},
sl@0
  1110
		{
sl@0
  1111
		1,	// Test P-T
sl@0
  1112
		2,
sl@0
  1113
		2
sl@0
  1114
		},
sl@0
  1115
		{
sl@0
  1116
		1,	// Test P-T Y
sl@0
  1117
		3,
sl@0
  1118
		3
sl@0
  1119
		},
sl@0
  1120
		{
sl@0
  1121
		1,	// Test L-P-T
sl@0
  1122
		3,
sl@0
  1123
		3
sl@0
  1124
		},
sl@0
  1125
		{
sl@0
  1126
		1,	// Test L-C-T
sl@0
  1127
		3,
sl@0
  1128
		3
sl@0
  1129
		},
sl@0
  1130
		{
sl@0
  1131
		1,	// Test X L-P-T
sl@0
  1132
		4,
sl@0
  1133
		4
sl@0
  1134
		},
sl@0
  1135
		{
sl@0
  1136
		1,	// Test X L-C-T
sl@0
  1137
		4,
sl@0
  1138
		4
sl@0
  1139
		},
sl@0
  1140
		{
sl@0
  1141
		1,	// Test L-P-T Y
sl@0
  1142
		4,
sl@0
  1143
		4
sl@0
  1144
		},
sl@0
  1145
		{
sl@0
  1146
		1,	// Test L-C-T Y
sl@0
  1147
		4,
sl@0
  1148
		4
sl@0
  1149
		},
sl@0
  1150
		{
sl@0
  1151
		1,	// Test X L-P-T Y
sl@0
  1152
		5,
sl@0
  1153
		5
sl@0
  1154
		},
sl@0
  1155
		{
sl@0
  1156
		1,	// Test X L-C-T Y
sl@0
  1157
		5,
sl@0
  1158
		5
sl@0
  1159
		},	// End of General Combination tests
sl@0
  1160
		{	// Start of Specific tests
sl@0
  1161
		3,	// Test P-T B
sl@0
  1162
		4,
sl@0
  1163
		4
sl@0
  1164
		},
sl@0
  1165
		{
sl@0
  1166
		1,	// Test X P-T one
sl@0
  1167
		4,
sl@0
  1168
		4
sl@0
  1169
		},
sl@0
  1170
		{
sl@0
  1171
		3,	// Test X P-T two
sl@0
  1172
		4,
sl@0
  1173
		4
sl@0
  1174
		},
sl@0
  1175
		{
sl@0
  1176
		1,	// Test X L-P-T one
sl@0
  1177
		5,
sl@0
  1178
		5
sl@0
  1179
		},
sl@0
  1180
		{
sl@0
  1181
		1,	// Test X L-P-T two
sl@0
  1182
		5,
sl@0
  1183
		5
sl@0
  1184
		},
sl@0
  1185
		{
sl@0
  1186
		3,	// Test X L-P-T three
sl@0
  1187
		5,
sl@0
  1188
		5
sl@0
  1189
		}	// End of Specific tests
sl@0
  1190
	};
sl@0
  1191
sl@0
  1192
void DoLineTestL(TDes& aText, CTextLayout* aLayout, CTestGraphicsDevice* aDevice, CTextView* aView, TInt aNumChar, TInt aIndex)
sl@0
  1193
	{
sl@0
  1194
	aText = KTestStrings[aIndex][aNumChar][0];
sl@0
  1195
	CTestFormExtendedInterfaceProvider* interfaceProvider = CTestFormExtendedInterfaceProvider::NewL(aText, aNumChar); // owned here
sl@0
  1196
	aLayout->SetInterfaceProvider(interfaceProvider);
sl@0
  1197
	CleanupStack::PushL(interfaceProvider);
sl@0
  1198
	aDevice->LineArray().ResetLineArray();
sl@0
  1199
	aView->HandleGlobalChangeL();
sl@0
  1200
	// now that we've redrawn the actual ooutput (what went through DrawText(), including
sl@0
  1201
	// any inline text) has been stored in the LineArray. So we#'ll have a look and see
sl@0
  1202
	// if it contains what we expect it to.
sl@0
  1203
	// Each line may produce one or more LineArray() entries as there is one created for
sl@0
  1204
	// each call to DrawText()
sl@0
  1205
	const TTestGCDisplayLine* line1 = 0;
sl@0
  1206
	const TTestGCDisplayLine* line2 = 0;
sl@0
  1207
	// Find out how many LineArray entries are expected for the output of this test
sl@0
  1208
	TInt count = KTestCount[aIndex][aNumChar];
sl@0
  1209
	// And test them (in reverse order, because it's easier)
sl@0
  1210
	switch (count)
sl@0
  1211
		{
sl@0
  1212
	case 5:
sl@0
  1213
		line1 = &(aDevice->LineArray().Line(4));
sl@0
  1214
		line2 = aDevice->LineArray().Find(KTestStrings[aIndex][aNumChar][5]);
sl@0
  1215
		TESTPOINT(0 != line1);
sl@0
  1216
		TESTPOINT(0 != line2);
sl@0
  1217
		TESTPOINT(line1->iLineData.Compare(line2->iLineData) == 0);
sl@0
  1218
	case 4:
sl@0
  1219
		line1 = &(aDevice->LineArray().Line(3));
sl@0
  1220
		line2 = aDevice->LineArray().Find(KTestStrings[aIndex][aNumChar][4]);
sl@0
  1221
		TESTPOINT(0 != line1);
sl@0
  1222
		TESTPOINT(0 != line2);
sl@0
  1223
		TESTPOINT(line1->iLineData.Compare(line2->iLineData) == 0);
sl@0
  1224
	case 3:
sl@0
  1225
		line1 = &(aDevice->LineArray().Line(2));
sl@0
  1226
		line2 = aDevice->LineArray().Find(KTestStrings[aIndex][aNumChar][3]);
sl@0
  1227
		TESTPOINT(0 != line1);
sl@0
  1228
		TESTPOINT(0 != line2);
sl@0
  1229
		TESTPOINT(line1->iLineData.Compare(line2->iLineData) == 0);
sl@0
  1230
	case 2:
sl@0
  1231
		line1 = &(aDevice->LineArray().Line(1));
sl@0
  1232
		line2 = aDevice->LineArray().Find(KTestStrings[aIndex][aNumChar][2]);
sl@0
  1233
		TESTPOINT(0 != line1);
sl@0
  1234
		TESTPOINT(0 != line2);
sl@0
  1235
		TESTPOINT(line1->iLineData.Compare(line2->iLineData) == 0);
sl@0
  1236
	case 1:
sl@0
  1237
		line1 = &(aDevice->LineArray().Line(0));
sl@0
  1238
		line2 = aDevice->LineArray().Find(KTestStrings[aIndex][aNumChar][1]);
sl@0
  1239
		TESTPOINT(0 != line1);
sl@0
  1240
		TESTPOINT(0 != line2);
sl@0
  1241
		// Can't always do a direct comparison of lines because same string
sl@0
  1242
		// may appear in more than one line, so compare contents
sl@0
  1243
		TESTPOINT(line1->iLineData.Compare(line2->iLineData) == 0);
sl@0
  1244
		}
sl@0
  1245
	aLayout->SetInterfaceProvider(NULL);
sl@0
  1246
	CleanupStack::PopAndDestroy(interfaceProvider);
sl@0
  1247
	}
sl@0
  1248
sl@0
  1249
void GeneralCombinationTestsTextViewL(TDes& aText, CTextLayout* aLayout, CTestGraphicsDevice* aDevice, CTextView* aView, TInt aNumChar)
sl@0
  1250
	{
sl@0
  1251
	// For all tests carried out from here up to 20 chars will fit on a line
sl@0
  1252
	TESTPRINT(_L("Test L-P"));
sl@0
  1253
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 0);
sl@0
  1254
	TESTPRINT(_L("Test X L-P"));
sl@0
  1255
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 1);
sl@0
  1256
	TESTPRINT(_L("Test P-T"));
sl@0
  1257
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 2);
sl@0
  1258
	TESTPRINT(_L("Test P-T Y"));
sl@0
  1259
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 3);
sl@0
  1260
	TESTPRINT(_L("Test L-P-T"));
sl@0
  1261
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 4);
sl@0
  1262
	TESTPRINT(_L("Test L-C-T"));
sl@0
  1263
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 5);
sl@0
  1264
	TESTPRINT(_L("Test X L-P-T"));
sl@0
  1265
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 6);
sl@0
  1266
	TESTPRINT(_L("Test X L-C-T"));
sl@0
  1267
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 7);
sl@0
  1268
	TESTPRINT(_L("Test L-P-T Y"));
sl@0
  1269
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 8);
sl@0
  1270
	TESTPRINT(_L("Test L-C-T Y"));
sl@0
  1271
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 9);
sl@0
  1272
	TESTPRINT(_L("Test X L-P-T Y"));
sl@0
  1273
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 10);
sl@0
  1274
	TESTPRINT(_L("Test X L-C-T Y"));
sl@0
  1275
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 11);
sl@0
  1276
	}
sl@0
  1277
sl@0
  1278
void SpecificTestsTextViewL(TDes& aText, CTextLayout* aLayout, CTestGraphicsDevice* aDevice, CTextView* aView, TInt aNumChar)
sl@0
  1279
	{
sl@0
  1280
	// For all tests carried out from here up to 10 chars will fit on a line
sl@0
  1281
    TESTPRINT(_L("Test P-T B"));
sl@0
  1282
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 12);
sl@0
  1283
	TESTPRINT(_L("Test X P-T one"));
sl@0
  1284
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 13);
sl@0
  1285
	TESTPRINT(_L("Test X P-T two"));
sl@0
  1286
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 14);
sl@0
  1287
	TESTPRINT(_L("Test X L-P-T one"));
sl@0
  1288
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 15);
sl@0
  1289
	TESTPRINT(_L("Test X L-P-T two"));
sl@0
  1290
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 16);
sl@0
  1291
	TESTPRINT(_L("Test X L-P-T three"));
sl@0
  1292
	DoLineTestL(aText, aLayout, aDevice, aView, aNumChar, 17);
sl@0
  1293
	}
sl@0
  1294
sl@0
  1295
void DoLineTestForINC141914L(TDes& aText, CTextLayout* aLayout, CTestGraphicsDevice* aDevice, CTextView* aView)
sl@0
  1296
    {
sl@0
  1297
    /*
sl@0
  1298
     * This case is to test whether or not inline text will find the correct format after changing the text content.
sl@0
  1299
     * In bytecode, there is one value to record the postion(iInlineTextFormat) to which inline text chunk attaches,
sl@0
  1300
     * INC141914 is raised because this value is not updated correctly after text change.
sl@0
  1301
     * The text string is as the following 3 lines:
sl@0
  1302
     * 111111;
sl@0
  1303
     * 222222;
sl@0
  1304
     * wxyBbz
sl@0
  1305
     * Where the 'b' is the inline text.
sl@0
  1306
     * 
sl@0
  1307
     * 1st step:
sl@0
  1308
     * delete 5 leading '1's in the first line,
sl@0
  1309
     * 2nd step:
sl@0
  1310
     * delete 5 leading '2's in the second line.
sl@0
  1311
     * after the 2 steps, inline text is still able to use iInlineTextFormat to find its attached text string
sl@0
  1312
    */
sl@0
  1313
    aText = _S("\x31\x31\x31\x31\x31\x31\x3B\x2029\x32\x32\x32\x32\x32\x32\x3B\x2029\x77\x78\x79\x42\x7A");
sl@0
  1314
    CTestFormExtendedInterfaceProvider* interfaceProvider = CTestFormExtendedInterfaceProvider::NewL(aText, 1); // owned here
sl@0
  1315
    aLayout->SetInterfaceProvider(interfaceProvider);
sl@0
  1316
    CleanupStack::PushL(interfaceProvider);
sl@0
  1317
    aDevice->LineArray().ResetLineArray();
sl@0
  1318
    aView->HandleGlobalChangeL();
sl@0
  1319
    aText.Delete(0,5);
sl@0
  1320
    aView->HandleInsertDeleteL(TCursorSelection(0,0),5);
sl@0
  1321
    aText.Delete(3,5);
sl@0
  1322
    aView->HandleInsertDeleteL(TCursorSelection(3,3),5);
sl@0
  1323
 
sl@0
  1324
    aLayout->SetInterfaceProvider(NULL);
sl@0
  1325
    CleanupStack::PopAndDestroy(interfaceProvider);
sl@0
  1326
    }
sl@0
  1327
sl@0
  1328
void DoLineTestForINC143086L(TDes& aText, CTextLayout* aLayout, CTestGraphicsDevice* aDevice, CTextView* aView)
sl@0
  1329
    {
sl@0
  1330
    /*
sl@0
  1331
     * This case is to test inline text behaviour for right-to-left text 
sl@0
  1332
     * The text string is as the following characters:
sl@0
  1333
     * \x5e0\x5e1\x5e2\x5e3\x5e4\x5c0\x5e5;
sl@0
  1334
     * Where the '\x5c0' is the inline text.
sl@0
  1335
     */
sl@0
  1336
    aText = _S("\x5e0\x5e1\x5e2\x5e3\x5e4\x5c0\x5e5");
sl@0
  1337
    CTestFormExtendedInterfaceProvider* interfaceProvider = CTestFormExtendedInterfaceProvider::NewL(aText, 1); // owned here
sl@0
  1338
    aLayout->SetInterfaceProvider(interfaceProvider);
sl@0
  1339
    CleanupStack::PushL(interfaceProvider);
sl@0
  1340
    aDevice->LineArray().ResetLineArray();
sl@0
  1341
    aView->HandleGlobalChangeL();
sl@0
  1342
 
sl@0
  1343
    aLayout->SetInterfaceProvider(NULL);
sl@0
  1344
    CleanupStack::PopAndDestroy(interfaceProvider);
sl@0
  1345
    }
sl@0
  1346
sl@0
  1347
// aNumChar determines what kind of inline text is in force
sl@0
  1348
// 0 means no inline text, 1 means insert a single char for
sl@0
  1349
// each possible inline text and 2 means insert two chars
sl@0
  1350
void RunGeneralCombinationTestsL(TInt aNumChar)
sl@0
  1351
	{
sl@0
  1352
	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
sl@0
  1353
	CleanupStack::PushL(scheduler);
sl@0
  1354
	CActiveScheduler::Install(scheduler);
sl@0
  1355
	TBuf<100> text;
sl@0
  1356
	TDocModel docModel(text);
sl@0
  1357
	// This time make it capable of 20 chars + a couple of spare pixels
sl@0
  1358
	// so all of these tests should result in a single line of output
sl@0
  1359
	TRect displayRect(0, 0, KDisplayWidthWide, KDisplayHeight);
sl@0
  1360
	CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width());
sl@0
  1361
	CleanupStack::PushL(layout);
sl@0
  1362
	CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0);
sl@0
  1363
	CleanupStack::PushL(device);
sl@0
  1364
	CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0);
sl@0
  1365
	CleanupStack::PushL(view);
sl@0
  1366
	// This is used to force the use of CTestGraphicsContext instead of a normal one
sl@0
  1367
	CWindowGc* offScreenContext;
sl@0
  1368
	User::LeaveIfError(device->CreateContext(offScreenContext));
sl@0
  1369
	CleanupStack::PushL(offScreenContext);
sl@0
  1370
	CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext);
sl@0
  1371
sl@0
  1372
	GeneralCombinationTestsTextViewL(text, layout, device, view, aNumChar);
sl@0
  1373
sl@0
  1374
	CleanupStack::PopAndDestroy(offScreenContext);
sl@0
  1375
	CleanupStack::PopAndDestroy(view);
sl@0
  1376
	CleanupStack::PopAndDestroy(device);
sl@0
  1377
	CleanupStack::PopAndDestroy(layout);
sl@0
  1378
	CleanupStack::PopAndDestroy(scheduler);
sl@0
  1379
	}
sl@0
  1380
sl@0
  1381
// aNumChar determines what kind of inline text is in force
sl@0
  1382
// 0 means no inline text, 1 means insert a single char for
sl@0
  1383
// each possible inline text and 2 means insert two chars
sl@0
  1384
void RunSpecificTestsL( TInt aNumChar)
sl@0
  1385
	{
sl@0
  1386
	// Note: If you need to move these heap checks any further "in" to focus
sl@0
  1387
	// on a specific test then you will have to move all the setup code in as
sl@0
  1388
	// well - and still preserve the two different display widths in use
sl@0
  1389
	__UHEAP_MARK;
sl@0
  1390
	CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
sl@0
  1391
	CleanupStack::PushL(scheduler);
sl@0
  1392
	CActiveScheduler::Install(scheduler);
sl@0
  1393
	TBuf<100> text;
sl@0
  1394
	TDocModel docModel(text);
sl@0
  1395
	// This time make it capable of 10 chars + a couple of spare pixels
sl@0
  1396
	// so that line wrapping will occur
sl@0
  1397
	TRect displayRect(0, 0, KDisplayWidthThin, KDisplayHeight);
sl@0
  1398
	CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width());
sl@0
  1399
	CleanupStack::PushL(layout);
sl@0
  1400
	CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0);
sl@0
  1401
	CleanupStack::PushL(device);
sl@0
  1402
	CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0);
sl@0
  1403
	CleanupStack::PushL(view);
sl@0
  1404
	// This is used to force the use of CTestGraphicsContext instead of a normal one
sl@0
  1405
	CWindowGc* offScreenContext;
sl@0
  1406
	User::LeaveIfError(device->CreateContext(offScreenContext));
sl@0
  1407
	CleanupStack::PushL(offScreenContext);
sl@0
  1408
	CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext);
sl@0
  1409
sl@0
  1410
	SpecificTestsTextViewL(text, layout, device, view, aNumChar);
sl@0
  1411
sl@0
  1412
	CleanupStack::PopAndDestroy(offScreenContext);
sl@0
  1413
	CleanupStack::PopAndDestroy(view);
sl@0
  1414
	CleanupStack::PopAndDestroy(device);
sl@0
  1415
	CleanupStack::PopAndDestroy(layout);
sl@0
  1416
	CleanupStack::PopAndDestroy(scheduler);
sl@0
  1417
	__UHEAP_MARKEND;
sl@0
  1418
	}
sl@0
  1419
sl@0
  1420
sl@0
  1421
void RunTestsForINC141914L()
sl@0
  1422
    {
sl@0
  1423
    __UHEAP_MARK;
sl@0
  1424
    CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
sl@0
  1425
    CleanupStack::PushL(scheduler);
sl@0
  1426
    CActiveScheduler::Install(scheduler);
sl@0
  1427
    TBuf<100> text;
sl@0
  1428
    TDocModel docModel(text);
sl@0
  1429
    // This time make it capable of 10 chars + a couple of spare pixels
sl@0
  1430
    // so that line wrapping will occur
sl@0
  1431
    TRect displayRect(0, 0, KDisplayWidthWide, KDisplayHeight);
sl@0
  1432
    CTextLayout* layout = CTextLayout::NewL(&docModel, displayRect.Width());
sl@0
  1433
    CleanupStack::PushL(layout);
sl@0
  1434
    CTestGraphicsDevice* device = CTestGraphicsDevice::NewL(displayRect.Size(), 0);
sl@0
  1435
    CleanupStack::PushL(device);
sl@0
  1436
    CTextView* view = CTextView::NewL(layout, displayRect, device, device, 0, 0, 0);
sl@0
  1437
    CleanupStack::PushL(view);
sl@0
  1438
    // This is used to force the use of CTestGraphicsContext instead of a normal one 
sl@0
  1439
    CWindowGc* offScreenContext;
sl@0
  1440
    User::LeaveIfError(device->CreateContext(offScreenContext));
sl@0
  1441
    CleanupStack::PushL(offScreenContext);
sl@0
  1442
    CTestTextView::SetContextForFlickerFreeRedraw(view, offScreenContext);
sl@0
  1443
sl@0
  1444
    DoLineTestForINC141914L(text, layout, device, view);
sl@0
  1445
    DoLineTestForINC143086L(text, layout, device, view);
sl@0
  1446
sl@0
  1447
    CleanupStack::PopAndDestroy(offScreenContext);
sl@0
  1448
    CleanupStack::PopAndDestroy(view);
sl@0
  1449
    CleanupStack::PopAndDestroy(device);
sl@0
  1450
    CleanupStack::PopAndDestroy(layout);
sl@0
  1451
    CleanupStack::PopAndDestroy(scheduler);
sl@0
  1452
    __UHEAP_MARKEND;
sl@0
  1453
    }
sl@0
  1454
sl@0
  1455
TVerdict CTInLineTextStep::doTestStepL()
sl@0
  1456
	{
sl@0
  1457
    SetTestStepResult(EPass);
sl@0
  1458
    TestStep = this;
sl@0
  1459
    
sl@0
  1460
	__UHEAP_MARK;
sl@0
  1461
	TESTPRINT(KTInlineText);
sl@0
  1462
	TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORM-LEGACY-INLINETEXT-0001 General combination tests - no inline text "));
sl@0
  1463
	TInt error = RFbsSession::Connect();
sl@0
  1464
	if (error == KErrNotFound)
sl@0
  1465
		{
sl@0
  1466
		FbsStartup();
sl@0
  1467
		error = RFbsSession::Connect();
sl@0
  1468
		}
sl@0
  1469
	TEST(error == KErrNone);
sl@0
  1470
	TRAP(error, RunGeneralCombinationTestsL(0));
sl@0
  1471
	TEST(error == KErrNone);
sl@0
  1472
	TESTPRINT(_L("General combination tests - single char inline text"));
sl@0
  1473
	TRAP(error, RunGeneralCombinationTestsL(1));
sl@0
  1474
	TEST(error == KErrNone);
sl@0
  1475
	TESTPRINT(_L("General combination tests - multi char inline text"));
sl@0
  1476
	TRAP(error, RunGeneralCombinationTestsL(2));
sl@0
  1477
	TEST(error == KErrNone);
sl@0
  1478
	TESTPRINT(_L("Specific tests - no inline text"));
sl@0
  1479
	TRAP(error, RunSpecificTestsL(0));
sl@0
  1480
	TEST(error == KErrNone);
sl@0
  1481
	TESTPRINT(_L("Specific tests - single char inline text"));
sl@0
  1482
	TRAP(error, RunSpecificTestsL(1));
sl@0
  1483
	TEST(error == KErrNone);
sl@0
  1484
	TESTPRINT(_L("Specific tests - multi char inline text"));
sl@0
  1485
	TRAP(error, RunSpecificTestsL(2));
sl@0
  1486
	TEST(error == KErrNone);
sl@0
  1487
	
sl@0
  1488
    TESTPRINT(_L("Defect tests - for INC141914"));
sl@0
  1489
    TRAP(error, RunTestsForINC141914L());
sl@0
  1490
    TEST(error == KErrNone);
sl@0
  1491
    
sl@0
  1492
	RFbsSession::Disconnect();
sl@0
  1493
	__UHEAP_MARKEND;
sl@0
  1494
	User::Heap().Check();
sl@0
  1495
	return TestStepResult();
sl@0
  1496
	}