branch | RCL_3 |
changeset 44 | 3e88ff8f41d5 |
parent 43 | c1f20ce4abcf |
43:c1f20ce4abcf | 44:3e88ff8f41d5 |
---|---|
11 // Contributors: |
11 // Contributors: |
12 // |
12 // |
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #define __E32TEST_EXTENSION__ |
|
17 #include <f32file.h> |
16 #include <f32file.h> |
18 #include <e32test.h> |
17 #include <e32test.h> |
19 #include "t_server.h" |
18 #include "t_server.h" |
20 |
19 |
21 GLDEF_D RTest test(_L("T_GDIR")); |
20 GLDEF_D RTest test(_L("T_GDIR")); |
109 |
108 |
110 TCheckedUid checkedUid(aFileName.iUidType); |
109 TCheckedUid checkedUid(aFileName.iUidType); |
111 TPtrC fileName(aFileName.iFileName); |
110 TPtrC fileName(aFileName.iFileName); |
112 TAutoClose<RFile> file; |
111 TAutoClose<RFile> file; |
113 TInt r=file.iObj.Replace(TheFs,fileName,EFileWrite); |
112 TInt r=file.iObj.Replace(TheFs,fileName,EFileWrite); |
114 test_KErrNone(r); |
113 test(r==KErrNone); |
115 TPtrC8 uidBuf((TUint8*)&checkedUid,sizeof(TCheckedUid)); |
114 TPtrC8 uidBuf((TUint8*)&checkedUid,sizeof(TCheckedUid)); |
116 r=file.iObj.Write(uidBuf); |
115 r=file.iObj.Write(uidBuf); |
117 test_KErrNone(r); |
116 test(r==KErrNone); |
118 TPtrC8 contents(aFileName.iContents); |
117 TPtrC8 contents(aFileName.iContents); |
119 r=file.iObj.Write(contents); |
118 r=file.iObj.Write(contents); |
120 test_KErrNone(r); |
119 test(r==KErrNone); |
121 } |
120 } |
122 |
121 |
123 LOCAL_C void createFile(TInt anIndex) |
122 LOCAL_C void createFile(TInt anIndex) |
124 // |
123 // |
125 // Create a file in the test directory. |
124 // Create a file in the test directory. |
133 mes.Format(_L("Create file %S"),&fName); |
132 mes.Format(_L("Create file %S"),&fName); |
134 test.Next(mes); |
133 test.Next(mes); |
135 // |
134 // |
136 TAutoClose<RFile> file; |
135 TAutoClose<RFile> file; |
137 TInt r=file.iObj.Replace(TheFs,fName,EFileWrite); |
136 TInt r=file.iObj.Replace(TheFs,fName,EFileWrite); |
138 test_KErrNone(r); |
137 test(r==KErrNone); |
139 TBuf8<36> b((TUint8*)"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
138 TBuf8<36> b((TUint8*)"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
140 b.SetLength(anIndex+1); |
139 b.SetLength(anIndex+1); |
141 r=file.iObj.Write(b); |
140 r=file.iObj.Write(b); |
142 test_KErrNone(r); |
141 test(r==KErrNone); |
143 } |
142 } |
144 |
143 |
145 LOCAL_C void createDir(TInt anIndex) |
144 LOCAL_C void createDir(TInt anIndex) |
146 // |
145 // |
147 // Create a dir in the test directory. |
146 // Create a dir in the test directory. |
154 TBuf<0x80> mes; |
153 TBuf<0x80> mes; |
155 mes.Format(_L("Create dir %S"),&dName); |
154 mes.Format(_L("Create dir %S"),&dName); |
156 test.Next(mes); |
155 test.Next(mes); |
157 // |
156 // |
158 TInt r=TheFs.MkDir(dName); |
157 TInt r=TheFs.MkDir(dName); |
159 test_KErrNone(r); |
158 test(r==KErrNone); |
160 } |
159 } |
161 |
160 |
162 LOCAL_C void testSetup() |
161 LOCAL_C void testSetup() |
163 // |
162 // |
164 // Setup the test environment. |
163 // Setup the test environment. |
166 { |
165 { |
167 |
166 |
168 test.Next(_L("Remove test directory")); |
167 test.Next(_L("Remove test directory")); |
169 CDir* pD; |
168 CDir* pD; |
170 TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD); |
169 TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD); |
171 test_Value(r, r == KErrNone || r==KErrNotFound || r==KErrPathNotFound); |
170 test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound); |
172 if (r==KErrNone) |
171 if (r==KErrNone) |
173 { |
172 { |
174 TInt count=pD->Count(); |
173 TInt count=pD->Count(); |
175 TInt i=0; |
174 TInt i=0; |
176 while (i<count) |
175 while (i<count) |
179 if (e.IsDir()) |
178 if (e.IsDir()) |
180 { |
179 { |
181 TFileName name; |
180 TFileName name; |
182 name.Format(_L("%S%S\\"),&test_dir,&e.iName); |
181 name.Format(_L("%S%S\\"),&test_dir,&e.iName); |
183 r=TheFs.RmDir(name); |
182 r=TheFs.RmDir(name); |
184 test_KErrNone(r); |
183 test(r==KErrNone); |
185 } |
184 } |
186 else |
185 else |
187 { |
186 { |
188 TFileName name; |
187 TFileName name; |
189 name.Format(_L("%S%S"),&test_dir,&e.iName); |
188 name.Format(_L("%S%S"),&test_dir,&e.iName); |
190 r=TheFs.Delete(name); |
189 r=TheFs.Delete(name); |
191 test_KErrNone(r); |
190 test(r==KErrNone); |
192 } |
191 } |
193 } |
192 } |
194 } |
193 } |
195 // |
194 // |
196 delete pD; |
195 delete pD; |
215 TInt dCount; |
214 TInt dCount; |
216 TInt fCount; |
215 TInt fCount; |
217 test.Next(_L("Test directory handling")); |
216 test.Next(_L("Test directory handling")); |
218 CDir* pD; |
217 CDir* pD; |
219 TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD); |
218 TInt r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,EDirsLast,pD); |
220 test_KErrNone(r); |
219 test(r==KErrNone); |
221 displayDir(*pD,dCount,fCount); |
220 displayDir(*pD,dCount,fCount); |
222 test(dCount==4 && fCount==9); |
221 test(dCount==4 && fCount==9); |
223 delete pD; |
222 delete pD; |
224 // |
223 // |
225 test.Next(_L("Attributes: NULL")); |
224 test.Next(_L("Attributes: NULL")); |
226 r=TheFs.GetDir(test_dir_1,NULL,EDirsLast,pD); |
225 r=TheFs.GetDir(test_dir_1,NULL,EDirsLast,pD); |
227 test_KErrNone(r); |
226 test(r==KErrNone); |
228 displayDir(*pD,dCount,fCount); |
227 displayDir(*pD,dCount,fCount); |
229 test(dCount==0 && fCount==9); |
228 test(dCount==0 && fCount==9); |
230 delete pD; |
229 delete pD; |
231 // |
230 // |
232 test.Next(_L("Attributes: KEntryAttDir & EDescending sort")); |
231 test.Next(_L("Attributes: KEntryAttDir & EDescending sort")); |
233 r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName|EDescending,pD); |
232 r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName|EDescending,pD); |
234 test_KErrNone(r); |
233 test(r==KErrNone); |
235 displayDir(*pD,dCount,fCount); |
234 displayDir(*pD,dCount,fCount); |
236 test(dCount==4 && fCount==9); |
235 test(dCount==4 && fCount==9); |
237 delete pD; |
236 delete pD; |
238 // |
237 // |
239 test.Next(_L("Attributes: Excl,Dir")); |
238 test.Next(_L("Attributes: Excl,Dir")); |
240 r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName|EDescending,pD); |
239 r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName|EDescending,pD); |
241 test_KErrNone(r); |
240 test(r==KErrNone); |
242 displayDir(*pD,dCount,fCount); |
241 displayDir(*pD,dCount,fCount); |
243 test(dCount==4 && fCount==0); |
242 test(dCount==4 && fCount==0); |
244 delete pD; |
243 delete pD; |
245 // |
244 // |
246 CDir* pD2; |
245 CDir* pD2; |
247 // |
246 // |
248 test.Next(_L("Test split directories and files")); |
247 test.Next(_L("Test split directories and files")); |
249 r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,ESortByName,pD,pD2); |
248 r=TheFs.GetDir(test_dir_1,KEntryAttMaskSupported,ESortByName,pD,pD2); |
250 test_KErrNone(r); |
249 test(r==KErrNone); |
251 test.Printf(_L("FileList:\n")); |
250 test.Printf(_L("FileList:\n")); |
252 displayDir(*pD,dCount,fCount); |
251 displayDir(*pD,dCount,fCount); |
253 test(dCount==4 && fCount==9); |
252 test(dCount==4 && fCount==9); |
254 test.Printf(_L("DirList:\n")); |
253 test.Printf(_L("DirList:\n")); |
255 displayDir(*pD2,dCount,fCount); |
254 displayDir(*pD2,dCount,fCount); |
257 delete pD; |
256 delete pD; |
258 delete pD2; |
257 delete pD2; |
259 // |
258 // |
260 test.Next(_L("Attributes: NULL")); |
259 test.Next(_L("Attributes: NULL")); |
261 r=TheFs.GetDir(test_dir_1,NULL,ESortByName,pD,pD2); |
260 r=TheFs.GetDir(test_dir_1,NULL,ESortByName,pD,pD2); |
262 test_KErrNone(r); |
261 test(r==KErrNone); |
263 test.Printf(_L("FileList:\n")); |
262 test.Printf(_L("FileList:\n")); |
264 displayDir(*pD,dCount,fCount); |
263 displayDir(*pD,dCount,fCount); |
265 test(dCount==0 && fCount==9); |
264 test(dCount==0 && fCount==9); |
266 test.Printf(_L("DirList:\n")); |
265 test.Printf(_L("DirList:\n")); |
267 displayDir(*pD2,dCount,fCount); |
266 displayDir(*pD2,dCount,fCount); |
269 delete pD; |
268 delete pD; |
270 delete pD2; |
269 delete pD2; |
271 // |
270 // |
272 test.Next(_L("Attributes: KEntryAttDir")); |
271 test.Next(_L("Attributes: KEntryAttDir")); |
273 r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName,pD,pD2); |
272 r=TheFs.GetDir(test_dir_1,KEntryAttDir,ESortByName,pD,pD2); |
274 test_KErrNone(r); |
273 test(r==KErrNone); |
275 test.Printf(_L("FileList:\n")); |
274 test.Printf(_L("FileList:\n")); |
276 displayDir(*pD,dCount,fCount); |
275 displayDir(*pD,dCount,fCount); |
277 test(dCount==4 && fCount==9); |
276 test(dCount==4 && fCount==9); |
278 test.Printf(_L("DirList:\n")); |
277 test.Printf(_L("DirList:\n")); |
279 displayDir(*pD2,dCount,fCount); |
278 displayDir(*pD2,dCount,fCount); |
281 delete pD; |
280 delete pD; |
282 delete pD2; |
281 delete pD2; |
283 // |
282 // |
284 test.Next(_L("Attributes: Excl,Dir")); |
283 test.Next(_L("Attributes: Excl,Dir")); |
285 r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName,pD,pD2); |
284 r=TheFs.GetDir(test_dir_1,KEntryAttMatchExclusive|KEntryAttDir,ESortByName,pD,pD2); |
286 test_KErrNone(r); |
285 test(r==KErrNone); |
287 test.Printf(_L("FileList:\n")); |
286 test.Printf(_L("FileList:\n")); |
288 displayDir(*pD,dCount,fCount); |
287 displayDir(*pD,dCount,fCount); |
289 test(dCount==4 && fCount==0); |
288 test(dCount==4 && fCount==0); |
290 test.Printf(_L("DirList:\n")); |
289 test.Printf(_L("DirList:\n")); |
291 displayDir(*pD2,dCount,fCount); |
290 displayDir(*pD2,dCount,fCount); |
302 |
301 |
303 test.Next(_L("Test Z:")); |
302 test.Next(_L("Test Z:")); |
304 TInt dCount,fCount; |
303 TInt dCount,fCount; |
305 CDir* pD; |
304 CDir* pD; |
306 TInt r=TheFs.GetDir(_L("Z:\\*"),KEntryAttMaskSupported,EDirsFirst,pD); |
305 TInt r=TheFs.GetDir(_L("Z:\\*"),KEntryAttMaskSupported,EDirsFirst,pD); |
307 test_KErrNone(r); |
306 test(r==KErrNone); |
308 displayDir(*pD,dCount,fCount); |
307 displayDir(*pD,dCount,fCount); |
309 delete pD; |
308 delete pD; |
310 } |
309 } |
311 |
310 |
312 LOCAL_C void testDisplayFiles() |
311 LOCAL_C void testDisplayFiles() |
316 { |
315 { |
317 |
316 |
318 test.Next(_L("Display contents of current directory")); |
317 test.Next(_L("Display contents of current directory")); |
319 CDir* pD; |
318 CDir* pD; |
320 TInt r=TheFs.GetDir(gSessionPath,KEntryAttMaskSupported,EDirsFirst,pD); |
319 TInt r=TheFs.GetDir(gSessionPath,KEntryAttMaskSupported,EDirsFirst,pD); |
321 test_KErrNone(r); |
320 test(r==KErrNone); |
322 TInt dCount,fCount; |
321 TInt dCount,fCount; |
323 displayDir(*pD,dCount,fCount); |
322 displayDir(*pD,dCount,fCount); |
324 delete pD; |
323 delete pD; |
325 |
324 |
326 TParsePtrC session(gSessionPath); |
325 TParsePtrC session(gSessionPath); |
327 TParse parser; |
326 TParse parser; |
328 TBuf<16> noName=_L("asdf.idd"); |
327 TBuf<16> noName=_L("asdf.idd"); |
329 parser.Set(session.Drive(),&noName,NULL); |
328 parser.Set(session.Drive(),&noName,NULL); |
330 r=TheFs.GetDir(parser.FullName(),KEntryAttMaskSupported,EDirsFirst,pD); |
329 r=TheFs.GetDir(parser.FullName(),KEntryAttMaskSupported,EDirsFirst,pD); |
331 test_KErrNone(r); |
330 test(r==KErrNone); |
332 test(pD->Count()==0); |
331 test(pD->Count()==0); |
333 delete pD; |
332 delete pD; |
334 } |
333 } |
335 |
334 |
336 LOCAL_C void MatchUidFile(TInt aUidFile,TInt anEntryNum,const CDir* aFileList) |
335 LOCAL_C void MatchUidFile(TInt aUidFile,TInt anEntryNum,const CDir* aFileList) |
348 test(entry.iName==uidFileName); |
347 test(entry.iName==uidFileName); |
349 test(entry.iType==uidFiles[aUidFile].iUidType); |
348 test(entry.iType==uidFiles[aUidFile].iUidType); |
350 |
349 |
351 RFile f; |
350 RFile f; |
352 TInt r=f.Open(TheFs,entry.iName,EFileRead); |
351 TInt r=f.Open(TheFs,entry.iName,EFileRead); |
353 test_KErrNone(r); |
352 test(r==KErrNone); |
354 TBuf8<256> contents; |
353 TBuf8<256> contents; |
355 r=f.Read(sizeof(TCheckedUid),contents); |
354 r=f.Read(sizeof(TCheckedUid),contents); |
356 test_KErrNone(r); |
355 test(r==KErrNone); |
357 TPtrC8 uidFileContents(uidFiles[aUidFile].iContents); |
356 TPtrC8 uidFileContents(uidFiles[aUidFile].iContents); |
358 test(contents==uidFileContents); |
357 test(contents==uidFileContents); |
359 r=f.Read(contents); |
358 r=f.Read(contents); |
360 test_KErrNone(r); |
359 test(r==KErrNone); |
361 test(contents.Length()==0); |
360 test(contents.Length()==0); |
362 f.Close(); |
361 f.Close(); |
363 } |
362 } |
364 |
363 |
365 LOCAL_C TInt PrintUid(TInt anEntryNum,const CDir* aFileList) |
364 LOCAL_C TInt PrintUid(TInt anEntryNum,const CDir* aFileList) |
388 |
387 |
389 TBuf<16> matchName=_L("*.txt"); |
388 TBuf<16> matchName=_L("*.txt"); |
390 TUidType matchUid(TUid::Null(),TUid::Uid(2),TUid::Null()); |
389 TUidType matchUid(TUid::Null(),TUid::Uid(2),TUid::Null()); |
391 CDir* fileList; |
390 CDir* fileList; |
392 TInt r=TheFs.GetDir(matchName,matchUid,EAscending,fileList); |
391 TInt r=TheFs.GetDir(matchName,matchUid,EAscending,fileList); |
393 test_KErrNone(r); |
392 test(r==KErrNone); |
394 TInt count=fileList->Count(); |
393 TInt count=fileList->Count(); |
395 test(count==1); |
394 test(count==1); |
396 MatchUidFile(0,0,fileList); |
395 MatchUidFile(0,0,fileList); |
397 delete fileList; |
396 delete fileList; |
398 |
397 |
399 matchName=_L("*.*"); |
398 matchName=_L("*.*"); |
400 matchUid=TUidType(TUid::Uid(1),TUid::Uid(2),TUid::Uid(731)); |
399 matchUid=TUidType(TUid::Uid(1),TUid::Uid(2),TUid::Uid(731)); |
401 r=TheFs.GetDir(matchName,matchUid,EAscending,fileList); |
400 r=TheFs.GetDir(matchName,matchUid,EAscending,fileList); |
402 test_KErrNone(r); |
401 test(r==KErrNone); |
403 count=fileList->Count(); |
402 count=fileList->Count(); |
404 test(count==1); |
403 test(count==1); |
405 MatchUidFile(0,0,fileList); |
404 MatchUidFile(0,0,fileList); |
406 delete fileList; |
405 delete fileList; |
407 |
406 |
408 matchName=_L("*.*"); |
407 matchName=_L("*.*"); |
409 matchUid=TUidType(TUid::Null(),TUid::Uid(2),TUid::Null()); |
408 matchUid=TUidType(TUid::Null(),TUid::Uid(2),TUid::Null()); |
410 r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList); |
409 r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList); |
411 test_KErrNone(r); |
410 test(r==KErrNone); |
412 count=fileList->Count(); |
411 count=fileList->Count(); |
413 test(count==3); |
412 test(count==3); |
414 MatchUidFile(0,2,fileList); |
413 MatchUidFile(0,2,fileList); |
415 MatchUidFile(1,1,fileList); |
414 MatchUidFile(1,1,fileList); |
416 MatchUidFile(4,0,fileList); |
415 MatchUidFile(4,0,fileList); |
417 delete fileList; |
416 delete fileList; |
418 |
417 |
419 matchName=_L("*.*"); |
418 matchName=_L("*.*"); |
420 matchUid=TUidType(TUid::Null(),TUid::Null(),TUid::Uid(731)); |
419 matchUid=TUidType(TUid::Null(),TUid::Null(),TUid::Uid(731)); |
421 r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList); |
420 r=TheFs.GetDir(matchName,matchUid,ESortByName|EAscending,fileList); |
422 test_KErrNone(r); |
421 test(r==KErrNone); |
423 count=fileList->Count(); |
422 count=fileList->Count(); |
424 test(count==3); |
423 test(count==3); |
425 MatchUidFile(2,0,fileList); |
424 MatchUidFile(2,0,fileList); |
426 MatchUidFile(1,1,fileList); |
425 MatchUidFile(1,1,fileList); |
427 MatchUidFile(0,2,fileList); |
426 MatchUidFile(0,2,fileList); |
428 delete fileList; |
427 delete fileList; |
429 |
428 |
430 matchName=_L("*.*"); |
429 matchName=_L("*.*"); |
431 r=TheFs.GetDir(matchName,KEntryAttNormal,ESortByUid|EAscending,fileList); |
430 r=TheFs.GetDir(matchName,KEntryAttNormal,ESortByUid|EAscending,fileList); |
432 test_KErrNone(r); |
431 test(r==KErrNone); |
433 count=fileList->Count(); |
432 count=fileList->Count(); |
434 MatchUidFile(4,0,fileList); |
433 MatchUidFile(4,0,fileList); |
435 MatchUidFile(1,1,fileList); |
434 MatchUidFile(1,1,fileList); |
436 MatchUidFile(0,2,fileList); |
435 MatchUidFile(0,2,fileList); |
437 MatchUidFile(5,3,fileList); |
436 MatchUidFile(5,3,fileList); |
456 { |
455 { |
457 |
456 |
458 TUidType matchUid(TUid::Null(),TUid::Uid(0x1000008c),TUid::Null()); |
457 TUidType matchUid(TUid::Null(),TUid::Uid(0x1000008c),TUid::Null()); |
459 CDir* fileList; |
458 CDir* fileList; |
460 TInt r=TheFs.GetDir(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\SYS\\BIN\\"):_L("Z:\\SYSTEM\\BIN\\"),matchUid,EAscending,fileList); |
459 TInt r=TheFs.GetDir(PlatSec::ConfigSetting(PlatSec::EPlatSecEnforceSysBin)?_L("Z:\\SYS\\BIN\\"):_L("Z:\\SYSTEM\\BIN\\"),matchUid,EAscending,fileList); |
461 test_KErrNone(r); |
460 test(r==KErrNone); |
462 TInt count=fileList->Count(); |
461 TInt count=fileList->Count(); |
463 #if defined(__WINS__) |
462 #if defined(__WINS__) |
464 test(count==0); |
463 test(count==0); |
465 #else |
464 #else |
466 test.Printf(_L("Count=%d\n"),count); |
465 test.Printf(_L("Count=%d\n"),count); |
489 |
488 |
490 test.Next(_L("Can match only read only files")); |
489 test.Next(_L("Can match only read only files")); |
491 TUint onlyRO=KEntryAttReadOnly|KEntryAttMatchExclusive; |
490 TUint onlyRO=KEntryAttReadOnly|KEntryAttMatchExclusive; |
492 CDir* fileList; |
491 CDir* fileList; |
493 TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),onlyRO,EAscending,fileList); |
492 TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),onlyRO,EAscending,fileList); |
494 test_KErrNone(r); |
493 test(r==KErrNone); |
495 TInt count=fileList->Count(); |
494 TInt count=fileList->Count(); |
496 test(count==2); |
495 test(count==2); |
497 |
496 |
498 TEntry entry; |
497 TEntry entry; |
499 entry=(*fileList)[0]; |
498 entry=(*fileList)[0]; |
503 delete fileList; |
502 delete fileList; |
504 |
503 |
505 test.Next(_L("Can match everything except read only files")); |
504 test.Next(_L("Can match everything except read only files")); |
506 TUint excludeRO=KEntryAttReadOnly|KEntryAttMatchExclude; |
505 TUint excludeRO=KEntryAttReadOnly|KEntryAttMatchExclude; |
507 r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeRO,EAscending,fileList); |
506 r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeRO,EAscending,fileList); |
508 test_KErrNone(r); |
507 test(r==KErrNone); |
509 count=fileList->Count(); |
508 count=fileList->Count(); |
510 test(count==4); |
509 test(count==4); |
511 |
510 |
512 entry=(*fileList)[0]; |
511 entry=(*fileList)[0]; |
513 test(entry.iName.MatchF(_L("RW1.CCC"))!=KErrNotFound); |
512 test(entry.iName.MatchF(_L("RW1.CCC"))!=KErrNotFound); |
520 delete fileList; |
519 delete fileList; |
521 |
520 |
522 test.Next(_L("Can match everything except system and readonly files")); |
521 test.Next(_L("Can match everything except system and readonly files")); |
523 TUint excludeSystemAndRO=KEntryAttReadOnly|KEntryAttSystem|KEntryAttMatchExclude; |
522 TUint excludeSystemAndRO=KEntryAttReadOnly|KEntryAttSystem|KEntryAttMatchExclude; |
524 r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeSystemAndRO,EAscending,fileList); |
523 r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\*.CCC"),excludeSystemAndRO,EAscending,fileList); |
525 test_KErrNone(r); |
524 test(r==KErrNone); |
526 count=fileList->Count(); |
525 count=fileList->Count(); |
527 test(count==2); |
526 test(count==2); |
528 |
527 |
529 entry=(*fileList)[0]; |
528 entry=(*fileList)[0]; |
530 test(entry.iName.MatchF(_L("RW1.CCC"))!=KErrNotFound); |
529 test(entry.iName.MatchF(_L("RW1.CCC"))!=KErrNotFound); |
531 entry=(*fileList)[1]; |
530 entry=(*fileList)[1]; |
532 test(entry.iName.MatchF(_L("RW2.CCC"))!=KErrNotFound); |
531 test(entry.iName.MatchF(_L("RW2.CCC"))!=KErrNotFound); |
533 delete fileList; |
532 delete fileList; |
534 |
533 |
535 r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY1.CCC"),0,KEntryAttReadOnly); |
534 r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY1.CCC"),0,KEntryAttReadOnly); |
536 test_KErrNone(r); |
535 test(r==KErrNone); |
537 r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY2.CCC"),0,KEntryAttReadOnly); |
536 r=TheFs.SetAtt(_L("\\F32-TST\\GDIR\\RONLY2.CCC"),0,KEntryAttReadOnly); |
538 test_KErrNone(r); |
537 test(r==KErrNone); |
539 } |
538 } |
540 |
539 |
541 LOCAL_C void testGetHidden() |
540 LOCAL_C void testGetHidden() |
542 // |
541 // |
543 // Match hidden files and directories |
542 // Match hidden files and directories |
553 MakeDir(_L("\\F32-TST\\GDIR\\Dirhidden.qqq\\")); |
552 MakeDir(_L("\\F32-TST\\GDIR\\Dirhidden.qqq\\")); |
554 MakeDir(_L("\\F32-TST\\GDIR\\Dirsystem.qqq\\")); |
553 MakeDir(_L("\\F32-TST\\GDIR\\Dirsystem.qqq\\")); |
555 MakeDir(_L("\\F32-TST\\GDIR\\Dirhiddensystem.qqq\\")); |
554 MakeDir(_L("\\F32-TST\\GDIR\\Dirhiddensystem.qqq\\")); |
556 |
555 |
557 TInt r=TheFs.SetAtt(_L("FileHidden.qqq"),KEntryAttHidden,0); |
556 TInt r=TheFs.SetAtt(_L("FileHidden.qqq"),KEntryAttHidden,0); |
558 test_KErrNone(r); |
557 test(r==KErrNone); |
559 r=TheFs.SetAtt(_L("Filesystem.qqq"),KEntryAttSystem,0); |
558 r=TheFs.SetAtt(_L("Filesystem.qqq"),KEntryAttSystem,0); |
560 test_KErrNone(r); |
559 test(r==KErrNone); |
561 r=TheFs.SetAtt(_L("FilehiddenSystem.qqq"),KEntryAttSystem|KEntryAttHidden,0); |
560 r=TheFs.SetAtt(_L("FilehiddenSystem.qqq"),KEntryAttSystem|KEntryAttHidden,0); |
562 test_KErrNone(r); |
561 test(r==KErrNone); |
563 r=TheFs.SetAtt(_L("dirhidden.qqq"),KEntryAttHidden,0); |
562 r=TheFs.SetAtt(_L("dirhidden.qqq"),KEntryAttHidden,0); |
564 test_KErrNone(r); |
563 test(r==KErrNone); |
565 r=TheFs.SetAtt(_L("dirsystem.qqq"),KEntryAttSystem,0); |
564 r=TheFs.SetAtt(_L("dirsystem.qqq"),KEntryAttSystem,0); |
566 test_KErrNone(r); |
565 test(r==KErrNone); |
567 r=TheFs.SetAtt(_L("dirhiddensystem.qqq"),KEntryAttSystem|KEntryAttHidden,0); |
566 r=TheFs.SetAtt(_L("dirhiddensystem.qqq"),KEntryAttSystem|KEntryAttHidden,0); |
568 test_KErrNone(r); |
567 test(r==KErrNone); |
569 |
568 |
570 // Files and directories not hidden or system |
569 // Files and directories not hidden or system |
571 CDir* dir; |
570 CDir* dir; |
572 r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir,ESortByName,dir); |
571 r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir,ESortByName,dir); |
573 test_KErrNone(r); |
572 test(r==KErrNone); |
574 TInt count=dir->Count(); |
573 TInt count=dir->Count(); |
575 test(count==2); |
574 test(count==2); |
576 TEntry entry; |
575 TEntry entry; |
577 entry=(*dir)[0]; |
576 entry=(*dir)[0]; |
578 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
577 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
580 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
579 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
581 delete dir; |
580 delete dir; |
582 |
581 |
583 // Files only |
582 // Files only |
584 r=TheFs.GetDir(_L("*.qqq"),KEntryAttNormal,ESortByName,dir); |
583 r=TheFs.GetDir(_L("*.qqq"),KEntryAttNormal,ESortByName,dir); |
585 test_KErrNone(r); |
584 test(r==KErrNone); |
586 count=dir->Count(); |
585 count=dir->Count(); |
587 test(count==1); |
586 test(count==1); |
588 entry=(*dir)[0]; |
587 entry=(*dir)[0]; |
589 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
588 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
590 delete dir; |
589 delete dir; |
591 |
590 |
592 // Directories only |
591 // Directories only |
593 r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
592 r=TheFs.GetDir(_L("*.qqq"),KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
594 test_KErrNone(r); |
593 test(r==KErrNone); |
595 count=dir->Count(); |
594 count=dir->Count(); |
596 test(count==1); |
595 test(count==1); |
597 entry=(*dir)[0]; |
596 entry=(*dir)[0]; |
598 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
597 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
599 delete dir; |
598 delete dir; |
600 |
599 |
601 // Files + hidden |
600 // Files + hidden |
602 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir); |
601 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir); |
603 test_KErrNone(r); |
602 test(r==KErrNone); |
604 count=dir->Count(); |
603 count=dir->Count(); |
605 test(count==2); |
604 test(count==2); |
606 entry=(*dir)[0]; |
605 entry=(*dir)[0]; |
607 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
606 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
608 entry=(*dir)[1]; |
607 entry=(*dir)[1]; |
609 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
608 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
610 delete dir; |
609 delete dir; |
611 |
610 |
612 // Files + system |
611 // Files + system |
613 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir); |
612 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden,ESortByName,dir); |
614 test_KErrNone(r); |
613 test(r==KErrNone); |
615 count=dir->Count(); |
614 count=dir->Count(); |
616 test(count==2); |
615 test(count==2); |
617 entry=(*dir)[0]; |
616 entry=(*dir)[0]; |
618 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
617 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
619 entry=(*dir)[1]; |
618 entry=(*dir)[1]; |
620 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
619 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
621 delete dir; |
620 delete dir; |
622 |
621 |
623 // Files + hidden + system |
622 // Files + hidden + system |
624 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem,ESortByName,dir); |
623 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem,ESortByName,dir); |
625 test_KErrNone(r); |
624 test(r==KErrNone); |
626 count=dir->Count(); |
625 count=dir->Count(); |
627 test(count==4); |
626 test(count==4); |
628 entry=(*dir)[0]; |
627 entry=(*dir)[0]; |
629 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
628 test(entry.iName.MatchF(_L("file.qqq"))!=KErrNotFound); |
630 entry=(*dir)[1]; |
629 entry=(*dir)[1]; |
635 test(entry.iName.MatchF(_L("filesystem.qqq"))!=KErrNotFound); |
634 test(entry.iName.MatchF(_L("filesystem.qqq"))!=KErrNotFound); |
636 delete dir; |
635 delete dir; |
637 |
636 |
638 // Dirs + hidden |
637 // Dirs + hidden |
639 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
638 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
640 test_KErrNone(r); |
639 test(r==KErrNone); |
641 count=dir->Count(); |
640 count=dir->Count(); |
642 test(count==2); |
641 test(count==2); |
643 entry=(*dir)[0]; |
642 entry=(*dir)[0]; |
644 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
643 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
645 entry=(*dir)[1]; |
644 entry=(*dir)[1]; |
646 test(entry.iName.MatchF(_L("dirhidden.qqq"))!=KErrNotFound); |
645 test(entry.iName.MatchF(_L("dirhidden.qqq"))!=KErrNotFound); |
647 delete dir; |
646 delete dir; |
648 |
647 |
649 // Dirs + system |
648 // Dirs + system |
650 r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
649 r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
651 test_KErrNone(r); |
650 test(r==KErrNone); |
652 count=dir->Count(); |
651 count=dir->Count(); |
653 test(count==2); |
652 test(count==2); |
654 entry=(*dir)[0]; |
653 entry=(*dir)[0]; |
655 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
654 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
656 entry=(*dir)[1]; |
655 entry=(*dir)[1]; |
657 test(entry.iName.MatchF(_L("dirsystem.qqq"))!=KErrNotFound); |
656 test(entry.iName.MatchF(_L("dirsystem.qqq"))!=KErrNotFound); |
658 delete dir; |
657 delete dir; |
659 |
658 |
660 // Dirs + hidden + system |
659 // Dirs + hidden + system |
661 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
660 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir|KEntryAttMatchExclusive,ESortByName,dir); |
662 test_KErrNone(r); |
661 test(r==KErrNone); |
663 count=dir->Count(); |
662 count=dir->Count(); |
664 test(count==4); |
663 test(count==4); |
665 entry=(*dir)[0]; |
664 entry=(*dir)[0]; |
666 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
665 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
667 entry=(*dir)[1]; |
666 entry=(*dir)[1]; |
673 |
672 |
674 delete dir; |
673 delete dir; |
675 |
674 |
676 // Files + Dirs + hidden |
675 // Files + Dirs + hidden |
677 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir,ESortByName,dir); |
676 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttDir,ESortByName,dir); |
678 test_KErrNone(r); |
677 test(r==KErrNone); |
679 count=dir->Count(); |
678 count=dir->Count(); |
680 test(count==4); |
679 test(count==4); |
681 entry=(*dir)[0]; |
680 entry=(*dir)[0]; |
682 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
681 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
683 entry=(*dir)[1]; |
682 entry=(*dir)[1]; |
688 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
687 test(entry.iName.MatchF(_L("filehidden.qqq"))!=KErrNotFound); |
689 delete dir; |
688 delete dir; |
690 |
689 |
691 // Files + Dirs + system |
690 // Files + Dirs + system |
692 r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir,ESortByName,dir); |
691 r=TheFs.GetDir(_L("*.qqq"),KEntryAttSystem|KEntryAttDir,ESortByName,dir); |
693 test_KErrNone(r); |
692 test(r==KErrNone); |
694 count=dir->Count(); |
693 count=dir->Count(); |
695 test(count==4); |
694 test(count==4); |
696 entry=(*dir)[0]; |
695 entry=(*dir)[0]; |
697 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
696 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
698 entry=(*dir)[1]; |
697 entry=(*dir)[1]; |
703 test(entry.iName.MatchF(_L("filesystem.qqq"))!=KErrNotFound); |
702 test(entry.iName.MatchF(_L("filesystem.qqq"))!=KErrNotFound); |
704 delete dir; |
703 delete dir; |
705 |
704 |
706 // Files + Dirs + hidden + system |
705 // Files + Dirs + hidden + system |
707 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir,ESortByName,dir); |
706 r=TheFs.GetDir(_L("*.qqq"),KEntryAttHidden|KEntryAttSystem|KEntryAttDir,ESortByName,dir); |
708 test_KErrNone(r); |
707 test(r==KErrNone); |
709 count=dir->Count(); |
708 count=dir->Count(); |
710 test(count==8); |
709 test(count==8); |
711 entry=(*dir)[0]; |
710 entry=(*dir)[0]; |
712 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
711 test(entry.iName.MatchF(_L("dir.qqq"))!=KErrNotFound); |
713 entry=(*dir)[1]; |
712 entry=(*dir)[1]; |
780 |
779 |
781 // Test DirFirst - EDescending |
780 // Test DirFirst - EDescending |
782 CDir* dir; |
781 CDir* dir; |
783 TUint sortOrder=ESortByName|EDirsFirst|EDescending; |
782 TUint sortOrder=ESortByName|EDirsFirst|EDescending; |
784 TInt r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
783 TInt r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
785 test_KErrNone(r); |
784 test(r==KErrNone); |
786 // TBuf8<16> result=_L("2,1,0,3,4,5"); |
785 // TBuf8<16> result=_L("2,1,0,3,4,5"); |
787 TBuf<16> result=_L("2,1,0,3,4,5"); |
786 TBuf<16> result=_L("2,1,0,3,4,5"); |
788 |
787 |
789 TestDirDescendingOrder(result,*dir); |
788 TestDirDescendingOrder(result,*dir); |
790 delete dir; |
789 delete dir; |
791 // Test DirFirst - EAscending |
790 // Test DirFirst - EAscending |
792 sortOrder=ESortByName|EDirsFirst; |
791 sortOrder=ESortByName|EDirsFirst; |
793 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
792 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
794 test_KErrNone(r); |
793 test(r==KErrNone); |
795 result=_L("3,4,5,0,1,2"); |
794 result=_L("3,4,5,0,1,2"); |
796 TestDirDescendingOrder(result,*dir); |
795 TestDirDescendingOrder(result,*dir); |
797 delete dir; |
796 delete dir; |
798 |
797 |
799 // Test DirLast - EDescending |
798 // Test DirLast - EDescending |
800 sortOrder=ESortByName|EDirsLast|EDescending; |
799 sortOrder=ESortByName|EDirsLast|EDescending; |
801 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
800 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
802 test_KErrNone(r); |
801 test(r==KErrNone); |
803 result=_L("3,4,5,2,1,0"); |
802 result=_L("3,4,5,2,1,0"); |
804 TestDirDescendingOrder(result,*dir); |
803 TestDirDescendingOrder(result,*dir); |
805 delete dir; |
804 delete dir; |
806 // Test DirLast - EAscending |
805 // Test DirLast - EAscending |
807 sortOrder=ESortByName|EDirsLast; |
806 sortOrder=ESortByName|EDirsLast; |
808 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
807 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
809 test_KErrNone(r); |
808 test(r==KErrNone); |
810 result=_L("0,1,2,3,4,5"); |
809 result=_L("0,1,2,3,4,5"); |
811 TestDirDescendingOrder(result,*dir); |
810 TestDirDescendingOrder(result,*dir); |
812 delete dir; |
811 delete dir; |
813 |
812 |
814 // Test DirFirst - EDirDescending |
813 // Test DirFirst - EDirDescending |
815 sortOrder=ESortByName|EDirsFirst|EDirDescending; |
814 sortOrder=ESortByName|EDirsFirst|EDirDescending; |
816 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
815 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
817 test_KErrNone(r); |
816 test(r==KErrNone); |
818 result=_L("5,4,3,0,1,2"); |
817 result=_L("5,4,3,0,1,2"); |
819 TestDirDescendingOrder(result,*dir); |
818 TestDirDescendingOrder(result,*dir); |
820 delete dir; |
819 delete dir; |
821 // Test DirLast - EDirDescending |
820 // Test DirLast - EDirDescending |
822 sortOrder=ESortByName|EDirsLast|EDirDescending; |
821 sortOrder=ESortByName|EDirsLast|EDirDescending; |
823 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
822 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
824 test_KErrNone(r); |
823 test(r==KErrNone); |
825 result=_L("0,1,2,5,4,3"); |
824 result=_L("0,1,2,5,4,3"); |
826 TestDirDescendingOrder(result,*dir); |
825 TestDirDescendingOrder(result,*dir); |
827 delete dir; |
826 delete dir; |
828 |
827 |
829 // Test DirFirst - EDescending|EDirDescending |
828 // Test DirFirst - EDescending|EDirDescending |
830 sortOrder=ESortByName|EDirsFirst|EDescending|EDirDescending; |
829 sortOrder=ESortByName|EDirsFirst|EDescending|EDirDescending; |
831 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
830 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
832 test_KErrNone(r); |
831 test(r==KErrNone); |
833 result=_L("2,1,0,5,4,3"); |
832 result=_L("2,1,0,5,4,3"); |
834 TestDirDescendingOrder(result,*dir); |
833 TestDirDescendingOrder(result,*dir); |
835 delete dir; |
834 delete dir; |
836 // Test DirLast - EDescending|EDirDescending |
835 // Test DirLast - EDescending|EDirDescending |
837 sortOrder=ESortByName|EDirsLast|EDirDescending|EDescending; |
836 sortOrder=ESortByName|EDirsLast|EDirDescending|EDescending; |
838 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
837 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
839 test_KErrNone(r); |
838 test(r==KErrNone); |
840 result=_L("5,4,3,2,1,0"); |
839 result=_L("5,4,3,2,1,0"); |
841 TestDirDescendingOrder(result,*dir); |
840 TestDirDescendingOrder(result,*dir); |
842 delete dir; |
841 delete dir; |
843 |
842 |
844 // Test DirNoOrder - EDescending|EDirDescending |
843 // Test DirNoOrder - EDescending|EDirDescending |
845 sortOrder=ESortByName|EDescending|EDirDescending; |
844 sortOrder=ESortByName|EDescending|EDirDescending; |
846 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
845 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
847 test_KErrNone(r); |
846 test(r==KErrNone); |
848 result=_L("5,2,4,1,3,0"); |
847 result=_L("5,2,4,1,3,0"); |
849 TestDirDescendingOrder(result,*dir); |
848 TestDirDescendingOrder(result,*dir); |
850 delete dir; |
849 delete dir; |
851 // Test DirNoOrder - EDescending |
850 // Test DirNoOrder - EDescending |
852 sortOrder=ESortByName|EDescending; |
851 sortOrder=ESortByName|EDescending; |
853 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
852 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
854 test_KErrNone(r); |
853 test(r==KErrNone); |
855 result=_L("5,2,4,1,3,0"); |
854 result=_L("5,2,4,1,3,0"); |
856 TestDirDescendingOrder(result,*dir); |
855 TestDirDescendingOrder(result,*dir); |
857 delete dir; |
856 delete dir; |
858 // Test DirNoOrder - EAscending |
857 // Test DirNoOrder - EAscending |
859 sortOrder=ESortByName; |
858 sortOrder=ESortByName; |
860 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
859 r=TheFs.GetDir(gDirDescendingBaseName,KEntryAttMaskSupported,sortOrder,dir); |
861 test_KErrNone(r); |
860 test(r==KErrNone); |
862 result=_L("0,3,1,4,2,5"); |
861 result=_L("0,3,1,4,2,5"); |
863 TestDirDescendingOrder(result,*dir); |
862 TestDirDescendingOrder(result,*dir); |
864 delete dir; |
863 delete dir; |
865 } |
864 } |
866 |
865 |
880 test.Next(_L("Test \"DEF122894: Defect in RFs GetDir() API\"")); |
879 test.Next(_L("Test \"DEF122894: Defect in RFs GetDir() API\"")); |
881 MakeFile(_L("\\F32-TST\\GDIR\\DEF122894\\xxxxxxxx2.dat")); |
880 MakeFile(_L("\\F32-TST\\GDIR\\DEF122894\\xxxxxxxx2.dat")); |
882 MakeFile(_L("\\F32-TST\\GDIR\\DEF122894\\Xxxxxxxx1.dat")); |
881 MakeFile(_L("\\F32-TST\\GDIR\\DEF122894\\Xxxxxxxx1.dat")); |
883 CDir* dir; |
882 CDir* dir; |
884 TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\DEF122894\\"),KEntryAttMaskSupported,ESortByName|EAscending,dir); |
883 TInt r=TheFs.GetDir(_L("\\F32-TST\\GDIR\\DEF122894\\"),KEntryAttMaskSupported,ESortByName|EAscending,dir); |
885 test_KErrNone(r); |
884 test(r==KErrNone); |
886 test(dir->Count() == 2); |
885 test(dir->Count() == 2); |
887 TEntry entry1, entry2; |
886 TEntry entry1, entry2; |
888 entry1 = (*dir)[0]; |
887 entry1 = (*dir)[0]; |
889 entry2 = (*dir)[1]; |
888 entry2 = (*dir)[1]; |
890 test(entry1.iName.Compare(_L("Xxxxxxxx1.dat")) == 0); |
889 test(entry1.iName.Compare(_L("Xxxxxxxx1.dat")) == 0); |