|
1 /* |
|
2 * Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "T_InvalidFontFile.h" |
|
20 #include <e32std.h> |
|
21 #include <f32file.h> |
|
22 #include <s32file.h> |
|
23 |
|
24 |
|
25 /** |
|
26 Simple application to create an invalid font file for use in the Font Store eclipsing tests |
|
27 This app is seperate from the test code so that it may use the Tcb capability in order to |
|
28 write to the \resource\* directory. |
|
29 */ |
|
30 LOCAL_C void MainL() |
|
31 { |
|
32 RFs fs; |
|
33 CleanupClosePushL(fs); |
|
34 User::LeaveIfError(fs.Connect()); |
|
35 |
|
36 RFileWriteStream fw; |
|
37 CleanupClosePushL(fw); |
|
38 |
|
39 //Ensure the directory exists or the file writing will fail |
|
40 TRAPD(err, fs.MkDirAll(KEclipsingFolder)); |
|
41 if (err != KErrAlreadyExists) |
|
42 User::LeaveIfError(err); |
|
43 |
|
44 //Create the invalid file |
|
45 User::LeaveIfError(fw.Create(fs, KEclipsingFile, EFileWrite)); |
|
46 fw.WriteL(KInvalidFontFileText); |
|
47 fw.CommitL(); |
|
48 |
|
49 CleanupStack::PopAndDestroy(2, &fs); |
|
50 } |
|
51 |
|
52 GLDEF_C TInt E32Main() |
|
53 { |
|
54 __UHEAP_MARK; |
|
55 CTrapCleanup* cleanup = CTrapCleanup::New(); |
|
56 TRAPD(mainError, MainL()); |
|
57 if (mainError != KErrNone) |
|
58 { |
|
59 RDebug::Printf("T_WriteInvalidFontFile.exe failed with error %i", mainError); |
|
60 } |
|
61 delete cleanup; |
|
62 __UHEAP_MARKEND; |
|
63 return KErrNone; |
|
64 } |
|
65 |