textrendering/texthandling/ttext/T_IMPORT.CPP
changeset 51 a7c938434754
parent 0 1fb32624e06b
child 55 336bee5c2d35
--- a/textrendering/texthandling/ttext/T_IMPORT.CPP	Tue Jul 06 16:23:19 2010 +0300
+++ b/textrendering/texthandling/ttext/T_IMPORT.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"
@@ -18,7 +18,6 @@
 
 #include <e32std.h>
 #include <e32base.h>
-#include <e32test.h>
 #include <e32svr.h>
 
 #include <txtetext.h>
@@ -29,6 +28,24 @@
 #include <gdi.h>
 #include <s32mem.h>
 #include <charconv.h>
+#include "T_IMPORT.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))
 
 /* this fixes a MSVC link warning */
 #ifdef __VC32__
@@ -42,7 +59,7 @@
 _LIT(KTestFileName1, "c:\\etext\\climb.txg");
 _LIT(KTestFileName2, "c:\\etext\\import1.txg");
 
-void EnsureFileExists(const TDesC& aName)
+LOCAL_D void EnsureFileExists(const TDesC& aName)
 	{
 	RFs fs;
 	fs.Connect();
@@ -53,7 +70,6 @@
 	fs.Close();
 	}
 
-LOCAL_D RTest test(_L("Plain Text File Imports"));
 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL;
 LOCAL_D CPlainText* TheText=NULL;
 LOCAL_D CRichText* richText=NULL;
@@ -309,7 +325,7 @@
 		pos += p1.Length();
 		} while (pos < length1);
 
-    test.Next(_L("DEF058651 - Propagated:NTT - Received MMS with line break CR set does not cause line feed."));
+    INFO_PRINTF1(_L("DEF058651 - Propagated:NTT - Received MMS with line break CR set does not cause line feed."));
     buffer->Reset();
     plain1->Reset();
     
@@ -334,7 +350,7 @@
 // Main routine
 //
     {
-	test.Start(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_IMPORT-0001 CPlainText "));
+	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-T_IMPORT-0001 CPlainText "));
 	CreateTextL();
 
 	ImportText1();
@@ -343,14 +359,14 @@
 	TestUnicodeCompressionL();
 	TestEncodingConversionL();
 
-	test.Next(_L("CRichText"));
+	INFO_PRINTF1(_L("CRichText"));
 	delete TheText;
 	TheText=richText;
 
 	ImportText1();
 	ImportText2();
 
-	test.Next(_L("CRichText - more than 256 styles, defect INC044582"));
+	INFO_PRINTF1(_L("CRichText - more than 256 styles, defect INC044582"));
 	TestInc044582();
 	
 	DestroyText();
@@ -402,29 +418,32 @@
 		}
 	}
 
-GLDEF_C TInt E32Main()
-//
-// Test the streaming framework.
-//
+CT_IMPORT::CT_IMPORT()
     {
+    SetTestStepName(KTestStep_T_IMPORT);
+    pTestStep = this;
+    }
 
-	test.Title();
-	__UHEAP_MARK;
-	setupCleanup();
-	TRAPD(r, DoTestL());
+TVerdict CT_IMPORT::doTestStepL()
+    {
+    SetTestStepResult(EFail);
 
-	test(r == KErrNone);
+    INFO_PRINTF1(_L("Plain Text File Imports"));
+    __UHEAP_MARK;
+    setupCleanup();
+    TRAPD(r, DoTestL());
 
-	::DeleteDataFile(KTestFileName1);		//deletion of data files must be before call to End() - DEF047652
-	::DeleteDataFile(KTestFileName2);	
+    ::DeleteDataFile(KTestFileName1);       //deletion of data files must be before call to End() - DEF047652
+    ::DeleteDataFile(KTestFileName2);   
 
-	test.End();
-	
-	delete TheTrapCleanup;
+    delete TheTrapCleanup;
 
-	__UHEAP_MARKEND;
+    __UHEAP_MARKEND;
+    
+    if (r == KErrNone)
+        {
+        SetTestStepResult(EPass);
+        }
 
-	test.Close();
-
-	return 0;
+    return TestStepResult();
     }