--- a/textrendering/texthandling/ttext/T_STYLE.CPP Wed Jun 09 11:40:52 2010 +0300
+++ b/textrendering/texthandling/ttext/T_STYLE.CPP Tue Aug 31 17:01:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2010 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"
@@ -21,18 +21,35 @@
#include <gdi.h>
#include <s32file.h>
-#include <e32test.h>
#include <txtrich.h>
#include <txtfmlyr.h>
#include <txtfrmat.h>
#include <txtstyle.h>
+#include "T_STYLE.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
const TInt KTestCleanupStack=0x40;
-LOCAL_D RTest test(_L("Testing Paragraph Styles"));
LOCAL_D CTrapCleanup* TheTrapCleanup;
LOCAL_D CRichText* TheText;
@@ -255,7 +272,7 @@
{
CParagraphStyle::TApplyParaStyleMode applyMode=CParagraphStyle::ERetainNoSpecificFormats;
- test.Next(_L("Apply style to paragraph with NULL para format"));
+ INFO_PRINTF1(_L("Apply style to paragraph with NULL para format"));
ConstructEnvWithNullParaFormat();
TheText->InsertL(0,_L("HEADINGBODYTEXT"));
//
@@ -280,7 +297,7 @@
{
CParagraphStyle::TApplyParaStyleMode applyMode=CParagraphStyle::ERetainNoSpecificFormats;
- test.Next(_L("Apply style to shared paragraph"));
+ INFO_PRINTF1(_L("Apply style to shared paragraph"));
ConstructEnvironment();
TheText->InsertL(0,_L("HEADINGBODYTEXT"));
//
@@ -305,7 +322,7 @@
{
CParagraphStyle::TApplyParaStyleMode applyMode=CParagraphStyle::ERetainNoSpecificFormats;
- test.Next(_L("Apply style to non-shared paragraph"));
+ INFO_PRINTF1(_L("Apply style to non-shared paragraph"));
ConstructEnvironment();
//
TheText->InsertL(0,_L("This is paragraph one.This is paragraph number two."));
@@ -371,7 +388,7 @@
__UHEAP_MARK;
// Test 1
// Construction under OOM
- test.Start(_L("Construction under OOM"));
+ INFO_PRINTF1(_L("Construction under OOM"));
CStyleList* list=NULL;
TInt nn;
for (nn=0; ;nn++)
@@ -398,12 +415,12 @@
__UHEAP_RESET;
TBuf<36> answer;
answer.Format(_L(" #allocs for full c'tion: %d\n"),nn-1);
- test.Printf(answer);
+ INFO_PRINTF1(answer);
// Test 2
// Populated style list, Append under OOM;
- test.Next(_L("AppendL() under OOM"));
+ INFO_PRINTF1(_L("AppendL() under OOM"));
CParaFormatLayer* paraLayer=CParaFormatLayer::NewL();
CCharFormatLayer* charLayer=CCharFormatLayer::NewL();
__UHEAP_MARK;
@@ -449,7 +466,7 @@
// Test 3
// Inserting a duplicate
- test.Next(_L("AppendL() a duplicate"));
+ INFO_PRINTF1(_L("AppendL() a duplicate"));
list=CStyleList::NewL();
style=NULL;
for (TInt pp=0;pp<KMaxStyleListGranularity;pp++)
@@ -469,7 +486,7 @@
// Test 4
// Looking for a style by name that does not exist.
- test.Next(_L("IndexByName() where style not present"));
+ INFO_PRINTF1(_L("IndexByName() where style not present"));
list=CStyleList::NewL();
style=NULL;
TUint name='A';
@@ -491,7 +508,7 @@
delete charLayer;
__UHEAP_MARKEND;
- test.End();
+
}
@@ -499,12 +516,12 @@
// Test rich text style usage.
//
{
- test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_STYLE-0001 RichText Styles "));
+ INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_STYLE-0001 RichText Styles "));
// Do the tests.
TestConstruction();
TestStyles();
TestStyleWithNullParaFormat();
- test.Next(_L("CStyleList"));
+ INFO_PRINTF1(_L("CStyleList"));
TestStyleList();
//
}
@@ -556,26 +573,32 @@
}
}
-GLDEF_C TInt E32Main()
-//
-// Test the streaming framework.
-//
+CT_STYLE::CT_STYLE()
{
+ SetTestStepName(KTestStep_T_STYLE);
+ pTestStep = this;
+ }
- test.Title();
- __UHEAP_MARK;
- setupCleanup();
- TRAPD(r,TestHarness());
+TVerdict CT_STYLE::doTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ INFO_PRINTF1(_L("Testing Paragraph Styles"));
+ __UHEAP_MARK;
+ setupCleanup();
+ TRAPD(r,TestHarness());
test(r == KErrNone);
- delete TheTrapCleanup;
-
- __UHEAP_MARKEND;
-
- ::DeleteDataFile(KOutputFile); //deletion of data files must be before call to End() - DEF047652
-
- test.End();
- test.Close();
+ delete TheTrapCleanup;
+
+ __UHEAP_MARKEND;
+
+ ::DeleteDataFile(KOutputFile); //deletion of data files must be before call to End() - DEF047652
- return 0;
+ if (r == KErrNone)
+ {
+ SetTestStepResult(EPass);
+ }
+
+ return TestStepResult();
}