--- a/textrendering/textformatting/test/src/TBidiCursorPos.cpp Wed Jun 09 11:40:52 2010 +0300
+++ b/textrendering/textformatting/test/src/TBidiCursorPos.cpp Tue Aug 31 17:01:26 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2010 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"
@@ -23,9 +23,17 @@
#include "TAGMA.H"
#include "TmLayoutImp.h"
#include "TMINTERP.H"
+#include "tbidicursorpos.h"
-CTrapCleanup* TrapCleanup;
-RTest test(_L("TBidiCursorPos - GetNextVisualCursorPos tests"));
+namespace LocalToTBidiCursorPos
+{
+CTBidiCursorPosStep* TestStep;
+#define TESTPOINT(p) TestStep->testpoint(p,(TText8*)__FILE__,__LINE__)
+#define TESTPRINT(p) TestStep->print(p,(TText8*)__FILE__,__LINE__)
+
+}
+
+using namespace LocalToTBidiCursorPos;
class CTestSource : public CBase, public MTmSource
{
@@ -189,7 +197,7 @@
for (TInt ii = 0; ii < NO_OF_TEST_CASES; ii++)
{
msg.Format(_L("GetNextVisualCursorPos test case %d\n"), ii + 1);
- test.Next(msg);
+ TESTPRINT(msg);
aSource->SetText(logicalText[ii]);
format.iEndChar = logicalText[ii]->Length();
if (rightToLeftPara[ii])
@@ -204,15 +212,15 @@
while (info.iDocPos.iPos != expectedCursorPos[ii][charIndex].iPos
|| info.iDocPos.iLeadingEdge != expectedCursorPos[ii][charIndex].iLeading)
{
- test(expectedCursorPos[ii][charIndex].iOptional);
+ TESTPOINT(expectedCursorPos[ii][charIndex].iOptional);
++charIndex;
- test(charIndex != numberOfCursorPositionsToCheck[ii]);
+ TESTPOINT(charIndex != numberOfCursorPositionsToCheck[ii]);
}
pos = info.iDocPos;
++charIndex;
- test(charIndex <= numberOfCursorPositionsToCheck[ii]);
+ TESTPOINT(charIndex <= numberOfCursorPositionsToCheck[ii]);
}
- test(charIndex == numberOfCursorPositionsToCheck[ii]);
+ TESTPOINT(charIndex == numberOfCursorPositionsToCheck[ii]);
aSource->iParFormat.iFlags &= ~(RTmParFormat::ERightToLeft); // reset back to default of LeftToRight
}
@@ -257,10 +265,10 @@
TTmDocPosSpec posSpec(pos,static_cast<TTmDocPosSpec::TType>(type));
TBool result = aLayout->GetCursor(posSpec, ECursorVertical,
lineInfo, position, width, ascent, descent);
- test(result);
+ TESTPOINT(result);
//Test that the LHS is non negative. Because we are allowing bidirectional text the
//text shouldnt wrap to next line but instead the cursor can scroll left or right to see the text.
- test(lineInfo.iInnerRect.iTl.iX >= 0);
+ TESTPOINT(lineInfo.iInnerRect.iTl.iX >= 0);
CleanupStack::PopAndDestroy(buf);
}
@@ -297,35 +305,30 @@
static_cast<TTmDocPosSpec::TType>(type));
TBool result = aLayout->GetCursor(posSpec, ECursorVertical,
lineInfo, position, width, ascent, descent);
- test(result);
- test(0 < width);
+ TESTPOINT(result);
+ TESTPOINT(0 < width);
}
}
CleanupStack::PopAndDestroy(buf);
}
-void RunTestsL()
+TVerdict CTBidiCursorPosStep::doTestStepL()
{
+ SetTestStepResult(EPass);
+ TestStep = this;
+ TESTPRINT(_L("TBidiCursorPos - GetNextVisualCursorPos tests"));
CTmTextLayout* layout = new(ELeave) CTmTextLayout;
CleanupStack::PushL(layout);
CTestSource* source = CTestSource::NewLC();
- test.Start(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-3610 GetNextVisualCursorPos tests "));
+ TESTPRINT(_L(" @SYMTestCaseID:SYSLIB-FORM-UT-3610 GetNextVisualCursorPos tests "));
GetNextVisualCursorPosTestsL(layout, source);
- test.Next(_L("INC041367"));
+ TESTPRINT(_L("INC041367"));
INC041367(layout, source);
- test.Next(_L("DEF109737"));
+ TESTPRINT(_L("DEF109737"));
DEF109737(layout, source);
- test.End();
+
CleanupStack::PopAndDestroy(source);
CleanupStack::PopAndDestroy(layout);
+ return TestStepResult();
}
-TInt E32Main()
- {
- TrapCleanup = CTrapCleanup::New();
- TRAPD(err, RunTestsL());
- test(err == KErrNone);
- test.Close();
- delete TrapCleanup;
- return 0;
- }