| author | sl | 
| Tue, 10 Jun 2014 14:32:02 +0200 | |
| changeset 1 | 260cb5ec6c19 | 
| permissions | -rw-r--r-- | 
| sl@0 | 1 | /* | 
| sl@0 | 2 | * Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). | 
| sl@0 | 3 | * All rights reserved. | 
| sl@0 | 4 | * This component and the accompanying materials are made available | 
| sl@0 | 5 | * under the terms of "Eclipse Public License v1.0" | 
| sl@0 | 6 | * which accompanies this distribution, and is available | 
| sl@0 | 7 | * at the URL "http://www.eclipse.org/legal/epl-v10.html". | 
| sl@0 | 8 | * | 
| sl@0 | 9 | * Initial Contributors: | 
| sl@0 | 10 | * Nokia Corporation - initial contribution. | 
| sl@0 | 11 | * | 
| sl@0 | 12 | * Contributors: | 
| sl@0 | 13 | * | 
| sl@0 | 14 | * Description: | 
| sl@0 | 15 | * T_FMT.CPP | 
| sl@0 | 16 | * | 
| sl@0 | 17 | */ | 
| sl@0 | 18 | |
| sl@0 | 19 | |
| sl@0 | 20 | #include <txtfmlyr.h> | 
| sl@0 | 21 | #include <txtrich.h> | 
| sl@0 | 22 | #include <txtfrmat.h> | 
| sl@0 | 23 | #include <gdi.h> | 
| sl@0 | 24 | #include "../stext/TXTSTD.H" | 
| sl@0 | 25 | #include "T_FMT1.h" | 
| sl@0 | 26 | |
| sl@0 | 27 | #define test(cond) \ | 
| sl@0 | 28 | 	{														\
 | 
| sl@0 | 29 | TBool __bb = (cond); \ | 
| sl@0 | 30 | pTestStep->TEST(__bb); \ | 
| sl@0 | 31 | if (!__bb) \ | 
| sl@0 | 32 | 		{													\
 | 
| sl@0 | 33 | 		pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed"));	\
 | 
| sl@0 | 34 | User::Leave(1); \ | 
| sl@0 | 35 | } \ | 
| sl@0 | 36 | } | 
| sl@0 | 37 | |
| sl@0 | 38 | void CT_FMT1::TestDEF047316L() | 
| sl@0 | 39 | // Test CParaFormat stack definition leave protection | 
| sl@0 | 40 | // | 
| sl@0 | 41 | 	{
 | 
| sl@0 | 42 |     INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-t_fmt1-0001 CParaFormat - DEF047316 - stack definition leave protection "));
 | 
| sl@0 | 43 | CParaFormat paraFormat; | 
| sl@0 | 44 | |
| sl@0 | 45 | // Allocate resources for paraFormat | 
| sl@0 | 46 | TTabStop tabStop; | 
| sl@0 | 47 | paraFormat.StoreTabL(tabStop); | 
| sl@0 | 48 | |
| sl@0 | 49 | TParaBorder border; | 
| sl@0 | 50 | paraFormat.SetParaBorderL(CParaFormat::EParaBorderTop,border); | 
| sl@0 | 51 | |
| sl@0 | 52 | paraFormat.iBullet=new(ELeave)TBullet; | 
| sl@0 | 53 | |
| sl@0 | 54 | // Push cleanup method for paraFormat | 
| sl@0 | 55 | ResetOnCleanupL( ¶Format); | 
| sl@0 | 56 | |
| sl@0 | 57 | // Force cleanup method to be called | 
| sl@0 | 58 | CleanupStack::PopAndDestroy(); | 
| sl@0 | 59 | |
| sl@0 | 60 | // Note that test end is when paraFormat's destructor is called when | 
| sl@0 | 61 | // this function terminates. The destructor should not cause any problems | 
| sl@0 | 62 | // even though we have already called the cleanup method | 
| sl@0 | 63 | } | 
| sl@0 | 64 | |
| sl@0 | 65 | CT_FMT1::CT_FMT1() | 
| sl@0 | 66 |     {
 | 
| sl@0 | 67 | SetTestStepName(KTestStep_T_FMT1); | 
| sl@0 | 68 | } | 
| sl@0 | 69 | |
| sl@0 | 70 | TVerdict CT_FMT1::doTestStepL() | 
| sl@0 | 71 |     {
 | 
| sl@0 | 72 | SetTestStepResult(EFail); | 
| sl@0 | 73 | |
| sl@0 | 74 | CTrapCleanup* cleanup=CTrapCleanup::New(); | 
| sl@0 | 75 |     INFO_PRINTF1(_L("TFormat Test Code for DEF047316"));
 | 
| sl@0 | 76 | |
| sl@0 | 77 | __UHEAP_MARK; | 
| sl@0 | 78 | TRAPD(error1, TestDEF047316L()); | 
| sl@0 | 79 | |
| sl@0 | 80 | __UHEAP_MARKEND; | 
| sl@0 | 81 | delete cleanup; | 
| sl@0 | 82 | |
| sl@0 | 83 | if(error1 == KErrNone) | 
| sl@0 | 84 |         {
 | 
| sl@0 | 85 | SetTestStepResult(EPass); | 
| sl@0 | 86 | } | 
| sl@0 | 87 | |
| sl@0 | 88 | return TestStepResult(); | 
| sl@0 | 89 | } |