diff -r 748ec5531811 -r 336bee5c2d35 textrendering/texthandling/ttext/T_CUTPST.CPP --- a/textrendering/texthandling/ttext/T_CUTPST.CPP Tue Aug 31 17:01:26 2010 +0300 +++ b/textrendering/texthandling/ttext/T_CUTPST.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" @@ -20,30 +20,14 @@ #include #include #include -#include "T_CUTPST.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)) +#include #define UNUSED_VAR(a) a = a const TInt KTestCleanupStack=0x40; +LOCAL_D RTest test(_L("Cut & Paste")); LOCAL_D CTrapCleanup* TheTrapCleanup=NULL; LOCAL_D CPlainText* TheTextObject=NULL; LOCAL_D CClipboard* TheWriteBoard=NULL; @@ -91,18 +75,18 @@ OpenWriteClipboardLC(); // delete the system clipboard file if it exists. // Copy zero-length text to the clipboard. - INFO_PRINTF1(_L("Copy zero-length text to the clipboard")); + test.Next(_L("Copy zero-length text to the clipboard")); TheTextObject->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),0,0); OpenReadClipboardLC(); test(TheTextObject->DocumentLength()==0); // Paste zero-length text from the clipboard. - INFO_PRINTF1(_L("Paste zero-length text from the clipboard")); + test.Next(_L("Paste zero-length text from the clipboard")); TheTextObject->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),0); // Copy multiple paragraphs to the clipboard - INFO_PRINTF1(_L("PasteFromStoreL(aPos,aMaxPasteLength)")); + test.Next(_L("PasteFromStoreL(aPos,aMaxPasteLength)")); TBuf<512> buf(_L("Here is para one.")); buf.Append(CEditableText::EParagraphDelimiter); buf.Append(_L("This is paragraph two.")); @@ -132,27 +116,27 @@ // // { - INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-CPLAIN-0001 Cut&Paste - with plainText ")); + test.Start(_L(" @SYMTestCaseID:SYSLIB-ETEXT-LEGACY-CPLAIN-0001 Cut&Paste - with plainText ")); TheTextObject=CPlainText::NewL(); CleanupStack::PushL(TheTextObject); OpenWriteClipboardLC(); // delete the system clipboard file if it exists. test(TheTextObject->DocumentLength()==0); // - INFO_PRINTF1(_L("Paste from empty store")); + test.Next(_L("Paste from empty store")); OpenReadClipboardLC(); TInt charCount=0; TRAPD(ret, charCount=TheTextObject->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),TheTextObject->DocumentLength())); UNUSED_VAR(ret); if (charCount<=0) - INFO_PRINTF1(_L(" No recognised data to paste or clipboard empty\n\r")); + test.Printf(_L(" No recognised data to paste or clipboard empty\n\r")); TInt fieldCount=TheTextObject->FieldCount(); test(fieldCount==0); // -// INFO_PRINTF1(_L("Paste from clipboard with no recognised types")); +// test.Next(_L("Paste from clipboard with no recognised types")); // WriteForeignDataToClipboardL(); // - INFO_PRINTF1(_L("Paste into empty PlainText")); + test.Next(_L("Paste into empty PlainText")); TheTextObject->InsertL(TheTextObject->DocumentLength(),_L("SomeData")); OpenWriteClipboardLC(); TheTextObject->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),0,TheTextObject->DocumentLength()); @@ -164,19 +148,19 @@ fieldCount=TheTextObject->FieldCount(); test(fieldCount==0); // - INFO_PRINTF1(_L("Paste @ start (pos=0)")); + test.Next(_L("Paste @ start (pos=0)")); TheTextObject->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),0); test(TheTextObject->DocumentLength()==_L("SomeDataSomeData").Length()); fieldCount=TheTextObject->FieldCount(); test(fieldCount==0); // - INFO_PRINTF1(_L("Paste @ end (DocumentLength())")); + test.Next(_L("Paste @ end (DocumentLength())")); TheTextObject->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),TheTextObject->DocumentLength()); test(TheTextObject->DocumentLength()==_L("SomeDataSomeDataSomeData").Length()); fieldCount=TheTextObject->FieldCount(); test(fieldCount==0); // - INFO_PRINTF1(_L("Paste @ middle")); + test.Next(_L("Paste @ middle")); TheTextObject->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),4); fieldCount=TheTextObject->FieldCount(); test(fieldCount==0); @@ -208,30 +192,25 @@ }); } -CT_CUTPST::CT_CUTPST() + +GLDEF_C TInt E32Main() +// +// Test the streaming framework. +// { - SetTestStepName(KTestStep_T_CUTPST); - pTestStep = this; - } - -TVerdict CT_CUTPST::doTestStepL() - { - SetTestStepResult(EFail); - INFO_PRINTF1(_L("Cut & Paste")); - __UHEAP_MARK; - setupCleanup(); - TRAPD(r1,testPlainTextCutPaste()); - TRAPD(r2,testPlainTextCutPaste2()); + test.Title(); + __UHEAP_MARK; + setupCleanup(); + TRAPD(r,testPlainTextCutPaste()); + test(r == KErrNone); + TRAP(r,testPlainTextCutPaste2()); + test(r == KErrNone); - delete TheTrapCleanup; - - __UHEAP_MARKEND; - - if (r1 == KErrNone && r2 == KErrNone) - { - SetTestStepResult(EPass); - } - - return TestStepResult(); + delete TheTrapCleanup; + + __UHEAP_MARKEND; + test.End(); + test.Close(); + return 0; }