--- a/textrendering/texthandling/ttext/TTIMES1.CPP Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/ttext/TTIMES1.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,6 +16,7 @@
*/
+#include <e32test.h>
#include <e32svr.h>
#include <s32mem.h>
@@ -24,22 +25,11 @@
#include <txtglobl.h>
#include "../incp/T_PMLPAR.H"
-#include "TTIMES1.h"
-
-#define test(cond) \
- { \
- TBool __bb = (cond); \
- TEST(__bb); \
- if (!__bb) \
- { \
- ERR_PRINTF1(_L("ERROR: Test Failed")); \
- User::Leave(1); \
- } \
- }
#define UNUSED_VAR(a) a = a
LOCAL_D CTrapCleanup* TheTrapCleanup;
+LOCAL_D RTest test(_L("CRichText Document"));
LOCAL_D CParaFormatLayer* TheGlobalParaFormatLayer;
LOCAL_D CCharFormatLayer* TheGlobalCharFormatLayer;
LOCAL_D CParser* TheParser;
@@ -49,7 +39,7 @@
LOCAL_D CRichText* TheText[KCreateRichTextCount];
-void CT_TTIMES1::GenerateGlobalLayersL()
+LOCAL_C void GenerateGlobalLayersL()
// Provides the base layers for globl text and below
//
{
@@ -61,7 +51,7 @@
}
-void CT_TTIMES1::KillGlobalLayers()
+LOCAL_C void KillGlobalLayers()
// Destroy the base layers for global text and below
//
{
@@ -71,7 +61,7 @@
TheGlobalCharFormatLayer=NULL;
}
-void CT_TTIMES1::KillText()
+LOCAL_C void KillText()
{
for (TInt ii=0; ii<KCreateRichTextCount;ii++)
{
@@ -86,7 +76,7 @@
TNow() { HomeTime(); }
};
-void CT_TTIMES1::CreationTestsL()
+LOCAL_C void CreationTestsL()
//
{
GenerateGlobalLayersL();
@@ -104,7 +94,7 @@
// Display the metric
TBuf<60> context;
context.Format(_L(" Create rich text %d times: %d\n"),KCreateRichTextCount,finish.MicroSecondsFrom(start).Int64());
- INFO_PRINTF1(context);
+ test.Printf(context);
//
// Tidy up
KillText();
@@ -112,7 +102,7 @@
}
-CRichText* CT_TTIMES1::LoadIntoTextL(TFileName& aFileName)
+LOCAL_C CRichText* LoadIntoTextL(TFileName& aFileName)
//
{
TRAPD(ret,
@@ -128,7 +118,7 @@
}
-void CT_TTIMES1::GetAppendTestTimeL(const CRichText* aSource,TInt aTestLoopCount)
+LOCAL_C void GetAppendTestTimeL(const CRichText* aSource,TInt aTestLoopCount)
{
CRichText* target=CRichText::NewL(TheGlobalParaFormatLayer,TheGlobalCharFormatLayer);
test(target->DocumentLength()==0);
@@ -148,12 +138,12 @@
test(ii==aTestLoopCount);
TBuf<60> context;
context.Format(_L(" Append %d rich text's: %d\n"),aTestLoopCount,finish.MicroSecondsFrom(start).Int64());
- INFO_PRINTF1(context);
+ test.Printf(context);
delete target;
}
-void CT_TTIMES1::GetBenchmarkAppendTestTimeL(const CRichText* aSource,TInt aTestLoopCount)
+LOCAL_C void GetBenchmarkAppendTestTimeL(const CRichText* aSource,TInt aTestLoopCount)
{
CRichText** target=new CRichText*[aTestLoopCount];
CBufStore** store=new CBufStore*[aTestLoopCount];
@@ -185,11 +175,11 @@
test(ii==aTestLoopCount);
TBuf<70> context2;
context2.Format(_L(" Benchmark : %d\n"),finish.MicroSecondsFrom(start).Int64());
- INFO_PRINTF1(context2);
+ test.Printf(context2);
}
-void CT_TTIMES1::AppendTest1L()
+LOCAL_C void AppendTest1L()
//
{
TInt testLoopCount=900;
@@ -206,7 +196,7 @@
}
-void CT_TTIMES1::AppendTest2L()
+LOCAL_C void AppendTest2L()
//
{
KillGlobalLayers(); // they are replaced by the ones read in from the PML file.
@@ -224,37 +214,38 @@
}
-void CT_TTIMES1::AppendTestsL()
+LOCAL_C void AppendTestsL()
//
{
GenerateGlobalLayersL();
//
- INFO_PRINTF1(_L("Plain Text Component Only"));
+ test.Start(_L("Plain Text Component Only"));
TRAPD(ret,
AppendTest1L());
test(ret==KErrNone);
//
- INFO_PRINTF1(_L("Plain Text with limited Markup - no pictures"));
+ test.Next(_L("Plain Text with limited Markup - no pictures"));
TRAP(ret,
AppendTest2L());
test(ret==KErrNone);
//
KillGlobalLayers();
+ test.End();
}
-void CT_TTIMES1::DoTestsL()
+LOCAL_C void DoTestsL()
//
{
- INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TTIMES1-0001 Creation Tests "));
+ test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_TTIMES1-0001 Creation Tests "));
CreationTestsL();
- INFO_PRINTF1(_L("Appending Tests"));
+ test.Next(_L("Appending Tests"));
AppendTestsL();
//
}
-void CT_TTIMES1::setupCleanup()
+LOCAL_C void setupCleanup()
//
// Initialise the cleanup stack.
//
@@ -270,30 +261,23 @@
});
}
-CT_TTIMES1::CT_TTIMES1()
- {
- SetTestStepName(KTestStep_T_TTIMES1);
- }
-TVerdict CT_TTIMES1::doTestStepL()
- {
- SetTestStepResult(EFail);
-
- __UHEAP_MARK;
- setupCleanup();
-
- INFO_PRINTF1(_L("CRichText Document"));
- TRAPD(error1, DoTestsL());
-
- delete TheTrapCleanup;
-
- __UHEAP_MARKEND;
-
- if(error1 == KErrNone)
- {
- SetTestStepResult(EPass);
- }
-
- return TestStepResult();
+GLDEF_C TInt E32Main()
+//
+// Test the Document Model Services.
+//
+ {
+ setupCleanup();
+ test.Title();
+ __UHEAP_MARK;
+
+ TRAPD(ret,DoTestsL());
+ test(ret == KErrNone);
+
+ test.End();
+ test.Close();
+ __UHEAP_MARKEND;
+ delete TheTrapCleanup;
+ return(0);
}