textrendering/textformatting/test/src/tformhindi.cpp
branchRCL_3
changeset 16 748ec5531811
parent 0 1fb32624e06b
child 17 336bee5c2d35
--- a/textrendering/textformatting/test/src/tformhindi.cpp	Wed Jun 09 11:40:52 2010 +0300
+++ b/textrendering/textformatting/test/src/tformhindi.cpp	Tue Aug 31 17:01:26 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-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"
@@ -27,17 +27,21 @@
 #include <w32std.h>
 #include <bitdev.h>
 #include <txtrich.h>
+#include "tformhindi.h"
 
-namespace LocalToFile {
+namespace LocalToTFormHindi {
 
 _LIT(KTformhindi, "tformhindi");
 const TInt KDisplayWidth = 100;
 const TInt KDisplayHeight = 100;
-RTest test(KTformhindi);
 _LIT(KDevanagariFontName, "Devanagari OT Eval");
 
+CTFormHindiStep* TestStep = NULL;
+#define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
+#define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
+
 }
-using namespace LocalToFile;
+using namespace LocalToTFormHindi;
 
 _LIT(KTestDeva, "|\x915\x94d\x92b|\x907|\x920\x94d\x920|");
 _LIT(KTestBidi, "|\x915|\x644|\x920|");
@@ -82,16 +86,16 @@
 		{
 		aTextView->SetDocPosL(positions[j], EFalse);
 		TInt pos = aTextView->GetForwardDeletePositionL().HigherPos();
-		test(pos == positions[j + 1]);
+		TESTPOINT(pos == positions[j + 1]);
 		aTextView->SetDocPosL(positions[j], ETrue);
 		pos = aTextView->GetForwardDeletePositionL().HigherPos();
-		test(pos == positions[j + 1]);
+		TESTPOINT(pos == positions[j + 1]);
 		aTextView->SetDocPosL(positions[j + 1], EFalse);
 		pos = aTextView->GetBackwardDeletePositionL().LowerPos();
-		test(pos == positions[j]);
+		TESTPOINT(pos == positions[j]);
 		aTextView->SetDocPosL(positions[j + 1], ETrue);
 		pos = aTextView->GetBackwardDeletePositionL().LowerPos();
-		test(pos == positions[j]);
+		TESTPOINT(pos == positions[j]);
 		}
 
 	aRichText->Reset();
@@ -151,13 +155,13 @@
 			// the first chunk with a LZW should be equal to iLeftChunk
 			if (0 == iChunk)
 				{
-				test(text == iLeftChunk);
+                TESTPOINT(text == iLeftChunk);
 				iChunk++;
 				}
 			// the following chunk should be equal to iRightChunk, if it is not-null.
 			else if (1 == iChunk && iRightChunk.Size() > 0)
 				{
-				test(text == iRightChunk);
+                TESTPOINT(text == iRightChunk);
 				iChunk++;
 				}
 			// just ignore the following chunks
@@ -273,25 +277,24 @@
 	CTextView* aTextView)
 	{
 	// Test devanagari delete-by-syllable
-	test.Start(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-1532 Test some simple Hindi "));
+	TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-1532 Test some simple Hindi "));
 	TestDeletePosition(KTestDeva, aRichText, aTextView);
 
 	// Test Bidi
 	// The Arabic character is not present in this font, not even
 	// as a fallback glyph. This allows us to exercise a fixes for
 	// a latent defect.
-	test.Next(_L("Test with characters not in font"));
+	TESTPRINT(_L("Test with characters not in font"));
 	TestDeletePosition(KTestBidi, aRichText, aTextView);
 
 	// Test sample suggested by customer
-	test.Next(_L("Test Hindi #2"));
+	TESTPRINT(_L("Test Hindi #2"));
 	TestDeletePosition(KTestDeva2, aRichText, aTextView);
 
 	// regression test for PDEF101617: FORM always splits chunks at ZWJ character
-	test.Next(_L("Regression test: PDEF101617"));
+	TESTPRINT(_L("Regression test: PDEF101617"));
 	PDEF_101617_DefectL(aRichText, aTextView);
 
-	test.End();
 	}
 
 void TestL(CFbsScreenDevice* aDevice)
@@ -316,8 +319,12 @@
 	CleanupStack::PopAndDestroy(paraFormat);
 	}
 
-void MainL()
+TVerdict CTFormHindiStep::doTestStepL()
 	{
+    SetTestStepResult(EPass);
+    TestStep = this;
+    TESTPRINT(KTformhindi);
+    
 	TInt error = RFbsSession::Connect();
 	if (error == KErrNotFound)
 		{
@@ -370,24 +377,12 @@
 	// We know that we have everything we need now, so we'll start the test!
 	// A failure before this point would show up in the logs as "not run" rather
 	// than "failed".
-	test.Title();
-	test.Start(_L("Test forward/backward delete for Hindi"));
+	TESTPRINT(_L("Test forward/backward delete for Hindi"));
 	TRAP(error, TestL(screenDevice));
-	test.End();
-	test.Close();
 	CleanupStack::PopAndDestroy(scheduler);
 	CleanupStack::PopAndDestroy(gc);
 	CleanupStack::PopAndDestroy(screenDevice);
 	RFbsSession::Disconnect();
 	User::LeaveIfError(error);
+	return TestStepResult();
 	}
-
-TInt E32Main()
-	{
-	static CTrapCleanup* TrapCleanup = CTrapCleanup::New();
-	if (!TrapCleanup)
-		return KErrNoMemory;
-	TRAPD(error, MainL());
-	delete TrapCleanup;
-	return error;
-	}