sl@0: /* sl@0: * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * T_FMT.CPP sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "../stext/TXTSTD.H" sl@0: #include "T_FMT1.h" sl@0: sl@0: #define test(cond) \ sl@0: { \ sl@0: TBool __bb = (cond); \ sl@0: pTestStep->TEST(__bb); \ sl@0: if (!__bb) \ sl@0: { \ sl@0: pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed")); \ sl@0: User::Leave(1); \ sl@0: } \ sl@0: } sl@0: sl@0: void CT_FMT1::TestDEF047316L() sl@0: // Test CParaFormat stack definition leave protection sl@0: // sl@0: { sl@0: INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-t_fmt1-0001 CParaFormat - DEF047316 - stack definition leave protection ")); sl@0: CParaFormat paraFormat; sl@0: sl@0: // Allocate resources for paraFormat sl@0: TTabStop tabStop; sl@0: paraFormat.StoreTabL(tabStop); sl@0: sl@0: TParaBorder border; sl@0: paraFormat.SetParaBorderL(CParaFormat::EParaBorderTop,border); sl@0: sl@0: paraFormat.iBullet=new(ELeave)TBullet; sl@0: sl@0: // Push cleanup method for paraFormat sl@0: ResetOnCleanupL( ¶Format); sl@0: sl@0: // Force cleanup method to be called sl@0: CleanupStack::PopAndDestroy(); sl@0: sl@0: // Note that test end is when paraFormat's destructor is called when sl@0: // this function terminates. The destructor should not cause any problems sl@0: // even though we have already called the cleanup method sl@0: } sl@0: sl@0: CT_FMT1::CT_FMT1() sl@0: { sl@0: SetTestStepName(KTestStep_T_FMT1); sl@0: } sl@0: sl@0: TVerdict CT_FMT1::doTestStepL() sl@0: { sl@0: SetTestStepResult(EFail); sl@0: sl@0: CTrapCleanup* cleanup=CTrapCleanup::New(); sl@0: INFO_PRINTF1(_L("TFormat Test Code for DEF047316")); sl@0: sl@0: __UHEAP_MARK; sl@0: TRAPD(error1, TestDEF047316L()); sl@0: sl@0: __UHEAP_MARKEND; sl@0: delete cleanup; sl@0: sl@0: if(error1 == KErrNone) sl@0: { sl@0: SetTestStepResult(EPass); sl@0: } sl@0: sl@0: return TestStepResult(); sl@0: }