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