textrendering/texthandling/ttext/T_INDTER.CPP
changeset 51 a7c938434754
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
44:601ab138ba0b 51:a7c938434754
     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".
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 #include <e32std.h>
    19 #include <e32std.h>
    20 #include <e32base.h>
    20 #include <e32base.h>
    21 #include <e32test.h>
       
    22 
    21 
    23 #include <txtfrmat.h>
    22 #include <txtfrmat.h>
    24 #include <txtfmlyr.h>
    23 #include <txtfmlyr.h>
    25 #include <txtrich.h>
    24 #include <txtrich.h>
    26 #include <gdi.h>
    25 #include <gdi.h>
    27 
    26 
    28 #include "../incp/T_PMLPAR.H"
    27 #include "../incp/T_PMLPAR.H"
       
    28 #include "T_INDTER.h"
       
    29 
       
    30 LOCAL_D CTestStep *pTestStep = NULL;
       
    31 #define test(cond)											\
       
    32 	{														\
       
    33 	TBool __bb = (cond);									\
       
    34 	pTestStep->TEST(__bb);									\
       
    35 	if (!__bb)												\
       
    36 		{													\
       
    37 		pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed"));	\
       
    38 		User::Leave(1);										\
       
    39 		}													\
       
    40 	}
       
    41 #undef INFO_PRINTF1
       
    42 #undef INFO_PRINTF2
       
    43 // copy from tefexportconst.h
       
    44 #define INFO_PRINTF1(p1)        pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
       
    45 #define INFO_PRINTF2(p1, p2)    pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
    29 
    46 
    30 #define UNUSED_VAR(a) a = a
    47 #define UNUSED_VAR(a) a = a
    31 
    48 
    32 const TInt KTestCleanupStack=0x40;
    49 const TInt KTestCleanupStack=0x40;
    33 
    50 
    34 
       
    35 LOCAL_D RTest test(_L("Rich Text Format attribute Indeterminate State tests"));
       
    36 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL;
    51 LOCAL_D CTrapCleanup* TheTrapCleanup=NULL;
    37 LOCAL_D CRichText* TheText=NULL;
    52 LOCAL_D CRichText* TheText=NULL;
    38 LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL;
    53 LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL;
    39 LOCAL_D CCharFormatLayer* TheGlobalCharLayer=NULL;
    54 LOCAL_D CCharFormatLayer* TheGlobalCharLayer=NULL;
    40 LOCAL_D CParser* TheParser;
    55 LOCAL_D CParser* TheParser;
   162 
   177 
   163 LOCAL_C void TestParaFormatL()
   178 LOCAL_C void TestParaFormatL()
   164 // Test the indeterminate state of paragraph format attributes.
   179 // Test the indeterminate state of paragraph format attributes.
   165 //
   180 //
   166 	{
   181 	{
   167 	test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_INDTER-0001 Paragraph format attributes "));
   182 	INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_INDTER-0001 Paragraph format attributes "));
   168 	TestParaBordersL();
   183 	TestParaBordersL();
   169 	}
   184 	}
   170 
   185 
   171 
   186 
   172 LOCAL_C void TestCharFormatL()
   187 LOCAL_C void TestCharFormatL()
   173 // Test the indeterminate state of character format attributes.
   188 // Test the indeterminate state of character format attributes.
   174 //
   189 //
   175 	{
   190 	{
   176 	test.Next(_L("Character format attributes"));
   191 	INFO_PRINTF1(_L("Character format attributes"));
   177 	//
   192 	//
   178 	ResetTextL();
   193 	ResetTextL();
   179 	TCharFormat applyFormat;
   194 	TCharFormat applyFormat;
   180 	TCharFormatMask applyMask;
   195 	TCharFormatMask applyMask;
   181 	//
   196 	//
   219 //
   234 //
   220     {
   235     {
   221 	CreateRichTextL();
   236 	CreateRichTextL();
   222 	TestParaFormatL();
   237 	TestParaFormatL();
   223 	TestCharFormatL();
   238 	TestCharFormatL();
   224 	test.End();
   239 	
   225 	DestroyRichText();
   240 	DestroyRichText();
   226     }
   241     }
   227 
   242 
   228 
   243 
   229 LOCAL_C void setupCleanup()
   244 LOCAL_C void setupCleanup()
   239 		test(r==KErrNone);\
   254 		test(r==KErrNone);\
   240 		CleanupStack::Pop(KTestCleanupStack);\
   255 		CleanupStack::Pop(KTestCleanupStack);\
   241 		});
   256 		});
   242 	}
   257 	}
   243 
   258 
   244 
   259 CT_INDTER::CT_INDTER()
   245 GLDEF_C TInt E32Main()
   260     {
   246 //
   261     SetTestStepName(KTestStep_T_INDTER);
   247 // Test the streaming framework.
   262     pTestStep = this;
   248 //
   263     }
   249     {
   264 
   250 
   265 TVerdict CT_INDTER::doTestStepL()
   251 	test.Title();
   266     {
   252 	__UHEAP_MARK;
   267     SetTestStepResult(EFail);
   253 	setupCleanup();
   268 
   254 	TRAPD(r, DoTestL());
   269     INFO_PRINTF1(_L("Rich Text Format attribute Indeterminate State tests"));
       
   270     __UHEAP_MARK;
       
   271     setupCleanup();
       
   272     TRAPD(r, DoTestL());
   255     test(r == KErrNone);
   273     test(r == KErrNone);
   256 
   274 
   257 	delete TheTrapCleanup;
   275     delete TheTrapCleanup;
   258 	
   276     
   259 	__UHEAP_MARKEND;
   277     __UHEAP_MARKEND;
   260 	test.Close();
   278     
   261 	return 0;
   279     if (r == KErrNone)
       
   280         {
       
   281         SetTestStepResult(EPass);
       
   282         }
       
   283 
       
   284     return TestStepResult();
   262     }
   285     }