textrendering/texthandling/ttext/T_PICRES.CPP
branchRCL_3
changeset 55 336bee5c2d35
parent 54 748ec5531811
--- a/textrendering/texthandling/ttext/T_PICRES.CPP	Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/ttext/T_PICRES.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"
@@ -22,31 +22,13 @@
 #include <gdi.h>
 #include <conpics.h>
 #include <s32file.h>
+#include <e32test.h>
 
 #include <txtrich.h>
 #include <txtfmlyr.h>
 #include "TXTMRTSR.H"
 
 #include "../incp/T_PMLPAR.H"
-#include "T_PICRES.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
 
@@ -73,6 +55,8 @@
 	const CCharFormatLayer* iGlobalCharFormatLayer;
 	};
 
+
+LOCAL_D RTest test(_L("Testing Picture Restorer mechanism"));
 LOCAL_D CTrapCleanup* TheTrapCleanup;
 LOCAL_D RFs TheFs;  // the file server
 LOCAL_D RFile TheFile;  // the data file
@@ -378,7 +362,7 @@
 	TRAPD(ret,
 	TheContainer->iText->DetachFromStoreL(CPicture::EDetachFull));
 	if (ret==KErrNotSupported)
-	    INFO_PRINTF1(_L("   SIMULATION: Some picture data is not supported by the current factory."));
+		test.Printf(_L("   SIMULATION: Some picture data is not supported by the current factory."));
 //	if (aAlwaysFailToLoad)
 //		test(error==KErrNotFound);
 //	else
@@ -395,13 +379,9 @@
     TheContainer->RestoreL(*TheStore,id,factory);
 	TInt pictureCount=TheContainer->iText->PictureCount();
 	if (aAlwaysFailToLoad)
-	    {
 		test(pictureCount==1);
-	    }
 	else
-	    {
 		test(pictureCount==3);
-	    }
 //
 	delete factory;
 	CleanupStack::PopAndDestroy();  // TheStore
@@ -413,7 +393,7 @@
 // Run the tests
 //
 	{
-	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_PICRES-0001 RichText Storing - with pictures deferred loading "));
+	test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_PICRES-0001 RichText Storing - with pictures deferred loading "));
 	TheContainer=CContainer::NewL();
 	TRAPD(r,
 	testPictureRestorer());
@@ -421,7 +401,7 @@
 	delete TheContainer;  // deletes the rich text, which deletes the contained pictures.
 	//
 	//
-	INFO_PRINTF1(_L("RichText Storing - with pictures auto loading"));
+	test.Next(_L("RichText Storing - with pictures auto loading"));
 	TheContainer=CContainer::NewL();
 	TRAP(r,
 	testPictureRestorer(EFalse));  // DO NOT DEFER PICTURE LOADING
@@ -430,7 +410,7 @@
 //
 //
 //
-	INFO_PRINTF1(_L("Testing no missing picture app's"));
+	test.Next(_L("Testing no missing picture app's"));
 	TheContainer=CContainer::NewL();
 	TRAP(r,
 	testPictureRestorer2());
@@ -441,7 +421,7 @@
 /*
 	TEST NOW REDUNDANT AS OF NEW PICTURE CONTAINMENT MECHANISM AS AT RELEASE 073
 
-	INFO_PRINTF1(_L("Testing missing picture app's"));
+	test.Next(_L("Testing missing picture app's"));
 	TheContainer=CContainer::NewL();
 	TRAP(r,
 	testPictureRestorer2(ETrue));  // ALWAYS FAIL TO DETACH FROM STORE
@@ -497,32 +477,27 @@
 		}
 	}
 
-CT_PICRES::CT_PICRES()
+GLDEF_C TInt E32Main()
+//
+// Test the streaming framework.
+//
     {
-    SetTestStepName(KTestStep_T_PICRES);
-    pTestStep = this;
-    }
 
-TVerdict CT_PICRES::doTestStepL()
-    {
-    SetTestStepResult(EFail);
-
-    INFO_PRINTF1(_L("Testing Picture Restorer mechanism"));
+	test.Title();
     __UHEAP_MARK;
-    setupCleanup();
-    TRAPD(r,GoL());
+	setupCleanup();
+	TRAPD(r,GoL());
+    test(r == KErrNone);
 
-    delete TheTrapCleanup;
-    
-    __UHEAP_MARKEND;
-    
-    ::DeleteDataFile(KOutputFile);      //deletion of data files must be before call to End() - DEF047652
-    ::DeleteDataFile(KOutputFile1); 
+	delete TheTrapCleanup;
+	
+	__UHEAP_MARKEND;
+	
+	::DeleteDataFile(KOutputFile);		//deletion of data files must be before call to End() - DEF047652
+	::DeleteDataFile(KOutputFile1);	
+	
+	test.End();
+	test.Close();
 
-    if (r == KErrNone)
-        {
-        SetTestStepResult(EPass);
-        }
-
-    return TestStepResult();
+	return 0;
     }