author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 43 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 44 | 3e88ff8f41d5 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
16 |
#define __E32TEST_EXTENSION__ |
0 | 17 |
#include <f32file.h> |
18 |
#include <e32test.h> |
|
19 |
#include "t_server.h" |
|
20 |
#include "t_chlffs.h" |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "f32_test_utils.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
|
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
using namespace F32_Test_Utils; |
0 | 24 |
|
25 |
GLDEF_D RTest test(_L("T_NMBS")); |
|
26 |
||
27 |
LOCAL_C void testMkDirRmDir() |
|
28 |
// |
|
29 |
// Test the MkDir functions. |
|
30 |
// |
|
31 |
{ |
|
32 |
||
33 |
test.Next(_L("Test MkDir")); |
|
34 |
||
35 |
TInt r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
test_KErrNone(r); |
0 | 37 |
r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
38 |
test_Value(r, r == KErrPathNotFound); |
0 | 39 |
r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
test_KErrNone(r); |
0 | 41 |
r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
42 |
test_KErrNone(r); |
0 | 43 |
|
44 |
test.Next(_L("Test RmDir 1.0")); |
|
45 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
test_KErrNone(r); |
0 | 47 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
test_KErrNone(r); |
0 | 49 |
|
50 |
test.Next(_L("Test MkDirAll 1.0")); |
|
51 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
52 |
test_KErrNone(r); |
0 | 53 |
|
54 |
test.Next(_L("Test RmDir 2.0")); |
|
55 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
56 |
test_KErrNone(r); |
0 | 57 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
58 |
test_KErrNone(r); |
0 | 59 |
|
60 |
test.Next(_L("Test MkDirAll 2.0")); |
|
61 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
test_KErrNone(r); |
0 | 63 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
test_KErrNone(r); |
0 | 65 |
|
66 |
test.Next(_L("Test RmDir 3.0")); |
|
67 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
68 |
test_KErrNone(r); |
0 | 69 |
r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
70 |
test_KErrNone(r); |
0 | 71 |
|
72 |
test.Next(_L("Test mkdir and rmdir on root")); |
|
73 |
r=TheFs.RmDir(_L("\\File.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
74 |
test_Value(r, r == KErrInUse); |
0 | 75 |
r=TheFs.MkDir(_L("\\asdf.ere")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
test_Value(r, r == KErrAlreadyExists); |
0 | 77 |
r=TheFs.MkDirAll(_L("\\asdf.ere")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
test_Value(r, r == KErrAlreadyExists); |
0 | 79 |
|
80 |
test.Next(_L("Test error code return values")); |
|
81 |
r=TheFs.MkDir(_L("\\F32-TST\\\\ABCDEF\\")); |
|
82 |
||
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
83 |
test_Value(r, r == KErrBadName); |
0 | 84 |
|
85 |
test.Next(_L("Test MkDir with trailing spaces")); |
|
86 |
r=TheFs.MkDir(_L("\\F32-TST\\TESTMKDIR \\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
test_KErrNone(r); |
0 | 88 |
r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
test_KErrNone(r); |
0 | 90 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TESTMKDIR \\NOTCREATED\\NORTHIS \\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
test_Value(r, r == KErrPathNotFound); |
0 | 92 |
r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\NOTCREATED\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
93 |
test_Value(r, r == KErrNotFound); |
0 | 94 |
r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
95 |
test_KErrNone(r); |
0 | 96 |
|
97 |
r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
98 |
test_KErrNone(r); |
0 | 99 |
} |
100 |
||
101 |
LOCAL_C void testRename() |
|
102 |
// |
|
103 |
// Test the rename function. |
|
104 |
// |
|
105 |
{ |
|
106 |
||
107 |
test.Next(_L("Test rename directories")); |
|
108 |
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
109 |
test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
0 | 110 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\"),_L("\\F32-TST\\ABCDEF\\LMED")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
111 |
test_Value(r, r == KErrInUse); |
0 | 112 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\GPQ"),_L("\\F32-TST\\LMED")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
113 |
test_KErrNone(r); |
0 | 114 |
r=TheFs.RmDir(_L("\\F32-TST\\LMED\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
115 |
test_KErrNone(r); |
0 | 116 |
|
117 |
MakeDir(_L("\\F32-TST\\ABC\\")); |
|
118 |
MakeFile(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
|
119 |
MakeFile(_L("\\F32-TST\\asdf.txt")); |
|
120 |
||
121 |
test.Next(_L("Test rename directory while subfile is open")); |
|
122 |
RFile f; |
|
123 |
r=f.Open(TheFs,_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt"),EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
124 |
test_KErrNone(r); |
0 | 125 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
126 |
test_Value(r, r == KErrInUse); |
0 | 127 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
128 |
test_Value(r, r == KErrInUse); |
0 | 129 |
r=TheFs.Rename(_L("\\F32-TST\\ABC"),_L("\\F32-TST\\XXX")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
130 |
test_KErrNone(r); |
0 | 131 |
f.Close(); |
132 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
133 |
test_KErrNone(r); |
0 | 134 |
r=TheFs.Rename(_L("\\F32-TST\\XXX"),_L("\\F32-TST\\ABC")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
135 |
test_KErrNone(r); |
0 | 136 |
r=TheFs.Rename(_L("\\"),_L("\\BLARG")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
137 |
test_Value(r, r == KErrBadName); |
0 | 138 |
|
139 |
r=f.Open(TheFs,_L("\\F32-TST\\asdf.txt"),EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
140 |
test_KErrNone(r); |
0 | 141 |
r=TheFs.Rename(_L("\\F32-TST\\xxxyyy"),_L("\\F32-TST\\ABCDEF")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
142 |
test_KErrNone(r); |
0 | 143 |
r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\ABCDEF")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
144 |
test_Value(r, r == KErrInUse); |
0 | 145 |
f.Close(); |
146 |
||
147 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
148 |
test_KErrNone(r); |
0 | 149 |
r=TheFs.Delete(_L("\\F32-TST\\asdf.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
test_KErrNone(r); |
0 | 151 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
test_KErrNone(r); |
0 | 153 |
r=TheFs.RmDir(_L("\\F32-TST\\ABC\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
test_KErrNone(r); |
0 | 155 |
|
156 |
r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
test_Value(r, r == KErrPathNotFound); |
0 | 158 |
r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
159 |
test_Value(r, r == KErrNotFound); |
0 | 160 |
r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
161 |
test_Value(r, r == KErrPathNotFound); |
0 | 162 |
r=TheFs.Rename(_L("\\F32-TST\\FEDCBA"),_L("\\TST-E32\\123456")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
163 |
test_Value(r, r == KErrNotFound); |
0 | 164 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
165 |
test_KErrNone(r); |
0 | 166 |
r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\XYZABC")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
167 |
test_KErrNone(r); |
0 | 168 |
|
169 |
test.Next(_L("Test rename files")); |
|
170 |
r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
171 |
test_KErrNone(r); |
0 | 172 |
f.Close(); |
173 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
174 |
test_KErrNone(r); |
0 | 175 |
r=TheFs.Delete(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
176 |
test_KErrNone(r); |
0 | 177 |
|
178 |
test.Next(_L("Test rename checks for duplicate entries")); |
|
179 |
r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
test_KErrNone(r); |
0 | 181 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\XYZABC")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
test_Value(r, r == KErrAlreadyExists); |
0 | 183 |
r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
test_KErrNone(r); |
0 | 185 |
f.Close(); |
186 |
r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
test_KErrNone(r); |
0 | 188 |
f.Close(); |
189 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
190 |
test_Value(r, r == KErrAlreadyExists); |
0 | 191 |
|
192 |
test.Next(_L("Test rename across directories")); |
|
193 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
194 |
test_KErrNone(r); |
0 | 195 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
196 |
test_Value(r, r == KErrNotFound); |
0 | 197 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\DIFNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
198 |
test_Value(r, r == KErrNotFound); |
0 | 199 |
r=TheFs.Rename(_L("\\F32-TST\\XYZABC"),_L("\\F32-TST\\ABCDEF\\XYZABC")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
200 |
test_KErrNone(r); |
0 | 201 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
202 |
test_KErrNone(r); |
0 | 203 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\NewNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
204 |
test_KErrNone(r); |
0 | 205 |
test.Next(_L("Test rename across drive error code")); |
206 |
r=TheFs.Rename(_L("Z:\\BLEG"),_L("C:\\FRUM")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
207 |
test_Value(r, r == KErrArgument); |
0 | 208 |
test.Next(_L("Test rename to identical names")); |
209 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
210 |
test_KErrNone(r); |
0 | 211 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),KErrNone); |
212 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLdnAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
213 |
test_KErrNone(r); |
0 | 214 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),KErrNone,EFalse); |
215 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLdnAME.TXT"),KErrNone,ETrue); |
|
216 |
||
217 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
218 |
test_KErrNone(r); |
0 | 219 |
test.Next(_L("Test RmDir")); |
220 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
221 |
test_KErrNone(r); |
0 | 222 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
223 |
test_KErrNone(r); |
0 | 224 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\XYZABC\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
225 |
test_KErrNone(r); |
0 | 226 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
227 |
test_KErrNone(r); |
0 | 228 |
} |
229 |
LOCAL_C void TestLongFileName() |
|
230 |
{ |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
231 |
if (Is_SimulatedSystemDrive(TheFs, CurrentDrive())) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
232 |
{ |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
233 |
// Do not perform this test for the system drive of the emulator or PlatSim |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
234 |
// as they use Windows system calls. |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
235 |
// Windows does not create a directory with length more than 244 characters |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
236 |
// (247 including <drive>:\) |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
237 |
test.Printf(_L("TestLongFileName() skipped on simulated system drive.\n")); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
238 |
return; |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
239 |
} |
0 | 240 |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
241 |
test.Next(_L("Test renaming 257 characters directories")); |
0 | 242 |
_LIT(KLongFileName256, "256dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
243 |
_LIT(KLongFileName257, "257dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
|
244 |
TBuf<260> Path; |
|
245 |
TBuf<10> baseDir; |
|
246 |
||
247 |
baseDir.Format(_L("%c:\\"),(TUint)(gDriveToTest)); |
|
248 |
Path.Copy(baseDir); |
|
249 |
Path.Append(KLongFileName256); |
|
250 |
Path.Append(_L("\\")); |
|
251 |
||
252 |
TInt result = KErrNone; |
|
253 |
//-- 1. create directory in Root which total path length is 256 symbols. result = TheFs.MkDirAll(Path); |
|
254 |
result=TheFs.MkDirAll(Path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
255 |
test_Value(result, (result == KErrNone)||(result==KErrAlreadyExists)); |
0 | 256 |
|
257 |
test.Next(_L("Renaming a 265 char directory to a 257 char directory")); |
|
258 |
result=TheFs.SetSessionPath(baseDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
259 |
test_KErrNone(result); |
0 | 260 |
TheFs.SessionPath(baseDir); |
261 |
test.Printf(_L("Session path was set to: %S"), &baseDir); |
|
262 |
||
263 |
//-- 2. try to rename this directory to one with 257 character total path length |
|
264 |
test.Printf(_L("Renaming 256-char directory to 257")); |
|
265 |
result = KErrNone; |
|
266 |
Path.Copy(KLongFileName257); |
|
267 |
result = TheFs.Rename(KLongFileName256, Path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
268 |
test_Value(result, result == KErrBadName); |
0 | 269 |
//-- 3. try to rename this directory to one with 258 character total path length |
270 |
||
271 |
Path.Append(_L("z")); |
|
272 |
result = TheFs.Rename(KLongFileName256, Path); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
273 |
test_Value(result, result == KErrBadName); |
0 | 274 |
|
275 |
} |
|
276 |
LOCAL_C void testRenameCase() |
|
277 |
// |
|
278 |
// Test renaming "AGENDA" to "agenda" |
|
279 |
// |
|
280 |
{ |
|
281 |
||
282 |
test.Next(_L("Test rename case")); |
|
283 |
MakeDir(_L("\\F32-TST\\RENAMECASE\\")); |
|
284 |
TInt r=TheFs.SetSessionPath(_L("\\F32-TST\\RENAMECASE\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
285 |
test_KErrNone(r); |
0 | 286 |
|
287 |
MakeFile(_L("file1.txt")); |
|
288 |
MakeFile(_L("FILE2.TXT")); |
|
289 |
MakeFile(_L("AGENDA")); |
|
290 |
MakeFile(_L("agenda.one")); |
|
291 |
||
292 |
TEntry entry; |
|
293 |
r=TheFs.Rename(_L("FILE1.TXT"),_L("FILE1.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
294 |
test_KErrNone(r); |
0 | 295 |
r=TheFs.Entry(_L("File1.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
296 |
test_KErrNone(r); |
0 | 297 |
test(entry.iName==_L("FILE1.TXT")); |
298 |
||
299 |
r=TheFs.Rename(_L("file2.txt"),_L("file2.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
300 |
test_KErrNone(r); |
0 | 301 |
r=TheFs.Entry(_L("File2.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
302 |
test_KErrNone(r); |
0 | 303 |
test(entry.iName==_L("file2.txt")); |
304 |
||
305 |
r=TheFs.Rename(_L("agenda."),_L("agenda.two")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
306 |
test_KErrNone(r); |
0 | 307 |
r=TheFs.Entry(_L("Agenda.two"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
308 |
test_KErrNone(r); |
0 | 309 |
test(entry.iName==_L("agenda.two")); |
310 |
||
311 |
r=TheFs.Rename(_L("AGENDA.ONE"),_L("AGENDA.ONE")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
312 |
test_KErrNone(r); |
0 | 313 |
r=TheFs.Entry(_L("Agenda.one"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
314 |
test_KErrNone(r); |
0 | 315 |
test(entry.iName==_L("AGENDA.ONE")); |
316 |
||
317 |
r=TheFs.Rename(_L("FILE1.TXT"),_L("file1.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
318 |
test_KErrNone(r); |
0 | 319 |
r=TheFs.Entry(_L("File1.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
320 |
test_KErrNone(r); |
0 | 321 |
test(entry.iName==_L("file1.txt")); |
322 |
||
323 |
r=TheFs.Rename(_L("file2.txt"),_L("FILE2.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
324 |
test_KErrNone(r); |
0 | 325 |
r=TheFs.Entry(_L("File2.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
326 |
test_KErrNone(r); |
0 | 327 |
test(entry.iName==_L("FILE2.TXT")); |
328 |
||
329 |
r=TheFs.Rename(_L("agenda.two"),_L("AGENDA")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
330 |
test_KErrNone(r); |
0 | 331 |
r=TheFs.Entry(_L("Agenda"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
332 |
test_KErrNone(r); |
0 | 333 |
test(entry.iName==_L("AGENDA")); |
334 |
||
335 |
r=TheFs.Rename(_L("AGENDA.ONE"),_L("agenda.one")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
test_KErrNone(r); |
0 | 337 |
r=TheFs.Entry(_L("Agenda.one"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
338 |
test_KErrNone(r); |
0 | 339 |
test(entry.iName==_L("agenda.one")); |
340 |
||
341 |
r=TheFs.Rename(_L("FILE1.TXT"),_L("FILe1.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
test_KErrNone(r); |
0 | 343 |
r=TheFs.Entry(_L("File1.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
344 |
test_KErrNone(r); |
0 | 345 |
test(entry.iName==_L("FILe1.txt")); |
346 |
||
347 |
r=TheFs.Rename(_L("file2.txt"),_L("FILE3.TXT")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
348 |
test_KErrNone(r); |
0 | 349 |
r=TheFs.Entry(_L("File3.txt"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
350 |
test_KErrNone(r); |
0 | 351 |
test(entry.iName==_L("FILE3.TXT")); |
352 |
||
353 |
r=TheFs.Rename(_L("agenda."),_L("AGENDA1")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
354 |
test_KErrNone(r); |
0 | 355 |
r=TheFs.Entry(_L("Agenda1"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
356 |
test_KErrNone(r); |
0 | 357 |
test(entry.iName==_L("AGENDA1")); |
358 |
||
359 |
r=TheFs.Rename(_L("AGENDA.ONE"),_L("Agenda.One")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
360 |
test_KErrNone(r); |
0 | 361 |
r=TheFs.Entry(_L("Agenda.one"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
362 |
test_KErrNone(r); |
0 | 363 |
test(entry.iName==_L("Agenda.One")); |
364 |
||
365 |
r=TheFs.Delete(_L("file1.txt")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
366 |
test_KErrNone(r); |
0 | 367 |
r=TheFs.Delete(_L("file3.txt")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
368 |
test_KErrNone(r); |
0 | 369 |
r=TheFs.Delete(_L("Agenda1")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
370 |
test_KErrNone(r); |
0 | 371 |
r=TheFs.Delete(_L("AGENDA.ONE")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
372 |
test_KErrNone(r); |
0 | 373 |
r=TheFs.RmDir(_L("\\F32-TST\\RENAMECASE\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
374 |
test_KErrNone(r); |
0 | 375 |
r=TheFs.SetSessionPath(gSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
376 |
test_KErrNone(r); |
0 | 377 |
} |
378 |
||
379 |
LOCAL_C void testReplace() |
|
380 |
// |
|
381 |
// Test the replace function |
|
382 |
// |
|
383 |
{ |
|
384 |
||
385 |
test.Next(_L("Test Replace")); |
|
386 |
TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
387 |
test_KErrNone(r); |
0 | 388 |
r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
389 |
test_Value(r, r == KErrAccessDenied); // Do not replace directories |
0 | 390 |
r=TheFs.Replace(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
391 |
test_Value(r, r == KErrAccessDenied); |
0 | 392 |
r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
393 |
test_Value(r, r == KErrPathNotFound); |
0 | 394 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
395 |
test_Value(r, r == KErrAccessDenied); |
0 | 396 |
|
397 |
test.Next(_L("Replace a file with itself (8.3 filename)")); |
|
398 |
MakeFile(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
|
399 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
400 |
test_KErrNone(r); |
0 | 401 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),KErrNone); |
402 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\test1.spr")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
403 |
test_KErrNone(r); |
0 | 404 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),KErrNone,ETrue); // Replace does not rename existing file |
405 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\test1.spr"),KErrNone,EFalse); |
|
406 |
||
407 |
test.Next(_L("Replace a file with itself (vfat filename)")); |
|
408 |
MakeFile(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
|
409 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
410 |
test_KErrNone(r); |
0 | 411 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),KErrNone); |
412 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),_L("\\F32-TST\\ABCDEF\\test_sheet(01).spr")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
413 |
test_KErrNone(r); |
0 | 414 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),KErrNone,ETrue); // Replace does not rename existing file |
415 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\test_sheet(01).spr"),KErrNone,EFalse); |
|
416 |
||
417 |
test.Next(_L("Replace preserves file contents (8.3 filename)")); |
|
418 |
MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("Original Data")); |
|
419 |
MakeFile(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L8("NewData")); |
|
420 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
421 |
test_KErrNone(r); |
0 | 422 |
CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
423 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
|
424 |
||
425 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
426 |
test_KErrNone(r); |
0 | 427 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
428 |
test_KErrNone(r); |
0 | 429 |
CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
430 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
|
431 |
||
432 |
test.Next(_L("Replace preserves file contents (vfat fileName)")); |
|
433 |
MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("Original Data")); |
|
434 |
MakeFile(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L8("NewData")); |
|
435 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
436 |
test_KErrNone(r); |
0 | 437 |
CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
438 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
|
439 |
||
440 |
r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
441 |
test_KErrNone(r); |
0 | 442 |
r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
443 |
test_KErrNone(r); |
0 | 444 |
CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
445 |
CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
|
446 |
||
447 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
448 |
test_Value(r, r == KErrInUse); |
0 | 449 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
450 |
test_Value(r, r == KErrPathNotFound); |
0 | 451 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
452 |
test_KErrNone(r); |
0 | 453 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
454 |
test_KErrNone(r); |
0 | 455 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
456 |
test_KErrNone(r); |
0 | 457 |
r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
458 |
test_KErrNone(r); |
0 | 459 |
r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
460 |
test_KErrNone(r); |
0 | 461 |
|
462 |
test.Next(_L("Check file date is retained")); |
|
463 |
MakeFile(_L("OldFile.Old")); |
|
464 |
MakeFile(_L("NewFile.new")); |
|
465 |
||
466 |
TDateTime newDate(1998,(TMonth)2,3,11,12,0,0); |
|
467 |
TTime newTime(newDate); |
|
468 |
||
469 |
r=TheFs.SetEntry(_L("NewFile.new"),newTime,0,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
test_KErrNone(r); |
0 | 471 |
|
472 |
TEntry entry; |
|
473 |
r=TheFs.Entry(_L("NewFile.new"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
474 |
test_KErrNone(r); |
0 | 475 |
|
476 |
TTime checkReturnedTime=entry.iModified; |
|
477 |
TDateTime dateTime=checkReturnedTime.DateTime(); |
|
478 |
||
479 |
test(entry.iModified==newTime); |
|
480 |
||
481 |
TDateTime oldDate(1996,(TMonth)2,3,23,0,0,0); |
|
482 |
TTime oldTime(oldDate); |
|
483 |
r=TheFs.SetEntry(_L("OldFile.old"),oldTime,0,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
test_KErrNone(r); |
0 | 485 |
|
486 |
TheFs.Replace(_L("NewFile.new"),_L("OldFile.old")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
487 |
test_KErrNone(r); |
0 | 488 |
TTime check; |
489 |
r=TheFs.Modified(_L("OldFile.old"),check); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
490 |
test_KErrNone(r); |
0 | 491 |
TDateTime checkDateTime=check.DateTime(); |
492 |
||
493 |
test(checkDateTime.Year()==dateTime.Year()); |
|
494 |
test(checkDateTime.Month()==dateTime.Month()); |
|
495 |
test(checkDateTime.Day()==dateTime.Day()); |
|
496 |
test(checkDateTime.Hour()==dateTime.Hour()); |
|
497 |
test(checkDateTime.Minute()==dateTime.Minute()); |
|
498 |
test(checkDateTime.Second()==dateTime.Second()); |
|
499 |
||
500 |
test.Next(_L("Replace 'Agenda' with 'Agenda.'")); |
|
501 |
MakeFile(_L("Agenda")); |
|
502 |
r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
503 |
test_KErrNone(r); |
0 | 504 |
CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
505 |
CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
|
506 |
CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
|
507 |
CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
|
508 |
||
509 |
r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
510 |
test_KErrNone(r); |
0 | 511 |
CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
512 |
CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
|
513 |
CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
|
514 |
CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
|
515 |
||
516 |
r=TheFs.Replace(_L("Agenda."),_L("AGENDA")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
517 |
test_KErrNone(r); |
0 | 518 |
CheckFileExists(_L("Agenda"),KErrNone,ETrue); // Replace does not rename existing file |
519 |
CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
|
520 |
CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
|
521 |
CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
|
522 |
||
523 |
r=TheFs.Replace(_L("AGENDA."),_L("AGENDA.")); // Unchanged, ie still 'Agenda' |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
524 |
test_KErrNone(r); |
0 | 525 |
CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
526 |
CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
|
527 |
CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
|
528 |
CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
|
529 |
} |
|
530 |
||
531 |
LOCAL_C void testEntry() |
|
532 |
// |
|
533 |
// Test RFs::Entry(..) function |
|
534 |
// |
|
535 |
{ |
|
536 |
||
537 |
test.Next(_L("Get directory entry")); |
|
538 |
TEntry entry; |
|
539 |
TInt r=TheFs.Entry(_L("\\BLEERRG\\"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
540 |
test_Value(r, r == KErrNotFound); // BLEERRG does not exist |
0 | 541 |
r=TheFs.Entry(_L("\\F32-TST"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
test_KErrNone(r); |
0 | 543 |
test(entry.iName==_L("F32-TST")||entry.iName==_L("F32-TST.")); |
544 |
if (IsTestingLFFS()) |
|
545 |
{ |
|
546 |
r=TheFs.Rename(_L("\\F32-TST.\\"),_L("\\F32-TST\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
547 |
test_Value(r, r == KErrBadName); |
0 | 548 |
r=TheFs.Entry(_L("\\F32-TST"),entry); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
549 |
test_KErrNone(r); |
0 | 550 |
} |
551 |
test(entry.iName==_L("F32-TST")); |
|
552 |
test(entry.IsDir()); |
|
553 |
||
554 |
test.Next(_L("Get file entry")); |
|
555 |
RFile f; |
|
556 |
r=f.Replace(TheFs,_L("ENTRY.TXT"),EFileStream); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
557 |
test_KErrNone(r); |
0 | 558 |
r=f.Write(_L8("Entry data")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
559 |
test_KErrNone(r); |
0 | 560 |
f.Close(); |
561 |
r=TheFs.Entry(_L("\\F32-TST\\TNMBS\\ENTRY.TXT"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
562 |
test_KErrNone(r); |
0 | 563 |
test(entry.iName==_L("ENTRY.TXT")); |
564 |
test(!entry.IsDir()); |
|
565 |
||
566 |
test.Next(_L("Get the root directory")); |
|
567 |
r=TheFs.Entry(_L("\\"),entry); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
568 |
test_Value(r, r == KErrBadName); |
0 | 569 |
} |
570 |
||
571 |
LOCAL_C void testRenameRegression() |
|
572 |
// |
|
573 |
// Regression tests for rename |
|
574 |
// |
|
575 |
{ |
|
576 |
||
577 |
test.Next(_L("More rename tests")); |
|
578 |
MakeFile(_L("\\F32-TST\\asdf")); |
|
579 |
TInt r=TheFs.Rename(_L("\\F32-TST\\asdf"),_L("*")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
580 |
test_Value(r, r == KErrBadName); |
0 | 581 |
r=TheFs.Rename(_L("\\F32-TST\\"),_L("*")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
582 |
test_Value(r, r == KErrBadName); |
0 | 583 |
r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\F32-TST.\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
584 |
test_Value(r, r == KErrBadName); |
0 | 585 |
CheckFileExists(_L("\\F32-TST\\asdf"),KErrNone); |
586 |
r=TheFs.Rename(_L("\\F32-TST\\asdf"),_L("\\F32-TST\\Asdf.")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
587 |
test_KErrNone(r); |
0 | 588 |
CheckFileExists(_L("\\F32-TST\\asdf"),KErrNone,EFalse); |
589 |
CheckFileExists(_L("\\F32-TST\\Asdf"),KErrNone,ETrue); |
|
590 |
||
591 |
TBuf<4> shortName; |
|
592 |
shortName.SetLength(1); |
|
593 |
shortName[0]=0xff; |
|
594 |
r=TheFs.Rename(_L("\\F32-TST\\asdf"),shortName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
test_KErrNone(r); |
0 | 596 |
r=TheFs.Delete(_L("\\F32-TST\\Asdf")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
597 |
test_Value(r, r == KErrNotFound); |
0 | 598 |
r=TheFs.Delete(shortName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
599 |
test_KErrNone(r); |
0 | 600 |
} |
601 |
||
602 |
LOCAL_C void testMaxNameLength() |
|
603 |
// |
|
604 |
// Create files and directories with the maximum name length |
|
605 |
// |
|
606 |
{ |
|
607 |
||
608 |
test.Next(_L("Test max name length")); |
|
609 |
TBuf<128> longNameBase=_L("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
|
610 |
TFullName longName=_L("\\F32-TST\\MAXNAMELEN\\"); |
|
611 |
||
612 |
longName.Append(longNameBase); |
|
613 |
longName.Append(_L("\\")); |
|
614 |
longName.Append(longNameBase); |
|
615 |
longName.Append(_L("\\")); |
|
616 |
||
617 |
TInt r=TheFs.MkDirAll(longName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
618 |
test_KErrNone(r); |
0 | 619 |
|
620 |
TInt i=0; |
|
621 |
FOREVER |
|
622 |
{ |
|
623 |
longName.Append(_L("X")); |
|
624 |
longName.Append(_L("\\")); |
|
625 |
r=TheFs.MkDirAll(longName); |
|
626 |
if (r!=KErrNone) |
|
627 |
break; |
|
628 |
i++; |
|
629 |
} |
|
630 |
||
631 |
longName.SetLength(longName.Length()-2); |
|
632 |
r=TheFs.RmDir(longName); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
633 |
test_KErrNone(r); // Make room for file |
0 | 634 |
longName.SetLength(longName.Length()-2); |
635 |
||
636 |
TFullName oldSessionPath; |
|
637 |
r=TheFs.SessionPath(oldSessionPath); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
638 |
test_KErrNone(r); |
0 | 639 |
r=TheFs.SetSessionPath(longName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
640 |
test_KErrNone(r); |
0 | 641 |
r=TheFs.SessionPath(longName); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
642 |
test_KErrNone(r); |
0 | 643 |
|
644 |
test.Printf(_L("MaxPathLength achieved = %d chars\n"),longName.Length()); |
|
645 |
TBuf<32> fileName=_L("012345678901234567890"); |
|
646 |
RFile f; |
|
647 |
while (fileName.Length()) |
|
648 |
{ |
|
649 |
r=f.Replace(TheFs,fileName,EFileWrite); |
|
650 |
if (r==KErrNone) |
|
651 |
break; |
|
652 |
fileName.SetLength(fileName.Length()-1); |
|
653 |
} |
|
654 |
||
655 |
f.Close(); |
|
656 |
test.Printf(_L("Added filename %S\n"),&fileName); |
|
657 |
r=f.Open(TheFs,fileName,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
658 |
test_KErrNone(r); |
0 | 659 |
f.Close(); |
660 |
||
661 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
662 |
r=fMan->RmDir(_L("\\F32-TST\\MAXNAMELEN\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
663 |
test_KErrNone(r); |
0 | 664 |
delete fMan; |
665 |
||
666 |
r=f.Open(TheFs,fileName,EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
667 |
test_Value(r, r == KErrPathNotFound); |
0 | 668 |
r=TheFs.SetSessionPath(oldSessionPath); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
669 |
test_KErrNone(r); |
0 | 670 |
} |
671 |
||
672 |
LOCAL_C void testErrorReturnValues() |
|
673 |
// |
|
674 |
// Test error return values |
|
675 |
// |
|
676 |
{ |
|
677 |
||
678 |
TInt r; |
|
679 |
test.Next(_L("Create folder with the name of an existing file")); |
|
680 |
MakeFile(_L("\\BLUE")); |
|
681 |
if (!IsTestingLFFS()) |
|
682 |
{ //FIXME: Bad error codes from LFFS |
|
683 |
r=TheFs.MkDir(_L("\\BLUE\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
684 |
test_Value(r, r == KErrAccessDenied); |
0 | 685 |
MakeFile(_L("\\RED\\BLUE")); |
686 |
r=TheFs.MkDir(_L("\\RED\\BLUE\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
687 |
test_Value(r, r == KErrAccessDenied); |
0 | 688 |
r=TheFs.MkDirAll(_L("\\BLUE\\GREEN\\ORANGE\\")); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
689 |
test_Value(r, r == KErrAccessDenied); |
0 | 690 |
} |
691 |
||
692 |
test.Next(_L("Create folder with the name of an existing folder")); |
|
693 |
MakeDir(_L("\\VOLVO\\")); |
|
694 |
r=TheFs.MkDir(_L("\\VOLVO\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
695 |
test_Value(r, r == KErrAlreadyExists); |
0 | 696 |
MakeDir(_L("\\FORD\\VOLKSWAGEN\\")); |
697 |
r=TheFs.MkDirAll(_L("\\ford\\volkswagen\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
698 |
test_Value(r, r == KErrAlreadyExists); |
0 | 699 |
|
700 |
RFile f; |
|
701 |
if (!IsTestingLFFS()) |
|
702 |
{ //FIXME Bad error codes from LFFS |
|
703 |
test.Next(_L("Create a file with the name of an existing folder")); |
|
704 |
r=f.Create(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
test_Value(r, r == KErrAccessDenied); |
0 | 706 |
r=f.Replace(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
707 |
test_Value(r, r == KErrAccessDenied); |
0 | 708 |
r=f.Open(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
709 |
test_Value(r, r == KErrAccessDenied); |
0 | 710 |
r=f.Create(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
711 |
test_Value(r, r == KErrAccessDenied); |
0 | 712 |
r=f.Replace(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
713 |
test_Value(r, r == KErrAccessDenied); |
0 | 714 |
r=f.Open(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
715 |
test_Value(r, r == KErrAccessDenied); |
0 | 716 |
} |
717 |
||
718 |
test.Next(_L("Create a file with the name of an existing file")); |
|
719 |
r=f.Create(TheFs,_L("\\BLUE"),EFileRead|EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
720 |
test_Value(r, r == KErrAlreadyExists); |
0 | 721 |
} |
722 |
||
723 |
LOCAL_C void testSetEntry() |
|
724 |
// |
|
725 |
// Test set entry |
|
726 |
// |
|
727 |
{ |
|
728 |
||
729 |
test.Next(_L("Test SetEntry")); |
|
730 |
// TDateTime dateTime(1968,ENovember,19,12,59,0,0); Year must be > 1980 |
|
731 |
TDateTime dateTime(1981,ENovember,19,12,59,0,0); |
|
732 |
TTime time(dateTime); |
|
733 |
MakeFile(_L("DUMENTRY.")); |
|
734 |
||
735 |
RFile f; |
|
736 |
TInt r=f.Open(TheFs,_L("dumentry"),EFileRead); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
737 |
test_KErrNone(r); |
0 | 738 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
739 |
test_Value(r, r == KErrInUse); |
0 | 740 |
f.Close(); |
741 |
||
742 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
743 |
test_KErrNone(r); |
0 | 744 |
CheckEntry(_L("DUMEntry"),KEntryAttReadOnly,TTime(dateTime)); |
745 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
746 |
test_KErrNone(r); |
0 | 747 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
748 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
749 |
test_KErrNone(r); |
0 | 750 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
751 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
752 |
test_KErrNone(r); |
0 | 753 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
754 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
755 |
test_KErrNone(r); |
0 | 756 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
757 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
758 |
test_KErrNone(r); |
0 | 759 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
760 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttRemote,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
761 |
test_KErrNone(r); |
0 | 762 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
763 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume|KEntryAttRemote,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
764 |
test_KErrNone(r); |
0 | 765 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
766 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume|KEntryAttRemote,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
767 |
test_KErrNone(r); |
0 | 768 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
769 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
770 |
test_KErrNone(r); |
0 | 771 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
772 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
773 |
test_KErrNone(r); |
0 | 774 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
775 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
776 |
test_KErrNone(r); |
0 | 777 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
778 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
779 |
test_KErrNone(r); |
0 | 780 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
781 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
782 |
test_KErrNone(r); |
0 | 783 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
784 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume|KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
785 |
test_KErrNone(r); |
0 | 786 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
787 |
r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume|KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
788 |
test_KErrNone(r); |
0 | 789 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
790 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
791 |
test_KErrNone(r); |
0 | 792 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
793 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
794 |
test_KErrNone(r); |
0 | 795 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
796 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
797 |
test_KErrNone(r); |
0 | 798 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
799 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttRemote); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
800 |
test_KErrNone(r); |
0 | 801 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
802 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
803 |
test_KErrNone(r); |
0 | 804 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
805 |
r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
806 |
test_KErrNone(r); |
0 | 807 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
808 |
||
809 |
r=f.Open(TheFs,_L("dumentry"),EFileWrite); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
810 |
test_KErrNone(r); |
0 | 811 |
|
812 |
r=f.SetAtt(KEntryAttDir,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
813 |
test_KErrNone(r); |
0 | 814 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
815 |
r=f.SetAtt(KEntryAttVolume,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
816 |
test_KErrNone(r); |
0 | 817 |
CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
818 |
f.Close(); |
|
819 |
r=TheFs.Delete(_L("dumEntry.")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
820 |
test_KErrNone(r); |
0 | 821 |
|
822 |
MakeDir(_L("\\DumEntry\\")); |
|
823 |
r=TheFs.SetEntry(_L("\\dumentry\\"),time,KEntryAttReadOnly,KEntryAttArchive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
824 |
test_KErrNone(r); |
0 | 825 |
CheckEntry(_L("\\DUMEntry"),KEntryAttReadOnly|KEntryAttDir,TTime(dateTime)); |
826 |
r=TheFs.SetEntry(_L("\\dumentry."),time,0,KEntryAttReadOnly); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
827 |
test_KErrNone(r); |
0 | 828 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
829 |
r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
830 |
test_KErrNone(r); |
0 | 831 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
832 |
r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
833 |
test_KErrNone(r); |
0 | 834 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
835 |
r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume|KEntryAttDir,0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
836 |
test_KErrNone(r); |
0 | 837 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
838 |
r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume|KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
839 |
test_KErrNone(r); |
0 | 840 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
841 |
r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
842 |
test_KErrNone(r); |
0 | 843 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
844 |
r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
845 |
test_KErrNone(r); |
0 | 846 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
847 |
r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,KEntryAttDir); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
848 |
test_KErrNone(r); |
0 | 849 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
850 |
r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,KEntryAttVolume); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
851 |
test_KErrNone(r); |
0 | 852 |
CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
853 |
r=TheFs.RmDir(_L("\\dumEntry\\")); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
854 |
test_KErrNone(r); |
0 | 855 |
} |
856 |
||
857 |
||
858 |
LOCAL_C void testSetFileAttributes() |
|
859 |
// |
|
860 |
// Test RFile::SetAtt() and RFile::Set() |
|
861 |
// |
|
862 |
{ |
|
863 |
// First test RFile::SetAtt() function |
|
864 |
||
865 |
test.Next(_L("Test RFile::SetAtt()")); |
|
866 |
||
867 |
// Create a file "TEMPFILE.TMP" and set attributes to hidden |
|
868 |
RFile file; |
|
869 |
TInt r=file.Replace(TheFs,_L("TEMPFILE.TMP"),0); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
870 |
test_Value(r, r == KErrNone || r==KErrPathNotFound); |
0 | 871 |
r=file.SetAtt(KEntryAttHidden,0); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
872 |
test_KErrNone(r); |
0 | 873 |
file.Close(); |
874 |
||
875 |
// Check attributes are as set |
|
876 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
877 |
TUint atts; |
|
878 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
test_KErrNone(r); |
0 | 880 |
file.Close(); |
881 |
test(atts&KEntryAttHidden); |
|
882 |
||
883 |
// Change attributes from hidden to system |
|
884 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
885 |
r=file.SetAtt(KEntryAttSystem,KEntryAttHidden); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
886 |
test_KErrNone(r); |
0 | 887 |
file.Close(); |
888 |
||
889 |
// Check attributes have been changed |
|
890 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
891 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
892 |
test_KErrNone(r); |
0 | 893 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
894 |
test_Value((TInt)atts, atts&KEntryAttSystem); |
0 | 895 |
|
896 |
// Change attributes to normal |
|
897 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
898 |
r=file.SetAtt(KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
899 |
test_KErrNone(r); |
0 | 900 |
file.Close(); |
901 |
||
902 |
// Check attributes have been changed |
|
903 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
904 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
905 |
test_KErrNone(r); |
0 | 906 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
907 |
test_Value((TInt)atts, atts==KEntryAttNormal); |
0 | 908 |
|
909 |
// Attempt to change attributes from normal file to directory |
|
910 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
911 |
r=file.SetAtt(KEntryAttDir,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
912 |
test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a directory |
0 | 913 |
file.Close(); |
914 |
||
915 |
// Check the file has not been changed to a directory |
|
916 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
917 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
918 |
test_KErrNone(r); |
0 | 919 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
920 |
test_Value((TInt)atts, (TInt)(atts&KEntryAttDir)==KErrNone); |
0 | 921 |
|
922 |
// Change the attributes from normal file to hidden file |
|
923 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
924 |
r=file.SetAtt(KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
925 |
test_KErrNone(r); |
0 | 926 |
file.Close(); |
927 |
||
928 |
// Check the attributes have been changed |
|
929 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
930 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
931 |
test_KErrNone(r); |
0 | 932 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
933 |
test_Value((TInt)atts, atts&KEntryAttHidden); |
0 | 934 |
|
935 |
// Try to change the attributes from hidden file to volume |
|
936 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
937 |
r=file.SetAtt(KEntryAttVolume,KEntryAttHidden); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
938 |
test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a volume |
0 | 939 |
file.Close(); |
940 |
||
941 |
// Check that the hidden file has not been changed to a volume |
|
942 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
943 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
944 |
test_KErrNone(r); |
0 | 945 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
946 |
test_Value((TInt)atts, (TInt)(atts&KEntryAttVolume)==KErrNone); |
0 | 947 |
|
948 |
// Test RFile::Set() function |
|
949 |
||
950 |
test.Next(_L("Test RFile::Set()")); |
|
951 |
||
952 |
// Check attributes |
|
953 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
954 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
955 |
test_KErrNone(r); |
0 | 956 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
957 |
test_Value((TInt)atts, atts==KEntryAttNormal); |
0 | 958 |
|
959 |
// Change attributes from hidden to system - and change modification time |
|
960 |
TDateTime dateTime(1998,EMay,25,18,23,0,0); |
|
961 |
TTime modTime1(dateTime); |
|
962 |
TTime retTime; |
|
963 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
964 |
r=file.Set(modTime1,KEntryAttSystem,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
965 |
test_KErrNone(r); |
0 | 966 |
file.Close(); |
967 |
||
968 |
// Check attributes have been changed |
|
969 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
970 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
971 |
test_KErrNone(r); |
0 | 972 |
r=file.Modified(retTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
973 |
test_KErrNone(r); |
0 | 974 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
975 |
test_Value((TInt)atts, atts&KEntryAttSystem); |
0 | 976 |
test(retTime==modTime1); |
977 |
||
978 |
// Change attributes to normal - and change modification time |
|
979 |
dateTime.Set(1997,EMay,24,17,25,0,0); |
|
980 |
TTime modTime2(dateTime); |
|
981 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
982 |
r=file.Set(modTime2,KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
983 |
test_KErrNone(r); |
0 | 984 |
file.Close(); |
985 |
||
986 |
// Check attributes have been changed |
|
987 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
988 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
989 |
test_KErrNone(r); |
0 | 990 |
r=file.Modified(retTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
991 |
test_KErrNone(r); |
0 | 992 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
993 |
test_Value((TInt)atts, atts==KEntryAttNormal); |
0 | 994 |
test(retTime==modTime2); |
995 |
||
996 |
// Attempt to change attributes from normal file to directory |
|
997 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
998 |
r=file.Set(modTime1,KEntryAttDir,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
999 |
test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a directory |
0 | 1000 |
file.Close(); |
1001 |
||
1002 |
// Check the file has not been changed to a directory |
|
1003 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
1004 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1005 |
test_KErrNone(r); |
0 | 1006 |
r=file.Modified(retTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1007 |
test_KErrNone(r); |
0 | 1008 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1009 |
test_Value((TInt)atts, (TInt)(atts&KEntryAttDir)==KErrNone); |
0 | 1010 |
test(retTime==modTime1);// Modification time should have been set successfully |
1011 |
||
1012 |
// Change the attributes from normal file to hidden file - and change modification time |
|
1013 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
1014 |
r=file.Set(modTime1,KEntryAttHidden,KEntryAttNormal); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1015 |
test_KErrNone(r); |
0 | 1016 |
file.Close(); |
1017 |
||
1018 |
// Check the attributes have been changed |
|
1019 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
1020 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1021 |
test_KErrNone(r); |
0 | 1022 |
r=file.Modified(retTime); |
1023 |
file.Close(); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1024 |
test_Value((TInt)atts, atts&KEntryAttHidden); |
0 | 1025 |
test(retTime==modTime1); |
1026 |
||
1027 |
// Try to change the attributes from hidden file to volume |
|
1028 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
1029 |
r=file.Set(modTime2,KEntryAttVolume,KEntryAttHidden); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1030 |
test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a volume |
0 | 1031 |
file.Close(); |
1032 |
||
1033 |
// Check that the hidden file has not been changed to a volume |
|
1034 |
file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
|
1035 |
r=file.Att(atts); |
|
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1036 |
test_KErrNone(r); |
0 | 1037 |
r=file.Modified(retTime); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1038 |
test_KErrNone(r); |
0 | 1039 |
file.Close(); |
43
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1040 |
test_Value((TInt)atts, (TInt)(atts&KEntryAttVolume)==KErrNone); |
0 | 1041 |
test(retTime==modTime2); // Modification time should have been set successfully |
1042 |
||
1043 |
r=TheFs.Delete(_L("TEMPFILE.TMP")); |
|
1044 |
||
1045 |
} |
|
1046 |
||
1047 |
||
1048 |
GLDEF_C void CallTestsL() |
|
1049 |
// |
|
1050 |
// Do tests relative to session path |
|
1051 |
// |
|
1052 |
{ |
|
1053 |
||
1054 |
TurnAllocFailureOff(); |
|
1055 |
CreateTestDirectory(_L("\\F32-TST\\TNMBS\\")); |
|
1056 |
testMkDirRmDir(); // Must come first |
|
1057 |
testSetEntry(); |
|
1058 |
testSetFileAttributes(); |
|
1059 |
testRename(); |
|
1060 |
TestLongFileName(); |
|
1061 |
testRenameRegression(); |
|
1062 |
testRenameCase(); |
|
1063 |
testMaxNameLength(); |
|
1064 |
testEntry(); |
|
1065 |
testReplace(); |
|
1066 |
testErrorReturnValues(); |
|
1067 |
DeleteTestDirectory(); |
|
1068 |
} |
|
1069 |