1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/fontstore/tfs/T_WriteInvalidFontFile.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,65 @@
1.4 +/*
1.5 +* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include "T_InvalidFontFile.h"
1.23 +#include <e32std.h>
1.24 +#include <f32file.h>
1.25 +#include <s32file.h>
1.26 +
1.27 +
1.28 +/**
1.29 +Simple application to create an invalid font file for use in the Font Store eclipsing tests
1.30 +This app is seperate from the test code so that it may use the Tcb capability in order to
1.31 +write to the \resource\* directory.
1.32 +*/
1.33 +LOCAL_C void MainL()
1.34 + {
1.35 + RFs fs;
1.36 + CleanupClosePushL(fs);
1.37 + User::LeaveIfError(fs.Connect());
1.38 +
1.39 + RFileWriteStream fw;
1.40 + CleanupClosePushL(fw);
1.41 +
1.42 + //Ensure the directory exists or the file writing will fail
1.43 + TRAPD(err, fs.MkDirAll(KEclipsingFolder));
1.44 + if (err != KErrAlreadyExists)
1.45 + User::LeaveIfError(err);
1.46 +
1.47 + //Create the invalid file
1.48 + User::LeaveIfError(fw.Create(fs, KEclipsingFile, EFileWrite));
1.49 + fw.WriteL(KInvalidFontFileText);
1.50 + fw.CommitL();
1.51 +
1.52 + CleanupStack::PopAndDestroy(2, &fs);
1.53 + }
1.54 +
1.55 +GLDEF_C TInt E32Main()
1.56 + {
1.57 + __UHEAP_MARK;
1.58 + CTrapCleanup* cleanup = CTrapCleanup::New();
1.59 + TRAPD(mainError, MainL());
1.60 + if (mainError != KErrNone)
1.61 + {
1.62 + RDebug::Printf("T_WriteInvalidFontFile.exe failed with error %i", mainError);
1.63 + }
1.64 + delete cleanup;
1.65 + __UHEAP_MARKEND;
1.66 + return KErrNone;
1.67 + }
1.68 +