diff -r 000000000000 -r 2e3d3ce01487 filehandling/htmltorichtextconverter/tsrc/loadconvertertest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/filehandling/htmltorichtextconverter/tsrc/loadconvertertest.cpp Tue Feb 02 10:12:00 2010 +0200 @@ -0,0 +1,137 @@ +// Copyright (c) 2003-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" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// CHtmlToCrtConverter loading test code +// +// + +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include "CHtmlToCrtConverter.h" + +_LIT(KTestName,"CHtmlToCrtConverter"); +_LIT(KTest1,"@SYMTestCaseID PIM-LOADCONVERTERTEST-0001 CHtmlToCrtConverter test"); + +LOCAL_D RTest test(KTestName); + +//================================================================================ +//getPathL +//================================================================================ +TBool getPathL(TDes& aPath, RFs& aFs) + { + // Generate the folder spec to search in + TFileName searchSpec; + TChar driveLetter = 'C'; + searchSpec.Append(driveLetter); + searchSpec.Append(aPath); + + CDir* entryList = NULL; + TFindFile finder(aFs); + TInt ret = finder.FindWildByPath(searchSpec, NULL, entryList); + if(retNewConverterL(KUidCHtmlToCrtConverter); + + if (conv) + { + CleanupStack::PushL(conv); + //do conversion + conv->ConvertL(aSourceFile, aTargetFile); + CleanupStack::PopAndDestroy(); //conv + //output result + _LIT(KString,"%S"); + test.Printf(KString,&(aSourceFile)); + test.Printf(_L(" converted\n")); + } + CleanupStack::PopAndDestroy(convList); + } +//========================================================================== + +/** +@SYMTestCaseID PIM-LOADCONVERTERTEST-0001 +*/ +void doMainL() + { + test.Start(KTest1); + + RFs fs; + fs.Connect(); + + TBufC<11> targetFile = (_L("target file")); + TBuf<100> sourceFile(_L(":\\testHtml\\LoadConverterTest.txt")); + + if(getPathL(sourceFile, fs)) + { + loadConverterL(sourceFile, targetFile); + } + + REComSession::FinalClose(); //needed, otherwise you will get a memory leak + + test.End(); + test.Close(); + } + +GLDEF_C TInt E32Main() + { + __UHEAP_MARK; + + CTrapCleanup* theCleanup=CTrapCleanup::New(); + TRAPD(ret,doMainL()); + test(ret==KErrNone); + delete theCleanup; + + __UHEAP_MARKEND; + return(KErrNone); + }