textrendering/texthandling/ttext/t_fmt1.cpp
branchRCL_3
changeset 54 748ec5531811
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
36:f902e87c146f 54:748ec5531811
     1 /*
     1 /*
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15 * T_FMT.CPP
    15 * T_FMT.CPP
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 #include <e32test.h>
       
    21 #include <txtfmlyr.h>
    20 #include <txtfmlyr.h>
    22 #include <txtrich.h>
    21 #include <txtrich.h>
    23 #include <txtfrmat.h>
    22 #include <txtfrmat.h>
    24 #include <gdi.h>
    23 #include <gdi.h>
    25 #include "TXTSTD.H"
    24 #include "../stext/TXTSTD.H"
       
    25 #include "T_FMT1.h"
    26 
    26 
       
    27 #define test(cond)											\
       
    28 	{														\
       
    29 	TBool __bb = (cond);									\
       
    30 	pTestStep->TEST(__bb);									\
       
    31 	if (!__bb)												\
       
    32 		{													\
       
    33 		pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed"));	\
       
    34 		User::Leave(1);										\
       
    35 		}													\
       
    36 	}
    27 
    37 
    28 LOCAL_D RTest test(_L("TFormat Test Code for DEF047316"));
    38 void CT_FMT1::TestDEF047316L()
    29 
       
    30 LOCAL_C void TestDEF047316L()
       
    31 // Test CParaFormat stack definition leave protection
    39 // Test CParaFormat stack definition leave protection
    32 //
    40 //
    33 	{
    41 	{
    34 
    42     INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-t_fmt1-0001 CParaFormat - DEF047316 - stack definition leave protection "));
    35 	
       
    36 	test.Start(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-t_fmt1-0001 CParaFormat - DEF047316 - stack definition leave protection "));
       
    37 	CParaFormat paraFormat;
    43 	CParaFormat paraFormat;
    38 	
    44 	
    39 	// Allocate resources for paraFormat
    45 	// Allocate resources for paraFormat
    40 	TTabStop tabStop;
    46 	TTabStop tabStop;
    41 	paraFormat.StoreTabL(tabStop);
    47 	paraFormat.StoreTabL(tabStop);
    52 	CleanupStack::PopAndDestroy();
    58 	CleanupStack::PopAndDestroy();
    53 
    59 
    54 	// Note that test end is when paraFormat's destructor is called when 
    60 	// Note that test end is when paraFormat's destructor is called when 
    55 	// this function terminates. The destructor should not cause any problems
    61 	// this function terminates. The destructor should not cause any problems
    56 	// even though we have already called the cleanup method
    62 	// even though we have already called the cleanup method
    57 	
       
    58 	test.End();
       
    59 	}
    63 	}
    60 
    64 
    61 GLDEF_C TInt E32Main()
    65 CT_FMT1::CT_FMT1()
    62 //
    66     {
    63 // Tests TFORMAT.
    67     SetTestStepName(KTestStep_T_FMT1);
    64 //
    68     }
    65 	{
       
    66 	CTrapCleanup* cleanup=CTrapCleanup::New();
       
    67 	test.Title();
       
    68 	
       
    69 	__UHEAP_MARK;
       
    70 	TRAPD(ret,TestDEF047316L());
       
    71 	test(ret==KErrNone);
       
    72 
    69 
    73 	__UHEAP_MARKEND;
    70 TVerdict CT_FMT1::doTestStepL()
    74 		
    71     {
    75 	test.Close();
    72     SetTestStepResult(EFail);
    76 
    73 
    77 	delete cleanup;
    74     CTrapCleanup* cleanup=CTrapCleanup::New();
       
    75     INFO_PRINTF1(_L("TFormat Test Code for DEF047316"));
       
    76     
       
    77     __UHEAP_MARK;
       
    78     TRAPD(error1, TestDEF047316L());
    78 
    79 
    79 	return(0);
    80     __UHEAP_MARKEND;
    80 	}
    81     delete cleanup;
       
    82 
       
    83     if(error1 == KErrNone)
       
    84         {
       
    85         SetTestStepResult(EPass);
       
    86         }
       
    87 
       
    88     return TestStepResult();
       
    89     }