--- a/textrendering/texthandling/ttext/T_CONVRT.CPP Tue Jul 06 16:23:19 2010 +0300
+++ b/textrendering/texthandling/ttext/T_CONVRT.CPP Wed Aug 18 11:34:25 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"
@@ -22,15 +22,25 @@
#include <s32file.h>
#include <flddef.h>
#include <fldbltin.h>
-#include <e32test.h>
#include "../incp/T_PMLPAR.H"
+#include "T_CONVRT.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
const TInt KTestCleanupStack=0x20;
LOCAL_D CTrapCleanup* TheTrapCleanup;
-LOCAL_D RTest test(_L("T_CONVRT - Rich Text Persistence"));
//
LOCAL_D CRichText* TheText=NULL;
LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL;
@@ -38,7 +48,7 @@
////////////////////////////////////////////////////////////////////////////////////////////
-class TTestFieldFactory : public MTextFieldFactory
+class TTestFieldFactoryCONVRT : public MTextFieldFactory
{
public:
// from MTextFieldFactory
@@ -47,7 +57,7 @@
// Returns NULL if it does not recognise/support the field type
};
-CTextField* TTestFieldFactory::NewFieldL(TUid aFieldType)
+CTextField* TTestFieldFactoryCONVRT::NewFieldL(TUid aFieldType)
// Creates a field (in aHeader) of the type specified in aHeader
//
{
@@ -60,7 +70,7 @@
_LIT(KOutputFile, "c:\\etext\\t_convrt.tst");
template <class T>
-void testStoreRestoreL(T& aCopy,const T& aOriginal)
+void CT_CONVRT::testStoreRestoreL(T& aCopy,const T& aOriginal)
// Test document persistance.
//
{
@@ -89,7 +99,7 @@
}
-LOCAL_C TInt IsEqual(const CEditableText* aCopy,const CEditableText* aOriginal)
+TInt CT_CONVRT::IsEqual(const CEditableText* aCopy,const CEditableText* aOriginal)
//
// Returns true if aCopy contents matches aOriginal contents.
// Takes account of multiple segments of a segmented text component.
@@ -115,7 +125,7 @@
}
-LOCAL_C void DoTestRichTextL()
+void CT_CONVRT::DoTestRichTextL()
//
// Test streaming CRichText.
//
@@ -143,14 +153,14 @@
TInt globalPrint=size-newsize;
TBuf<50> buf;
buf.Format(_L("Empty rich text takes: %d bytes\n"),footprint);
- test.Printf(buf);
+ INFO_PRINTF1(buf);
buf.Format(_L("Empty global text takes: %d bytes\n"),globalPrint);
- test.Printf(buf);
+ INFO_PRINTF1(buf);
// test.Getch();
delete gText;
//
// Now add a text field to this.
- TTestFieldFactory factory;
+ TTestFieldFactoryCONVRT factory;
TheText->SetFieldFactory(&factory);
theCopy->SetFieldFactory(&factory);
CTextField* field=NULL;
@@ -175,7 +185,7 @@
}
-LOCAL_C void LoadIntoText(TFileName& aFileName)
+void CT_CONVRT::LoadIntoText(TFileName& aFileName)
//
{
CParser* myParser=NULL;
@@ -191,21 +201,21 @@
}
-LOCAL_C void KillText()
+void CT_CONVRT::KillText()
//
{
delete TheText;
}
-LOCAL_C void KillLayers()
+void CT_CONVRT::KillLayers()
{
delete TheGlobalParaLayer;
delete TheGlobalCharLayer;
}
-LOCAL_C void Reset()
+void CT_CONVRT::Reset()
//
{
KillText();
@@ -213,10 +223,10 @@
}
-LOCAL_C void GoL()
+void CT_CONVRT::GoL()
//
{
- test.Start(_L("Rich Text of Shared Para Formats Only"));
+ INFO_PRINTF1(_L("Rich Text of Shared Para Formats Only"));
TFileName fileName=_L("z:\\test\\app-framework\\etext\\shared.pml");
LoadIntoText(fileName);
TBool hasMarkupData=TheText->HasMarkupData();
@@ -224,19 +234,17 @@
DoTestRichTextL();
Reset();
//
- test.Next(_L("Rich Text with specific character formatting"));
+ INFO_PRINTF1(_L("Rich Text with specific character formatting"));
fileName=_L("z:\\test\\app-framework\\etext\\test1.pml");
LoadIntoText(fileName);
hasMarkupData=TheText->HasMarkupData();
test(hasMarkupData);
DoTestRichTextL();
Reset();
- //
- test.End();
}
-LOCAL_C void setupCleanup()
+void CT_CONVRT::setupCleanup()
//
// Initialise the cleanup stack.
//
@@ -253,7 +261,7 @@
}
-LOCAL_C void DeleteDataFile(const TDesC& aFullName)
+void CT_CONVRT::DeleteDataFile(const TDesC& aFullName)
{
RFs fsSession;
TInt err = fsSession.Connect();
@@ -282,26 +290,30 @@
}
}
-GLDEF_C TInt E32Main()
-//
-// Test streaming conversions.
-//
+CT_CONVRT::CT_CONVRT()
{
- setupCleanup();
- test.Title();
- test.Start(_L("Persisting Rich Text"));
- test.Next(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_CONVRT-0001 "));
- __UHEAP_MARK;
- TRAPD(ret, GoL());
- __UHEAP_MARKEND;
- test(ret == KErrNone);
-
- //deletion of data files must be before call to End() - DEF047652
- ::DeleteDataFile(KOutputFile);
- test.End();
- test.Close();
-
- delete TheTrapCleanup;
- return 0;
+ SetTestStepName(KTestStep_T_CONVRT);
}
+TVerdict CT_CONVRT::doTestStepL()
+ {
+ SetTestStepResult(EFail);
+
+ setupCleanup();
+ __UHEAP_MARK;
+
+ INFO_PRINTF1(_L("T_CONVRT - Rich Text Persistence"));
+ INFO_PRINTF1(_L("Persisting Rich Text"));
+ INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_CONVRT-0001 "));
+ TRAPD(error1, GoL());
+
+ __UHEAP_MARKEND;
+ delete TheTrapCleanup;
+
+ if(error1 == KErrNone)
+ {
+ SetTestStepResult(EPass);
+ }
+
+ return TestStepResult();
+ }