--- a/textrendering/texthandling/ttext/T_LAYDOC.CPP Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/ttext/T_LAYDOC.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"
@@ -16,32 +16,15 @@
*/
+#include <e32test.h>
#include <txtlaydc.h>
#include <txtglobl.h>
#include <txtfrmat.h>
#include <txtfmlyr.h>
-#include "T_LAYDOC.h"
-
-LOCAL_D CTestStep *pTestStep = NULL;
-#define test(cond) \
- { \
- TBool __bb = (cond); \
- pTestStep->TEST(__bb); \
- if (!__bb) \
- { \
- pTestStep->ERR_PRINTF1(_L("ERROR: Test Failed")); \
- User::Leave(1); \
- } \
- }
-#undef INFO_PRINTF1
-#undef INFO_PRINTF2
-// copy from tefexportconst.h
-#define INFO_PRINTF1(p1) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1))
-#define INFO_PRINTF2(p1, p2) pTestStep->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (p1), (p2))
-
#define UNUSED_VAR(a) a = a
+LOCAL_D RTest test(_L("TGlobalLayDoc - Layout class"));
LOCAL_D TPtrC defaultText(_L("This is default text"));
LOCAL_D TPtrC comp1(_L("fault text"));
LOCAL_D TPtrC comp2(_L("t"));
@@ -109,23 +92,23 @@
TCharFormat format;
TPtrC view;
- INFO_PRINTF1(_L("Sensing at start"));
+ test.Start(_L("Sensing at start"));
doc->GetChars(view,format,0);
CheckView(view,defaultText);
- INFO_PRINTF1(_L("Sensing from char.pos.10"));
+ test.Next(_L("Sensing from char.pos.10"));
doc->GetChars(view,format,10);
CheckView(view,comp1);
- INFO_PRINTF1(_L("Sensing from end-1"));
+ test.Next(_L("Sensing from end-1"));
doc->GetChars(view,format,19);
CheckView(view,comp2);
- INFO_PRINTF1(_L("Sensing from end"));
+ test.Next(_L("Sensing from end"));
doc->GetChars(view,format,20);
test(*view.Ptr()==CEditableText::EParagraphDelimiter);
-
+ test.End();
delete doc;
delete paraLayer;
delete charLayer;
@@ -197,17 +180,17 @@
TPtrC body(content);
document->InsertL(0,body);
// Now do the tests.
- INFO_PRINTF1(_L("Paragraph 1"));
+ test.Start(_L("Paragraph 1"));
DoParagraphStart(0,55,document); // Paragraph 1
- INFO_PRINTF1(_L("Paragraph 2"));
+ test.Next(_L("Paragraph 2"));
DoParagraphStart(55,23,document); // Paragraph 2
- INFO_PRINTF1(_L("Paragraph 3"));
+ test.Next(_L("Paragraph 3"));
DoParagraphStart(78,20,document); // Paragraph 3
delete paraLayer;
delete charLayer;
delete document;
-
+ test.End();
__UHEAP_MARKEND;
User::Heap().Check();
}
@@ -285,28 +268,28 @@
doc->SetGlobalParaFormat(layer);
// Check constructor
- INFO_PRINTF1(_L("Constructor"));
+ test.Start(_L("Constructor"));
// Check DocumentLength
- INFO_PRINTF1(_L("DocumentLength()"));
+ test.Next(_L("DocumentLength()"));
doc->LdDocumentLength();
// Check ParagraphStart
- INFO_PRINTF1(_L("ParagraphStart()"));
+ test.Next(_L("ParagraphStart()"));
doc->LdToParagraphStart(pos);
// Check GetParagraphFormatL
- INFO_PRINTF1(_L("GetParagraphFormatL()"));
+ test.Next(_L("GetParagraphFormatL()"));
doc->GetParagraphFormatL(format,pos);
// Check GetChars
- INFO_PRINTF1(_L("GetChars()"));
+ test.Next(_L("GetChars()"));
TPtrC view;
TCharFormat charFormat;
doc->GetChars(view,charFormat,pos);
// check EnquirePage
- INFO_PRINTF1(_L("EnquirePageBreak()"));
+ test.Next(_L("EnquirePageBreak()"));
doc->EnquirePageBreak(pos,0);
delete paraLayer;
@@ -314,7 +297,7 @@
delete doc;
delete layer;
delete format;
-
+ test.End();
__UHEAP_MARKEND;
User::Heap().Check();
}
@@ -325,25 +308,25 @@
//
{
__UHEAP_MARK;
- INFO_PRINTF1(_L("Checking all methods present"));
+ test.Start(_L("Checking all methods present"));
TestRegister(CEditableText::EFlatStorage);
- INFO_PRINTF1(_L("DocumentLength()"));
+ test.Next(_L("DocumentLength()"));
TestDocumentLength(CEditableText::EFlatStorage);
- INFO_PRINTF1(_L("EnquirePage()"));
- INFO_PRINTF1(_L("Always returns 0"));
-
+ test.Next(_L("EnquirePage()"));
+ test.Start(_L("Always returns 0"));
+ test.End();
- INFO_PRINTF1(_L("ParagraphStart()"));
+ test.Next(_L("ParagraphStart()"));
TestParagraphStart(CEditableText::EFlatStorage);
- INFO_PRINTF1(_L("GetParagraphFormatL()"));
+ test.Next(_L("GetParagraphFormatL()"));
TestGetParagraphFormatL(CEditableText::EFlatStorage);
- INFO_PRINTF1(_L("GetChars"));
+ test.Next(_L("GetChars"));
TestRead(CEditableText::EFlatStorage);
-
+ test.End();
__UHEAP_MARKEND;
}
@@ -354,59 +337,56 @@
//
{
__UHEAP_MARK;
- INFO_PRINTF1(_L("Checking all methods present"));
+ test.Next(_L("Checking all methods present"));
TestRegister(CEditableText::ESegmentedStorage);
- INFO_PRINTF1(_L("DocumentLength()"));
+ test.Next(_L("DocumentLength()"));
TestDocumentLength(CEditableText::ESegmentedStorage);
- INFO_PRINTF1(_L("EnquirePage()"));
- INFO_PRINTF1(_L("Always returns 0"));
-
+ test.Next(_L("EnquirePage()"));
+ test.Start(_L("Always returns 0"));
+ test.End();
- INFO_PRINTF1(_L("ParagraphStart()"));
+ test.Next(_L("ParagraphStart()"));
TestParagraphStart(CEditableText::ESegmentedStorage);
- INFO_PRINTF1(_L("SenseParagraphFormatL()"));
+ test.Next(_L("SenseParagraphFormatL()"));
TestGetParagraphFormatL(CEditableText::ESegmentedStorage);
- INFO_PRINTF1(_L("GetChars"));
+ test.Next(_L("GetChars"));
//TestRead();
- //
- INFO_PRINTF1(_L("Test not yet implemented"));
-
+ //test.End();
+ test.Start(_L("Test not yet implemented"));
+ test.End();
__UHEAP_MARKEND;
}
-
-CT_LAYDOC::CT_LAYDOC()
- {
- SetTestStepName(KTestStep_T_LAYDOC);
- pTestStep = this;
- }
-
-TVerdict CT_LAYDOC::doTestStepL()
- {
- SetTestStepResult(EFail);
-
- CTrapCleanup* cleanup=CTrapCleanup::New();
+
+
+GLDEF_C TInt E32Main()
+//
+// Drives the test program
+//
+ {
+ CTrapCleanup* cleanup=CTrapCleanup::New();
+
- INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_LAYDOC-0001 MLayDoc - Using Flat document "));
-
- __UHEAP_MARK;
- TRAPD(ret1,Test());
- __UHEAP_MARKEND;
-
- INFO_PRINTF1(_L("MLaydoc - Using Segmented document"));
- __UHEAP_MARK;
- TRAPD(ret2,TestSeg());
- __UHEAP_MARKEND;
+ test.Start(_L(" @SYMTestCaseID:SYSLIB-TTEXT-LEGACY-T_LAYDOC-0001 MLayDoc - Using Flat document "));
+
+ __UHEAP_MARK;
+ TRAPD(ret,Test());
+ __UHEAP_MARKEND;
+ test(ret == KErrNone);
+
+ test.Next(_L("MLaydoc - Using Segmented document"));
+ __UHEAP_MARK;
+ TRAP(ret,TestSeg());
+ __UHEAP_MARKEND;
+ test(ret == KErrNone);
- delete cleanup;
+ test.End();
+ test.Close();
- if (ret1 == KErrNone && ret2 == KErrNone)
- {
- SetTestStepResult(EPass);
- }
+ delete cleanup;
- return TestStepResult();
- }
+ return(0);
+ }