diff -r 748ec5531811 -r 336bee5c2d35 textrendering/textformatting/test/src/TLINEPAG.CPP --- a/textrendering/textformatting/test/src/TLINEPAG.CPP Tue Aug 31 17:01:26 2010 +0300 +++ b/textrendering/textformatting/test/src/TLINEPAG.CPP Wed Sep 01 12:39:40 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 1997-2009 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" @@ -22,30 +22,31 @@ #include #include #include -#include "tlinepag.h" -namespace LocalToTLinePag -{ _LIT(KTLinePag, "TLinePag"); -CTLinePagStep* TestStep = NULL; -#define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__) -#define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__) -} -using namespace LocalToTLinePag; +RTest TheTest(KTLinePag); + /////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////// //Test macroses and functions +LOCAL_C void CheckL(TInt aValue, TInt aLine) + { + if(!aValue) + { + TheTest(EFalse, aLine); + } + } LOCAL_C void CheckL(TInt aValue, TInt aExpected, TInt aLine) { if(aValue != aExpected) { - TBuf<256> buf; - buf.AppendFormat(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); - TestStep->print(buf,(TText8*)__FILE__,aLine); - TestStep->testpoint(EFalse,(TText8*)__FILE__,aLine); + RDebug::Print(_L("*** Expected error: %d, got: %d\r\n"), aExpected, aValue); + TheTest(EFalse, aLine); } } +#define TEST(arg) ::CheckL((arg), __LINE__) +#define TEST2(aValue, aExpected) ::CheckL(aValue, aExpected, __LINE__) class CLinePaginatorTest : public CBase { @@ -115,7 +116,7 @@ { } TBool success=CompareArrays(); - CheckL(success, ETrue,__LINE__); + TEST2(success, ETrue); } @@ -152,9 +153,7 @@ lex.Val(pageHeight); iPaginator.SetPageHeight(pageHeight); - TBuf<254> buf; - buf.AppendFormat(_L("DocPos\tHeight\tKeep\tStart\tHeight of Pages = <%d>\n"), pageHeight); - TESTPRINT(buf); + TheTest.Printf(_L("DocPos\tHeight\tKeep\tStart\tHeight of Pages = <%d>\n"), pageHeight); } TBool CLinePaginatorTest::ReadTestFile(TPageLine& aLine) @@ -172,9 +171,7 @@ iFilePos+=startNum; lex=textBuffer; lex.Val(aLine.iDocPos); - TBuf<254> buf; - buf.AppendFormat(_L("%d\tX\n"), aLine.iDocPos); - TESTPRINT(buf); + TheTest.Printf(_L("%d\tX\n"), aLine.iDocPos); return EFalse; } @@ -215,17 +212,13 @@ void CLinePaginatorTest::WriteOutputFile(TPageLine aLine) { - TBuf<256> buf; if (iTestPageBreak) { - buf.AppendFormat(_L("%d\t%d\t%d\t%d\tBREAK\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage); - TESTPRINT(buf); + TheTest.Printf(_L("%d\t%d\t%d\t%d\tBREAK\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage); } else { - buf.Zero(); - buf.AppendFormat(_L("%d\t%d\t%d\t%d\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage); - TESTPRINT(buf); + TheTest.Printf(_L("%d\t%d\t%d\t%d\n"), aLine.iDocPos, aLine.iLineHeight, aLine.iKeepWithNext, aLine.iStartNewPage); } } @@ -248,11 +241,9 @@ TInt prevDocPos=0; TInt docPosError=0; - TBuf<256> buf; if (numPages==numTestPages) { - buf.AppendFormat(_L("Correct Number of Pages = %d\n"), numPages); - TESTPRINT(buf); + TheTest.Printf(_L("Correct Number of Pages = %d\n"), numPages); pagesSame=ETrue; for (TInt i=0; i