--- a/textrendering/texthandling/ttext/T_RTCLIP.CPP Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/ttext/T_RTCLIP.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"
@@ -23,31 +23,15 @@
#include <s32file.h>
#include <gdi.h>
#include <conpics.h>
+#include <e32test.h>
#include "../incp/T_PMLPAR.H"
-#include "T_RTCLIP.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
const TInt KTestCleanupStack=0x80;
+
+LOCAL_D RTest test(_L("Cut & Paste"));
LOCAL_D CTrapCleanup* TheTrapCleanup=NULL;
LOCAL_D CRichText* TheText=NULL;
LOCAL_D CParaFormatLayer* TheGlobalParaLayer=NULL;
@@ -128,7 +112,7 @@
//
//
{
- INFO_PRINTF1(_L("Cut & paste, preserving formatting into non-empty document"));
+ test.Next(_L("Cut & paste, preserving formatting into non-empty document"));
TheFileName=_L("z:\\test\\app-framework\\etext\\rtclipb2.pml");
ParseRichTextDocumentLC();
TheText->DeleteL(0,TheText->DocumentLength());
@@ -157,7 +141,7 @@
{
TheReadBoard=NULL;
TheWriteBoard=NULL;
- INFO_PRINTF1(_L("Copy to Clipboard with pictures, with missing host applications."));
+ test.Next(_L("Copy to Clipboard with pictures, with missing host applications."));
TheFileName=_L("z:\\test\\app-framework\\etext\\rtclipb2.pml"); // dummy - just to get global layers
ParseRichTextDocumentLC();
TheText->Reset();
@@ -212,7 +196,7 @@
TRAP(r,
TheText->DetachFromStoreL(CPicture::EDetachFull,0,documentLength));
if (r==KErrNotSupported)
- INFO_PRINTF1(_L(" SIMULATION: Some picture data has been removed\n"));
+ test.Printf(_L(" SIMULATION: Some picture data has been removed\n"));
else if (r!=KErrNone)
User::Leave(r);
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),0,documentLength);
@@ -241,7 +225,7 @@
//
//
{
- INFO_PRINTF1(_L("Cut&Paste - preserving formatting"));
+ test.Next(_L("Cut&Paste - preserving formatting"));
TheFileName=_L("z:\\test\\app-framework\\etext\\rtclipb2.pml");
ParseRichTextDocumentLC();
//
@@ -251,7 +235,7 @@
TheWriteBoard=NULL;
//
// Scenario 1
- INFO_PRINTF1(_L("multiple partial phrases"));
+ test.Start(_L("multiple partial phrases"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),36,73);
OpenReadClipboardLC();
@@ -265,7 +249,7 @@
test(copiedText->ParagraphCount()==3);
//
// Scenario 2
- INFO_PRINTF1(_L("multiple whole phrases"));
+ test.Next(_L("multiple whole phrases"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),51,60);
copiedText->Reset();
@@ -276,7 +260,7 @@
test(copiedText->ParagraphCount()==3);
//
// Scenario 3
- INFO_PRINTF1(_L("single middle portion of a phrase"));
+ test.Next(_L("single middle portion of a phrase"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),53,2);
copiedText->Reset();
@@ -287,7 +271,7 @@
test(copiedText->ParagraphCount()==1);
//
// Scenario 4
- INFO_PRINTF1(_L("multiple phrases, starting/ending on shared paragraphs"));
+ test.Next(_L("multiple phrases, starting/ending on shared paragraphs"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),0,140);
copiedText->Reset();
@@ -299,7 +283,7 @@
//
// Scenario 5
- INFO_PRINTF1(_L("zero phrases"));
+ test.Next(_L("zero phrases"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),70,10);
copiedText->Reset();
@@ -315,7 +299,7 @@
delete copiedText;
delete TheGlobalParaLayer;
delete TheGlobalCharLayer;
-
+ test.End();
}
@@ -333,7 +317,7 @@
*/
LOCAL_C void testRichTextCutPaste2()
{
- INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-ETEXT-CT-4001 Pasted final paragraph format should match copied final paragraph format "));
+ test.Next(_L(" @SYMTestCaseID:SYSLIB-ETEXT-CT-4001 Pasted final paragraph format should match copied final paragraph format "));
TheReadBoard=NULL;
TheWriteBoard=NULL;
TheFileName=_L("z:\\test\\app-framework\\etext\\rtclipb2.pml"); // dummy - just to get global layers
@@ -379,14 +363,14 @@
//
//
{
- INFO_PRINTF1(_L("Cutting paragraph of constant character formatting"));
+ test.Next(_L("Cutting paragraph of constant character formatting"));
TheFileName=_L("z:\\test\\app-framework\\etext\\rtclipb3.pml");
ParseRichTextDocumentLC();
//
TheReadBoard=NULL;
TheWriteBoard=NULL;
//
- INFO_PRINTF1(_L("Copying to clipboard"));
+ test.Start(_L("Copying to clipboard"));
OpenWriteClipboardLC();
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),4,3);
//
@@ -394,7 +378,7 @@
CleanupStack::PopAndDestroy(); // TheTextObject
delete TheGlobalParaLayer;
delete TheGlobalCharLayer;
-
+ test.End();
}
@@ -403,24 +387,24 @@
//
//
{
- INFO_PRINTF1(_L("Cut&Paste - with Rich Text"));
+ test.Start(_L("Cut&Paste - with Rich Text"));
ParseRichTextDocumentLC();
OpenWriteClipboardLC();
- INFO_PRINTF1(_L("Copy zero-length text to the clipboard"));
+ test.Next(_L("Copy zero-length text to the clipboard"));
TheText->CopyToStoreL(TheWriteBoard->Store(),TheWriteBoard->StreamDictionary(),0,0);
OpenReadClipboardLC();
- INFO_PRINTF1(_L("Paste from empty clipboard"));
+ test.Next(_L("Paste from empty clipboard"));
TInt err=0;
TRAPD(ret,
err=TheText->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),TheText->DocumentLength()));
UNUSED_VAR(ret);
if (err==KErrNotFound)
- 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=TheText->FieldCount();
test(fieldCount==0);
////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Paste into empty RichText"));
+ test.Next(_L("Paste into empty RichText"));
TheText->Reset();
TheText->InsertL(TheText->DocumentLength(),_L("SomeData"));
OpenWriteClipboardLC();
@@ -434,13 +418,13 @@
fieldCount=TheText->FieldCount();
test(fieldCount==0);
/////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Pasting text only - no paragraph delimiter"));
+ test.Next(_L("Pasting text only - no paragraph delimiter"));
TheText->Reset();
TheText->InsertL(0,_L("the end"));
TheText->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),4);
test(TheText->DocumentLength()==16);
//////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Paste @ start (pos=0)"));
+ test.Next(_L("Paste @ start (pos=0)"));
TheText->Reset();
TheText->InsertL(TheText->DocumentLength(),_L("SomeData"));
TheText->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),0);
@@ -449,14 +433,14 @@
fieldCount=TheText->FieldCount();
test(fieldCount==0);
////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Paste @ end (DocumentLength())"));
+ test.Next(_L("Paste @ end (DocumentLength())"));
TheText->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),TheText->DocumentLength());
test(TheText->DocumentLength()==_L("SomeDataSomeDataSomeData").Length());
test(TheText->ParagraphCount()==1);
fieldCount=TheText->FieldCount();
test(fieldCount==0);
////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Paste @ middle"));
+ test.Next(_L("Paste @ middle"));
TheText->PasteFromStoreL(TheReadBoard->Store(),TheReadBoard->StreamDictionary(),4);
fieldCount=TheText->FieldCount();
test(fieldCount==0);
@@ -468,7 +452,7 @@
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Pasting rich text inbetween 2 pictures"));
+ test.Next(_L("Pasting rich text inbetween 2 pictures"));
TheText->Reset();
//
CXzePicture* pic1=CXzePicture::NewL('1');
@@ -495,7 +479,7 @@
test(TheText->DocumentLength()==4);
test(TheText->ParagraphCount()==1);
/////////////////////////////////////////////////////////////////////////////
- INFO_PRINTF1(_L("Pasting rich text with para delimiters"));
+ test.Next(_L("Pasting rich text with para delimiters"));
TheText->InsertL(1,CEditableText::EParagraphDelimiter);
//
OpenWriteClipboardLC();
@@ -560,38 +544,43 @@
}
}
-CT_RTCLIP::CT_RTCLIP()
+GLDEF_C TInt E32Main()
+//
+// Test the streaming framework.
+//
{
- SetTestStepName(KTestStep_T_RTCLIP);
- pTestStep = this;
- }
-TVerdict CT_RTCLIP::doTestStepL()
- {
- SetTestStepResult(EFail);
+ test.Title();
+
+ __UHEAP_MARK;
+ setupCleanup();
- INFO_PRINTF1(_L("Cut & Paste"));
-
- __UHEAP_MARK;
- setupCleanup();
+ TRAPD(r, testRichTextCutPaste());
+ test(r == KErrNone);
+
+ TRAP(r, testRichTextCutPaste1());
+ test(r == KErrNone);
+
+ TRAP(r, testRichTextCutPaste1a());
+ test(r == KErrNone);
- TRAPD(r1, testRichTextCutPaste());
- TRAPD(r2, testRichTextCutPaste1());
- TRAPD(r3, testRichTextCutPaste1a());
- TRAPD(r4, testRichTextCutPaste1b());
- TRAPD(r5, testRichTextCutPaste2());
- TRAPD(r6, testRichTextCutPaste3());
+ TRAP(r, testRichTextCutPaste1b());
+ test(r == KErrNone);
+
+ TRAP(r, testRichTextCutPaste2());
+ test(r == KErrNone);
+
+ TRAP(r, testRichTextCutPaste3());
+ test(r == KErrNone);
- delete TheTrapCleanup;
-
- __UHEAP_MARKEND;
-
- ::DeleteDataFile(KOutputFile); //deletion of data files must be before call to End() - DEF047652
+ delete TheTrapCleanup;
+
+ __UHEAP_MARKEND;
+
+ ::DeleteDataFile(KOutputFile); //deletion of data files must be before call to End() - DEF047652
+
+ test.End();
+ test.Close();
- if (r1 == KErrNone && r2 == KErrNone && r3 == KErrNone && r4 == KErrNone && r5 == KErrNone && r6 == KErrNone)
- {
- SetTestStepResult(EPass);
- }
-
- return TestStepResult();
+ return 0;
}