--- a/textrendering/texthandling/ttext/T_SCANDC.CPP Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/ttext/T_SCANDC.CPP Wed Sep 01 12:39:40 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -16,29 +16,12 @@
*/
+#include <e32test.h>
#include <txtetext.h>
-#include "T_SCANDC.h"
-
-LOCAL_D CTestStep *pTestStep = NULL;
-#define test(cond) \
- { \
- TBool __bb = (cond); \
- pTestStep->TEST(__bb); \
- if (!__bb) \
- { \
- pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed")); \
- User::Leave(1); \
- } \
- }
-#undef INFO_PRINTF1
-#undef INFO_PRINTF2
-// copy from tefexportconst.h
-#define INFO_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
-#define INFO_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
-
#define UNUSED_VAR(a) a = a
+LOCAL_D RTest test(_L("SCANNING OF TEXT DOCUMENTS"));
LOCAL_D CTrapCleanup* TheTrapCleanup;
template<class S,CEditableText::TDocumentStorage D>
@@ -215,7 +198,7 @@
{
TBuf<64> temp;
- //INFO_PRINTF1(_L("0 words"));
+ //test.Start(_L("0 words"));
//iDocument->InsertL(0,buf.Ptr(),buf.Size());
//DoCountWords(0);
// This test has been removed since it is no longer feasible.
@@ -223,40 +206,40 @@
// as soon as the document is created, hence, there can not
// be 0 words.
- INFO_PRINTF1(_L("0 words, all delimiters"));
+ test.Start(_L("0 words, all delimiters"));
temp.Append(_L(" "));
temp.Append(iDelimiter);
temp.Append(_L(" "));
StoreTextL(temp);
DoCountWords(0);
- INFO_PRINTF1(_L("1 word, no delimiter"));
+ test.Next(_L("1 word, no delimiter"));
temp.Append(_L("This"));
StoreTextL(temp);
DoCountWords(1);
- INFO_PRINTF1(_L("1 word, at start, no delimiter"));
+ test.Next(_L("1 word, at start, no delimiter"));
temp.Delete(0,temp.Size());
temp.Append(_L("THIS"));
StoreTextL(temp);
DoCountWords(1);
- INFO_PRINTF1(_L("1 word, with delimiter"));
+ test.Next(_L("1 word, with delimiter"));
temp.Append(' ');
StoreTextL(temp);
DoCountWords(1);
- INFO_PRINTF1(_L("Many words, no delimiter"));
+ test.Next(_L("Many words, no delimiter"));
temp.Append(_L(" is a wonderful world"));
StoreTextL(temp);
DoCountWords(5);
- INFO_PRINTF1(_L("Many words with delimiter"));
+ test.Next(_L("Many words with delimiter"));
temp.Append(' ');
StoreTextL(temp);
DoCountWords(5);
-
+ test.End();
}
@@ -271,16 +254,16 @@
StoreTextL(buf);
iCharsSkipped=iUnitCount=0;
- INFO_PRINTF1(_L("Forward scan"));
+ test.Start(_L("Forward scan"));
- INFO_PRINTF1(_L("Stay at boundary:to unit start"));
+ test.Next(_L("Stay at boundary:to unit start"));
TUint flags=(CPlainText::EScanStayIfBoundary | CPlainText::EScanToUnitStart);
DoScanWords(8,flags,12,4);
DoScanWords(7,flags,7,0);
DoScanWords(6,flags,6,0);
DoScanWords(5,flags,6,1);
- INFO_PRINTF1(_L("Stay at boundary:to unit end"));
+ test.Next(_L("Stay at boundary:to unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(8,flags,11,3);
@@ -288,14 +271,14 @@
DoScanWords(6,flags,6,0);
DoScanWords(5,flags,5,0);
- INFO_PRINTF1(_L("Stay at boundary:to unit start:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit start:join delimiters"));
flags=(CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters);
DoScanWords(8,flags,13,5);
DoScanWords(7,flags,7,0);
DoScanWords(6,flags,7,1);
DoScanWords(5,flags,7,2);
- INFO_PRINTF1(_L("Stay at boundary:to unit end:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(8,flags,11,3);
@@ -303,14 +286,14 @@
DoScanWords(6,flags,11,5);
DoScanWords(5,flags,5,0);
- INFO_PRINTF1(_L("To unit start"));
+ test.Next(_L("To unit start"));
flags=CPlainText::EScanToUnitStart;
DoScanWords(8,flags,12,4);
DoScanWords(7,flags,12,5);
DoScanWords(6,flags,7,1);
DoScanWords(5,flags,6,1);
- INFO_PRINTF1(_L("To unit end"));
+ test.Next(_L("To unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(8,flags,11,3);
@@ -318,14 +301,14 @@
DoScanWords(6,flags,11,5);
DoScanWords(5,flags,6,1);
- INFO_PRINTF1(_L("To unit start:join delimiters"));
+ test.Next(_L("To unit start:join delimiters"));
flags=(CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters);
DoScanWords(8,flags,13,5);
DoScanWords(7,flags,13,6);
DoScanWords(6,flags,7,1);
DoScanWords(5,flags,7,2);
- INFO_PRINTF1(_L("To unit end:join delimiters"));
+ test.Next(_L("To unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(8,flags,11,3);
@@ -333,8 +316,8 @@
DoScanWords(6,flags,11,5);
DoScanWords(5,flags,11,6);
- INFO_PRINTF1(_L("Backward scan"));
- INFO_PRINTF1(_L("Stay at boundary:to unit start"));
+ test.Next(_L("Backward scan"));
+ test.Next(_L("Stay at boundary:to unit start"));
flags=(CPlainText::EScanBackwards|CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart);
DoScanWords(9,flags,7,2);
DoScanWords(10,flags,7,3);
@@ -342,7 +325,7 @@
DoScanWords(12,flags,12,0);
DoScanWords(13,flags,13,0);
- INFO_PRINTF1(_L("Stay at boundary:to unit end"));
+ test.Next(_L("Stay at boundary:to unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(9,flags,6,3);
@@ -351,7 +334,7 @@
DoScanWords(12,flags,12,0);
DoScanWords(13,flags,12,1);
- INFO_PRINTF1(_L("Stay at boundary:to unit start:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit start:join delimiters"));
flags=CPlainText::EScanBackwards|CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters;
DoScanWords(9,flags,7,2);
DoScanWords(10,flags,7,3);
@@ -359,7 +342,7 @@
DoScanWords(12,flags,7,5);
DoScanWords(13,flags,13,0);
- INFO_PRINTF1(_L("Stay at boundary:to unit end:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(9,flags,5,4);
@@ -368,7 +351,7 @@
DoScanWords(12,flags,11,1);
DoScanWords(13,flags,11,2);
- INFO_PRINTF1(_L("To unit start"));
+ test.Next(_L("To unit start"));
flags=CPlainText::EScanBackwards|CPlainText::EScanToUnitStart;
DoScanWords(9,flags,7,2);
DoScanWords(10,flags,7,3);
@@ -376,7 +359,7 @@
DoScanWords(12,flags,7,5);
DoScanWords(13,flags,12,1);
- INFO_PRINTF1(_L("To unit end"));
+ test.Next(_L("To unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanWords(9,flags,6,3);
@@ -385,7 +368,7 @@
DoScanWords(12,flags,11,1);
DoScanWords(13,flags,12,1);
- INFO_PRINTF1(_L("To unit start:join delimiters"));
+ test.Next(_L("To unit start:join delimiters"));
flags=CPlainText::EScanBackwards|CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters;
DoScanWords(9,flags,7,2);
DoScanWords(10,flags,7,3);
@@ -393,14 +376,14 @@
DoScanWords(12,flags,7,5);
DoScanWords(13,flags,7,6);
- INFO_PRINTF1(_L("To unit end:join delimiters"));
+ test.Next(_L("To unit end:join delimiters"));
flags=CPlainText::EScanToUnitEnd|CPlainText::EScanJoinDelimiters|CPlainText::EScanBackwards;
DoScanWords(9,flags,5,4);
DoScanWords(10,flags,5,5);
DoScanWords(11,flags,5,6);
DoScanWords(12,flags,11,1);
DoScanWords(13,flags,11,2);
-
+ test.End();
}
@@ -412,46 +395,46 @@
{
TBuf<64> buf;
- //INFO_PRINTF1(_L("0 paras"));
+ //test.Start(_L("0 paras"));
//iDocument->InsertL(0,buf.Ptr(),buf.Size());
//DoCountParagraphs(0);
// This test no longer applies, since documents are created with
// an end of document character. ie, The document can not have
// 0 words.
- INFO_PRINTF1(_L("Empty text source"));
+ test.Start(_L("Empty text source"));
// buf.Append(iDelimiter);
// buf.Append(iDelimiter);
StoreTextL(buf);
DoCountParas(1);
- INFO_PRINTF1(_L("1 para. no delimiter"));
+ test.Next(_L("1 para. no delimiter"));
buf.Append(_L("This"));
StoreTextL(buf);
DoCountParas(1);
- INFO_PRINTF1(_L("1 para. at start, no delimiter"));
+ test.Next(_L("1 para. at start, no delimiter"));
buf.Delete(0,buf.Size());
buf.Append(_L(" THIS "));
StoreTextL(buf);
DoCountParas(1);
- INFO_PRINTF1(_L("1 para, with delimiter"));
+ test.Next(_L("1 para, with delimiter"));
buf.Append(iDelimiter);
StoreTextL(buf);
DoCountParas(2);
- INFO_PRINTF1(_L("2 paras, no delimiter"));
+ test.Next(_L("2 paras, no delimiter"));
buf.Append(' ');
StoreTextL(buf);
DoCountParas(2);
- INFO_PRINTF1(_L("2 paras with delimiter"));
+ test.Next(_L("2 paras with delimiter"));
buf.Append(iDelimiter);
StoreTextL(buf);
DoCountParas(3);
-
+ test.End();
}
@@ -472,16 +455,16 @@
StoreTextL(buf);
iCharsSkipped=iUnitCount=0;
- INFO_PRINTF1(_L("Forward scan"));
+ test.Start(_L("Forward scan"));
- INFO_PRINTF1(_L("Stay at boundary:to unit start"));
+ test.Next(_L("Stay at boundary:to unit start"));
TUint flags=(CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart);
DoScanParas(8,flags,12,4);
DoScanParas(7,flags,7,0);
DoScanParas(6,flags,6,0);
DoScanParas(5,flags,6,1);
- INFO_PRINTF1(_L("Stay at boundary:to unit end"));
+ test.Next(_L("Stay at boundary:to unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(8,flags,11,3);
@@ -489,14 +472,14 @@
DoScanParas(6,flags,6,0);
DoScanParas(5,flags,5,0);
- INFO_PRINTF1(_L("Stay at boundary:to unit start:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit start:join delimiters"));
flags=(CPlainText::EScanStayIfBoundary | CPlainText::EScanToUnitStart | CPlainText::EScanJoinDelimiters);
DoScanParas(8,flags,13,5);
DoScanParas(7,flags,7,0);
DoScanParas(6,flags,7,1);
DoScanParas(5,flags,7,2);
- INFO_PRINTF1(_L("Stay at boundary:to unit end:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(8,flags,11,3);
@@ -504,14 +487,14 @@
DoScanParas(6,flags,11,5);
DoScanParas(5,flags,5,0);
- INFO_PRINTF1(_L("To unit start"));
+ test.Next(_L("To unit start"));
flags=CPlainText::EScanToUnitStart;
DoScanParas(8,flags,12,4);
DoScanParas(7,flags,12,5);
DoScanParas(6,flags,7,1);
DoScanParas(5,flags,6,1);
- INFO_PRINTF1(_L("To unit end"));
+ test.Next(_L("To unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(8,flags,11,3);
@@ -519,14 +502,14 @@
DoScanParas(6,flags,11,5);
DoScanParas(5,flags,6,1);
- INFO_PRINTF1(_L("To unit start:join delimiters"));
+ test.Next(_L("To unit start:join delimiters"));
flags=(CPlainText::EScanToUnitStart | CPlainText::EScanJoinDelimiters);
DoScanParas(8,flags,13,5);
DoScanParas(7,flags,13,6);
DoScanParas(6,flags,7,1);
DoScanParas(5,flags,7,2);
- INFO_PRINTF1(_L("To unit end:join delimiters"));
+ test.Next(_L("To unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(8,flags,11,3);
@@ -534,8 +517,8 @@
DoScanParas(6,flags,11,5);
DoScanParas(5,flags,11,6);
- INFO_PRINTF1(_L("Backward scan"));
- INFO_PRINTF1(_L("Stay at boundary:to unit start"));
+ test.Next(_L("Backward scan"));
+ test.Next(_L("Stay at boundary:to unit start"));
flags=(CPlainText::EScanBackwards|CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart);
DoScanParas(9,flags,7,2);
DoScanParas(10,flags,7,3);
@@ -549,12 +532,12 @@
DoScanParas(3,flags,0,3);
DoScanParas(2,flags,0,2);
DoScanParas(1,flags,0,1);
- INFO_PRINTF1(_L("Testing at buffer boundaries."));
+ test.Next(_L("Testing at buffer boundaries."));
DoScanParas(0,flags,0,0);
DoScanParas(16,flags,13,3);
- INFO_PRINTF1(_L("Stay at boundary:to unit end"));
+ test.Next(_L("Stay at boundary:to unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(9,flags,6,3);
@@ -563,7 +546,7 @@
DoScanParas(12,flags,12,0);
DoScanParas(13,flags,12,1);
- INFO_PRINTF1(_L("Stay at boundary:to unit start:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit start:join delimiters"));
flags=CPlainText::EScanBackwards|CPlainText::EScanStayIfBoundary|CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters;
DoScanParas(9,flags,7,2);
DoScanParas(10,flags,7,3);
@@ -571,7 +554,7 @@
DoScanParas(12,flags,7,5);
DoScanParas(13,flags,13,0);
- INFO_PRINTF1(_L("Stay at boundary:to unit end:join delimiters"));
+ test.Next(_L("Stay at boundary:to unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(9,flags,5,4);
@@ -580,7 +563,7 @@
DoScanParas(12,flags,11,1);
DoScanParas(13,flags,11,2);
- INFO_PRINTF1(_L("To unit start"));
+ test.Next(_L("To unit start"));
flags=CPlainText::EScanBackwards|CPlainText::EScanToUnitStart;
DoScanParas(9,flags,7,2);
DoScanParas(10,flags,7,3);
@@ -588,7 +571,7 @@
DoScanParas(12,flags,7,5);
DoScanParas(13,flags,12,1);
- INFO_PRINTF1(_L("To unit end"));
+ test.Next(_L("To unit end"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(9,flags,6,3);
@@ -597,7 +580,7 @@
DoScanParas(12,flags,11,1);
DoScanParas(13,flags,12,1);
- INFO_PRINTF1(_L("To unit start:join delimiters"));
+ test.Next(_L("To unit start:join delimiters"));
flags=CPlainText::EScanBackwards|CPlainText::EScanToUnitStart|CPlainText::EScanJoinDelimiters;
DoScanParas(9,flags,7,2);
DoScanParas(10,flags,7,3);
@@ -605,7 +588,7 @@
DoScanParas(12,flags,7,5);
DoScanParas(13,flags,7,6);
- INFO_PRINTF1(_L("To unit end:join delimiters"));
+ test.Next(_L("To unit end:join delimiters"));
flags |= CPlainText::EScanToUnitEnd;
flags &=~CPlainText::EScanToUnitStart;
DoScanParas(9,flags,5,4);
@@ -614,7 +597,7 @@
DoScanParas(12,flags,11,1);
DoScanParas(13,flags,11,2);
-
+ test.End();
}
@@ -624,72 +607,76 @@
// Test all the methods of the class
//
{
- INFO_PRINTF1(_L("CountWords"));
+ test.Start(_L("CountWords"));
Test2aL();
- INFO_PRINTF1(_L("ScanWord"));
+ test.Next(_L("ScanWord"));
Test2bL();
- INFO_PRINTF1(_L("Count Paragraphs"));
+ test.Next(_L("Count Paragraphs"));
Test2cL();
- INFO_PRINTF1(_L("Scan Paragraph"));
+ test.Next(_L("Scan Paragraph"));
Test2dL();
-
+ test.End();
}
-CT_SCANDC::CT_SCANDC()
- {
- SetTestStepName(KTestStep_T_SCANDC);
- pTestStep = this;
- }
-TVerdict CT_SCANDC::doTestStepL()
- {
- SetTestStepResult(EFail);
-
- TheTrapCleanup=CTrapCleanup::New();
+GLDEF_C TInt E32Main()
+//
+// Test the OLIB Varray types.
+//
+ {
+ TheTrapCleanup=CTrapCleanup::New();
- INFO_PRINTF1(_L("SCANNING OF TEXT DOCUMENTS"));
- INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_SCANDC-0001 CPlainText - Flat "));
- typedef CTestScan<TText,CEditableText::EFlatStorage> instance1;
- typedef CTestScan<TText,CEditableText::ESegmentedStorage> instance2;
-
- instance1* aa=NULL;
- TRAPD(ret1, aa=instance1::NewL());
+ test.Title();
+ test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_SCANDC-0001 CPlainText - Flat "));
+ typedef CTestScan<TText,CEditableText::EFlatStorage> instance1;
+ typedef CTestScan<TText,CEditableText::ESegmentedStorage> instance2;
+
+ instance1* aa=NULL;
+ TRAPD(ret, aa=instance1::NewL());
+ test(ret == KErrNone);
- INFO_PRINTF1(_L("Registering all methods"));
+ test.Start(_L("Registering all methods"));
+
+ TRAP(ret,aa->Test1L());
+ test(ret == KErrNone);
- TRAPD(ret2,aa->Test1L());
+ test.Next(_L("Testing all methods"));
- INFO_PRINTF1(_L("Testing all methods"));
+ TRAP(ret,aa->Test2L());
+ test(ret == KErrNone);
- TRAPD(ret3,aa->Test2L());
+ __UHEAP_MARK;
+ delete aa;
+ __UHEAP_MARKEND;
+
+ test.End();
- __UHEAP_MARK;
- delete aa;
- __UHEAP_MARKEND;
+ test.Next(_L("CPlainText - Segmented"));
- INFO_PRINTF1(_L("CPlainText - Segmented"));
-
- instance2* bb=NULL;
- TRAPD(ret4, bb=instance2::NewL());
+ instance2* bb=NULL;
+ TRAP(ret, bb=instance2::NewL());
+ test(ret == KErrNone);
- __UHEAP_MARK;
- INFO_PRINTF1(_L("Registering all methods"));
- TRAPD(ret5,bb->Test1L());
- INFO_PRINTF1(_L("Testing all methods"));
- TRAPD(ret6,bb->Test2L());
- delete bb;
- __UHEAP_MARKEND;
-
- delete TheTrapCleanup;
+ __UHEAP_MARK;
+ test.Start(_L("Registering all methods"));
+ TRAP(ret,bb->Test1L());
+ test(ret == KErrNone);
+ test.Next(_L("Testing all methods"));
+ TRAP(ret,bb->Test2L());
+ test(ret == KErrNone);
+ delete bb;
+ __UHEAP_MARKEND;
+ test.End();
- if (ret1 == KErrNone && ret2 == KErrNone && ret3 == KErrNone && ret4 == KErrNone && ret5 == KErrNone && ret6 == KErrNone)
- {
- SetTestStepResult(EPass);
- }
+ test.End();
+ test.Close();
+
+ delete TheTrapCleanup;
- return TestStepResult();
- }
+ return(0);
+ }
+