31 { |
27 { |
32 |
28 |
33 test.Next(_L("Test MkDir")); |
29 test.Next(_L("Test MkDir")); |
34 |
30 |
35 TInt r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
31 TInt r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
36 test_KErrNone(r); |
32 test(r==KErrNone); |
37 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
33 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
38 test_Value(r, r == KErrPathNotFound); |
34 test(r==KErrPathNotFound); |
39 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\")); |
35 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\")); |
40 test_KErrNone(r); |
36 test(r==KErrNone); |
41 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
37 r=TheFs.MkDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
42 test_KErrNone(r); |
38 test(r==KErrNone); |
43 |
39 |
44 test.Next(_L("Test RmDir 1.0")); |
40 test.Next(_L("Test RmDir 1.0")); |
45 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
41 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
46 test_KErrNone(r); |
42 test(r==KErrNone); |
47 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
43 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
48 test_KErrNone(r); |
44 test(r==KErrNone); |
49 |
45 |
50 test.Next(_L("Test MkDirAll 1.0")); |
46 test.Next(_L("Test MkDirAll 1.0")); |
51 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
47 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
52 test_KErrNone(r); |
48 test(r==KErrNone); |
53 |
49 |
54 test.Next(_L("Test RmDir 2.0")); |
50 test.Next(_L("Test RmDir 2.0")); |
55 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
51 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
56 test_KErrNone(r); |
52 test(r==KErrNone); |
57 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
53 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
58 test_KErrNone(r); |
54 test(r==KErrNone); |
59 |
55 |
60 test.Next(_L("Test MkDirAll 2.0")); |
56 test.Next(_L("Test MkDirAll 2.0")); |
61 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
57 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
62 test_KErrNone(r); |
58 test(r==KErrNone); |
63 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
59 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\TEST\\")); |
64 test_KErrNone(r); |
60 test(r==KErrNone); |
65 |
61 |
66 test.Next(_L("Test RmDir 3.0")); |
62 test.Next(_L("Test RmDir 3.0")); |
67 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
63 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\TEST\\")); |
68 test_KErrNone(r); |
64 test(r==KErrNone); |
69 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
65 r=TheFs.RmDir(_L("\\F32-TST\\TNMBS\\")); |
70 test_KErrNone(r); |
66 test(r==KErrNone); |
71 |
67 |
72 test.Next(_L("Test mkdir and rmdir on root")); |
68 test.Next(_L("Test mkdir and rmdir on root")); |
73 r=TheFs.RmDir(_L("\\File.TXT")); |
69 r=TheFs.RmDir(_L("\\File.TXT")); |
74 test_Value(r, r == KErrInUse); |
70 test(r==KErrInUse); |
75 r=TheFs.MkDir(_L("\\asdf.ere")); |
71 r=TheFs.MkDir(_L("\\asdf.ere")); |
76 test_Value(r, r == KErrAlreadyExists); |
72 test(r==KErrAlreadyExists); |
77 r=TheFs.MkDirAll(_L("\\asdf.ere")); |
73 r=TheFs.MkDirAll(_L("\\asdf.ere")); |
78 test_Value(r, r == KErrAlreadyExists); |
74 test(r==KErrAlreadyExists); |
79 |
75 |
80 test.Next(_L("Test error code return values")); |
76 test.Next(_L("Test error code return values")); |
81 r=TheFs.MkDir(_L("\\F32-TST\\\\ABCDEF\\")); |
77 r=TheFs.MkDir(_L("\\F32-TST\\\\ABCDEF\\")); |
82 |
78 |
83 test_Value(r, r == KErrBadName); |
79 test(r==KErrBadName); |
84 |
80 |
85 test.Next(_L("Test MkDir with trailing spaces")); |
81 test.Next(_L("Test MkDir with trailing spaces")); |
86 r=TheFs.MkDir(_L("\\F32-TST\\TESTMKDIR \\")); |
82 r=TheFs.MkDir(_L("\\F32-TST\\TESTMKDIR \\")); |
87 test_KErrNone(r); |
83 test(r==KErrNone); |
88 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
84 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
89 test_KErrNone(r); |
85 test(r==KErrNone); |
90 r=TheFs.MkDirAll(_L("\\F32-TST\\TESTMKDIR \\NOTCREATED\\NORTHIS \\")); |
86 r=TheFs.MkDirAll(_L("\\F32-TST\\TESTMKDIR \\NOTCREATED\\NORTHIS \\")); |
91 test_Value(r, r == KErrPathNotFound); |
87 test(r==KErrPathNotFound); |
92 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\NOTCREATED\\")); |
88 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\NOTCREATED\\")); |
93 test_Value(r, r == KErrNotFound); |
89 test(r==KErrNotFound); |
94 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
90 r=TheFs.RmDir(_L("\\F32-TST\\TESTMKDIR\\")); |
95 test_KErrNone(r); |
91 test(r==KErrNone); |
96 |
92 |
97 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
93 r=TheFs.MkDirAll(_L("\\F32-TST\\TNMBS\\")); |
98 test_KErrNone(r); |
94 test(r==KErrNone); |
99 } |
95 } |
100 |
96 |
101 LOCAL_C void testRename() |
97 LOCAL_C void testRename() |
102 // |
98 // |
103 // Test the rename function. |
99 // Test the rename function. |
104 // |
100 // |
105 { |
101 { |
106 |
102 |
107 test.Next(_L("Test rename directories")); |
103 test.Next(_L("Test rename directories")); |
108 TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
104 TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
109 test_Value(r, r == KErrNone || r==KErrAlreadyExists); |
105 test(r==KErrNone || r==KErrAlreadyExists); |
110 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\"),_L("\\F32-TST\\ABCDEF\\LMED")); |
106 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\"),_L("\\F32-TST\\ABCDEF\\LMED")); |
111 test_Value(r, r == KErrInUse); |
107 test(r==KErrInUse); |
112 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\GPQ"),_L("\\F32-TST\\LMED")); |
108 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\GPQ"),_L("\\F32-TST\\LMED")); |
113 test_KErrNone(r); |
109 test(r==KErrNone); |
114 r=TheFs.RmDir(_L("\\F32-TST\\LMED\\")); |
110 r=TheFs.RmDir(_L("\\F32-TST\\LMED\\")); |
115 test_KErrNone(r); |
111 test(r==KErrNone); |
116 |
112 |
117 MakeDir(_L("\\F32-TST\\ABC\\")); |
113 MakeDir(_L("\\F32-TST\\ABC\\")); |
118 MakeFile(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
114 MakeFile(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
119 MakeFile(_L("\\F32-TST\\asdf.txt")); |
115 MakeFile(_L("\\F32-TST\\asdf.txt")); |
120 |
116 |
121 test.Next(_L("Test rename directory while subfile is open")); |
117 test.Next(_L("Test rename directory while subfile is open")); |
122 RFile f; |
118 RFile f; |
123 r=f.Open(TheFs,_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt"),EFileRead); |
119 r=f.Open(TheFs,_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt"),EFileRead); |
124 test_KErrNone(r); |
120 test(r==KErrNone); |
125 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
121 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
126 test_Value(r, r == KErrInUse); |
122 test(r==KErrInUse); |
127 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
123 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
128 test_Value(r, r == KErrInUse); |
124 test(r==KErrInUse); |
129 r=TheFs.Rename(_L("\\F32-TST\\ABC"),_L("\\F32-TST\\XXX")); |
125 r=TheFs.Rename(_L("\\F32-TST\\ABC"),_L("\\F32-TST\\XXX")); |
130 test_KErrNone(r); |
126 test(r==KErrNone); |
131 f.Close(); |
127 f.Close(); |
132 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
128 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\xxxyyy")); |
133 test_KErrNone(r); |
129 test(r==KErrNone); |
134 r=TheFs.Rename(_L("\\F32-TST\\XXX"),_L("\\F32-TST\\ABC")); |
130 r=TheFs.Rename(_L("\\F32-TST\\XXX"),_L("\\F32-TST\\ABC")); |
135 test_KErrNone(r); |
131 test(r==KErrNone); |
136 r=TheFs.Rename(_L("\\"),_L("\\BLARG")); |
132 r=TheFs.Rename(_L("\\"),_L("\\BLARG")); |
137 test_Value(r, r == KErrBadName); |
133 test(r==KErrBadName); |
138 |
134 |
139 r=f.Open(TheFs,_L("\\F32-TST\\asdf.txt"),EFileRead); |
135 r=f.Open(TheFs,_L("\\F32-TST\\asdf.txt"),EFileRead); |
140 test_KErrNone(r); |
136 test(r==KErrNone); |
141 r=TheFs.Rename(_L("\\F32-TST\\xxxyyy"),_L("\\F32-TST\\ABCDEF")); |
137 r=TheFs.Rename(_L("\\F32-TST\\xxxyyy"),_L("\\F32-TST\\ABCDEF")); |
142 test_KErrNone(r); |
138 test(r==KErrNone); |
143 r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\ABCDEF")); |
139 r=TheFs.Rename(_L("\\F32-TST\\"),_L("\\ABCDEF")); |
144 test_Value(r, r == KErrInUse); |
140 test(r==KErrInUse); |
145 f.Close(); |
141 f.Close(); |
146 |
142 |
147 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
143 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\GPQ\\asdf.txt")); |
148 test_KErrNone(r); |
144 test(r==KErrNone); |
149 r=TheFs.Delete(_L("\\F32-TST\\asdf.txt")); |
145 r=TheFs.Delete(_L("\\F32-TST\\asdf.txt")); |
150 test_KErrNone(r); |
146 test(r==KErrNone); |
151 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
147 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\GPQ\\")); |
152 test_KErrNone(r); |
148 test(r==KErrNone); |
153 r=TheFs.RmDir(_L("\\F32-TST\\ABC\\")); |
149 r=TheFs.RmDir(_L("\\F32-TST\\ABC\\")); |
154 test_KErrNone(r); |
150 test(r==KErrNone); |
155 |
151 |
156 r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
152 r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
157 test_Value(r, r == KErrPathNotFound); |
153 test(r==KErrPathNotFound); |
158 r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
154 r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
159 test_Value(r, r == KErrNotFound); |
155 test(r==KErrNotFound); |
160 r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
156 r=TheFs.Rename(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
161 test_Value(r, r == KErrPathNotFound); |
157 test(r==KErrPathNotFound); |
162 r=TheFs.Rename(_L("\\F32-TST\\FEDCBA"),_L("\\TST-E32\\123456")); |
158 r=TheFs.Rename(_L("\\F32-TST\\FEDCBA"),_L("\\TST-E32\\123456")); |
163 test_Value(r, r == KErrNotFound); |
159 test(r==KErrNotFound); |
164 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
160 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
165 test_KErrNone(r); |
161 test(r==KErrNone); |
166 r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\XYZABC")); |
162 r=TheFs.Rename(_L("\\F32-TST\\123456"),_L("\\F32-TST\\XYZABC")); |
167 test_KErrNone(r); |
163 test(r==KErrNone); |
168 |
164 |
169 test.Next(_L("Test rename files")); |
165 test.Next(_L("Test rename files")); |
170 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
166 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
171 test_KErrNone(r); |
167 test(r==KErrNone); |
172 f.Close(); |
168 f.Close(); |
173 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
169 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
174 test_KErrNone(r); |
170 test(r==KErrNone); |
175 r=TheFs.Delete(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
171 r=TheFs.Delete(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
176 test_KErrNone(r); |
172 test(r==KErrNone); |
177 |
173 |
178 test.Next(_L("Test rename checks for duplicate entries")); |
174 test.Next(_L("Test rename checks for duplicate entries")); |
179 r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
175 r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
180 test_KErrNone(r); |
176 test(r==KErrNone); |
181 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\XYZABC")); |
177 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\XYZABC")); |
182 test_Value(r, r == KErrAlreadyExists); |
178 test(r==KErrAlreadyExists); |
183 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
179 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),EFileRead|EFileWrite); |
184 test_KErrNone(r); |
180 test(r==KErrNone); |
185 f.Close(); |
181 f.Close(); |
186 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),EFileRead|EFileWrite); |
182 r=f.Create(TheFs,_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),EFileRead|EFileWrite); |
187 test_KErrNone(r); |
183 test(r==KErrNone); |
188 f.Close(); |
184 f.Close(); |
189 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
185 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\XYZABC\\NEWNAME.TXT")); |
190 test_Value(r, r == KErrAlreadyExists); |
186 test(r==KErrAlreadyExists); |
191 |
187 |
192 test.Next(_L("Test rename across directories")); |
188 test.Next(_L("Test rename across directories")); |
193 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
189 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
194 test_KErrNone(r); |
190 test(r==KErrNone); |
195 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
191 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
196 test_Value(r, r == KErrNotFound); |
192 test(r==KErrNotFound); |
197 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\DIFNAME.TXT")); |
193 r=TheFs.Rename(_L("\\F32-TST\\XYZABC\\NEWNAME.TXT"),_L("\\F32-TST\\ABCDEF\\DIFNAME.TXT")); |
198 test_Value(r, r == KErrNotFound); |
194 test(r==KErrNotFound); |
199 r=TheFs.Rename(_L("\\F32-TST\\XYZABC"),_L("\\F32-TST\\ABCDEF\\XYZABC")); |
195 r=TheFs.Rename(_L("\\F32-TST\\XYZABC"),_L("\\F32-TST\\ABCDEF\\XYZABC")); |
200 test_KErrNone(r); |
196 test(r==KErrNone); |
201 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
197 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
202 test_KErrNone(r); |
198 test(r==KErrNone); |
203 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\NewNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT")); |
199 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\NewNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT")); |
204 test_KErrNone(r); |
200 test(r==KErrNone); |
205 test.Next(_L("Test rename across drive error code")); |
201 test.Next(_L("Test rename across drive error code")); |
206 r=TheFs.Rename(_L("Z:\\BLEG"),_L("C:\\FRUM")); |
202 r=TheFs.Rename(_L("Z:\\BLEG"),_L("C:\\FRUM")); |
207 test_Value(r, r == KErrArgument); |
203 test(r==KErrArgument); |
208 test.Next(_L("Test rename to identical names")); |
204 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")); |
205 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT")); |
210 test_KErrNone(r); |
206 test(r==KErrNone); |
211 CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),KErrNone); |
207 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")); |
208 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\XYZABC\\OLdnAME.TXT")); |
213 test_KErrNone(r); |
209 test(r==KErrNone); |
214 CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),KErrNone,EFalse); |
210 CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),KErrNone,EFalse); |
215 CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLdnAME.TXT"),KErrNone,ETrue); |
211 CheckFileExists(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLdnAME.TXT"),KErrNone,ETrue); |
216 |
212 |
217 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
213 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\XYZABC\\OLDNAME.TXT"),_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
218 test_KErrNone(r); |
214 test(r==KErrNone); |
219 test.Next(_L("Test RmDir")); |
215 test.Next(_L("Test RmDir")); |
220 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
216 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\NEWNAME.TXT")); |
221 test_KErrNone(r); |
217 test(r==KErrNone); |
222 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
218 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\OLDNAME.TXT")); |
223 test_KErrNone(r); |
219 test(r==KErrNone); |
224 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\XYZABC\\")); |
220 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\XYZABC\\")); |
225 test_KErrNone(r); |
221 test(r==KErrNone); |
226 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
222 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
227 test_KErrNone(r); |
223 test(r==KErrNone); |
228 } |
224 } |
229 LOCAL_C void TestLongFileName() |
225 LOCAL_C void TestLongFileName() |
230 { |
226 { |
231 if (Is_SimulatedSystemDrive(TheFs, CurrentDrive())) |
227 #ifndef __EPOC32__ //emulator |
232 { |
228 if (gDriveToTest.GetLowerCase()=='c') |
233 // Do not perform this test for the system drive of the emulator or PlatSim |
229 return;//don't perform this test for c: in emulator as emulator uses windows system calls |
234 // as they use Windows system calls. |
230 //windows doesn't create a directory with length more than 244 characters |
235 // Windows does not create a directory with length more than 244 characters |
231 #endif |
236 // (247 including <drive>:\) |
232 |
237 test.Printf(_L("TestLongFileName() skipped on simulated system drive.\n")); |
233 test.Next(_L("Test renaming 257 characters directories")); |
238 return; |
|
239 } |
|
240 |
|
241 test.Next(_L("Test renaming 257 characters directories")); |
|
242 _LIT(KLongFileName256, "256dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
234 _LIT(KLongFileName256, "256dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
243 _LIT(KLongFileName257, "257dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
235 _LIT(KLongFileName257, "257dir_IncludingBackslash_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); |
244 TBuf<260> Path; |
236 TBuf<260> Path; |
245 TBuf<10> baseDir; |
237 TBuf<10> baseDir; |
246 |
238 |
280 { |
272 { |
281 |
273 |
282 test.Next(_L("Test rename case")); |
274 test.Next(_L("Test rename case")); |
283 MakeDir(_L("\\F32-TST\\RENAMECASE\\")); |
275 MakeDir(_L("\\F32-TST\\RENAMECASE\\")); |
284 TInt r=TheFs.SetSessionPath(_L("\\F32-TST\\RENAMECASE\\")); |
276 TInt r=TheFs.SetSessionPath(_L("\\F32-TST\\RENAMECASE\\")); |
285 test_KErrNone(r); |
277 test(r==KErrNone); |
286 |
278 |
287 MakeFile(_L("file1.txt")); |
279 MakeFile(_L("file1.txt")); |
288 MakeFile(_L("FILE2.TXT")); |
280 MakeFile(_L("FILE2.TXT")); |
289 MakeFile(_L("AGENDA")); |
281 MakeFile(_L("AGENDA")); |
290 MakeFile(_L("agenda.one")); |
282 MakeFile(_L("agenda.one")); |
291 |
283 |
292 TEntry entry; |
284 TEntry entry; |
293 r=TheFs.Rename(_L("FILE1.TXT"),_L("FILE1.TXT")); |
285 r=TheFs.Rename(_L("FILE1.TXT"),_L("FILE1.TXT")); |
294 test_KErrNone(r); |
286 test(r==KErrNone); |
295 r=TheFs.Entry(_L("File1.txt"),entry); |
287 r=TheFs.Entry(_L("File1.txt"),entry); |
296 test_KErrNone(r); |
288 test(r==KErrNone); |
297 test(entry.iName==_L("FILE1.TXT")); |
289 test(entry.iName==_L("FILE1.TXT")); |
298 |
290 |
299 r=TheFs.Rename(_L("file2.txt"),_L("file2.txt")); |
291 r=TheFs.Rename(_L("file2.txt"),_L("file2.txt")); |
300 test_KErrNone(r); |
292 test(r==KErrNone); |
301 r=TheFs.Entry(_L("File2.txt"),entry); |
293 r=TheFs.Entry(_L("File2.txt"),entry); |
302 test_KErrNone(r); |
294 test(r==KErrNone); |
303 test(entry.iName==_L("file2.txt")); |
295 test(entry.iName==_L("file2.txt")); |
304 |
296 |
305 r=TheFs.Rename(_L("agenda."),_L("agenda.two")); |
297 r=TheFs.Rename(_L("agenda."),_L("agenda.two")); |
306 test_KErrNone(r); |
298 test(r==KErrNone); |
307 r=TheFs.Entry(_L("Agenda.two"),entry); |
299 r=TheFs.Entry(_L("Agenda.two"),entry); |
308 test_KErrNone(r); |
300 test(r==KErrNone); |
309 test(entry.iName==_L("agenda.two")); |
301 test(entry.iName==_L("agenda.two")); |
310 |
302 |
311 r=TheFs.Rename(_L("AGENDA.ONE"),_L("AGENDA.ONE")); |
303 r=TheFs.Rename(_L("AGENDA.ONE"),_L("AGENDA.ONE")); |
312 test_KErrNone(r); |
304 test(r==KErrNone); |
313 r=TheFs.Entry(_L("Agenda.one"),entry); |
305 r=TheFs.Entry(_L("Agenda.one"),entry); |
314 test_KErrNone(r); |
306 test(r==KErrNone); |
315 test(entry.iName==_L("AGENDA.ONE")); |
307 test(entry.iName==_L("AGENDA.ONE")); |
316 |
308 |
317 r=TheFs.Rename(_L("FILE1.TXT"),_L("file1.txt")); |
309 r=TheFs.Rename(_L("FILE1.TXT"),_L("file1.txt")); |
318 test_KErrNone(r); |
310 test(r==KErrNone); |
319 r=TheFs.Entry(_L("File1.txt"),entry); |
311 r=TheFs.Entry(_L("File1.txt"),entry); |
320 test_KErrNone(r); |
312 test(r==KErrNone); |
321 test(entry.iName==_L("file1.txt")); |
313 test(entry.iName==_L("file1.txt")); |
322 |
314 |
323 r=TheFs.Rename(_L("file2.txt"),_L("FILE2.TXT")); |
315 r=TheFs.Rename(_L("file2.txt"),_L("FILE2.TXT")); |
324 test_KErrNone(r); |
316 test(r==KErrNone); |
325 r=TheFs.Entry(_L("File2.txt"),entry); |
317 r=TheFs.Entry(_L("File2.txt"),entry); |
326 test_KErrNone(r); |
318 test(r==KErrNone); |
327 test(entry.iName==_L("FILE2.TXT")); |
319 test(entry.iName==_L("FILE2.TXT")); |
328 |
320 |
329 r=TheFs.Rename(_L("agenda.two"),_L("AGENDA")); |
321 r=TheFs.Rename(_L("agenda.two"),_L("AGENDA")); |
330 test_KErrNone(r); |
322 test(r==KErrNone); |
331 r=TheFs.Entry(_L("Agenda"),entry); |
323 r=TheFs.Entry(_L("Agenda"),entry); |
332 test_KErrNone(r); |
324 test(r==KErrNone); |
333 test(entry.iName==_L("AGENDA")); |
325 test(entry.iName==_L("AGENDA")); |
334 |
326 |
335 r=TheFs.Rename(_L("AGENDA.ONE"),_L("agenda.one")); |
327 r=TheFs.Rename(_L("AGENDA.ONE"),_L("agenda.one")); |
336 test_KErrNone(r); |
328 test(r==KErrNone); |
337 r=TheFs.Entry(_L("Agenda.one"),entry); |
329 r=TheFs.Entry(_L("Agenda.one"),entry); |
338 test_KErrNone(r); |
330 test(r==KErrNone); |
339 test(entry.iName==_L("agenda.one")); |
331 test(entry.iName==_L("agenda.one")); |
340 |
332 |
341 r=TheFs.Rename(_L("FILE1.TXT"),_L("FILe1.txt")); |
333 r=TheFs.Rename(_L("FILE1.TXT"),_L("FILe1.txt")); |
342 test_KErrNone(r); |
334 test(r==KErrNone); |
343 r=TheFs.Entry(_L("File1.txt"),entry); |
335 r=TheFs.Entry(_L("File1.txt"),entry); |
344 test_KErrNone(r); |
336 test(r==KErrNone); |
345 test(entry.iName==_L("FILe1.txt")); |
337 test(entry.iName==_L("FILe1.txt")); |
346 |
338 |
347 r=TheFs.Rename(_L("file2.txt"),_L("FILE3.TXT")); |
339 r=TheFs.Rename(_L("file2.txt"),_L("FILE3.TXT")); |
348 test_KErrNone(r); |
340 test(r==KErrNone); |
349 r=TheFs.Entry(_L("File3.txt"),entry); |
341 r=TheFs.Entry(_L("File3.txt"),entry); |
350 test_KErrNone(r); |
342 test(r==KErrNone); |
351 test(entry.iName==_L("FILE3.TXT")); |
343 test(entry.iName==_L("FILE3.TXT")); |
352 |
344 |
353 r=TheFs.Rename(_L("agenda."),_L("AGENDA1")); |
345 r=TheFs.Rename(_L("agenda."),_L("AGENDA1")); |
354 test_KErrNone(r); |
346 test(r==KErrNone); |
355 r=TheFs.Entry(_L("Agenda1"),entry); |
347 r=TheFs.Entry(_L("Agenda1"),entry); |
356 test_KErrNone(r); |
348 test(r==KErrNone); |
357 test(entry.iName==_L("AGENDA1")); |
349 test(entry.iName==_L("AGENDA1")); |
358 |
350 |
359 r=TheFs.Rename(_L("AGENDA.ONE"),_L("Agenda.One")); |
351 r=TheFs.Rename(_L("AGENDA.ONE"),_L("Agenda.One")); |
360 test_KErrNone(r); |
352 test(r==KErrNone); |
361 r=TheFs.Entry(_L("Agenda.one"),entry); |
353 r=TheFs.Entry(_L("Agenda.one"),entry); |
362 test_KErrNone(r); |
354 test(r==KErrNone); |
363 test(entry.iName==_L("Agenda.One")); |
355 test(entry.iName==_L("Agenda.One")); |
364 |
356 |
365 r=TheFs.Delete(_L("file1.txt")); |
357 r=TheFs.Delete(_L("file1.txt")); |
366 test_KErrNone(r); |
358 test(r==KErrNone); |
367 r=TheFs.Delete(_L("file3.txt")); |
359 r=TheFs.Delete(_L("file3.txt")); |
368 test_KErrNone(r); |
360 test(r==KErrNone); |
369 r=TheFs.Delete(_L("Agenda1")); |
361 r=TheFs.Delete(_L("Agenda1")); |
370 test_KErrNone(r); |
362 test(r==KErrNone); |
371 r=TheFs.Delete(_L("AGENDA.ONE")); |
363 r=TheFs.Delete(_L("AGENDA.ONE")); |
372 test_KErrNone(r); |
364 test(r==KErrNone); |
373 r=TheFs.RmDir(_L("\\F32-TST\\RENAMECASE\\")); |
365 r=TheFs.RmDir(_L("\\F32-TST\\RENAMECASE\\")); |
374 test_KErrNone(r); |
366 test(r==KErrNone); |
375 r=TheFs.SetSessionPath(gSessionPath); |
367 r=TheFs.SetSessionPath(gSessionPath); |
376 test_KErrNone(r); |
368 test(r==KErrNone); |
377 } |
369 } |
378 |
370 |
379 LOCAL_C void testReplace() |
371 LOCAL_C void testReplace() |
380 // |
372 // |
381 // Test the replace function |
373 // Test the replace function |
382 // |
374 // |
383 { |
375 { |
384 |
376 |
385 test.Next(_L("Test Replace")); |
377 test.Next(_L("Test Replace")); |
386 TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
378 TInt r=TheFs.MkDirAll(_L("\\F32-TST\\ABCDEF\\")); |
387 test_KErrNone(r); |
379 test(r==KErrNone); |
388 r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
380 r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\ABCDEF")); |
389 test_Value(r, r == KErrAccessDenied); // Do not replace directories |
381 test(r==KErrAccessDenied); // Do not replace directories |
390 r=TheFs.Replace(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
382 r=TheFs.Replace(_L("\\F32-TST\\123456"),_L("\\F32-TST\\ABCDEF")); |
391 test_Value(r, r == KErrAccessDenied); |
383 test(r==KErrAccessDenied); |
392 r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
384 r=TheFs.Replace(_L("\\TST-E32\\123456"),_L("\\F32-TST\\FEDCBA")); |
393 test_Value(r, r == KErrPathNotFound); |
385 test(r==KErrPathNotFound); |
394 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
386 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF"),_L("\\F32-TST\\123456")); |
395 test_Value(r, r == KErrAccessDenied); |
387 test(r==KErrAccessDenied); |
396 |
388 |
397 test.Next(_L("Replace a file with itself (8.3 filename)")); |
389 test.Next(_L("Replace a file with itself (8.3 filename)")); |
398 MakeFile(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
390 MakeFile(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
399 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
391 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
400 test_KErrNone(r); |
392 test(r==KErrNone); |
401 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),KErrNone); |
393 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),KErrNone); |
402 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\test1.spr")); |
394 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\test1.spr")); |
403 test_KErrNone(r); |
395 test(r==KErrNone); |
404 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST1.SPR"),KErrNone,ETrue); // Replace does not rename existing file |
396 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); |
397 CheckFileExists(_L("\\F32-TST\\ABCDEF\\test1.spr"),KErrNone,EFalse); |
406 |
398 |
407 test.Next(_L("Replace a file with itself (vfat filename)")); |
399 test.Next(_L("Replace a file with itself (vfat filename)")); |
408 MakeFile(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
400 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")); |
401 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
410 test_KErrNone(r); |
402 test(r==KErrNone); |
411 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),KErrNone); |
403 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")); |
404 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),_L("\\F32-TST\\ABCDEF\\test_sheet(01).spr")); |
413 test_KErrNone(r); |
405 test(r==KErrNone); |
414 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR"),KErrNone,ETrue); // Replace does not rename existing file |
406 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); |
407 CheckFileExists(_L("\\F32-TST\\ABCDEF\\test_sheet(01).spr"),KErrNone,EFalse); |
416 |
408 |
417 test.Next(_L("Replace preserves file contents (8.3 filename)")); |
409 test.Next(_L("Replace preserves file contents (8.3 filename)")); |
418 MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("Original Data")); |
410 MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("Original Data")); |
419 MakeFile(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L8("NewData")); |
411 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")); |
412 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
421 test_KErrNone(r); |
413 test(r==KErrNone); |
422 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
414 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
423 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
415 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
424 |
416 |
425 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR")); |
417 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR")); |
426 test_KErrNone(r); |
418 test(r==KErrNone); |
427 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
419 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
428 test_KErrNone(r); |
420 test(r==KErrNone); |
429 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
421 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR"),_L8("NewData")); |
430 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
422 CheckFileExists(_L("\\F32-TST\\ABCDEF\\TEMP0001.SPR"),KErrNotFound); |
431 |
423 |
432 test.Next(_L("Replace preserves file contents (vfat fileName)")); |
424 test.Next(_L("Replace preserves file contents (vfat fileName)")); |
433 MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("Original Data")); |
425 MakeFile(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("Original Data")); |
434 MakeFile(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L8("NewData")); |
426 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")); |
427 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
436 test_KErrNone(r); |
428 test(r==KErrNone); |
437 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
429 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
438 CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
430 CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
439 |
431 |
440 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR")); |
432 r=TheFs.Rename(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR")); |
441 test_KErrNone(r); |
433 test(r==KErrNone); |
442 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
434 r=TheFs.Replace(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
443 test_KErrNone(r); |
435 test(r==KErrNone); |
444 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
436 CheckFileContents(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR"),_L8("NewData")); |
445 CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
437 CheckFileExists(_L("\\F32-TST\\ABCDEF\\NEW_TEMP0001.SPR"),KErrNotFound); |
446 |
438 |
447 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
439 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
448 test_Value(r, r == KErrInUse); |
440 test(r==KErrInUse); |
449 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR\\")); |
441 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR\\")); |
450 test_Value(r, r == KErrPathNotFound); |
442 test(r==KErrPathNotFound); |
451 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
443 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET1.SPR")); |
452 test_KErrNone(r); |
444 test(r==KErrNone); |
453 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
445 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\SHEET_TEST1.SPR")); |
454 test_KErrNone(r); |
446 test(r==KErrNone); |
455 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
447 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST1.SPR")); |
456 test_KErrNone(r); |
448 test(r==KErrNone); |
457 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
449 r=TheFs.Delete(_L("\\F32-TST\\ABCDEF\\TEST_SHEET(01).SPR")); |
458 test_KErrNone(r); |
450 test(r==KErrNone); |
459 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
451 r=TheFs.RmDir(_L("\\F32-TST\\ABCDEF\\")); |
460 test_KErrNone(r); |
452 test(r==KErrNone); |
461 |
453 |
462 test.Next(_L("Check file date is retained")); |
454 test.Next(_L("Check file date is retained")); |
463 MakeFile(_L("OldFile.Old")); |
455 MakeFile(_L("OldFile.Old")); |
464 MakeFile(_L("NewFile.new")); |
456 MakeFile(_L("NewFile.new")); |
465 |
457 |
466 TDateTime newDate(1998,(TMonth)2,3,11,12,0,0); |
458 TDateTime newDate(1998,(TMonth)2,3,11,12,0,0); |
467 TTime newTime(newDate); |
459 TTime newTime(newDate); |
468 |
460 |
469 r=TheFs.SetEntry(_L("NewFile.new"),newTime,0,0); |
461 r=TheFs.SetEntry(_L("NewFile.new"),newTime,0,0); |
470 test_KErrNone(r); |
462 test(r==KErrNone); |
471 |
463 |
472 TEntry entry; |
464 TEntry entry; |
473 r=TheFs.Entry(_L("NewFile.new"),entry); |
465 r=TheFs.Entry(_L("NewFile.new"),entry); |
474 test_KErrNone(r); |
466 test(r==KErrNone); |
475 |
467 |
476 TTime checkReturnedTime=entry.iModified; |
468 TTime checkReturnedTime=entry.iModified; |
477 TDateTime dateTime=checkReturnedTime.DateTime(); |
469 TDateTime dateTime=checkReturnedTime.DateTime(); |
478 |
470 |
479 test(entry.iModified==newTime); |
471 test(entry.iModified==newTime); |
480 |
472 |
481 TDateTime oldDate(1996,(TMonth)2,3,23,0,0,0); |
473 TDateTime oldDate(1996,(TMonth)2,3,23,0,0,0); |
482 TTime oldTime(oldDate); |
474 TTime oldTime(oldDate); |
483 r=TheFs.SetEntry(_L("OldFile.old"),oldTime,0,0); |
475 r=TheFs.SetEntry(_L("OldFile.old"),oldTime,0,0); |
484 test_KErrNone(r); |
476 test(r==KErrNone); |
485 |
477 |
486 TheFs.Replace(_L("NewFile.new"),_L("OldFile.old")); |
478 TheFs.Replace(_L("NewFile.new"),_L("OldFile.old")); |
487 test_KErrNone(r); |
479 test(r==KErrNone); |
488 TTime check; |
480 TTime check; |
489 r=TheFs.Modified(_L("OldFile.old"),check); |
481 r=TheFs.Modified(_L("OldFile.old"),check); |
490 test_KErrNone(r); |
482 test(r==KErrNone); |
491 TDateTime checkDateTime=check.DateTime(); |
483 TDateTime checkDateTime=check.DateTime(); |
492 |
484 |
493 test(checkDateTime.Year()==dateTime.Year()); |
485 test(checkDateTime.Year()==dateTime.Year()); |
494 test(checkDateTime.Month()==dateTime.Month()); |
486 test(checkDateTime.Month()==dateTime.Month()); |
495 test(checkDateTime.Day()==dateTime.Day()); |
487 test(checkDateTime.Day()==dateTime.Day()); |
498 test(checkDateTime.Second()==dateTime.Second()); |
490 test(checkDateTime.Second()==dateTime.Second()); |
499 |
491 |
500 test.Next(_L("Replace 'Agenda' with 'Agenda.'")); |
492 test.Next(_L("Replace 'Agenda' with 'Agenda.'")); |
501 MakeFile(_L("Agenda")); |
493 MakeFile(_L("Agenda")); |
502 r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
494 r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
503 test_KErrNone(r); |
495 test(r==KErrNone); |
504 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
496 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
505 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
497 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
506 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
498 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
507 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
499 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
508 |
500 |
509 r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
501 r=TheFs.Replace(_L("Agenda"),_L("Agenda.")); |
510 test_KErrNone(r); |
502 test(r==KErrNone); |
511 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
503 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
512 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
504 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
513 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
505 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
514 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
506 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
515 |
507 |
516 r=TheFs.Replace(_L("Agenda."),_L("AGENDA")); |
508 r=TheFs.Replace(_L("Agenda."),_L("AGENDA")); |
517 test_KErrNone(r); |
509 test(r==KErrNone); |
518 CheckFileExists(_L("Agenda"),KErrNone,ETrue); // Replace does not rename existing file |
510 CheckFileExists(_L("Agenda"),KErrNone,ETrue); // Replace does not rename existing file |
519 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
511 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
520 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
512 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
521 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
513 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
522 |
514 |
523 r=TheFs.Replace(_L("AGENDA."),_L("AGENDA.")); // Unchanged, ie still 'Agenda' |
515 r=TheFs.Replace(_L("AGENDA."),_L("AGENDA.")); // Unchanged, ie still 'Agenda' |
524 test_KErrNone(r); |
516 test(r==KErrNone); |
525 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
517 CheckFileExists(_L("Agenda"),KErrNone,ETrue); |
526 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
518 CheckFileExists(_L("Agenda."),KErrNone,ETrue); |
527 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
519 CheckFileExists(_L("AGENDA"),KErrNone,EFalse); |
528 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
520 CheckFileExists(_L("AGENDA."),KErrNone,EFalse); |
529 } |
521 } |
679 test.Next(_L("Create folder with the name of an existing file")); |
671 test.Next(_L("Create folder with the name of an existing file")); |
680 MakeFile(_L("\\BLUE")); |
672 MakeFile(_L("\\BLUE")); |
681 if (!IsTestingLFFS()) |
673 if (!IsTestingLFFS()) |
682 { //FIXME: Bad error codes from LFFS |
674 { //FIXME: Bad error codes from LFFS |
683 r=TheFs.MkDir(_L("\\BLUE\\")); |
675 r=TheFs.MkDir(_L("\\BLUE\\")); |
684 test_Value(r, r == KErrAccessDenied); |
676 test(r==KErrAccessDenied); |
685 MakeFile(_L("\\RED\\BLUE")); |
677 MakeFile(_L("\\RED\\BLUE")); |
686 r=TheFs.MkDir(_L("\\RED\\BLUE\\")); |
678 r=TheFs.MkDir(_L("\\RED\\BLUE\\")); |
687 test_Value(r, r == KErrAccessDenied); |
679 test(r==KErrAccessDenied); |
688 r=TheFs.MkDirAll(_L("\\BLUE\\GREEN\\ORANGE\\")); |
680 r=TheFs.MkDirAll(_L("\\BLUE\\GREEN\\ORANGE\\")); |
689 test_Value(r, r == KErrAccessDenied); |
681 test(r==KErrAccessDenied); |
690 } |
682 } |
691 |
683 |
692 test.Next(_L("Create folder with the name of an existing folder")); |
684 test.Next(_L("Create folder with the name of an existing folder")); |
693 MakeDir(_L("\\VOLVO\\")); |
685 MakeDir(_L("\\VOLVO\\")); |
694 r=TheFs.MkDir(_L("\\VOLVO\\")); |
686 r=TheFs.MkDir(_L("\\VOLVO\\")); |
695 test_Value(r, r == KErrAlreadyExists); |
687 test(r==KErrAlreadyExists); |
696 MakeDir(_L("\\FORD\\VOLKSWAGEN\\")); |
688 MakeDir(_L("\\FORD\\VOLKSWAGEN\\")); |
697 r=TheFs.MkDirAll(_L("\\ford\\volkswagen\\")); |
689 r=TheFs.MkDirAll(_L("\\ford\\volkswagen\\")); |
698 test_Value(r, r == KErrAlreadyExists); |
690 test(r==KErrAlreadyExists); |
699 |
691 |
700 RFile f; |
692 RFile f; |
701 if (!IsTestingLFFS()) |
693 if (!IsTestingLFFS()) |
702 { //FIXME Bad error codes from LFFS |
694 { //FIXME Bad error codes from LFFS |
703 test.Next(_L("Create a file with the name of an existing folder")); |
695 test.Next(_L("Create a file with the name of an existing folder")); |
704 r=f.Create(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
696 r=f.Create(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
705 test_Value(r, r == KErrAccessDenied); |
697 test(r==KErrAccessDenied); |
706 r=f.Replace(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
698 r=f.Replace(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
707 test_Value(r, r == KErrAccessDenied); |
699 test(r==KErrAccessDenied); |
708 r=f.Open(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
700 r=f.Open(TheFs,_L("\\VOLVO"),EFileRead|EFileWrite); |
709 test_Value(r, r == KErrAccessDenied); |
701 test(r==KErrAccessDenied); |
710 r=f.Create(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
702 r=f.Create(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
711 test_Value(r, r == KErrAccessDenied); |
703 test(r==KErrAccessDenied); |
712 r=f.Replace(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
704 r=f.Replace(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
713 test_Value(r, r == KErrAccessDenied); |
705 test(r==KErrAccessDenied); |
714 r=f.Open(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
706 r=f.Open(TheFs,_L("\\FORD\\VOLKSWAGEN"),EFileRead|EFileWrite); |
715 test_Value(r, r == KErrAccessDenied); |
707 test(r==KErrAccessDenied); |
716 } |
708 } |
717 |
709 |
718 test.Next(_L("Create a file with the name of an existing file")); |
710 test.Next(_L("Create a file with the name of an existing file")); |
719 r=f.Create(TheFs,_L("\\BLUE"),EFileRead|EFileWrite); |
711 r=f.Create(TheFs,_L("\\BLUE"),EFileRead|EFileWrite); |
720 test_Value(r, r == KErrAlreadyExists); |
712 test(r==KErrAlreadyExists); |
721 } |
713 } |
722 |
714 |
723 LOCAL_C void testSetEntry() |
715 LOCAL_C void testSetEntry() |
724 // |
716 // |
725 // Test set entry |
717 // Test set entry |
732 TTime time(dateTime); |
724 TTime time(dateTime); |
733 MakeFile(_L("DUMENTRY.")); |
725 MakeFile(_L("DUMENTRY.")); |
734 |
726 |
735 RFile f; |
727 RFile f; |
736 TInt r=f.Open(TheFs,_L("dumentry"),EFileRead); |
728 TInt r=f.Open(TheFs,_L("dumentry"),EFileRead); |
737 test_KErrNone(r); |
729 test(r==KErrNone); |
738 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
730 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
739 test_Value(r, r == KErrInUse); |
731 test(r==KErrInUse); |
740 f.Close(); |
732 f.Close(); |
741 |
733 |
742 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
734 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttReadOnly,KEntryAttArchive); |
743 test_KErrNone(r); |
735 test(r==KErrNone); |
744 CheckEntry(_L("DUMEntry"),KEntryAttReadOnly,TTime(dateTime)); |
736 CheckEntry(_L("DUMEntry"),KEntryAttReadOnly,TTime(dateTime)); |
745 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttReadOnly); |
737 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttReadOnly); |
746 test_KErrNone(r); |
738 test(r==KErrNone); |
747 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
739 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
748 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,0); |
740 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,0); |
749 test_KErrNone(r); |
741 test(r==KErrNone); |
750 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
742 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
751 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,0); |
743 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,0); |
752 test_KErrNone(r); |
744 test(r==KErrNone); |
753 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
745 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
754 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,0); |
746 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,0); |
755 test_KErrNone(r); |
747 test(r==KErrNone); |
756 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
748 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
757 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume,0); |
749 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume,0); |
758 test_KErrNone(r); |
750 test(r==KErrNone); |
759 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
751 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
760 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttRemote,0); |
752 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttRemote,0); |
761 test_KErrNone(r); |
753 test(r==KErrNone); |
762 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
754 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
763 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume|KEntryAttRemote,0); |
755 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume|KEntryAttRemote,0); |
764 test_KErrNone(r); |
756 test(r==KErrNone); |
765 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
757 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
766 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume|KEntryAttRemote,0); |
758 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir|KEntryAttVolume|KEntryAttRemote,0); |
767 test_KErrNone(r); |
759 test(r==KErrNone); |
768 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
760 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
769 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir); |
761 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir); |
770 test_KErrNone(r); |
762 test(r==KErrNone); |
771 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
763 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
772 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume); |
764 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume); |
773 test_KErrNone(r); |
765 test(r==KErrNone); |
774 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
766 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
775 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttRemote); |
767 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttRemote); |
776 test_KErrNone(r); |
768 test(r==KErrNone); |
777 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
769 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
778 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume); |
770 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume); |
779 test_KErrNone(r); |
771 test(r==KErrNone); |
780 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
772 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
781 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttRemote); |
773 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttRemote); |
782 test_KErrNone(r); |
774 test(r==KErrNone); |
783 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
775 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
784 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume|KEntryAttRemote); |
776 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttVolume|KEntryAttRemote); |
785 test_KErrNone(r); |
777 test(r==KErrNone); |
786 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
778 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
787 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume|KEntryAttRemote); |
779 r=TheFs.SetEntry(_L("dumentry."),time,0,KEntryAttDir|KEntryAttVolume|KEntryAttRemote); |
788 test_KErrNone(r); |
780 test(r==KErrNone); |
789 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
781 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
790 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttVolume); |
782 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttVolume); |
791 test_KErrNone(r); |
783 test(r==KErrNone); |
792 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
784 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
793 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttRemote); |
785 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttDir,KEntryAttRemote); |
794 test_KErrNone(r); |
786 test(r==KErrNone); |
795 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
787 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
796 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttDir); |
788 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttDir); |
797 test_KErrNone(r); |
789 test(r==KErrNone); |
798 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
790 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
799 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttRemote); |
791 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttVolume,KEntryAttRemote); |
800 test_KErrNone(r); |
792 test(r==KErrNone); |
801 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
793 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
802 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttDir); |
794 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttDir); |
803 test_KErrNone(r); |
795 test(r==KErrNone); |
804 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
796 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
805 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttVolume); |
797 r=TheFs.SetEntry(_L("dumentry."),time,KEntryAttRemote,KEntryAttVolume); |
806 test_KErrNone(r); |
798 test(r==KErrNone); |
807 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
799 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
808 |
800 |
809 r=f.Open(TheFs,_L("dumentry"),EFileWrite); |
801 r=f.Open(TheFs,_L("dumentry"),EFileWrite); |
810 test_KErrNone(r); |
802 test(r==KErrNone); |
811 |
803 |
812 r=f.SetAtt(KEntryAttDir,0); |
804 r=f.SetAtt(KEntryAttDir,0); |
813 test_KErrNone(r); |
805 test(r==KErrNone); |
814 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
806 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
815 r=f.SetAtt(KEntryAttVolume,KEntryAttDir); |
807 r=f.SetAtt(KEntryAttVolume,KEntryAttDir); |
816 test_KErrNone(r); |
808 test(r==KErrNone); |
817 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
809 CheckEntry(_L("DUMEntry"),0,TTime(dateTime)); |
818 f.Close(); |
810 f.Close(); |
819 r=TheFs.Delete(_L("dumEntry.")); |
811 r=TheFs.Delete(_L("dumEntry.")); |
820 test_KErrNone(r); |
812 test(r==KErrNone); |
821 |
813 |
822 MakeDir(_L("\\DumEntry\\")); |
814 MakeDir(_L("\\DumEntry\\")); |
823 r=TheFs.SetEntry(_L("\\dumentry\\"),time,KEntryAttReadOnly,KEntryAttArchive); |
815 r=TheFs.SetEntry(_L("\\dumentry\\"),time,KEntryAttReadOnly,KEntryAttArchive); |
824 test_KErrNone(r); |
816 test(r==KErrNone); |
825 CheckEntry(_L("\\DUMEntry"),KEntryAttReadOnly|KEntryAttDir,TTime(dateTime)); |
817 CheckEntry(_L("\\DUMEntry"),KEntryAttReadOnly|KEntryAttDir,TTime(dateTime)); |
826 r=TheFs.SetEntry(_L("\\dumentry."),time,0,KEntryAttReadOnly); |
818 r=TheFs.SetEntry(_L("\\dumentry."),time,0,KEntryAttReadOnly); |
827 test_KErrNone(r); |
819 test(r==KErrNone); |
828 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
820 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
829 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,0); |
821 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,0); |
830 test_KErrNone(r); |
822 test(r==KErrNone); |
831 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
823 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
832 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,0); |
824 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,0); |
833 test_KErrNone(r); |
825 test(r==KErrNone); |
834 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
826 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
835 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume|KEntryAttDir,0); |
827 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume|KEntryAttDir,0); |
836 test_KErrNone(r); |
828 test(r==KErrNone); |
837 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
829 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
838 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume|KEntryAttDir); |
830 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume|KEntryAttDir); |
839 test_KErrNone(r); |
831 test(r==KErrNone); |
840 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
832 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
841 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume); |
833 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttVolume); |
842 test_KErrNone(r); |
834 test(r==KErrNone); |
843 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
835 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
844 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttDir); |
836 r=TheFs.SetEntry(_L("\\dumentry"),time,0,KEntryAttDir); |
845 test_KErrNone(r); |
837 test(r==KErrNone); |
846 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
838 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
847 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,KEntryAttDir); |
839 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttVolume,KEntryAttDir); |
848 test_KErrNone(r); |
840 test(r==KErrNone); |
849 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
841 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
850 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,KEntryAttVolume); |
842 r=TheFs.SetEntry(_L("\\dumentry"),time,KEntryAttDir,KEntryAttVolume); |
851 test_KErrNone(r); |
843 test(r==KErrNone); |
852 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
844 CheckEntry(_L("\\DUMEntry"),KEntryAttDir,TTime(dateTime)); |
853 r=TheFs.RmDir(_L("\\dumEntry\\")); |
845 r=TheFs.RmDir(_L("\\dumEntry\\")); |
854 test_KErrNone(r); |
846 test(r==KErrNone); |
855 } |
847 } |
856 |
848 |
857 |
849 |
858 LOCAL_C void testSetFileAttributes() |
850 LOCAL_C void testSetFileAttributes() |
859 // |
851 // |
865 test.Next(_L("Test RFile::SetAtt()")); |
857 test.Next(_L("Test RFile::SetAtt()")); |
866 |
858 |
867 // Create a file "TEMPFILE.TMP" and set attributes to hidden |
859 // Create a file "TEMPFILE.TMP" and set attributes to hidden |
868 RFile file; |
860 RFile file; |
869 TInt r=file.Replace(TheFs,_L("TEMPFILE.TMP"),0); |
861 TInt r=file.Replace(TheFs,_L("TEMPFILE.TMP"),0); |
870 test_Value(r, r == KErrNone || r==KErrPathNotFound); |
862 test(r==KErrNone || r==KErrPathNotFound); |
871 r=file.SetAtt(KEntryAttHidden,0); |
863 r=file.SetAtt(KEntryAttHidden,0); |
872 test_KErrNone(r); |
864 test(r==KErrNone); |
873 file.Close(); |
865 file.Close(); |
874 |
866 |
875 // Check attributes are as set |
867 // Check attributes are as set |
876 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
868 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
877 TUint atts; |
869 TUint atts; |
878 r=file.Att(atts); |
870 r=file.Att(atts); |
879 test_KErrNone(r); |
871 test(r==KErrNone); |
880 file.Close(); |
872 file.Close(); |
881 test(atts&KEntryAttHidden); |
873 test(atts&KEntryAttHidden); |
882 |
874 |
883 // Change attributes from hidden to system |
875 // Change attributes from hidden to system |
884 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
876 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
885 r=file.SetAtt(KEntryAttSystem,KEntryAttHidden); |
877 r=file.SetAtt(KEntryAttSystem,KEntryAttHidden); |
886 test_KErrNone(r); |
878 test(r==KErrNone); |
887 file.Close(); |
879 file.Close(); |
888 |
880 |
889 // Check attributes have been changed |
881 // Check attributes have been changed |
890 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
882 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
891 r=file.Att(atts); |
883 r=file.Att(atts); |
892 test_KErrNone(r); |
884 test(r==KErrNone); |
893 file.Close(); |
885 file.Close(); |
894 test_Value((TInt)atts, atts&KEntryAttSystem); |
886 test(atts&KEntryAttSystem); |
895 |
887 |
896 // Change attributes to normal |
888 // Change attributes to normal |
897 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
889 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
898 r=file.SetAtt(KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
890 r=file.SetAtt(KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
899 test_KErrNone(r); |
891 test(r==KErrNone); |
900 file.Close(); |
892 file.Close(); |
901 |
893 |
902 // Check attributes have been changed |
894 // Check attributes have been changed |
903 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
895 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
904 r=file.Att(atts); |
896 r=file.Att(atts); |
905 test_KErrNone(r); |
897 test(r==KErrNone); |
906 file.Close(); |
898 file.Close(); |
907 test_Value((TInt)atts, atts==KEntryAttNormal); |
899 test(atts==KEntryAttNormal); |
908 |
900 |
909 // Attempt to change attributes from normal file to directory |
901 // Attempt to change attributes from normal file to directory |
910 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
902 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
911 r=file.SetAtt(KEntryAttDir,KEntryAttNormal); |
903 r=file.SetAtt(KEntryAttDir,KEntryAttNormal); |
912 test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a directory |
904 test(r==KErrNone); // Returns KErrNone but DOESN'T change the file to a directory |
913 file.Close(); |
905 file.Close(); |
914 |
906 |
915 // Check the file has not been changed to a directory |
907 // Check the file has not been changed to a directory |
916 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
908 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
917 r=file.Att(atts); |
909 r=file.Att(atts); |
918 test_KErrNone(r); |
910 test(r==KErrNone); |
919 file.Close(); |
911 file.Close(); |
920 test_Value((TInt)atts, (TInt)(atts&KEntryAttDir)==KErrNone); |
912 test((TInt)(atts&KEntryAttDir)==KErrNone); |
921 |
913 |
922 // Change the attributes from normal file to hidden file |
914 // Change the attributes from normal file to hidden file |
923 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
915 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
924 r=file.SetAtt(KEntryAttHidden,KEntryAttNormal); |
916 r=file.SetAtt(KEntryAttHidden,KEntryAttNormal); |
925 test_KErrNone(r); |
917 test(r==KErrNone); |
926 file.Close(); |
918 file.Close(); |
927 |
919 |
928 // Check the attributes have been changed |
920 // Check the attributes have been changed |
929 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
921 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
930 r=file.Att(atts); |
922 r=file.Att(atts); |
931 test_KErrNone(r); |
923 test(r==KErrNone); |
932 file.Close(); |
924 file.Close(); |
933 test_Value((TInt)atts, atts&KEntryAttHidden); |
925 test(atts&KEntryAttHidden); |
934 |
926 |
935 // Try to change the attributes from hidden file to volume |
927 // Try to change the attributes from hidden file to volume |
936 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
928 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
937 r=file.SetAtt(KEntryAttVolume,KEntryAttHidden); |
929 r=file.SetAtt(KEntryAttVolume,KEntryAttHidden); |
938 test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a volume |
930 test(r==KErrNone); // Returns KErrNone but DOESN'T change the file to a volume |
939 file.Close(); |
931 file.Close(); |
940 |
932 |
941 // Check that the hidden file has not been changed to a volume |
933 // Check that the hidden file has not been changed to a volume |
942 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
934 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
943 r=file.Att(atts); |
935 r=file.Att(atts); |
944 test_KErrNone(r); |
936 test(r==KErrNone); |
945 file.Close(); |
937 file.Close(); |
946 test_Value((TInt)atts, (TInt)(atts&KEntryAttVolume)==KErrNone); |
938 test((TInt)(atts&KEntryAttVolume)==KErrNone); |
947 |
939 |
948 // Test RFile::Set() function |
940 // Test RFile::Set() function |
949 |
941 |
950 test.Next(_L("Test RFile::Set()")); |
942 test.Next(_L("Test RFile::Set()")); |
951 |
943 |
952 // Check attributes |
944 // Check attributes |
953 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
945 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
954 r=file.Att(atts); |
946 r=file.Att(atts); |
955 test_KErrNone(r); |
947 test(r==KErrNone); |
956 file.Close(); |
948 file.Close(); |
957 test_Value((TInt)atts, atts==KEntryAttNormal); |
949 test(atts==KEntryAttNormal); |
958 |
950 |
959 // Change attributes from hidden to system - and change modification time |
951 // Change attributes from hidden to system - and change modification time |
960 TDateTime dateTime(1998,EMay,25,18,23,0,0); |
952 TDateTime dateTime(1998,EMay,25,18,23,0,0); |
961 TTime modTime1(dateTime); |
953 TTime modTime1(dateTime); |
962 TTime retTime; |
954 TTime retTime; |
963 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
955 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
964 r=file.Set(modTime1,KEntryAttSystem,KEntryAttNormal); |
956 r=file.Set(modTime1,KEntryAttSystem,KEntryAttNormal); |
965 test_KErrNone(r); |
957 test(r==KErrNone); |
966 file.Close(); |
958 file.Close(); |
967 |
959 |
968 // Check attributes have been changed |
960 // Check attributes have been changed |
969 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
961 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
970 r=file.Att(atts); |
962 r=file.Att(atts); |
971 test_KErrNone(r); |
963 test(r==KErrNone); |
972 r=file.Modified(retTime); |
964 r=file.Modified(retTime); |
973 test_KErrNone(r); |
965 test(r==KErrNone); |
974 file.Close(); |
966 file.Close(); |
975 test_Value((TInt)atts, atts&KEntryAttSystem); |
967 test(atts&KEntryAttSystem); |
976 test(retTime==modTime1); |
968 test(retTime==modTime1); |
977 |
969 |
978 // Change attributes to normal - and change modification time |
970 // Change attributes to normal - and change modification time |
979 dateTime.Set(1997,EMay,24,17,25,0,0); |
971 dateTime.Set(1997,EMay,24,17,25,0,0); |
980 TTime modTime2(dateTime); |
972 TTime modTime2(dateTime); |
981 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
973 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
982 r=file.Set(modTime2,KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
974 r=file.Set(modTime2,KEntryAttNormal,KEntryAttSystem|KEntryAttArchive); |
983 test_KErrNone(r); |
975 test(r==KErrNone); |
984 file.Close(); |
976 file.Close(); |
985 |
977 |
986 // Check attributes have been changed |
978 // Check attributes have been changed |
987 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
979 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
988 r=file.Att(atts); |
980 r=file.Att(atts); |
989 test_KErrNone(r); |
981 test(r==KErrNone); |
990 r=file.Modified(retTime); |
982 r=file.Modified(retTime); |
991 test_KErrNone(r); |
983 test(r==KErrNone); |
992 file.Close(); |
984 file.Close(); |
993 test_Value((TInt)atts, atts==KEntryAttNormal); |
985 test(atts==KEntryAttNormal); |
994 test(retTime==modTime2); |
986 test(retTime==modTime2); |
995 |
987 |
996 // Attempt to change attributes from normal file to directory |
988 // Attempt to change attributes from normal file to directory |
997 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
989 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
998 r=file.Set(modTime1,KEntryAttDir,KEntryAttNormal); |
990 r=file.Set(modTime1,KEntryAttDir,KEntryAttNormal); |
999 test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a directory |
991 test(r==KErrNone); // Returns KErrNone but DOESN'T change the file to a directory |
1000 file.Close(); |
992 file.Close(); |
1001 |
993 |
1002 // Check the file has not been changed to a directory |
994 // Check the file has not been changed to a directory |
1003 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
995 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1004 r=file.Att(atts); |
996 r=file.Att(atts); |
1005 test_KErrNone(r); |
997 test(r==KErrNone); |
1006 r=file.Modified(retTime); |
998 r=file.Modified(retTime); |
1007 test_KErrNone(r); |
999 test(r==KErrNone); |
1008 file.Close(); |
1000 file.Close(); |
1009 test_Value((TInt)atts, (TInt)(atts&KEntryAttDir)==KErrNone); |
1001 test((TInt)(atts&KEntryAttDir)==KErrNone); |
1010 test(retTime==modTime1);// Modification time should have been set successfully |
1002 test(retTime==modTime1);// Modification time should have been set successfully |
1011 |
1003 |
1012 // Change the attributes from normal file to hidden file - and change modification time |
1004 // Change the attributes from normal file to hidden file - and change modification time |
1013 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1005 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1014 r=file.Set(modTime1,KEntryAttHidden,KEntryAttNormal); |
1006 r=file.Set(modTime1,KEntryAttHidden,KEntryAttNormal); |
1015 test_KErrNone(r); |
1007 test(r==KErrNone); |
1016 file.Close(); |
1008 file.Close(); |
1017 |
1009 |
1018 // Check the attributes have been changed |
1010 // Check the attributes have been changed |
1019 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1011 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1020 r=file.Att(atts); |
1012 r=file.Att(atts); |
1021 test_KErrNone(r); |
1013 test(r==KErrNone); |
1022 r=file.Modified(retTime); |
1014 r=file.Modified(retTime); |
1023 file.Close(); |
1015 file.Close(); |
1024 test_Value((TInt)atts, atts&KEntryAttHidden); |
1016 test(atts&KEntryAttHidden); |
1025 test(retTime==modTime1); |
1017 test(retTime==modTime1); |
1026 |
1018 |
1027 // Try to change the attributes from hidden file to volume |
1019 // Try to change the attributes from hidden file to volume |
1028 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1020 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1029 r=file.Set(modTime2,KEntryAttVolume,KEntryAttHidden); |
1021 r=file.Set(modTime2,KEntryAttVolume,KEntryAttHidden); |
1030 test_KErrNone(r); // Returns KErrNone but DOESN'T change the file to a volume |
1022 test(r==KErrNone); // Returns KErrNone but DOESN'T change the file to a volume |
1031 file.Close(); |
1023 file.Close(); |
1032 |
1024 |
1033 // Check that the hidden file has not been changed to a volume |
1025 // Check that the hidden file has not been changed to a volume |
1034 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1026 file.Open(TheFs,_L("TEMPFILE.TMP"),EFileWrite); |
1035 r=file.Att(atts); |
1027 r=file.Att(atts); |
1036 test_KErrNone(r); |
1028 test(r==KErrNone); |
1037 r=file.Modified(retTime); |
1029 r=file.Modified(retTime); |
1038 test_KErrNone(r); |
1030 test(r==KErrNone); |
1039 file.Close(); |
1031 file.Close(); |
1040 test_Value((TInt)atts, (TInt)(atts&KEntryAttVolume)==KErrNone); |
1032 test((TInt)(atts&KEntryAttVolume)==KErrNone); |
1041 test(retTime==modTime2); // Modification time should have been set successfully |
1033 test(retTime==modTime2); // Modification time should have been set successfully |
1042 |
1034 |
1043 r=TheFs.Delete(_L("TEMPFILE.TMP")); |
1035 r=TheFs.Delete(_L("TEMPFILE.TMP")); |
1044 |
1036 |
1045 } |
1037 } |