author | hgs |
Wed, 05 May 2010 05:11:16 +0100 | |
changeset 131 | e880629062dd |
parent 90 | 947f0dc9f7a8 |
child 109 | b3a1d9898418 |
child 189 | a5496987b1da |
child 249 | a179b74831c9 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
16 |
#define __E32TEST_EXTENSION__ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
17 |
|
0 | 18 |
#include <f32file.h> |
19 |
#include <e32test.h> |
|
20 |
#include <hal.h> |
|
21 |
#include "t_server.h" |
|
22 |
#include "t_chlffs.h" |
|
23 |
||
24 |
GLDEF_D RTest test(_L("T_FMAN")); |
|
25 |
||
26 |
LOCAL_D CFileMan* gFileMan=NULL; |
|
27 |
LOCAL_D TBool gAsynch=EFalse; |
|
28 |
LOCAL_D TRequestStatus gStat; |
|
29 |
LOCAL_D TBool testingInvalidPathLengths; |
|
30 |
||
31 |
class CFileManObserver : public CBase, public MFileManObserver |
|
32 |
{ |
|
33 |
public: |
|
34 |
CFileManObserver(CFileMan* aFileMan); |
|
35 |
TControl NotifyFileManEnded(); |
|
36 |
private: |
|
37 |
CFileMan* iFileMan; |
|
38 |
}; |
|
39 |
||
40 |
LOCAL_D CFileManObserver* gObserver; |
|
41 |
||
42 |
CFileManObserver::CFileManObserver(CFileMan* aFileMan) |
|
43 |
// |
|
44 |
// Constructor |
|
45 |
// |
|
46 |
{ |
|
47 |
__DECLARE_NAME(_S("CFileManObserver")); |
|
48 |
iFileMan=aFileMan; |
|
49 |
} |
|
50 |
||
51 |
MFileManObserver::TControl CFileManObserver::NotifyFileManEnded() |
|
52 |
// |
|
53 |
// Called back after each FMan tick |
|
54 |
// |
|
55 |
{ |
|
56 |
TInt lastError=iFileMan->GetLastError(); |
|
57 |
if (lastError!=KErrNone && lastError!=KErrBadName) |
|
58 |
{ |
|
59 |
TFileName fileName=iFileMan->CurrentEntry().iName; |
|
60 |
if (gAsynch==EFalse) |
|
61 |
test.Printf(_L("CurrentEntry is %S\n"),&fileName); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
62 |
test_Equal(KErrAlreadyExists, lastError); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
63 |
test_Value(KErrNotFound, fileName.MatchF(_L("PIPE1.PLP"))!=KErrNotFound || fileName.MatchF(_L("FOUR"))!=KErrNotFound || fileName.MatchF(_L("File*.TXT"))!=KErrNotFound || fileName.MatchF(_L("ah"))!=KErrNotFound || fileName.MatchF(_L("a"))!=KErrNotFound); |
0 | 64 |
} |
65 |
return(MFileManObserver::EContinue); |
|
66 |
} |
|
67 |
||
68 |
LOCAL_C void WaitForSuccess() |
|
69 |
// |
|
70 |
// Wait for gStat to complete with KErrNone |
|
71 |
// |
|
72 |
{ |
|
73 |
User::WaitForRequest(gStat); |
|
74 |
test(gStat==KErrNone); |
|
75 |
} |
|
76 |
||
77 |
LOCAL_C void WaitForResult(TInt aResult) |
|
78 |
// |
|
79 |
// Wait for gStat to complete with aResult |
|
80 |
// |
|
81 |
{ |
|
82 |
User::WaitForRequest(gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
83 |
test_Value(aResult, gStat==aResult); |
0 | 84 |
} |
85 |
||
86 |
LOCAL_C void TestResult(TInt aReturnVal, TInt aExpectedAsynchReturnStatus=KErrNone, TInt aExpectedSynchReturn=KErrNone) |
|
87 |
// |
|
88 |
// Test the result, wait for an asynchronous call |
|
89 |
// |
|
90 |
{ |
|
91 |
if (!gAsynch) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
92 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
93 |
test_Equal(aExpectedAsynchReturnStatus, aReturnVal); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
94 |
} |
0 | 95 |
else |
96 |
{ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
97 |
test_Equal(aExpectedSynchReturn, aReturnVal); |
0 | 98 |
WaitForResult(aExpectedAsynchReturnStatus); |
99 |
} |
|
100 |
} |
|
101 |
||
102 |
LOCAL_C void RmDir(const TDesC& aDirName) |
|
103 |
// |
|
104 |
// Remove a directory |
|
105 |
// |
|
106 |
{ |
|
107 |
gFileMan->Attribs(aDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse); |
|
108 |
TInt r=gFileMan->RmDir(aDirName); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
test_Value(r, r==KErrNone || r==KErrNotFound || r==KErrPathNotFound); |
0 | 110 |
} |
111 |
||
112 |
LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2) |
|
113 |
// |
|
114 |
// Test that the contents of two directories are identical |
|
115 |
// |
|
116 |
{ |
|
117 |
CDirScan* scanDir1=CDirScan::NewL(TheFs); |
|
118 |
scanDir1->SetScanDataL(aDir1,KEntryAttMaskSupported,ESortByName); |
|
119 |
CDirScan* scanDir2=CDirScan::NewL(TheFs); |
|
120 |
scanDir2->SetScanDataL(aDir2,KEntryAttMaskSupported,ESortByName); |
|
121 |
||
122 |
FOREVER |
|
123 |
{ |
|
124 |
CDir* entryList1; |
|
125 |
CDir* entryList2; |
|
126 |
||
127 |
scanDir1->NextL(entryList1); |
|
128 |
scanDir2->NextL(entryList2); |
|
129 |
||
130 |
if (entryList1==NULL || entryList2==NULL) |
|
131 |
{ |
|
132 |
test(entryList1==NULL && entryList2==NULL); |
|
133 |
break; |
|
134 |
} |
|
135 |
||
136 |
TFileName abbPath1=scanDir1->AbbreviatedPath(); |
|
137 |
TFileName abbPath2=scanDir2->AbbreviatedPath(); |
|
138 |
test(abbPath1==abbPath2); |
|
139 |
||
140 |
TInt count1=entryList1->Count(); |
|
141 |
TInt count2=entryList2->Count(); |
|
142 |
test(count1==count2); |
|
143 |
||
144 |
while(count1--) |
|
145 |
{ |
|
146 |
TEntry entry1=(*entryList1)[count1]; |
|
147 |
TEntry entry2=(*entryList2)[count1]; |
|
148 |
test(entry1.iName==entry2.iName); |
|
149 |
test(entry1.iAtt==entry2.iAtt); |
|
150 |
} |
|
151 |
||
152 |
delete entryList1; |
|
153 |
delete entryList2; |
|
154 |
} |
|
155 |
||
156 |
delete scanDir1; |
|
157 |
delete scanDir2; |
|
158 |
} |
|
159 |
||
160 |
LOCAL_C void SetupDirectories(TBool aCreateFiles, TFileName* aDestOtherDrive) |
|
161 |
// |
|
162 |
// Set up a directory structure and files to test copying/moving across drives |
|
163 |
// |
|
164 |
{ |
|
165 |
TInt err = KErrNone; |
|
166 |
||
167 |
TFileName sourceName = _L("\\F32-TST\\TFMAN\\source\\"); |
|
168 |
TFileName sourceNameSubDir = _L("\\F32-TST\\TFMAN\\source\\subdir\\"); |
|
169 |
TFileName sourceCompare = _L("\\F32-TST\\TFMAN\\compare\\"); |
|
170 |
TFileName sourceCompareSubDir = _L("\\F32-TST\\TFMAN\\compare\\subdir\\"); |
|
171 |
TFileName destSameDrive = _L("\\F32-TST\\TFMAN\\dest\\"); // Target destination on the same drive |
|
172 |
||
173 |
if(aDestOtherDrive) |
|
174 |
{ |
|
175 |
#if !defined(__WINS__) |
|
176 |
*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("D:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
|
177 |
#else |
|
178 |
*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\"); |
|
179 |
#endif |
|
180 |
err = TheFs.MkDirAll(*aDestOtherDrive); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
181 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 182 |
} |
183 |
||
184 |
err = TheFs.MkDirAll(sourceName); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
185 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 186 |
|
187 |
err = TheFs.MkDirAll(sourceCompare); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
188 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 189 |
|
190 |
err = TheFs.MkDirAll(destSameDrive); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
191 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 192 |
|
193 |
if(aCreateFiles) |
|
194 |
{ |
|
195 |
err = TheFs.MkDirAll(sourceNameSubDir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
196 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 197 |
|
198 |
err = TheFs.MkDirAll(sourceCompareSubDir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
199 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 200 |
|
201 |
for(TInt i=0; i<5; i++) |
|
202 |
{ |
|
203 |
// Create a test file to be copied |
|
204 |
TFileName name = sourceName; |
|
205 |
name.Append(_L("File")); |
|
206 |
name.AppendNum(i); |
|
207 |
name.Append(_L(".TXT")); |
|
208 |
||
209 |
RFile file; |
|
210 |
err = file.Create(TheFs,name,EFileRead|EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
211 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 212 |
file.Close(); |
213 |
||
214 |
// ...and another to compare against |
|
215 |
name = sourceCompare; |
|
216 |
name.Append(_L("File")); |
|
217 |
name.AppendNum(i); |
|
218 |
name.Append(_L(".TXT")); |
|
219 |
||
220 |
err = file.Create(TheFs,name,EFileRead|EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
221 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 222 |
file.Close(); |
223 |
} |
|
224 |
} |
|
225 |
} |
|
226 |
||
227 |
TBool CheckIfShortPathsAreSupported() |
|
228 |
{ |
|
229 |
TBool ret = EFalse; |
|
230 |
TBuf<1+8+3+1+4> buf; |
|
231 |
_LIT(KTestFile, "\\longname1\\file"); |
|
232 |
RmDir(_L("\\longname1\\")); |
|
233 |
MakeFile(KTestFile); |
|
234 |
TInt err = TheFs.GetShortName(_L("\\longname1\\"), buf); |
|
235 |
if(err == KErrNone) |
|
236 |
{ |
|
237 |
buf.Insert(0, _L("\\")); |
|
238 |
buf.Append(_L("\\file")); |
|
239 |
err = TheFs.Delete(buf); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
240 |
test_KErrNone(err); |
0 | 241 |
ret = ETrue; |
242 |
} |
|
243 |
RmDir(_L("\\longname1\\")); |
|
244 |
return ret; |
|
245 |
} |
|
246 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
247 |
LOCAL_C void TestDelete() |
0 | 248 |
// |
249 |
// Test files are deleted |
|
250 |
// |
|
251 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
252 |
test.Next(_L("Test delete - Set up files and start deleting")); |
0 | 253 |
|
254 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
|
255 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
256 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
|
257 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
|
258 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
259 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
260 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
|
261 |
||
262 |
TInt r; |
|
263 |
// absolute path for code warrior two more than wins (\epoc32\winscw\c vs \epoc32\wins\c) |
|
264 |
#if defined(__WINSCW__) |
|
265 |
_LIT(KLongName1,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffd"); |
|
266 |
#else |
|
267 |
_LIT(KLongName1,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa"); |
|
268 |
#endif |
|
269 |
||
270 |
_LIT(KInvalidLongName,"\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdffdsa23asdffdsa24asdffdsa25asdffdsa"); |
|
271 |
_LIT(KInvalidLongPath, "\\F32-TST\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\0495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\PLATTEST\\FileStore\\TestData\\20495_Folder\\middle.gif"); |
|
272 |
if (testingInvalidPathLengths) |
|
273 |
// Create a path of greater 256 characters by renaming a directory and check it can be |
|
274 |
// manipulated (tests fix to F32) |
|
275 |
{ |
|
276 |
// One long directory name - makes paths invalid |
|
277 |
MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE")); |
|
278 |
MakeDir(_L("\\TEST\\LONG\\NAME\\ABCDE\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
279 |
MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
|
280 |
MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
|
281 |
TFileName name1(KLongName1); |
|
282 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),name1,CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
283 |
test_KErrNone(r); |
0 | 284 |
// Two long directory names - makes paths invalid |
285 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
|
286 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
287 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
|
288 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
|
289 |
||
290 |
// Testing invalid long file name (i.e. >256) |
|
291 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongName,CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
292 |
test_Equal(KErrBadName, r); |
0 | 293 |
|
294 |
// Testing invalid long path (i.e. >256) |
|
295 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongPath,CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
296 |
test_Equal(KErrBadName, r); |
0 | 297 |
|
298 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
299 |
test_KErrNone(r); |
0 | 300 |
} |
301 |
||
302 |
//testing invalid source path at the beginning: |
|
303 |
if (!gAsynch) |
|
304 |
{ |
|
305 |
r=gFileMan->Delete(_L(":C\\F32-TST\\TFMAN\\DELDIR\\*.TXT")); |
|
306 |
} |
|
307 |
else |
|
308 |
{ |
|
309 |
r=gFileMan->Delete(_L(":C\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat); |
|
310 |
} |
|
311 |
TestResult(r,KErrBadName,KErrBadName); |
|
312 |
||
313 |
//testing invalid source path at the middle: |
|
314 |
if (!gAsynch) |
|
315 |
{ |
|
316 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\:DELDIR\\*.TXT")); |
|
317 |
} |
|
318 |
else |
|
319 |
{ |
|
320 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\:DELDIR\\*.TXT"),0,gStat); |
|
321 |
} |
|
322 |
TestResult(r,KErrBadName,KErrNone); |
|
323 |
||
324 |
//testing invalid source path at the end: |
|
325 |
if (!gAsynch) |
|
326 |
{ |
|
327 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\:*.TXT")); |
|
328 |
} |
|
329 |
else |
|
330 |
{ |
|
331 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\:*.TXT"),0,gStat); |
|
332 |
} |
|
333 |
TestResult(r,KErrBadName,KErrNone); |
|
334 |
||
335 |
if (!gAsynch) |
|
336 |
{ |
|
337 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT")); |
|
338 |
TestResult(r); |
|
339 |
if (testingInvalidPathLengths) |
|
340 |
{ |
|
341 |
TFileName name1(KLongName1); |
|
342 |
name1+=_L("\\NAME\\ABCDE\\*.*"); |
|
343 |
r=gFileMan->Delete(name1); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
344 |
test_KErrNone(r); |
0 | 345 |
|
346 |
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
347 |
test_KErrNone(r); |
0 | 348 |
} |
349 |
} |
|
350 |
else |
|
351 |
{ |
|
352 |
gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),0,gStat); |
|
353 |
WaitForSuccess(); |
|
354 |
if (testingInvalidPathLengths) |
|
355 |
{ |
|
356 |
TFileName name1(KLongName1); |
|
357 |
name1+=_L("\\NAME\\ABCDE\\*.*"); |
|
358 |
r=gFileMan->Delete(name1,0,gStat); |
|
359 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
360 |
test_KErrNone(r); |
0 | 361 |
|
362 |
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"),0,gStat); |
|
363 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
364 |
test_KErrNone(r); |
0 | 365 |
} |
366 |
} |
|
367 |
||
368 |
test.Next(_L("Check files are deleted")); |
|
369 |
RmDir(_L("\\F32-TST\\TFMAN\\After\\")); |
|
370 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\EMPTY\\")); |
|
371 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
372 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
373 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\EXE2.BIN")); |
|
374 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\AFTER\\DELDIR\\*")); |
|
375 |
||
376 |
if (testingInvalidPathLengths) |
|
377 |
{ |
|
378 |
r=gFileMan->RmDir(_L("\\TEST\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
379 |
test_KErrNone(r); |
0 | 380 |
} |
381 |
||
382 |
/** |
|
383 |
Test wild card matching in short file names |
|
384 |
Note this test is only run on FAT file systems as 'short file names' are only |
|
385 |
supported by FAT. |
|
386 |
DEF130113: TTG:<Wild card characters cannot be handled in the short file names> |
|
387 |
*/ |
|
388 |
TInt theDrive; |
|
389 |
r=TheFs.CharToDrive(gDriveToTest,theDrive); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
390 |
test_KErrNone(r); |
0 | 391 |
TFSName f; |
392 |
r = TheFs.FileSystemName(f, theDrive); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
393 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 394 |
if (f.FindF(_L("Fat")) == 0 ) |
395 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
396 |
test.Next(_L("Test wild card matching in short file names")); |
0 | 397 |
MakeFile(_L("abcdefghi.txt")); |
398 |
TInt err = gFileMan->Delete(_L("ABCDEF~*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
399 |
test_KErrNone(err); |
0 | 400 |
MakeFile(_L("abcdefghi.txt")); |
401 |
err = gFileMan->Delete(_L("ABCDEF~*.TXT")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
402 |
test_KErrNone(err); |
0 | 403 |
MakeFile(_L("abcdefghi.txt")); |
404 |
err = gFileMan->Delete(_L("ABCDEF~*.?XT")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
405 |
test_KErrNone(err); |
0 | 406 |
MakeFile(_L("abcdefghi.txt")); |
407 |
err = gFileMan->Delete(_L("ABCDEF~1.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
408 |
test_KErrNone(err); |
0 | 409 |
} |
410 |
} |
|
411 |
||
412 |
LOCAL_C void TestCopy() |
|
413 |
// |
|
414 |
// Test copy |
|
415 |
// |
|
416 |
{ |
|
417 |
test.Next(_L("Test copy")); |
|
418 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
419 |
||
420 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
421 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
|
422 |
MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF")); |
|
423 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
424 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
|
425 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
|
426 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
427 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
428 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
|
429 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA1.TXT")); |
|
430 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA2.TXT")); |
|
431 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA3.TXT")); |
|
432 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA4.TXT")); |
|
433 |
||
434 |
test.Next(_L("Test copy files to the same directory")); |
|
435 |
TInt r; |
|
436 |
||
437 |
if (testingInvalidPathLengths) |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
438 |
// Create a path of greater than 256 characters by renaming a directory and |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
439 |
// check it can be manipulated (tests fix to F32) |
0 | 440 |
{ |
441 |
MakeDir(_L("\\START\\LONG\\")); |
|
442 |
MakeDir(_L("\\FINISH\\")); |
|
443 |
MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
|
444 |
MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
|
445 |
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
|
446 |
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
|
447 |
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
448 |
test_KErrNone(r); |
0 | 449 |
MakeDir(_L("\\START\\ASDFFDSA\\")); |
450 |
} |
|
451 |
||
452 |
//testing invalid source path at the beginning: |
|
453 |
if (!gAsynch) |
|
454 |
{ |
|
455 |
r=gFileMan->Copy(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0); |
|
456 |
} |
|
457 |
else |
|
458 |
{ |
|
459 |
r=gFileMan->Copy(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat); |
|
460 |
} |
|
461 |
TestResult(r,KErrBadName,KErrBadName); |
|
462 |
||
463 |
//testing invalid target path at the beginning: |
|
464 |
||
465 |
if (!gAsynch) |
|
466 |
{ |
|
467 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0); |
|
468 |
} |
|
469 |
else |
|
470 |
{ |
|
471 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat); |
|
472 |
} |
|
473 |
TestResult(r,KErrBadName,KErrBadName); |
|
474 |
||
475 |
//testing invalid source path at the middle: |
|
476 |
if (!gAsynch) |
|
477 |
{ |
|
478 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\:DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0); |
|
479 |
} |
|
480 |
else |
|
481 |
{ |
|
482 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\:DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat); |
|
483 |
} |
|
484 |
TestResult(r,KErrBadName,KErrNone); |
|
485 |
||
486 |
//testing invalid target path at the middle: |
|
487 |
if (!gAsynch) |
|
488 |
{ |
|
489 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0); |
|
490 |
} |
|
491 |
else |
|
492 |
{ |
|
493 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0,gStat); |
|
494 |
} |
|
495 |
TestResult(r,KErrBadName,KErrNone); |
|
496 |
||
497 |
//testing invalid source path at the end: |
|
498 |
if (!gAsynch) |
|
499 |
{ |
|
500 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\:file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0); |
|
501 |
} |
|
502 |
else |
|
503 |
{ |
|
504 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\:file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\rumba?.txt"),0,gStat); |
|
505 |
} |
|
506 |
TestResult(r,KErrBadName,KErrNone); |
|
507 |
||
508 |
//testing invalid target path at the end: |
|
509 |
if (!gAsynch) |
|
510 |
{ |
|
511 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\:rumba?.txt"),0); |
|
512 |
} |
|
513 |
else |
|
514 |
{ |
|
515 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\:DELDIR\\:rumba?.txt"),0,gStat); |
|
516 |
} |
|
517 |
TestResult(r,KErrBadName,KErrNone); |
|
518 |
||
519 |
if (!gAsynch) |
|
520 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0); |
|
521 |
else |
|
522 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat); |
|
523 |
TestResult(r,KErrAlreadyExists); |
|
524 |
||
525 |
if (!gAsynch) |
|
526 |
r = gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\rumba.txt"),0); |
|
527 |
else |
|
528 |
r = gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\rumba.txt"),0,gStat); |
|
529 |
TestResult(r,KErrNone); |
|
530 |
||
531 |
if (!gAsynch) |
|
532 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\file1.txt"),0); |
|
533 |
else |
|
534 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\file1.txt"),0,gStat); |
|
535 |
TestResult(r,KErrAlreadyExists); |
|
536 |
||
537 |
if (!gAsynch) |
|
538 |
{ |
|
539 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
540 |
test_KErrNone(r); |
0 | 541 |
if (testingInvalidPathLengths) |
542 |
{ |
|
543 |
test.Next(_L("Test invalid length paths")); |
|
544 |
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
545 |
test_KErrNone(r); |
0 | 546 |
r=gFileMan->RmDir(_L("\\START\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
547 |
test_KErrNone(r); |
0 | 548 |
r=gFileMan->RmDir(_L("\\FINISH\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
549 |
test_KErrNone(r); |
0 | 550 |
} |
551 |
} |
|
552 |
else |
|
553 |
{ |
|
554 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat); |
|
555 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
556 |
test_KErrNone(r); |
0 | 557 |
if (testingInvalidPathLengths) |
558 |
{ |
|
559 |
test.Next(_L("Test invalid length paths (Asynch)")); |
|
560 |
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),0,gStat); |
|
561 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
562 |
test_KErrNone(r); |
0 | 563 |
r=gFileMan->RmDir(_L("\\START\\"),gStat); |
564 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
565 |
test_KErrNone(r); |
0 | 566 |
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
567 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
568 |
test_KErrNone(r); |
0 | 569 |
} |
570 |
} |
|
571 |
||
572 |
if (!gAsynch) |
|
573 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
574 |
else |
|
575 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NewDir\\*.*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat); |
|
576 |
TestResult(r); |
|
577 |
||
578 |
test.Next(_L("Check files have been copied")); |
|
579 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
580 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT")); |
|
581 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE2.TXT")); |
|
582 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE3.TXT")); |
|
583 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA1.TXT")); |
|
584 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA2.TXT")); |
|
585 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA3.TXT")); |
|
586 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA4.TXT")); |
|
587 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\ABC.DEF")); |
|
588 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
589 |
||
590 |
TFileName fn = _L("Z:\\TEST\\T_FSRV.CPP"); |
|
591 |
fn[0] = gExeFileName[0]; |
|
592 |
if (!gAsynch) |
|
593 |
r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
594 |
else |
|
595 |
r=gFileMan->Copy(fn,_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat); |
|
596 |
TestResult(KErrNone); |
|
597 |
||
598 |
TEntry entry; |
|
599 |
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
600 |
test_KErrNone(r); |
0 | 601 |
test(entry.iName.MatchF(_L("T_FSRV.CPP"))!=KErrNotFound); |
602 |
#if defined (__WINS__) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
603 |
test_Equal(KEntryAttArchive, entry.iAtt); |
0 | 604 |
#else |
605 |
if (!IsTestingLFFS()) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
606 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
607 |
test_Equal(KEntryAttReadOnly, entry.iAtt); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
608 |
} |
0 | 609 |
else |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
610 |
{ |
0 | 611 |
test(entry.iAtt&KEntryAttReadOnly); // ??? |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
612 |
} |
0 | 613 |
#endif |
614 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),0,KEntryAttReadOnly); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
615 |
test_KErrNone(r); |
0 | 616 |
|
617 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
618 |
test_KErrNone(r); |
0 | 619 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
620 |
test_KErrNone(r); |
0 | 621 |
} |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
622 |
|
0 | 623 |
LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath) |
624 |
{ |
|
625 |
RmDir(aSrcPath); |
|
626 |
MakeDir(aSrcPath); |
|
627 |
||
628 |
for(TInt index=0; index<10; index++) |
|
629 |
{ |
|
630 |
TFileName fileName; |
|
631 |
fileName.Copy(aSrcPath); |
|
632 |
fileName.Append(_L("FILE_"));fileName.AppendNum(index);fileName.Append(_L(".TXT")); |
|
633 |
MakeFile(fileName, _L8("Some Data")); |
|
634 |
} |
|
635 |
} |
|
636 |
||
637 |
LOCAL_C void TestDEF121663() |
|
638 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
639 |
test.Next(_L("Test moving directory to its subdirectory (DEF121663)")); |
0 | 640 |
|
641 |
gFileMan->SetObserver(NULL); |
|
642 |
TInt err = 0; |
|
643 |
TFileName srcPath = _L("C:\\TestDEF121663\\"); |
|
644 |
||
645 |
TestDEF121663_Setup(srcPath); |
|
646 |
if(!gAsynch) |
|
647 |
{ |
|
648 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite); |
|
649 |
} |
|
650 |
else |
|
651 |
{ |
|
652 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite, gStat); |
|
653 |
} |
|
654 |
TestResult(err,KErrInUse,KErrInUse); |
|
655 |
||
656 |
TestDEF121663_Setup(srcPath); |
|
657 |
if(!gAsynch) |
|
658 |
{ |
|
659 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::EOverWrite); |
|
660 |
} |
|
661 |
else |
|
662 |
{ |
|
663 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::EOverWrite, gStat); |
|
664 |
} |
|
665 |
TestResult(err,KErrPathNotFound); |
|
666 |
||
667 |
TestDEF121663_Setup(srcPath); |
|
668 |
if(!gAsynch) |
|
669 |
{ |
|
670 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite); |
|
671 |
} |
|
672 |
else |
|
673 |
{ |
|
674 |
err = gFileMan->Move(_L("C:\\TestDEF121663\\"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::EOverWrite, gStat); |
|
675 |
} |
|
676 |
TestResult(err,KErrPathNotFound); |
|
677 |
||
678 |
TestDEF121663_Setup(srcPath); |
|
679 |
if(!gAsynch) |
|
680 |
{ |
|
681 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::ERecurse|CFileMan::EOverWrite); |
|
682 |
} |
|
683 |
else |
|
684 |
{ |
|
685 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663\\"),CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
|
686 |
} |
|
687 |
TestResult(err,KErrInUse,KErrInUse); |
|
688 |
||
689 |
TestDEF121663_Setup(srcPath); |
|
690 |
if(!gAsynch) |
|
691 |
{ |
|
692 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::ERecurse); |
|
693 |
} |
|
694 |
else |
|
695 |
{ |
|
696 |
err = gFileMan->Move(_L("C:\\TestDEF121663"),_L("C:\\TestDEF121663\\TestDEF121663"),CFileMan::ERecurse, gStat); |
|
697 |
} |
|
698 |
TestResult(err,KErrInUse,KErrInUse); |
|
699 |
||
700 |
gFileMan->SetObserver(gObserver); |
|
701 |
// remove previous dirs |
|
702 |
RmDir(_L("C:\\TestDEF121663\\")); |
|
703 |
} |
|
704 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
705 |
// Test moving directories where source and target have matching subdirectory structures |
0 | 706 |
LOCAL_C void TestDEF123575() |
707 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
708 |
test.Next(_L("Test moving directories with matching subdirectory structures (DEF123575)")); |
0 | 709 |
TFileName srcPath; |
710 |
TFileName destPath; |
|
711 |
TInt err; |
|
712 |
//setup the initial directory structure |
|
713 |
srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\"); |
|
714 |
destPath = _L("\\F32-TST\\DEF123575\\DSTDIR\\CommonDIR\\temp\\temp1.1\\"); |
|
715 |
MakeDir(srcPath); |
|
716 |
MakeDir(destPath); |
|
717 |
MakeFile(_L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR\\temp\\temp1.1\\FILE1.TXT")); |
|
718 |
||
719 |
srcPath = _L("\\F32-TST\\DEF123575\\SRCDIR\\CommonDIR"); |
|
720 |
destPath = _L("\\F32-TST\\DEF123575\\DSTDIR\\"); |
|
721 |
if(!gAsynch) |
|
722 |
{ |
|
723 |
err = gFileMan->Move(srcPath,destPath,CFileMan::EOverWrite); |
|
724 |
} |
|
725 |
else |
|
726 |
{ |
|
727 |
err = gFileMan->Move(srcPath,destPath,CFileMan::EOverWrite, gStat); |
|
728 |
} |
|
729 |
TestResult(err,KErrNone,KErrNone); |
|
730 |
||
731 |
//test that source directory is empty after move |
|
732 |
MakeDir(_L("\\F32-TST\\DEF123575\\AFTER\\")); |
|
733 |
Compare(_L("\\F32-TST\\DEF123575\\SRCDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*")); |
|
734 |
//test that the files have been moved to the destination directory |
|
735 |
MakeDir(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\")); |
|
736 |
MakeFile(_L("\\F32-TST\\DEF123575\\AFTER\\CommonDIR\\temp\\temp1.1\\FILE1.TXT")); |
|
737 |
Compare(_L("\\F32-TST\\DEF123575\\DSTDIR\\*"),_L("\\F32-TST\\DEF123575\\AFTER\\*")); |
|
738 |
||
739 |
//delete the entire directory structure |
|
740 |
RmDir(_L("\\F32-TST\\DEF123575\\*")); |
|
741 |
} |
|
742 |
||
743 |
LOCAL_C void TestDEF125570() |
|
744 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
745 |
test.Next(_L("Test move when trg has at least one of the src dirs (DEF125570)")); |
0 | 746 |
gFileMan->SetObserver(NULL); |
747 |
TInt err = KErrNone; |
|
748 |
TFileName srcPath = _L("C:\\TestDEF125570\\src\\"); |
|
749 |
TFileName trgPath = _L("C:\\TestDEF125570\\trg\\"); |
|
750 |
||
751 |
// remove previous dirs |
|
752 |
RmDir(srcPath); |
|
753 |
RmDir(trgPath); |
|
754 |
||
755 |
//create src |
|
756 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR1\\")); |
|
757 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\File1.txt")); |
|
758 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\File2.txt")); |
|
759 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\")); |
|
760 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\DIR11\\File1.txt")); |
|
761 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR1\\DIR11\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR1\\DIR11\\File2.txt")); |
|
762 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR2\\")); |
|
763 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\File1.txt")); |
|
764 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\File2.txt")); |
|
765 |
MakeDir(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\")); |
|
766 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\DIR12\\File1.txt")); |
|
767 |
MakeFile(_L("C:\\TestDEF125570\\src\\DIR2\\DIR12\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\SRC\\DIR2\\DIR12\\File2.txt")); |
|
768 |
||
769 |
//trg has at least one of the src subfolders |
|
770 |
MakeDir(_L("C:\\TestDEF125570\\trg\\DIR2\\")); |
|
771 |
MakeFile(_L("C:\\TestDEF125570\\trg\\DIR2\\File1.txt"),_L8("FILE PATH : C:\\TestDEF125570\\TRG\\DIR2\\File1.txt")); |
|
772 |
MakeFile(_L("C:\\TestDEF125570\\trg\\DIR2\\File2.txt"),_L8("FILE PATH : C:\\TestDEF125570\\TRG\\DIR2\\File2.txt")); |
|
773 |
||
774 |
if(!gAsynch) |
|
775 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite); |
|
776 |
else |
|
777 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
|
778 |
TestResult(err); |
|
779 |
gFileMan->SetObserver(gObserver); |
|
780 |
// remove previous dirs |
|
781 |
RmDir(_L("C:\\TestDEF125570\\")); |
|
782 |
} |
|
783 |
||
784 |
LOCAL_C void TestDEF130404() |
|
785 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
786 |
test.Printf(_L("Test move when the src doesn't fully exist (DEF130404)")); |
0 | 787 |
|
788 |
TInt r = 0; |
|
789 |
TFileName trgPath; |
|
790 |
trgPath.Format(_L("%c:\\TestDEF130404\\Trg\\"), (TUint8)gDriveToTest); |
|
791 |
TFileName srcPath; |
|
792 |
srcPath.Format(_L("C:\\TestDEF130404\\Src\\DIR1\\"), (TUint8)gDriveToTest); |
|
793 |
||
794 |
// clean up before testing |
|
795 |
RmDir(srcPath); |
|
796 |
RmDir(trgPath); |
|
797 |
||
798 |
MakeDir(srcPath); |
|
799 |
srcPath.Append(_L("NODIR\\*.*")); |
|
800 |
MakeDir(trgPath); |
|
801 |
||
802 |
if(!gAsynch) |
|
803 |
r = gFileMan->Move(srcPath, trgPath, 0); |
|
804 |
else |
|
805 |
r = gFileMan->Move(srcPath, trgPath, 0, gStat); |
|
806 |
TestResult(r,KErrPathNotFound); |
|
807 |
||
808 |
// clean up before leaving |
|
809 |
trgPath.Format(_L("%c:\\TestDEF130404\\"), (TUint8)gDriveToTest); |
|
810 |
RmDir(trgPath); |
|
811 |
RmDir(_L("C:\\TestDEF130404\\")); |
|
812 |
} |
|
813 |
||
814 |
||
815 |
/** |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
816 |
This is to test that moving files to overwrite folders with the same names |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
817 |
and moving folders (directories) to overwrite files with the same names |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
818 |
across drives return proper error codes |
0 | 819 |
*/ |
820 |
void TestPDEF137716() |
|
821 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
822 |
// Do not run tests if we cannot move across different drives |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
823 |
if (gSessionPath[0]=='C') |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
824 |
return; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
825 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
826 |
// Move FILE to overwrite FOLDER -------------------------------------------------------- |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
827 |
test.Next(_L("Test moving files to overwrite folders with the same names")); |
0 | 828 |
gFileMan->SetObserver(NULL); |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
829 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
830 |
_LIT(KFixedTargetTestFolder, "\\PDEF137716\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
831 |
_LIT(KFileToDirTargetCreatePath, "\\PDEF137716\\FileToDir_Target\\ITEM\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
832 |
_LIT(KFileToDirTargetNameWild, "\\PDEF137716\\FileToDir_Target\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
833 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
834 |
_LIT(KFixedSourceTestFolder, "C:\\PDEF137716\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
835 |
_LIT(KFileToDirSourceName, "C:\\PDEF137716\\FileToDir_Source\\ITEM"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
836 |
_LIT(KFileToDirSourceNameWild, "C:\\PDEF137716\\FileToDir_Source\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
837 |
|
0 | 838 |
RmDir(KFixedTargetTestFolder); |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
839 |
RmDir(KFixedSourceTestFolder); |
0 | 840 |
MakeDir(KFileToDirTargetCreatePath); |
841 |
MakeFile(KFileToDirSourceName); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
842 |
TInt err = KErrNone; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
843 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
844 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
845 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
846 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
847 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
848 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
849 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
850 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, 0, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
851 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
852 |
TestResult(err,KErrAccessDenied); |
0 | 853 |
|
854 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
855 |
RmDir(KFixedSourceTestFolder); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
856 |
MakeDir(KFileToDirTargetCreatePath); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
857 |
MakeFile(KFileToDirSourceName); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
858 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
859 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
860 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
861 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
862 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
863 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
864 |
err = gFileMan->Move(KFileToDirSourceName, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
865 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
866 |
TestResult(err,KErrAccessDenied); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
867 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
868 |
RmDir(KFixedTargetTestFolder); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
869 |
RmDir(KFixedSourceTestFolder); |
0 | 870 |
MakeDir(KFileToDirTargetCreatePath); |
871 |
MakeFile(KFileToDirSourceName); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
872 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
873 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
874 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
875 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
876 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
877 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
878 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, 0, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
879 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
880 |
TestResult(err,KErrAccessDenied); |
0 | 881 |
|
882 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
883 |
RmDir(KFixedSourceTestFolder); |
0 | 884 |
MakeDir(KFileToDirTargetCreatePath); |
885 |
MakeFile(KFileToDirSourceName); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
886 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
887 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
888 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
889 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
890 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
891 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
892 |
err = gFileMan->Move(KFileToDirSourceNameWild, KFileToDirTargetNameWild, CFileMan::EOverWrite, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
893 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
894 |
TestResult(err,KErrAccessDenied); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
895 |
|
0 | 896 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
897 |
// Move FOLDER to overwrite FILE -------------------------------------------------------- |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
898 |
test.Next(_L("Test moving folders to overwrite files with the same names")); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
899 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
900 |
_LIT(KDirToFileTargetName, "\\PDEF137716\\DirToFile_Target\\ITEM"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
901 |
_LIT(KDirToFileTargetNameWild, "\\PDEF137716\\DirToFile_Target\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
902 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
903 |
_LIT(KDirToFileSourceName, "C:\\PDEF137716\\DirToFile_Source\\ITEM"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
904 |
_LIT(KDirToFileSourceNameWild, "C:\\PDEF137716\\DirToFile_Source\\"); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
905 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
906 |
_LIT(KDirToFileSourceCreatePath, "C:\\PDEF137716\\DirToFile_Source\\ITEM\\"); |
0 | 907 |
|
908 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
909 |
RmDir(KFixedSourceTestFolder); |
0 | 910 |
MakeFile(KDirToFileTargetName); |
911 |
MakeDir(KDirToFileSourceCreatePath); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
912 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
913 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
914 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
915 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
916 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
917 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
918 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, 0, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
919 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
920 |
TestResult(err,KErrAccessDenied,KErrAccessDenied); |
0 | 921 |
|
922 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
923 |
RmDir(KFixedSourceTestFolder); |
0 | 924 |
MakeFile(KDirToFileTargetName); |
925 |
MakeDir(KDirToFileSourceCreatePath); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
926 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
927 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
928 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
929 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
930 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
931 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
932 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetName, CFileMan::EOverWrite, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
933 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
934 |
TestResult(err,KErrAccessDenied,KErrAccessDenied); |
0 | 935 |
|
936 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
937 |
RmDir(KFixedSourceTestFolder); |
0 | 938 |
MakeFile(KDirToFileTargetName); |
939 |
MakeDir(KDirToFileSourceCreatePath); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
940 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
941 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
942 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
943 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
944 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
945 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
946 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, 0, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
947 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
948 |
TestResult(err,KErrAccessDenied,KErrAccessDenied); |
0 | 949 |
|
950 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
951 |
RmDir(KFixedSourceTestFolder); |
0 | 952 |
MakeFile(KDirToFileTargetName); |
953 |
MakeDir(KDirToFileSourceCreatePath); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
955 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
956 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
957 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
958 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
959 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
960 |
err = gFileMan->Move(KDirToFileSourceName, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
961 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
962 |
TestResult(err,KErrAccessDenied,KErrAccessDenied); |
0 | 963 |
|
964 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
965 |
RmDir(KFixedSourceTestFolder); |
0 | 966 |
MakeFile(KDirToFileTargetName); |
967 |
MakeDir(KDirToFileSourceCreatePath); |
|
968 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
969 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
970 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
971 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
972 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
973 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
974 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
975 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, 0, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
976 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
977 |
TestResult(err,KErrNotFound); |
0 | 978 |
|
979 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
980 |
RmDir(KFixedSourceTestFolder); |
0 | 981 |
MakeFile(KDirToFileTargetName); |
982 |
MakeDir(KDirToFileSourceCreatePath); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
983 |
if(!gAsynch) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
984 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
985 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
986 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
987 |
else |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
988 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
989 |
err = gFileMan->Move(KDirToFileSourceNameWild, KDirToFileTargetNameWild, CFileMan::EOverWrite, gStat); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
990 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
991 |
TestResult(err,KErrNotFound); |
0 | 992 |
|
993 |
RmDir(KFixedTargetTestFolder); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
994 |
RmDir(KFixedSourceTestFolder); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
995 |
gFileMan->SetObserver(gObserver); |
0 | 996 |
} |
997 |
||
998 |
LOCAL_C void TestMove() |
|
999 |
// |
|
1000 |
// Test Move |
|
1001 |
// |
|
1002 |
{ |
|
1003 |
test.Next(_L("Test move")); |
|
1004 |
RmDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\*")); |
|
1005 |
||
1006 |
MakeDir(_L("\\F32-TST\\TFMAN\\MOVEDIR\\")); |
|
1007 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
|
1008 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1009 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
|
1010 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
|
1011 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
1012 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
1013 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
|
1014 |
||
1015 |
TInt r=KErrNone; |
|
1016 |
||
1017 |
if (testingInvalidPathLengths) |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1018 |
// Create a path of greater 256 characters by renaming a directory and check it can be |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1019 |
// manipulated (tests fix to F32) |
0 | 1020 |
{ |
1021 |
MakeDir(_L("\\START\\LONG\\")); |
|
1022 |
MakeDir(_L("\\FINISH\\")); |
|
1023 |
MakeFile(_L("\\START\\LONG\\ABCDEFGH01ABCDEFGH01ABCDEFGH01ABCDEFGH01.txt")); |
|
1024 |
MakeFile(_L("\\START\\LONG\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
|
1025 |
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
|
1026 |
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt")); |
|
1027 |
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1028 |
test_KErrNone(r); |
0 | 1029 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1030 |
// Two long directory names - makes paths invalid |
0 | 1031 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
1032 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
1033 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
|
1034 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
|
1035 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1036 |
test_KErrNone(r); |
0 | 1037 |
|
1038 |
MakeDir(_L("\\START\\ASDFFDSA\\")); |
|
1039 |
} |
|
1040 |
||
1041 |
//testing invalid source path at the beginning: |
|
1042 |
if (!gAsynch) |
|
1043 |
{ |
|
1044 |
r=gFileMan->Move(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1045 |
} |
|
1046 |
else |
|
1047 |
{ |
|
1048 |
r=gFileMan->Move(_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat); |
|
1049 |
} |
|
1050 |
TestResult(r,KErrBadName,KErrBadName); |
|
1051 |
||
1052 |
//testing invalid target path at the beginning: |
|
1053 |
if (!gAsynch) |
|
1054 |
{ |
|
1055 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1056 |
} |
|
1057 |
else |
|
1058 |
{ |
|
1059 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L(":C:\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat); |
|
1060 |
} |
|
1061 |
TestResult(r,KErrBadName,KErrBadName); |
|
1062 |
||
1063 |
//testing invalid source path at the middle: |
|
1064 |
if (!gAsynch) |
|
1065 |
{ |
|
1066 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1067 |
} |
|
1068 |
else |
|
1069 |
{ |
|
1070 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat); |
|
1071 |
} |
|
1072 |
TestResult(r,KErrBadName,KErrNone); |
|
1073 |
||
1074 |
//testing invalid target path at the middle: |
|
1075 |
if (!gAsynch) |
|
1076 |
{ |
|
1077 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE1.TXT")); |
|
1078 |
} |
|
1079 |
else |
|
1080 |
{ |
|
1081 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\:DELDIR\\FILE*.TXT"),0,gStat); |
|
1082 |
} |
|
1083 |
TestResult(r,KErrBadName,KErrNone); |
|
1084 |
||
1085 |
//testing invalid source path at the end: |
|
1086 |
if (!gAsynch) |
|
1087 |
{ |
|
1088 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1089 |
} |
|
1090 |
else |
|
1091 |
{ |
|
1092 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat); |
|
1093 |
} |
|
1094 |
TestResult(r,KErrBadName,KErrNone); |
|
1095 |
||
1096 |
//testing invalid target path at the end: |
|
1097 |
if (!gAsynch) |
|
1098 |
{ |
|
1099 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE1.TXT")); |
|
1100 |
} |
|
1101 |
else |
|
1102 |
{ |
|
1103 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\:FILE*.TXT"),0,gStat); |
|
1104 |
} |
|
1105 |
TestResult(r,KErrBadName,KErrNone); |
|
1106 |
||
1107 |
||
1108 |
if (!gAsynch) |
|
1109 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT")); |
|
1110 |
else |
|
1111 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE?.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE*.TXT"),0,gStat); |
|
1112 |
TestResult(r,KErrNone); |
|
1113 |
||
1114 |
if ((!gAsynch)&&(testingInvalidPathLengths)) |
|
1115 |
{ |
|
1116 |
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1117 |
test_KErrNone(r); |
0 | 1118 |
|
1119 |
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1120 |
test_KErrNone(r); |
0 | 1121 |
|
1122 |
r=gFileMan->RmDir(_L("\\START\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1123 |
test_KErrNone(r); |
0 | 1124 |
r=gFileMan->RmDir(_L("\\FINISH\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1125 |
test_KErrNone(r); |
0 | 1126 |
} |
1127 |
if ((gAsynch)&&(testingInvalidPathLengths)) |
|
1128 |
{ |
|
1129 |
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),CFileMan::EOverWrite,gStat); |
|
1130 |
User::WaitForRequest(gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1131 |
test_KErrNone(r); |
0 | 1132 |
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse,gStat); |
1133 |
User::WaitForRequest(gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1134 |
test_KErrNone(r); |
0 | 1135 |
r=gFileMan->RmDir(_L("\\START\\"),gStat); |
1136 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1137 |
test_KErrNone(r); |
0 | 1138 |
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat); |
1139 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1140 |
test_KErrNone(r); |
0 | 1141 |
} |
1142 |
||
1143 |
if (!gAsynch) |
|
1144 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1145 |
else |
|
1146 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),0,gStat); |
|
1147 |
TestResult(r,KErrNone); |
|
1148 |
||
1149 |
if (!gAsynch) |
|
1150 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\")); |
|
1151 |
else |
|
1152 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\"),0,gStat); |
|
1153 |
TestResult(r); |
|
1154 |
||
1155 |
if (!gAsynch) |
|
1156 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR.\\FILE*.TXT")); |
|
1157 |
else |
|
1158 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE*.TXT"),0,gStat); |
|
1159 |
TestResult(r,KErrNotFound); |
|
1160 |
||
1161 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1162 |
if (!gAsynch) |
|
1163 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0); |
|
1164 |
else |
|
1165 |
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0,gStat); |
|
1166 |
TestResult(r,KErrAlreadyExists); |
|
1167 |
r=TheFs.Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1168 |
test_KErrNone(r); |
0 | 1169 |
|
1170 |
test.Next(_L("Check files have been moved")); |
|
1171 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*")); |
|
1172 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EMPTY\\")); |
|
1173 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\FILE4.TXT")); |
|
1174 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EXE1.BIN")); |
|
1175 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\EXE2.BIN")); |
|
1176 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\DELDIR\\*")); |
|
1177 |
||
1178 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*")); |
|
1179 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT")); |
|
1180 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE2.TXT")); |
|
1181 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE3.TXT")); |
|
1182 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\MOVEDIR\\*")); |
|
1183 |
||
1184 |
if (testingInvalidPathLengths) |
|
1185 |
{ |
|
1186 |
r=gFileMan->RmDir(_L("\\TEST\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1187 |
test_KErrNone(r); |
0 | 1188 |
} |
1189 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1190 |
TestDEF121663(); // Test moving directory to its subdirectory |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1191 |
TestDEF123575(); // Test moving directories where src and trg have matching subdirectory structures |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1192 |
TestDEF125570(); // Test move when trg has at least one of the src dirs |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1193 |
TestDEF130404(); // Test move when the src doesn't fully exist |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1194 |
if (!IsTestingLFFS()) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1195 |
TestPDEF137716(); // Test moving files to overwrite folders that have the same names |
0 | 1196 |
} |
1197 |
||
1198 |
LOCAL_C void TestSimultaneous() |
|
1199 |
// |
|
1200 |
// Create and run two CFileMen simultaneously |
|
1201 |
// |
|
1202 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1203 |
test.Next(_L("Test create and run two CFileMans simultaneously")); |
0 | 1204 |
RmDir(_L("\\F32-TST\\TFMAN\\fman2\\")); |
1205 |
||
1206 |
MakeDir(_L("\\F32-TST\\TFMAN\\FMAN1\\")); |
|
1207 |
MakeDir(_L("\\F32-TST\\TFMAN\\FMAN2\\")); |
|
1208 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\ROD.TXT")); |
|
1209 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\JANE.TXT")); |
|
1210 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN1\\FREDDY.TXT")); |
|
1211 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\BORIS.TXT")); |
|
1212 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\FREDRICK.TXT")); |
|
1213 |
MakeFile(_L("\\F32-TST\\TFMAN\\FMAN2\\PETER.TXT")); |
|
1214 |
||
1215 |
CFileMan* fman=CFileMan::NewL(TheFs); |
|
1216 |
TRequestStatus stat1; |
|
1217 |
TInt r=fman->Delete(_L("\\F32-TST\\TFMAN\\FMAN1\\*.*"),0,stat1); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1218 |
test_KErrNone(r); |
0 | 1219 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\FMAN2\\*.TXT"),_L("\\F32-TST\\TFMAN\\FMAN2\\*.EXT"),0,gStat); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1220 |
test_KErrNone(r); |
0 | 1221 |
FOREVER |
1222 |
{ |
|
1223 |
if (stat1!=KRequestPending && gStat!=KRequestPending) |
|
1224 |
break; |
|
1225 |
User::WaitForAnyRequest(); |
|
1226 |
} |
|
1227 |
test(stat1==KErrNone && gStat==KErrNone); |
|
1228 |
delete fman; |
|
1229 |
||
1230 |
test.Next(_L("Check all files")); |
|
1231 |
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*")); |
|
1232 |
||
1233 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\")); |
|
1234 |
Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN1\\*")); |
|
1235 |
||
1236 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\BORIS.EXT")); |
|
1237 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FREDRICK.EXT")); |
|
1238 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\PETER.EXT")); |
|
1239 |
Compare(_L("\\F32-TST\\TFMAN\\After\\*"),_L("\\F32-TST\\TFMAN\\FMAN2\\*")); |
|
1240 |
} |
|
1241 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1242 |
// Test wildcards are replaced with letters from the matched file (CFileMan::CreateTargetNameFromSource) |
0 | 1243 |
LOCAL_C void TestDEF092084() |
1244 |
{ |
|
1245 |
if(gAsynch) |
|
1246 |
{ |
|
1247 |
return; |
|
1248 |
} |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1249 |
test.Next(_L("Test wildcards are replaced with letters from the matched file (DEF092084)")); |
0 | 1250 |
MakeDir(_L("\\DEF092084")); |
1251 |
MakeFile(_L("\\DEF092084\\FILE1.TXT")); |
|
1252 |
||
1253 |
TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1254 |
test_KErrNone(r); |
0 | 1255 |
CheckFileExists(_L("\\DEF092084\\FILE1.DDB"), KErrNone); |
1256 |
||
1257 |
r = gFileMan->Rename(_L("\\DEF092084\\?*.DD?"),_L("\\DEF092084\\?*.TXT"), CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1258 |
test_KErrNone(r); |
0 | 1259 |
CheckFileExists(_L("\\DEF092084\\FILE1.TXT"), KErrNone); |
1260 |
||
1261 |
RmDir(_L("\\DEF092084\\")); |
|
1262 |
} |
|
1263 |
||
1264 |
//--------------------------------------------- |
|
1265 |
//! @SYMTestCaseID PBASE-T_FMAN-0542 |
|
1266 |
//! @SYMTestType UT |
|
1267 |
//! @SYMREQ INC109754 |
|
1268 |
//! @SYMTestCaseDesc 1. Tests that CFileMan::Rename() does not incorrectly remove empty source directory |
|
1269 |
//! @SYMTestActions Renames the only file from source directory to target directory, then check if |
|
1270 |
//! the empty source directory still exists. |
|
1271 |
//! 2. Tests the trailing backslash ("\") is interpreted to ("\*.*"). |
|
1272 |
//! @SYMTestExpectedResults The operation completes with error code KErrNone; |
|
1273 |
//! The empty source directory still exists. |
|
1274 |
//! @SYMTestPriority High |
|
1275 |
//! @SYMTestStatus Implemented |
|
1276 |
//--------------------------------------------- |
|
1277 |
void TestINC109754() |
|
1278 |
{ |
|
1279 |
test.Next(_L("Test empty source directory should exist after contents being renamed (INC109754)")); |
|
1280 |
TInt r = KErrNone; |
|
1281 |
// Setting up comparing dir |
|
1282 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754_C\\")); |
|
1283 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754_C\\SRC\\")); |
|
1284 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754_C\\TRG\\FILE.TXT")); |
|
1285 |
||
1286 |
// Setting up testing dir |
|
1287 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754\\")); |
|
1288 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754\\SRC\\FILE.TXT")); |
|
1289 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754\\TRG\\")); |
|
1290 |
||
1291 |
// Test case 1: CFileMan::Rename(_L("C:\\SRC\\"), _L("C:\\TRG\\")); |
|
1292 |
if (!gAsynch) |
|
1293 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\")); |
|
1294 |
else |
|
1295 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"),0,gStat); |
|
1296 |
TestResult(r); |
|
1297 |
Compare(_L("\\F32-TST\\TFMAN\\INC109754\\"), _L("\\F32-TST\\TFMAN\\INC109754_C\\")); |
|
1298 |
||
1299 |
// Setting up testing dir |
|
1300 |
RmDir( _L("\\F32-TST\\TFMAN\\INC109754\\")); |
|
1301 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC109754\\SRC\\FILE.TXT")); |
|
1302 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC109754\\TRG\\")); |
|
1303 |
||
1304 |
// Test case 2: CFileMan::Rename(_L("C:\\SRC\\*.*"), _L("C:\\TRG\\")); |
|
1305 |
if (!gAsynch) |
|
1306 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\")); |
|
1307 |
else |
|
1308 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\INC109754\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\INC109754\\TRG\\"),0,gStat); |
|
1309 |
TestResult(r); |
|
1310 |
Compare(_L("\\F32-TST\\TFMAN\\INC109754\\"), _L("\\F32-TST\\TFMAN\\INC109754_C\\")); |
|
1311 |
} |
|
1312 |
||
1313 |
||
1314 |
/* |
|
1315 |
Test code for INC111038() and executed with Cache enabled and FS_NOT_RUGGED. |
|
1316 |
*/ |
|
1317 |
LOCAL_C void TestINC111038() |
|
1318 |
{ |
|
1319 |
TInt r; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1320 |
test.Next(_L("Test example of incorrect attribute flushing")); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1321 |
|
0 | 1322 |
_LIT(KTestFile, "\\TESTFILE.TXT"); |
1323 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1324 |
test.Printf(_L("1: Create Test File\n")); |
0 | 1325 |
RFile testFile; |
1326 |
r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1327 |
test_KErrNone(r); |
0 | 1328 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1329 |
test.Printf(_L("2: Populate testFile1 Data\n")); |
0 | 1330 |
r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1331 |
test_KErrNone(r); |
0 | 1332 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1333 |
test.Printf(_L("3: Get Initial Attributes\n")); |
0 | 1334 |
TUint atts = 0; |
1335 |
r = testFile.Att(atts); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1336 |
test_KErrNone(r); |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1337 |
test.Printf(_L(" Attributes: %08x"), atts); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1338 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1339 |
test.Printf(_L("4: Set KEntryAttHidden Attribute\n")); |
0 | 1340 |
r = testFile.SetAtt(KEntryAttHidden, 0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1341 |
test_KErrNone(r); |
0 | 1342 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1343 |
test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n")); |
0 | 1344 |
r = testFile.Att(atts); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1345 |
test_KErrNone(r); |
0 | 1346 |
test(atts & KEntryAttHidden); |
1347 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1348 |
test.Printf(_L("6: Read Data from beginning of file testFile1\n")); |
0 | 1349 |
TBuf8<4> data; |
1350 |
r = testFile.Read(0, data); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1351 |
test_KErrNone(r); |
0 | 1352 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1353 |
test.Printf(_L("7: Close all the testFiles\n")); |
0 | 1354 |
testFile.Close(); |
1355 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1356 |
test.Printf(_L("8: Verify KEntryAttHidden is present\n")); |
0 | 1357 |
r = TheFs.Att(KTestFile, atts); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1358 |
test_KErrNone(r); |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1359 |
test.Printf(_L(" Finally, attributes are : %08x\n"), atts); |
0 | 1360 |
test(atts & KEntryAttHidden); |
1361 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1362 |
test.Printf(_L("9: Delete Test File\n")); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1363 |
r = TheFs.Delete(KTestFile); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1364 |
test_Value(r, r == KErrNone || r == KErrNotFound); |
0 | 1365 |
} |
1366 |
||
1367 |
LOCAL_C void TestDEF113299() |
|
1368 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1369 |
test.Next(_L("Test invalid file rename (DEF113299)")); |
0 | 1370 |
|
1371 |
TInt err =0; |
|
1372 |
TFileName srcFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\corner.html"); |
|
1373 |
TFileName trgFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle.html"); |
|
1374 |
TFileName trgInvalidFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mi?d**dle>.html"); // Invalid filename |
|
1375 |
TFileName renamedFileName = _L("C:\\F32-TST\\TFMAN\\DEF113299\\src\\mirderdle.html"); |
|
1376 |
||
1377 |
RmDir(_L("C:\\F32-TST\\TFMAN\\DEF113299\\")); |
|
1378 |
MakeFile(srcFileName,_L8("Test Data")); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1379 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1380 |
// Renaming a file with invalid special characters should fail with error code KErrBadName(-28) |
0 | 1381 |
if (!gAsynch) |
1382 |
err = gFileMan->Rename(srcFileName,trgInvalidFileName); |
|
1383 |
else |
|
1384 |
err = gFileMan->Rename(srcFileName,trgInvalidFileName, 0, gStat); |
|
1385 |
TestResult(err,KErrBadName); |
|
1386 |
||
1387 |
if(!gAsynch) |
|
1388 |
err = gFileMan->Rename(srcFileName,trgFileName); |
|
1389 |
else |
|
1390 |
err = gFileMan->Rename(srcFileName,trgFileName, 0, gStat); |
|
1391 |
TestResult(err,KErrNone); |
|
1392 |
||
1393 |
CheckFileExists(renamedFileName,KErrNone,ETrue); |
|
1394 |
} |
|
1395 |
||
1396 |
LOCAL_C void TestRename() |
|
1397 |
// |
|
1398 |
// Test rename with wildcards |
|
1399 |
// |
|
1400 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1401 |
test.Next(_L("Test rename with wildcards")); |
0 | 1402 |
RmDir(_L("\\F32-TST\\TFMAN\\rename\\dest\\")); |
1403 |
||
1404 |
MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\")); |
|
1405 |
MakeDir(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest\\")); |
|
1406 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abcDEF.TXT")); |
|
1407 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\abxx.TXT")); |
|
1408 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\HELLO.SPG")); |
|
1409 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\SHEET1.SPR")); |
|
1410 |
MakeFile(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\DirTest.TXT\\Unchanged.txt")); |
|
1411 |
||
1412 |
TInt r; |
|
1413 |
||
1414 |
if (testingInvalidPathLengths) |
|
1415 |
// Create a path of greater 256 characters by renaming a directory and check it can be |
|
1416 |
// manipulated (tests fix to F32) |
|
1417 |
{ |
|
1418 |
MakeDir(_L("\\LONGNAME\\")); |
|
1419 |
MakeDir(_L("\\LONGNAME\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
1420 |
MakeFile(_L("\\LONGNAME\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04.txt")); |
|
1421 |
MakeFile(_L("\\LONGNAME\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt")); |
|
1422 |
MakeFile(_L("\\LONGNAME\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.bin")); |
|
1423 |
r=gFileMan->Rename(_L("\\LONGNAME"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1424 |
test_KErrNone(r); |
0 | 1425 |
|
1426 |
// Two long directory names - makes paths invalid |
|
1427 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ")); |
|
1428 |
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
1429 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT.txt")); |
|
1430 |
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE.txt")); |
|
1431 |
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1432 |
test_KErrNone(r); |
0 | 1433 |
} |
1434 |
||
1435 |
//testing invalid source path at the beginning: |
|
1436 |
if (!gAsynch) |
|
1437 |
{ |
|
1438 |
r=gFileMan->Rename(_L("::C\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
1439 |
} |
|
1440 |
else |
|
1441 |
{ |
|
1442 |
r=gFileMan->Rename(_L("::C\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1443 |
} |
|
1444 |
TestResult(r,KErrBadName,KErrBadName); |
|
1445 |
||
1446 |
//testing invalid target path at the beginning: |
|
1447 |
||
1448 |
if (!gAsynch) |
|
1449 |
{ |
|
1450 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("::C\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
1451 |
} |
|
1452 |
else |
|
1453 |
{ |
|
1454 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("::C\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1455 |
} |
|
1456 |
TestResult(r,KErrBadName,KErrBadName); |
|
1457 |
||
1458 |
//testing invalid source path at the middle: |
|
1459 |
if (!gAsynch) |
|
1460 |
{ |
|
1461 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\:RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
1462 |
} |
|
1463 |
else |
|
1464 |
{ |
|
1465 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\:RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1466 |
} |
|
1467 |
TestResult(r,KErrBadName,KErrNone); |
|
1468 |
||
1469 |
//testing invalid target path at the middle: |
|
1470 |
if (!gAsynch) |
|
1471 |
{ |
|
1472 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\:RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
1473 |
} |
|
1474 |
else |
|
1475 |
{ |
|
1476 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\:RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1477 |
} |
|
1478 |
TestResult(r,KErrBadName,KErrNone); |
|
1479 |
||
1480 |
//testing invalid source path at the end: |
|
1481 |
if (!gAsynch) |
|
1482 |
{ |
|
1483 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\:*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
1484 |
} |
|
1485 |
else |
|
1486 |
{ |
|
1487 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\:*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1488 |
} |
|
1489 |
TestResult(r,KErrBadName,KErrNone); |
|
1490 |
||
1491 |
//testing invalid target path at the end: |
|
1492 |
if (!gAsynch) |
|
1493 |
{ |
|
1494 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\:*.DDB"),CFileMan::EOverWrite); |
|
1495 |
} |
|
1496 |
else |
|
1497 |
{ |
|
1498 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\:*.DDB"),CFileMan::EOverWrite,gStat); |
|
1499 |
} |
|
1500 |
TestResult(r,KErrBadName,KErrNone); |
|
1501 |
||
1502 |
if (!gAsynch) |
|
1503 |
{ |
|
1504 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1505 |
test_KErrNone(r); |
0 | 1506 |
if (testingInvalidPathLengths) |
1507 |
{ |
|
1508 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1509 |
test_Equal(KErrBadName, r); |
0 | 1510 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1511 |
test_KErrNone(r); |
0 | 1512 |
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.cat")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1513 |
test_KErrNone(r); |
0 | 1514 |
r=gFileMan->RmDir(_L("\\Shortened\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1515 |
test_KErrNone(r); |
0 | 1516 |
|
1517 |
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1518 |
test_KErrNone(r); |
0 | 1519 |
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1520 |
test_KErrNone(r); |
0 | 1521 |
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1522 |
test_KErrNone(r); |
0 | 1523 |
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1524 |
test_KErrNone(r); |
0 | 1525 |
r=gFileMan->RmDir(_L("\\OXO!\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1526 |
test_KErrNone(r); |
0 | 1527 |
|
1528 |
} |
|
1529 |
} |
|
1530 |
else |
|
1531 |
{ |
|
1532 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite,gStat); |
|
1533 |
WaitForSuccess(); |
|
1534 |
if (testingInvalidPathLengths) |
|
1535 |
{ |
|
1536 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1537 |
test_Equal(KErrBadName, r); |
0 | 1538 |
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite,gStat); |
1539 |
WaitForSuccess(); |
|
1540 |
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.bin"),0,gStat); |
|
1541 |
WaitForSuccess(); |
|
1542 |
r=gFileMan->RmDir(_L("\\Shortened\\"),gStat); |
|
1543 |
WaitForSuccess(); |
|
1544 |
||
1545 |
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite,gStat); |
|
1546 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1547 |
test_KErrNone(r); |
0 | 1548 |
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"),CFileMan::EOverWrite,gStat); |
1549 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1550 |
test_KErrNone(r); |
0 | 1551 |
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"),CFileMan::EOverWrite,gStat); |
1552 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1553 |
test_KErrNone(r); |
0 | 1554 |
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"),CFileMan::EOverWrite,gStat); |
1555 |
WaitForSuccess(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1556 |
test_KErrNone(r); |
0 | 1557 |
r=gFileMan->RmDir(_L("\\OXO!\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1558 |
test_KErrNone(r); |
0 | 1559 |
r=gFileMan->RmDir(_L("\\TEST\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1560 |
test_KErrNone(r); |
0 | 1561 |
} |
1562 |
} |
|
1563 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
1564 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.DDB")); |
|
1565 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.DDB")); |
|
1566 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest.DDB\\Unchanged.txt")); |
|
1567 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*")); |
|
1568 |
||
1569 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
1570 |
MakeDir(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest\\")); |
|
1571 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\HELLO.SPG")); |
|
1572 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\SHEET1.SPR")); |
|
1573 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*")); |
|
1574 |
||
1575 |
if (!gAsynch) |
|
1576 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.TXT")); |
|
1577 |
else |
|
1578 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.TXT"),0,gStat); |
|
1579 |
TestResult(r); |
|
1580 |
||
1581 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
1582 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abcDEF.TXT")); |
|
1583 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\abxx.TXT")); |
|
1584 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DirTest.TXT\\Unchanged.txt")); |
|
1585 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*")); |
|
1586 |
||
1587 |
test.Next(_L("Test rename case of filenames")); |
|
1588 |
MakeFile(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1")); |
|
1589 |
||
1590 |
if (!gAsynch) |
|
1591 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1")); |
|
1592 |
else |
|
1593 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),0,gStat); |
|
1594 |
TestResult(r); |
|
1595 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FileName1"),KErrNone,EFalse); |
|
1596 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),KErrNone,ETrue); |
|
1597 |
||
1598 |
if (!gAsynch) |
|
1599 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),CFileMan::EOverWrite); |
|
1600 |
else |
|
1601 |
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),CFileMan::EOverWrite,gStat); |
|
1602 |
TestResult(r); |
|
1603 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CASETEST\\FILENAME1"),KErrNone,ETrue); |
|
1604 |
||
1605 |
// Test behaviour for omitted parameters |
|
1606 |
// For this, default should be session path |
|
1607 |
TFileName sessionPath; |
|
1608 |
TInt err=TheFs.SessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1609 |
test_KErrNone(err); |
0 | 1610 |
|
1611 |
SetupDirectories(ETrue, NULL); |
|
1612 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1613 |
test_KErrNone(err); |
0 | 1614 |
|
1615 |
err = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source"), _L("")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1616 |
test_KErrNone(err); |
0 | 1617 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
1618 |
||
1619 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
1620 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
|
1621 |
SetupDirectories(ETrue, NULL); |
|
1622 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1623 |
test_KErrNone(err); |
0 | 1624 |
|
1625 |
err = gFileMan->Rename(_L(""), _L("\\F32-TST\\TFMAN\\dest\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1626 |
test_KErrNone(err); |
0 | 1627 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
1628 |
||
1629 |
err=TheFs.SetSessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1630 |
test_KErrNone(err); |
0 | 1631 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1632 |
TestINC109754(); // Test empty source directory should exist after contents being renamed |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1633 |
TestDEF092084(); // Test wildcards are replaced with letters from the matched file |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1634 |
TestDEF113299(); // Test invalid file rename |
0 | 1635 |
} |
1636 |
||
1637 |
LOCAL_C void TestAttribs() |
|
1638 |
// |
|
1639 |
// Test attribs |
|
1640 |
// |
|
1641 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1642 |
test.Next(_L("Test set file attributes")); |
0 | 1643 |
MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib1.AT")); |
1644 |
MakeFile(_L("\\F32-TST\\TFMAN\\ATTRIBS\\Attrib2.at")); |
|
1645 |
||
1646 |
TUint legalAttMask=KEntryAttMaskSupported&~(KEntryAttDir|KEntryAttVolume); |
|
1647 |
TUint setMask=KEntryAttReadOnly; |
|
1648 |
TUint clearMask=KEntryAttHidden|KEntryAttArchive; |
|
1649 |
if (!gAsynch) |
|
1650 |
{ |
|
1651 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0)); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1652 |
test_KErrNone(r); |
0 | 1653 |
} |
1654 |
else |
|
1655 |
{ |
|
1656 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1657 |
test_KErrNone(r); |
0 | 1658 |
WaitForSuccess(); |
1659 |
} |
|
1660 |
||
1661 |
CDirScan* scan=CDirScan::NewL(TheFs); |
|
1662 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
|
1663 |
CDir* entryList; |
|
1664 |
scan->NextL(entryList); |
|
1665 |
TInt count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1666 |
test_Equal(2, count); |
0 | 1667 |
TEntry entry=(*entryList)[0]; |
1668 |
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1669 |
test_Equal(KEntryAttReadOnly, entry.iAtt); |
0 | 1670 |
entry=(*entryList)[1]; |
1671 |
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1672 |
test_Equal(KEntryAttReadOnly, entry.iAtt); |
0 | 1673 |
delete entryList; |
1674 |
||
1675 |
TDateTime dateTime(1990,ENovember,20,9,5,0,0); |
|
1676 |
TTime time(dateTime); // FAT loses microseconds if try to convert HomeTime() |
|
1677 |
||
1678 |
if (!gAsynch) |
|
1679 |
{ |
|
1680 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1681 |
test_KErrNone(r); |
0 | 1682 |
} |
1683 |
else |
|
1684 |
{ |
|
1685 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time,0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1686 |
test_KErrNone(r); |
0 | 1687 |
WaitForSuccess(); |
1688 |
} |
|
1689 |
||
1690 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
|
1691 |
scan->NextL(entryList); |
|
1692 |
count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1693 |
test_Equal(2, count); |
0 | 1694 |
entry=(*entryList)[0]; |
1695 |
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1696 |
test_Equal(0, entry.iAtt); |
0 | 1697 |
TDateTime dt=(entry.iModified).DateTime(); |
1698 |
test(dt.Year()==dateTime.Year()); |
|
1699 |
test(dt.Month()==dateTime.Month()); |
|
1700 |
test(dt.Day()==dateTime.Day()); |
|
1701 |
test(dt.Hour()==dateTime.Hour()); |
|
1702 |
test(dt.Minute()==dateTime.Minute()); |
|
1703 |
test(dt.Second()==dateTime.Second()); |
|
1704 |
test(entry.iModified==time); |
|
1705 |
entry=(*entryList)[1]; |
|
1706 |
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1707 |
test_Equal(0, entry.iAtt); |
0 | 1708 |
test(entry.iModified==time); |
1709 |
delete entryList; |
|
1710 |
delete scan; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1711 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1712 |
TestINC111038(); // Test example of incorrect attribute flushing |
0 | 1713 |
} |
1714 |
||
1715 |
LOCAL_C void TestINC091841() |
|
1716 |
{ |
|
1717 |
if(gAsynch) |
|
1718 |
{ |
|
1719 |
return; |
|
1720 |
} |
|
1721 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1722 |
test.Next(_L("Test delete long fullnames (INC091841)")); |
0 | 1723 |
MakeDir(_L("\\12345678\\Book\\12345678\\")); |
1724 |
TFileName longname; |
|
1725 |
longname.Copy(_L("\\12345678\\Book\\12345678\\12345678901234567890123456789012345678901234567890.x")); |
|
1726 |
MakeFile(longname); |
|
1727 |
TFileName oldname = longname; |
|
1728 |
TInt ret = KErrNone; |
|
1729 |
while(ret == KErrNone) |
|
1730 |
{ |
|
1731 |
oldname = longname; |
|
1732 |
longname.Append(_L("xxxxx")); |
|
1733 |
ret = TheFs.Replace(oldname, longname); |
|
1734 |
} |
|
1735 |
if(oldname.Length() >= KMaxFileName-5) // if not, it means that we won't be calling ShrinkNames !! |
|
1736 |
{ |
|
1737 |
TInt r = gFileMan->Rename(_L("\\12345678\\Book\\12345678"),_L("\\INC091841\\Book\\012-235-abcd"),0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1738 |
test_KErrNone(r); |
0 | 1739 |
CDir* dir; |
1740 |
r = TheFs.GetDir(_L("\\INC091841\\Book\\012-235-abcd\\"), KEntryAttNormal, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1741 |
test_KErrNone(r); |
0 | 1742 |
r = KErrNotFound; |
1743 |
TInt dirlen = sizeof("\\INC091841\\Book\\012-235-abcd\\"); |
|
1744 |
for(TInt i=0; r==KErrNotFound && i<dir->Count(); i++) |
|
1745 |
{ |
|
1746 |
if((*dir)[i].iName.Length() + dirlen > oldname.Length()) |
|
1747 |
{ |
|
1748 |
r = KErrNone; |
|
1749 |
} |
|
1750 |
} |
|
1751 |
delete dir; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1752 |
test_KErrNone(r); |
0 | 1753 |
r = gFileMan->RmDir(_L("\\INC091841\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1754 |
test_KErrNone(r); |
0 | 1755 |
} |
1756 |
RmDir(_L("\\12345678\\")); |
|
1757 |
} |
|
1758 |
||
1759 |
LOCAL_C void TestRmDir() |
|
1760 |
// |
|
1761 |
// Test rmdir function |
|
1762 |
// |
|
1763 |
{ |
|
1764 |
test.Next(_L("Test rmdir function")); |
|
1765 |
||
1766 |
MakeDir(_L("\\F32-TST\\TFMAN\\RMDIR\\EMPTY\\")); |
|
1767 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\ALFRED.txt")); |
|
1768 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RICHARD.txt")); |
|
1769 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RMSUBDIR1\\RMSUBSUBDIR\\CHARLES.txt")); |
|
1770 |
MakeFile(_L("\\F32-TST\\TFMAN\\RMDIR\\RMSUBDIR2\\EDMUND.txt")); |
|
1771 |
MakeDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\")); |
|
1772 |
MakeFile(_L("\\F32-TST\\TFMAN\\TESTDIR\\DEF123044.txt")); |
|
1773 |
||
1774 |
TInt r; |
|
1775 |
||
1776 |
if (testingInvalidPathLengths) |
|
1777 |
// Create a path of greater 256 characters by renaming a directory and check it can be |
|
1778 |
// manipulated (tests fix to F32) |
|
1779 |
{ |
|
1780 |
MakeDir(_L("\\LONGNAMETEST\\")); |
|
1781 |
MakeDir(_L("\\LONGNAMETEST\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\")); |
|
1782 |
MakeFile(_L("\\LONGNAMETEST\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04")); |
|
1783 |
MakeFile(_L("\\LONGNAMETEST\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04")); |
|
1784 |
r=gFileMan->Rename(_L("\\LONGNAMETEST"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1785 |
test_KErrNone(r); |
0 | 1786 |
} |
1787 |
||
1788 |
//testing invalid source path at the beginning: |
|
1789 |
if (!gAsynch) |
|
1790 |
{ |
|
1791 |
r=gFileMan->RmDir(_L(":C:\\F32-TST\\TFMAN\\RMDIR\\*.AT")); |
|
1792 |
} |
|
1793 |
else |
|
1794 |
{ |
|
1795 |
r=gFileMan->RmDir(_L(":C:\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat); |
|
1796 |
} |
|
1797 |
TestResult(r,KErrBadName,KErrBadName); |
|
1798 |
||
1799 |
//testing invalid source path at the middle: |
|
1800 |
if (!gAsynch) |
|
1801 |
{ |
|
1802 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\:RMDIR\\*.AT")); |
|
1803 |
} |
|
1804 |
else |
|
1805 |
{ |
|
1806 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\:RMDIR\\*.AT"),gStat); |
|
1807 |
} |
|
1808 |
TestResult(r,KErrBadName,KErrNone); |
|
1809 |
||
1810 |
//testing invalid source path at the end: |
|
1811 |
if (!gAsynch) |
|
1812 |
{ |
|
1813 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\:DEF.txt")); |
|
1814 |
} |
|
1815 |
else |
|
1816 |
{ |
|
1817 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\TESTDIR\\:DEF.txt"),gStat); |
|
1818 |
} |
|
1819 |
TestResult(r,KErrNone,KErrNone); |
|
1820 |
||
1821 |
if (!gAsynch) |
|
1822 |
{ |
|
1823 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1824 |
test_KErrNone(r); |
0 | 1825 |
if (testingInvalidPathLengths) |
1826 |
{ |
|
1827 |
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1828 |
test_KErrNone(r); |
0 | 1829 |
} |
1830 |
} |
|
1831 |
else |
|
1832 |
{ |
|
1833 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1834 |
test_KErrNone(r); |
0 | 1835 |
WaitForSuccess(); |
1836 |
if (testingInvalidPathLengths) |
|
1837 |
{ |
|
1838 |
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1839 |
test_KErrNone(r); |
0 | 1840 |
WaitForSuccess(); |
1841 |
} |
|
1842 |
} |
|
1843 |
||
1844 |
TEntry entry; |
|
1845 |
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1846 |
test_Equal(KErrNotFound, r); |
0 | 1847 |
|
1848 |
MakeDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
|
1849 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),KEntryAttReadOnly,0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1850 |
test_KErrNone(r); |
0 | 1851 |
|
1852 |
if (!gAsynch) |
|
1853 |
{ |
|
1854 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1855 |
test_Equal(KErrAccessDenied, r); |
0 | 1856 |
} |
1857 |
else |
|
1858 |
{ |
|
1859 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"),gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1860 |
test_KErrNone(r); |
0 | 1861 |
WaitForResult(KErrAccessDenied); |
1862 |
} |
|
1863 |
||
1864 |
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),0,KEntryAttReadOnly); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1865 |
test_KErrNone(r); |
0 | 1866 |
|
1867 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1868 |
test_KErrNone(r); |
0 | 1869 |
|
1870 |
// Test behaviour for omitted parameters |
|
1871 |
// For this, default should be session path |
|
1872 |
TFileName sessionPath; |
|
1873 |
r=TheFs.SessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1874 |
test_KErrNone(r); |
0 | 1875 |
|
1876 |
SetupDirectories(ETrue, NULL); |
|
1877 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
|
1878 |
||
1879 |
// Default removal of session path |
|
1880 |
r=gFileMan->RmDir(_L("")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1881 |
test_KErrNone(r); |
0 | 1882 |
|
1883 |
r=TheFs.SetSessionPath(sessionPath); |
|
1884 |
||
1885 |
r = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source\\subdir"), _L("\\F32-TST\\TFMAN\\source\\tofail"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1886 |
test_Equal(KErrPathNotFound, r); |
0 | 1887 |
|
1888 |
r = gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1889 |
test_KErrNone(r); |
0 | 1890 |
MakeDir(_L("\\F32-TST\\TFMAN\\")); |
1891 |
||
1892 |
if(testingInvalidPathLengths) |
|
1893 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1894 |
TestINC091841(); // Test delete long fullnames |
0 | 1895 |
} |
1896 |
||
1897 |
//--------------------------------------------- |
|
1898 |
//! @SYMTestCaseID PBASE-T_FMAN-0316 |
|
1899 |
//! @SYMTestType UT |
|
1900 |
//! @SYMREQ DEF099820 |
|
1901 |
//! @SYMTestCaseDesc Test that CFileMan::RmDir() works when deleting a directory containing open files. |
|
1902 |
//! @SYMTestActions Open a file within a directory and try to remove the directory. |
|
1903 |
//! @SYMTestExpectedResults The operation completes with the error code KErrInUse. |
|
1904 |
//! @SYMTestPriority High |
|
1905 |
//! @SYMTestStatus Implemented |
|
1906 |
//--------------------------------------------- |
|
1907 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1908 |
test.Next(_L("Test delete directory containing open files")); |
0 | 1909 |
gFileMan->SetObserver(NULL); |
1910 |
||
1911 |
MakeDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\")); |
|
1912 |
MakeFile(_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT")); |
|
1913 |
||
1914 |
RFile file; |
|
1915 |
r = file.Open(TheFs,_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"), EFileRead | EFileShareExclusive); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1916 |
test_KErrNone(r); |
0 | 1917 |
|
1918 |
if (!gAsynch) |
|
1919 |
{ |
|
1920 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1921 |
test_Equal(KErrInUse, r); |
0 | 1922 |
|
1923 |
file.Close(); |
|
1924 |
||
1925 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1926 |
test_KErrNone(r); |
0 | 1927 |
} |
1928 |
else |
|
1929 |
{ |
|
1930 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1931 |
test_KErrNone(r); |
0 | 1932 |
WaitForResult(KErrInUse); |
1933 |
||
1934 |
file.Close(); |
|
1935 |
||
1936 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1937 |
test_KErrNone(r); |
0 | 1938 |
WaitForResult(KErrNone); |
1939 |
} |
|
1940 |
||
1941 |
gFileMan->SetObserver(gObserver); |
|
1942 |
} |
|
1943 |
||
1944 |
LOCAL_C void TestRecursiveCopy() |
|
1945 |
// |
|
1946 |
// Test the recursive copy function |
|
1947 |
// |
|
1948 |
{ |
|
1949 |
test.Next(_L("Test recursive copy")); |
|
1950 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1951 |
||
1952 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1953 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
|
1954 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
1955 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
|
1956 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
|
1957 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
1958 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
1959 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
|
1960 |
||
1961 |
TInt r; |
|
1962 |
if (!gAsynch) |
|
1963 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L("\\F32-TST\\TFMAN\\COPYDIR"),CFileMan::ERecurse); |
|
1964 |
else |
|
1965 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L("\\F32-TST\\TFMAN\\COPYDIR"),CFileMan::ERecurse,gStat); |
|
1966 |
TestResult(r); |
|
1967 |
||
1968 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
1969 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1970 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1971 |
||
1972 |
if (!gAsynch) |
|
1973 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.BIN"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*.EXT"),CFileMan::ERecurse); |
|
1974 |
else |
|
1975 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.BIN"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*.EXT"),CFileMan::ERecurse,gStat); |
|
1976 |
TestResult(KErrNone); |
|
1977 |
||
1978 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
1979 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\DELTEST\\EXE1.EXT")); |
|
1980 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\EXE2.EXT")); |
|
1981 |
Compare(_L("\\F32-TST\\TFMAN\\AFTER\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
1982 |
||
1983 |
// Test behaviour for omitted parameters |
|
1984 |
// For this, default should be session path |
|
1985 |
TFileName sessionPath; |
|
1986 |
r=TheFs.SessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
1987 |
test_KErrNone(r); |
0 | 1988 |
|
1989 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1990 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1991 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
1992 |
||
1993 |
// Default copy to session path |
|
1994 |
if (!gAsynch) |
|
1995 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L(""),CFileMan::ERecurse); |
|
1996 |
else |
|
1997 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\"),_L(""),CFileMan::ERecurse,gStat); |
|
1998 |
TestResult(KErrNone); |
|
1999 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
2000 |
||
2001 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
2002 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
2003 |
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\DELDIR\\")); |
|
2004 |
||
2005 |
// Default copy from session path |
|
2006 |
if (!gAsynch) |
|
2007 |
r=gFileMan->Copy(_L(""),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),CFileMan::ERecurse); |
|
2008 |
else |
|
2009 |
r=gFileMan->Copy(_L(""),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),CFileMan::ERecurse,gStat); |
|
2010 |
TestResult(KErrNone); |
|
2011 |
Compare(_L("\\F32-TST\\TFMAN\\DELDIR\\*"),_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
2012 |
||
2013 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
2014 |
RmDir(_L("\\F32-TST\\TFMAN\\DELDIR\\")); |
|
2015 |
r=TheFs.SetSessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2016 |
test_KErrNone(r); |
0 | 2017 |
} |
2018 |
||
2019 |
LOCAL_C void TestRecursiveAttribs() |
|
2020 |
// |
|
2021 |
// Test set attribs recursively |
|
2022 |
// |
|
2023 |
{ |
|
2024 |
test.Next(_L("Test recursive attribs")); |
|
2025 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib1.AT")); |
|
2026 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\Attrib2.at")); |
|
2027 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\SUBDIR\\ATFILE.TXT")); |
|
2028 |
||
2029 |
if (!gAsynch) |
|
2030 |
{ |
|
2031 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2032 |
test_KErrNone(r); |
0 | 2033 |
} |
2034 |
else |
|
2035 |
{ |
|
2036 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2037 |
test_KErrNone(r); |
0 | 2038 |
WaitForSuccess(); |
2039 |
} |
|
2040 |
||
2041 |
CDir* entryList; |
|
2042 |
CDirScan* scan=CDirScan::NewL(TheFs); |
|
2043 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
|
2044 |
scan->NextL(entryList); |
|
2045 |
TInt count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2046 |
test_Equal(3, count); |
0 | 2047 |
TEntry entry=(*entryList)[0]; |
2048 |
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
|
2049 |
if (!IsTestingLFFS()) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2050 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2051 |
test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2052 |
} |
0 | 2053 |
else |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2054 |
{ |
0 | 2055 |
test(entry.iAtt&KEntryAttReadOnly); // ??? |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2056 |
} |
0 | 2057 |
entry=(*entryList)[1]; |
2058 |
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
|
2059 |
if (!IsTestingLFFS()) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2060 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2061 |
test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2062 |
} |
0 | 2063 |
else |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2064 |
{ |
0 | 2065 |
test(entry.iAtt&KEntryAttReadOnly); // ??? |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2066 |
} |
0 | 2067 |
entry=(*entryList)[2]; |
2068 |
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
|
2069 |
delete entryList; |
|
2070 |
||
2071 |
scan->NextL(entryList); |
|
2072 |
count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2073 |
test_Equal(1, count); |
0 | 2074 |
entry=(*entryList)[0]; |
2075 |
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
|
2076 |
if (!IsTestingLFFS()) |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2077 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2078 |
test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2079 |
} |
0 | 2080 |
else |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2081 |
{ |
0 | 2082 |
test(entry.iAtt&KEntryAttReadOnly); // ??? |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2083 |
} |
0 | 2084 |
delete entryList; |
2085 |
||
2086 |
scan->NextL(entryList); |
|
2087 |
test(entryList==NULL); |
|
2088 |
||
2089 |
if (!gAsynch) |
|
2090 |
{ |
|
2091 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2092 |
test_KErrNone(r); |
0 | 2093 |
} |
2094 |
else |
|
2095 |
{ |
|
2096 |
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2097 |
test_KErrNone(r); |
0 | 2098 |
WaitForSuccess(); |
2099 |
} |
|
2100 |
||
2101 |
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName); |
|
2102 |
scan->NextL(entryList); |
|
2103 |
count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2104 |
test_Equal(3, count); |
0 | 2105 |
entry=(*entryList)[0]; |
2106 |
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2107 |
test_Equal(KEntryAttNormal, entry.iAtt); |
0 | 2108 |
entry=(*entryList)[1]; |
2109 |
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2110 |
test_Equal(KEntryAttNormal, entry.iAtt); |
0 | 2111 |
entry=(*entryList)[2]; |
2112 |
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound); |
|
2113 |
delete entryList; |
|
2114 |
||
2115 |
scan->NextL(entryList); |
|
2116 |
count=entryList->Count(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2117 |
test_Equal(1, count); |
0 | 2118 |
entry=(*entryList)[0]; |
2119 |
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2120 |
test_Equal(KEntryAttNormal, entry.iAtt); |
0 | 2121 |
delete entryList; |
2122 |
||
2123 |
scan->NextL(entryList); |
|
2124 |
test(entryList==NULL); |
|
2125 |
delete scan; |
|
2126 |
} |
|
2127 |
||
2128 |
LOCAL_C void TestRecursiveDelete() |
|
2129 |
// |
|
2130 |
// Test Recursive delete |
|
2131 |
// |
|
2132 |
{ |
|
2133 |
test.Next(_L("Test recursive delete")); |
|
2134 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.TXT")); |
|
2135 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FULL\\GRAPE.PLP")); |
|
2136 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\GRAPE.PLP")); |
|
2137 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECDELETE\\FILE1.TXT")); |
|
2138 |
||
2139 |
if (!gAsynch) |
|
2140 |
{ |
|
2141 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2142 |
test_KErrNone(r); |
0 | 2143 |
} |
2144 |
else |
|
2145 |
{ |
|
2146 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2147 |
test_KErrNone(r); |
0 | 2148 |
WaitForSuccess(); |
2149 |
} |
|
2150 |
||
2151 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
2152 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\GRAPE.TXT")); |
|
2153 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.TXT")); |
|
2154 |
Compare(_L("\\F32-TST\\TFMAN\\after\\*"),_L("\\F32-TST\\TFMAN\\RecDelete\\*")); |
|
2155 |
} |
|
2156 |
||
2157 |
LOCAL_C void TestINC108401() |
|
2158 |
{ |
|
2159 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2160 |
test.Next(_L("Test synchronous and asynchronous move operations (INC108401)")); |
0 | 2161 |
TInt err = 0; |
2162 |
||
2163 |
TFileName trgPath = _L("?:\\F32-TST\\"); |
|
2164 |
||
2165 |
if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y') |
|
2166 |
{ |
|
2167 |
#if !defined(__WINS__) |
|
2168 |
trgPath[0] = 'D'; |
|
2169 |
#else |
|
2170 |
trgPath[0] = 'Y'; |
|
2171 |
#endif |
|
2172 |
} |
|
2173 |
else |
|
2174 |
return; |
|
2175 |
||
2176 |
TFileName trgDir = trgPath; |
|
2177 |
trgDir.Append(_L("TFMAN\\INC108401\\dest\\")); |
|
2178 |
||
2179 |
// Moving files and dirs ACROSS DRIVE. |
|
2180 |
err = 0; |
|
2181 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2182 |
MakeDir(trgDir); |
|
2183 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2184 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2185 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2186 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2187 |
// Synchronously |
|
2188 |
if (!gAsynch) |
|
2189 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, 0); |
|
2190 |
else // Asynchronously |
|
2191 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, 0, gStat); |
|
2192 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with 0")); |
|
2193 |
TestResult(err); |
|
2194 |
// cleanup the current drive |
|
2195 |
RmDir(trgPath); |
|
2196 |
// remove the F32-TST dir on the C: drive |
|
2197 |
RmDir(_L("\\F32-TST\\TFMAN\\")); |
|
2198 |
||
2199 |
err = 0; |
|
2200 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2201 |
MakeDir(trgDir); |
|
2202 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2203 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2204 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2205 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2206 |
// Synchronously |
|
2207 |
if (!gAsynch) |
|
2208 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::EOverWrite); |
|
2209 |
else // Asynchronously |
|
2210 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::EOverWrite, gStat); |
|
2211 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with CFileMan::EOverWrite")); |
|
2212 |
TestResult(err); |
|
2213 |
// cleanup the current drive |
|
2214 |
RmDir(trgPath); |
|
2215 |
// remove the F32-TST dir on the C: drive |
|
2216 |
RmDir(_L("\\F32-TST\\")); |
|
2217 |
||
2218 |
err = 0; |
|
2219 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2220 |
MakeDir(trgDir); |
|
2221 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2222 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2223 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2224 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2225 |
// Synchronously |
|
2226 |
if (!gAsynch) |
|
2227 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::ERecurse); |
|
2228 |
else // Asynchronously |
|
2229 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), trgDir, CFileMan::ERecurse, gStat); |
|
2230 |
test.Next(_L("Test INC108401 : ACROSS DRIVES with CFileMan::ERecurse")); |
|
2231 |
TestResult(err); |
|
2232 |
// cleanup the current drive |
|
2233 |
RmDir(trgPath); |
|
2234 |
// remove the F32-TST dir on the C: drive |
|
2235 |
RmDir(_L("\\F32-TST\\")); |
|
2236 |
||
2237 |
||
2238 |
// Moving files and dirs on the SAME DRIVE. |
|
2239 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0); |
|
2240 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2241 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\")); |
|
2242 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2243 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2244 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2245 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2246 |
// Synchronously |
|
2247 |
if (!gAsynch) |
|
2248 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0); |
|
2249 |
else // Asynchronously |
|
2250 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0, gStat); |
|
2251 |
test.Next(_L("Test INC108401 : SAME DRIVE with 0")); |
|
2252 |
TestResult(err); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2253 |
// test_KErrNone(err); |
0 | 2254 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\")); |
2255 |
||
2256 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite); |
|
2257 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2258 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\")); |
|
2259 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2260 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2261 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2262 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2263 |
// Synchronously |
|
2264 |
if (!gAsynch) |
|
2265 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite); |
|
2266 |
else // Asynchronously |
|
2267 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite, gStat); |
|
2268 |
test.Next(_L("Test INC108401 : SAME DRIVE with CFileMan::EOverWrite")); |
|
2269 |
TestResult(err); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2270 |
// test_KErrNone(err); |
0 | 2271 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\")); |
2272 |
||
2273 |
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite|CFileMan::ERecurse); |
|
2274 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\")); |
|
2275 |
MakeDir(_L("\\F32-TST\\TFMAN\\INC108401\\dest\\")); |
|
2276 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file1")); |
|
2277 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\file2")); |
|
2278 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file1")); |
|
2279 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\file2")); |
|
2280 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1")); |
|
2281 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\file1")); |
|
2282 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1")); |
|
2283 |
MakeFile(_L("\\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1"),_L8("FILE PATH : \\F32-TST\\TFMAN\\INC108401\\src\\subDirA\\subDirB\\subDirC\\file1")); |
|
2284 |
// Synchronously |
|
2285 |
if (!gAsynch) |
|
2286 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite); |
|
2287 |
else // Asynchronously |
|
2288 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
|
2289 |
test.Next(_L("Test INC108401 : SAME DRIVES with CFileMan::ERecurse|CFileMan::EOverWrite")); |
|
2290 |
TestResult(err); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2291 |
// test_KErrNone(err); |
0 | 2292 |
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\")); |
2293 |
||
2294 |
// cleanup for the current drive |
|
2295 |
RmDir(trgPath); |
|
2296 |
RmDir(_L("\\F32-TST\\")); |
|
2297 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2298 |
test.Printf(_L("Test INC108401 : ends\n")); |
0 | 2299 |
} |
2300 |
||
2301 |
LOCAL_C void TestINC089638() |
|
2302 |
{ |
|
2303 |
if(gAsynch) |
|
2304 |
{ |
|
2305 |
return; |
|
2306 |
} |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2307 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2308 |
test.Next(_L("Test all items removed from source directory after recursive moving (INC089638)")); |
0 | 2309 |
RmDir(_L("\\INC089638\\source\\")); |
2310 |
RmDir(_L("\\INC089638\\dest\\")); |
|
2311 |
MakeFile(_L("\\INC089638\\source\\file1")); |
|
2312 |
MakeFile(_L("\\INC089638\\source\\file2")); |
|
2313 |
MakeFile(_L("\\INC089638\\source\\subdir1\\file3")); |
|
2314 |
MakeFile(_L("\\INC089638\\source\\subdir1\\file4")); |
|
2315 |
MakeFile(_L("\\INC089638\\source\\subdir2\\file5")); |
|
2316 |
MakeFile(_L("\\INC089638\\source\\subdir2\\file6")); |
|
2317 |
MakeDir(_L("\\INC089638\\dest\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2318 |
test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2319 |
test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0)); |
0 | 2320 |
|
2321 |
TInt r = gFileMan->Move(_L("\\INC089638\\source\\"), _L("\\INC089638\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2322 |
test_KErrNone(r); |
0 | 2323 |
r = TheFs.RmDir(_L("\\INC089638\\source\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2324 |
test_KErrNone(r); |
0 | 2325 |
|
2326 |
RmDir(_L("\\INC089638\\")); |
|
2327 |
} |
|
2328 |
||
2329 |
void TestINC101379() |
|
2330 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2331 |
test.Next(_L("Test moving of directory to its subdirectory recursively and not recursively (INC101379)")); |
0 | 2332 |
TInt err; |
2333 |
_LIT(KSourceDir,"\\INC101379\\dir\\"); |
|
2334 |
_LIT(KFile1, "\\INC101379\\dir\\file1.txt"); |
|
2335 |
_LIT(KFile2, "\\INC101379\\dir\\subdir\\file2.txt"); |
|
2336 |
_LIT(KFile3, "\\INC101379\\dir\\other\\file3.txt"); |
|
2337 |
MakeFile(KFile1, _L8("qwerty")); |
|
2338 |
MakeFile(KFile2, _L8("abc")); |
|
2339 |
MakeFile(KFile3, _L8("qwerty")); |
|
2340 |
TFileName dest; |
|
2341 |
dest.Copy(KSourceDir); |
|
2342 |
dest.Append(_L("subdir")); |
|
2343 |
gFileMan->SetObserver(NULL); |
|
2344 |
if (!gAsynch) |
|
2345 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite); |
|
2346 |
else |
|
2347 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite, gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2348 |
test_Equal(KErrInUse, err); // Recursive move prohibited |
0 | 2349 |
if (gAsynch) |
2350 |
WaitForResult(KErrInUse); |
|
2351 |
CheckFileContents(KFile1, _L8("qwerty")); |
|
2352 |
CheckFileContents(KFile2, _L8("abc")); |
|
2353 |
CheckFileContents(KFile3, _L8("qwerty")); |
|
2354 |
||
2355 |
if (!gAsynch) |
|
2356 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::EOverWrite); |
|
2357 |
else |
|
2358 |
err = gFileMan->Move(KSourceDir, dest, CFileMan::EOverWrite, gStat); |
|
2359 |
TestResult(err, KErrNone); // Non-recursive move must be OK |
|
2360 |
||
2361 |
_LIT(KFile1Moved, "\\INC101379\\dir\\subdir\\file1.txt"); |
|
2362 |
CheckFileContents(KFile1Moved, _L8("qwerty")); |
|
2363 |
CheckFileContents(KFile2, _L8("abc")); |
|
2364 |
CheckFileContents(KFile3, _L8("qwerty")); |
|
2365 |
gFileMan->SetObserver(gObserver); |
|
2366 |
RmDir(KSourceDir); |
|
2367 |
RmDir(_L("\\INC101379\\")); |
|
2368 |
} |
|
2369 |
||
2370 |
void TestINC099600() // and INC101061 |
|
2371 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2372 |
// Test move files from the internal drive to an external one (INC099600) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2373 |
// Test move files with system (KEntryAttSystem) or hidden (KEntryAttHidden) attributes (INC101061) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2374 |
test.Next(_L("Test move files from internal drive to external with system and hidden attributes")); |
0 | 2375 |
_LIT(KDest,"C:\\DEST099600\\"); |
2376 |
TBuf<64> source; |
|
2377 |
source.Format(_L("%c:\\INC099600\\"), (TUint) gDriveToTest); |
|
2378 |
TBuf<64> src; |
|
2379 |
TInt r; |
|
2380 |
TBuf<64> dst; |
|
2381 |
RmDir(source); |
|
2382 |
RmDir(KDest); |
|
2383 |
||
2384 |
src = source; |
|
2385 |
src.Append('a'); |
|
2386 |
MakeFile(src); |
|
2387 |
TheFs.SetAtt(src, KEntryAttArchive, 0); |
|
2388 |
src.Append('h'); |
|
2389 |
MakeFile(src); |
|
2390 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden, 0); |
|
2391 |
src.Append('s'); |
|
2392 |
MakeFile(src); |
|
2393 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden | KEntryAttSystem, 0); |
|
2394 |
src.Append('x'); |
|
2395 |
src.Append(KPathDelimiter); |
|
2396 |
src.Append('a'); |
|
2397 |
MakeFile(src); |
|
2398 |
TheFs.SetAtt(src, KEntryAttArchive, 0); |
|
2399 |
src.Append('h'); |
|
2400 |
MakeFile(src); |
|
2401 |
TheFs.SetAtt(src, KEntryAttArchive | KEntryAttHidden, 0); |
|
2402 |
||
2403 |
dst.Copy(KDest); |
|
2404 |
dst.Append(_L("ahsx\\")); |
|
2405 |
MakeDir(dst); |
|
2406 |
||
2407 |
TEntry entry; |
|
2408 |
r = gFileMan->Move(src, KDest, 0); // ahsx\ah |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2409 |
test_KErrNone(r); |
0 | 2410 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2411 |
test_Equal(KErrNotFound, r); |
0 | 2412 |
|
2413 |
src.SetLength(src.Length()-1); // ahsx\a |
|
2414 |
r = gFileMan->Move(src, KDest, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2415 |
test_KErrNone(r); |
0 | 2416 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2417 |
test_Equal(KErrNotFound, r); |
0 | 2418 |
|
2419 |
src.SetLength(src.Length()-3); // ahs |
|
2420 |
r = gFileMan->Move(src, KDest, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2421 |
test_KErrNone(r); |
0 | 2422 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2423 |
test_Equal(KErrNotFound, r); |
0 | 2424 |
|
2425 |
src.SetLength(src.Length()-1); // ah |
|
2426 |
r = gFileMan->Move(src, KDest, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2427 |
test_Equal(KErrAlreadyExists, r); |
0 | 2428 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2429 |
test_KErrNone(r); |
0 | 2430 |
|
2431 |
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // ah |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2432 |
test_KErrNone(r); |
0 | 2433 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2434 |
test_Equal(KErrNotFound, r); |
0 | 2435 |
|
2436 |
src.SetLength(src.Length()-1); // a |
|
2437 |
r = gFileMan->Move(src, KDest, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2438 |
test_Equal(KErrAlreadyExists, r); |
0 | 2439 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2440 |
test_KErrNone(r); |
0 | 2441 |
|
2442 |
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // a |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2443 |
test_KErrNone(r); |
0 | 2444 |
r = TheFs.Entry(src, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2445 |
test_Equal(KErrNotFound, r); |
0 | 2446 |
|
2447 |
RmDir(source); |
|
2448 |
RmDir(KDest); |
|
2449 |
} |
|
2450 |
||
2451 |
void SetupDirectoriesForCase0520() |
|
2452 |
// Setup initial directory structure for test case PBASE-T_FMAN-0520 |
|
2453 |
{ |
|
2454 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735\\")); |
|
2455 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\")); |
|
2456 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2457 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\")); |
|
2458 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\F_SUB.TXT"), _L8("blahblahblah")); |
|
2459 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\")); |
|
2460 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2461 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\SUB02\\")); |
|
2462 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2463 |
} |
|
2464 |
||
2465 |
void SetupDirectoriesForCase0520Compare1() |
|
2466 |
// Comparing directory structure for recursive Move() without wildcard |
|
2467 |
{ |
|
2468 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2469 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2470 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\")); |
|
2471 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2472 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah")); |
|
2473 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\")); |
|
2474 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2475 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\")); |
|
2476 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2477 |
} |
|
2478 |
||
2479 |
void SetupDirectoriesForCase0520Compare2() |
|
2480 |
// Comparing directory structure for recursive Move() with wildcard |
|
2481 |
{ |
|
2482 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2483 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2484 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\")); |
|
2485 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2486 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah")); |
|
2487 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2488 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2489 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\")); |
|
2490 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\")); |
|
2491 |
} |
|
2492 |
||
2493 |
void SetupDirectoriesForCase0520Compare3() |
|
2494 |
// Comparing directory structure for recursive Copy() without wildcard |
|
2495 |
{ |
|
2496 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2497 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2498 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2499 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\")); |
|
2500 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2501 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah")); |
|
2502 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\")); |
|
2503 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2504 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\")); |
|
2505 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2506 |
} |
|
2507 |
||
2508 |
void SetupDirectoriesForCase0520Compare4() |
|
2509 |
// Comparing directory structure for recursive Copy() with wildcard |
|
2510 |
{ |
|
2511 |
RmDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2512 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2513 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2514 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\")); |
|
2515 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_ROOT.TXT"), _L8("blahblahblah")); |
|
2516 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\F_SUB.TXT"), _L8("blahblahblah")); |
|
2517 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2518 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2519 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\")); |
|
2520 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\F_SUB01.TXT"), _L8("blahblahblah")); |
|
2521 |
MakeDir( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\")); |
|
2522 |
MakeFile( _L("\\F32-TST\\TFMAN\\INC106735_COM\\SUB01\\SUB02\\F_SUB02.TXT"), _L8("blahblahblah")); |
|
2523 |
} |
|
2524 |
||
2525 |
LOCAL_C void TestRecursiveMove() |
|
2526 |
// |
|
2527 |
// Test recursive move |
|
2528 |
// |
|
2529 |
{ |
|
2530 |
test.Next(_L("Test recursive move")); |
|
2531 |
RmDir(_L("\\F32-TST\\TFMAN\\RecMove2\\")); |
|
2532 |
||
2533 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE2.PLP")); |
|
2534 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE3.PLP")); |
|
2535 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FULL\\GRAPE.TXT")); |
|
2536 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\GRAPE.TXT")); |
|
2537 |
MakeFile(_L("\\F32-TST\\TFMAN\\RECMOVE\\FILE1.PLP")); |
|
2538 |
||
2539 |
TInt err; |
|
2540 |
if (!gAsynch) |
|
2541 |
err=gFileMan->Move(_L("\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),_L("\\F32-TST\\TFMAN\\RECMOVE2\\"),CFileMan::ERecurse); |
|
2542 |
else |
|
2543 |
err=gFileMan->Move(_L("\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),_L("\\F32-TST\\TFMAN\\RECMOVE2\\"),CFileMan::ERecurse,gStat); |
|
2544 |
TestResult(err); |
|
2545 |
||
2546 |
RmDir(_L("\\F32-TST\\TFMAN\\after\\")); |
|
2547 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP")); |
|
2548 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP")); |
|
2549 |
MakeFile(_L("\\F32-TST\\TFMAN\\AFTER\\FILE1.PLP")); |
|
2550 |
Compare(_L("\\F32-TST\\TFMAN\\after\\*"),_L("\\F32-TST\\TFMAN\\RecMOve2\\*")); |
|
2551 |
||
2552 |
// |
|
2553 |
// Test moving empty directories (DEF073924) |
|
2554 |
// |
|
2555 |
test.Next(_L("Test moving empty directories")); |
|
2556 |
||
2557 |
SetupDirectories(EFalse, NULL); |
|
2558 |
||
2559 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2560 |
test_Equal(KErrNotFound, err); // Expected - directory is empty |
0 | 2561 |
|
2562 |
// Test that all directories are still present |
|
2563 |
TEntry entry; |
|
2564 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2565 |
test_KErrNone(err); |
0 | 2566 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\"), entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2567 |
test_KErrNone(err); |
0 | 2568 |
|
2569 |
SetupDirectories(EFalse, NULL); |
|
2570 |
||
2571 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2572 |
test_KErrNone(err); // Expected - should move (or rename) directory |
0 | 2573 |
|
2574 |
// Test directory has been moved |
|
2575 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\source\\"), entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2576 |
test_KErrNone(err); |
0 | 2577 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2578 |
test_Equal(KErrNotFound, err); |
0 | 2579 |
|
2580 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\source\\")); |
|
2581 |
||
2582 |
// |
|
2583 |
// Test moving when the source directory contains subdirectories (INC074828, INC078800) |
|
2584 |
// |
|
2585 |
test.Next(_L("Test moving a directory containing subdirectories")); |
|
2586 |
||
2587 |
SetupDirectories(ETrue, NULL); |
|
2588 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2589 |
test_KErrNone(err); |
0 | 2590 |
|
2591 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
|
2592 |
||
2593 |
//--------------------------------------------- |
|
2594 |
//! @SYMTestCaseID PBASE-T_FMAN-0160 |
|
2595 |
//! @SYMTestType UT |
|
2596 |
//! @SYMREQ DEF087791 |
|
2597 |
//! @SYMTestCaseDesc Test that CFileMan::Move() works when the destination paths does not exist. |
|
2598 |
//! @SYMTestActions Copy directory structures to a non-existant directory on the same drive. |
|
2599 |
//! @SYMTestExpectedResults Completes with no error, files are copied and intermediate directories are created. |
|
2600 |
//! @SYMTestPriority High |
|
2601 |
//! @SYMTestStatus Implemented |
|
2602 |
//--------------------------------------------- |
|
2603 |
test.Next(_L("Test moving when the target directory does not exist")); |
|
2604 |
||
2605 |
SetupDirectories(ETrue, NULL); |
|
2606 |
||
2607 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2608 |
||
2609 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2610 |
test_KErrNone(err); |
0 | 2611 |
|
2612 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
|
2613 |
||
2614 |
SetupDirectories(ETrue, NULL); |
|
2615 |
||
2616 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2617 |
||
2618 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2619 |
test_KErrNone(err); |
0 | 2620 |
|
2621 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
|
2622 |
||
2623 |
SetupDirectories(ETrue, NULL); |
|
2624 |
||
2625 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2626 |
||
2627 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2628 |
test_KErrNone(err); |
0 | 2629 |
|
2630 |
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
|
2631 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
|
2632 |
RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
|
2633 |
||
2634 |
SetupDirectories(ETrue, NULL); |
|
2635 |
||
2636 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2637 |
||
2638 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2639 |
test_KErrNone(err); |
0 | 2640 |
|
2641 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue); |
|
2642 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\dest\\File1.TXT"), KErrNone, ETrue); |
|
2643 |
||
2644 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2645 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
|
2646 |
||
2647 |
// Test behaviour for omitted parameters |
|
2648 |
// For this, default should be session path |
|
2649 |
TFileName sessionPath; |
|
2650 |
err=TheFs.SessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2651 |
test_KErrNone(err); |
0 | 2652 |
|
2653 |
SetupDirectories(ETrue, NULL); |
|
2654 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2655 |
test_KErrNone(err); |
0 | 2656 |
|
2657 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L(""), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2658 |
test_KErrNone(err); |
0 | 2659 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*")); |
2660 |
||
2661 |
RmDir(_L("\\F32-TST\\TFMAN\\dest\\")); |
|
2662 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
|
2663 |
SetupDirectories(ETrue, NULL); |
|
2664 |
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2665 |
test_KErrNone(err); |
0 | 2666 |
|
2667 |
err = gFileMan->Move(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2668 |
test_KErrNone(err); |
0 | 2669 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*")); |
2670 |
||
2671 |
err=TheFs.SetSessionPath(sessionPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2672 |
test_KErrNone(err); |
0 | 2673 |
|
2674 |
//--------------------------------------------- |
|
2675 |
//! @SYMTestCaseID PBASE-T_FMAN-0520 |
|
2676 |
//! @SYMTestType UT |
|
2677 |
//! @SYMREQ INC106735 |
|
2678 |
//! @SYMTestCaseDesc Test that CFileMan::Move() (recursive mode) works properly when the destination |
|
2679 |
//! directory is sub-directory of the source directory. |
|
2680 |
//! (e.g. "C:SRC\\*.TXT" -> "C:\\SRC\\SUB\\") |
|
2681 |
//! @SYMTestActions Move, copy files recursively from source directory to one of its sub-directory, |
|
2682 |
//! with or without wildcards applied. |
|
2683 |
//! @SYMTestExpectedResults Completes with no error, file(s) are moved or copied properly, and no redundant |
|
2684 |
//! movings or copyings are made for files in destination directory. |
|
2685 |
//! @SYMTestPriority High |
|
2686 |
//! @SYMTestStatus Implemented |
|
2687 |
//--------------------------------------------- |
|
2688 |
test.Next(_L("Test recursive moving and copying to sub-directories")); |
|
2689 |
// Testing recursive Move() without wildcard |
|
2690 |
SetupDirectoriesForCase0520(); |
|
2691 |
SetupDirectoriesForCase0520Compare1(); |
|
2692 |
if (!gAsynch) |
|
2693 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\*"), CFileMan::ERecurse); |
|
2694 |
else |
|
2695 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\*"), CFileMan::ERecurse, gStat); |
|
2696 |
TestResult(err, KErrNone); |
|
2697 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2698 |
||
2699 |
// Testing recursive Move() with wildcard |
|
2700 |
SetupDirectoriesForCase0520(); |
|
2701 |
SetupDirectoriesForCase0520Compare2(); |
|
2702 |
if (!gAsynch) |
|
2703 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse); |
|
2704 |
else |
|
2705 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat); |
|
2706 |
TestResult(err, KErrNone); |
|
2707 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2708 |
||
2709 |
// Testing recursive Copy() without wildcard |
|
2710 |
SetupDirectoriesForCase0520(); |
|
2711 |
SetupDirectoriesForCase0520Compare3(); |
|
2712 |
if (!gAsynch) |
|
2713 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse); |
|
2714 |
else |
|
2715 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\F_ROOT.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat); |
|
2716 |
TestResult(err, KErrNone); |
|
2717 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2718 |
||
2719 |
// Testing recursive Copy() with wildcard |
|
2720 |
SetupDirectoriesForCase0520(); |
|
2721 |
SetupDirectoriesForCase0520Compare4(); |
|
2722 |
if (!gAsynch) |
|
2723 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse); |
|
2724 |
else |
|
2725 |
err = gFileMan->Copy(_L("\\F32-TST\\TFMAN\\INC106735\\*.TXT"), _L("\\F32-TST\\TFMAN\\INC106735\\SUB\\"), CFileMan::ERecurse, gStat); |
|
2726 |
TestResult(err, KErrNone); |
|
2727 |
Compare(_L("\\F32-TST\\TFMAN\\INC106735\\"), _L("\\F32-TST\\TFMAN\\INC106735_COM\\")); |
|
2728 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2729 |
TestINC089638(); // Test all items removed from source directory after recursive moving |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2730 |
TestINC101379(); // Test moving of directory to its subdirectory recursively and not recursively |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2731 |
TestINC099600(); // and INC101061, Test move files from internal drive to external with system |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2732 |
// and hidden attributes |
0 | 2733 |
} |
2734 |
||
2735 |
||
2736 |
// |
|
2737 |
// A complex test directory structure... |
|
2738 |
// |
|
2739 |
LOCAL_D const TInt KNumFiles = 8; |
|
2740 |
LOCAL_D const TFileName complexFile[] = |
|
2741 |
{ |
|
2742 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\file1.txt"), |
|
2743 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\file2.txt"), |
|
2744 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\subdir1\\file3.txt"), |
|
2745 |
_L("\\F32-TST\\TFMAN\\complex\\dir1\\subdir1\\file4.txt"), |
|
2746 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\file1.txt"), |
|
2747 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\file2.txt"), |
|
2748 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\subdir1\\file3.txt"), |
|
2749 |
_L("\\F32-TST\\TFMAN\\complex\\dir12\\dir1\\subdir1\\file4.txt") |
|
2750 |
}; |
|
2751 |
||
2752 |
// |
|
2753 |
// The expected result of moving the directory complex\\dir1 into complex\\dir2\\ *without* EOverWrite |
|
2754 |
// |
|
2755 |
LOCAL_D const TInt KNumFilesResult1 = 8; |
|
2756 |
LOCAL_D const TFileName complexResult1[] = |
|
2757 |
{ |
|
2758 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\file1.txt"), |
|
2759 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\file2.txt"), |
|
2760 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\subdir1\\file3.txt"), |
|
2761 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir1\\subdir1\\file4.txt"), |
|
2762 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\file1.txt"), |
|
2763 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\file2.txt"), |
|
2764 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\subdir1\\file3.txt"), |
|
2765 |
_L("\\F32-TST\\TFMAN\\complex_result1\\dir12\\dir1\\subdir1\\file4.txt") |
|
2766 |
}; |
|
2767 |
||
2768 |
// |
|
2769 |
// The expected result of moving the directory complex\\dir1 into complex\\dir2\\ *with* EOverWrite |
|
2770 |
// |
|
2771 |
LOCAL_D const TInt KNumFilesResult2 = 4; |
|
2772 |
LOCAL_D const TFileName complexResult2[] = |
|
2773 |
{ |
|
2774 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\file1.txt"), |
|
2775 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\file2.txt"), |
|
2776 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\subdir1\\file3.txt"), |
|
2777 |
_L("\\F32-TST\\TFMAN\\complex_result2\\dir12\\dir1\\subdir1\\file4.txt"), |
|
2778 |
||
2779 |
}; |
|
2780 |
||
2781 |
||
2782 |
LOCAL_C void TestRecursiveMoveAcrossDrives() |
|
2783 |
// |
|
2784 |
// Test recursive move across drives |
|
2785 |
// |
|
2786 |
{ |
|
2787 |
test.Next(_L("Test recursive move across drives")); |
|
2788 |
||
2789 |
TFileName trgDir = _L("\\F32-TST\\TFMAN\\RECMOVE2\\"); |
|
2790 |
TFileName trgSpec = _L("\\F32-TST\\TFMAN\\RECMOVE2\\*"); |
|
2791 |
||
2792 |
if (gSessionPath[0]=='C') |
|
2793 |
{ |
|
2794 |
#if !defined(__WINS__) |
|
2795 |
trgDir = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\"); |
|
2796 |
trgSpec = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\*"); |
|
2797 |
#else |
|
2798 |
trgDir = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\"); |
|
2799 |
trgSpec = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\*"); |
|
2800 |
#endif |
|
2801 |
} |
|
2802 |
||
2803 |
RmDir(trgDir); |
|
2804 |
||
2805 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE2.PLP")); |
|
2806 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\FILE3.PLP")); |
|
2807 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FULL\\GRAPE.TXT")); |
|
2808 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\GRAPE.TXT")); |
|
2809 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\FILE1.PLP")); |
|
2810 |
||
2811 |
TInt err; |
|
2812 |
if (!gAsynch) |
|
2813 |
err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse); |
|
2814 |
else |
|
2815 |
err=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\*.PLP"),trgDir,CFileMan::ERecurse,gStat); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2816 |
test.Printf(_L("TestRecursiveMoveAcrossDrives(),gFileMan->Move(),err=%d\n"),err); |
0 | 2817 |
TestResult(err); |
2818 |
||
2819 |
RmDir(_L("C:\\F32-TST\\TFMAN\\after\\")); |
|
2820 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE2.PLP")); |
|
2821 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FULL\\FILE3.PLP")); |
|
2822 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\AFTER\\FILE1.PLP")); |
|
2823 |
Compare(_L("C:\\F32-TST\\TFMAN\\after\\*"),trgSpec); |
|
2824 |
RmDir(_L("C:\\F32-TST\\TFMAN\\AFTER\\")); |
|
2825 |
RmDir(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\")); |
|
2826 |
||
2827 |
// |
|
2828 |
// Test moving empty directories (DEF073924) |
|
2829 |
// |
|
2830 |
test.Next(_L("Test moving empty directories")); |
|
2831 |
||
2832 |
TFileName destOtherDrive; |
|
2833 |
SetupDirectories(EFalse, &destOtherDrive); |
|
2834 |
||
2835 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2836 |
test_Equal(KErrNotFound, err); // Expected - directory is empty |
0 | 2837 |
|
2838 |
// Test that all directories are still present |
|
2839 |
TEntry entry; |
|
2840 |
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2841 |
test_KErrNone(err); |
0 | 2842 |
err = TheFs.Entry(destOtherDrive, entry); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2843 |
test_KErrNone(err); |
0 | 2844 |
|
2845 |
//--------------------------------------------- |
|
2846 |
//! @SYMTestCaseID PBASE-T_FMAN-0571 |
|
2847 |
//! @SYMTestType UT |
|
2848 |
//! @SYMREQ INC108401 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2849 |
//! @SYMTestCaseDesc This testcase tests the synchronous and asynchronous move operations |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2850 |
//! exhaustively with flags set as 0, CFileMan::EOverWrite, CFileMan::ERecurse |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2851 |
//! on the SAME and ACROSS drives without trailing slash at the end of source |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2852 |
//! dir path. |
0 | 2853 |
//! @SYMTestActions 1. Copy directory structures to another directory across drive. |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2854 |
//! 2. Copy directory structures to another directory across drive overwriting |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2855 |
//! duplicate files. |
0 | 2856 |
//! 3. Copy directory structures to another directory across drive. |
2857 |
//! 4. Copy directory structures to another directory on same drive. |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2858 |
//! 5. Copy directory structures to another directory on same drive overwriting |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2859 |
//! duplicate files. |
0 | 2860 |
//! 6. Copy directory structures to another directory on same drive. |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2861 |
//! @SYMTestExpectedResults 1. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2862 |
//! from the src directory to the destination directory. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2863 |
//! 2. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2864 |
//! from the src directory to the destination directory, duplicate files are updated. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2865 |
//! 3. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2866 |
//! from the src directory to the destination directory. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2867 |
//! 4. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2868 |
//! from the src directory to the destination directory. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2869 |
//! 5. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2870 |
//! from the src directory to the destination directory, duplicate files are updated. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2871 |
//! 6. Completes with no error, the last directory and its contents are moved |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
2872 |
//! from the src directory to the destination directory. |
0 | 2873 |
//! @SYMTestPriority High |
2874 |
//! @SYMTestStatus Implemented |
|
2875 |
//--------------------------------------------- |
|
2876 |
||
2877 |
TestINC108401(); |
|
2878 |
||
2879 |
// |
|
2880 |
// Test moving when the source directory contains subdirectories (INC074828, INC078800) |
|
2881 |
// |
|
2882 |
test.Next(_L("Test moving a directory containing subdirectories")); |
|
2883 |
||
2884 |
SetupDirectories(ETrue, &destOtherDrive); |
|
2885 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2886 |
test_KErrNone(err); |
0 | 2887 |
|
2888 |
destOtherDrive.Append(_L("*")); |
|
2889 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive); |
|
2890 |
||
2891 |
//--------------------------------------------- |
|
2892 |
//! @SYMTestCaseID PBASE-T_FMAN-0161 |
|
2893 |
//! @SYMTestType UT |
|
2894 |
//! @SYMREQ DEF087791 |
|
2895 |
//! @SYMTestCaseDesc Test that CFileMan::Move() works when the destination paths does not exist. |
|
2896 |
//! @SYMTestActions Copy directory structures to a non-existant directory on a different drive. |
|
2897 |
//! @SYMTestExpectedResults Completes with no error, files are copied and intermediate directories are created. |
|
2898 |
//! @SYMTestPriority High |
|
2899 |
//! @SYMTestStatus Implemented |
|
2900 |
//--------------------------------------------- |
|
2901 |
test.Next(_L("Test moving when the target directory does not exist")); |
|
2902 |
||
2903 |
SetupDirectories(ETrue, &destOtherDrive); |
|
2904 |
||
2905 |
RmDir(destOtherDrive); |
|
2906 |
||
2907 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2908 |
test_KErrNone(err); |
0 | 2909 |
|
2910 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive); |
|
2911 |
||
2912 |
SetupDirectories(ETrue, &destOtherDrive); |
|
2913 |
||
2914 |
RmDir(destOtherDrive); |
|
2915 |
||
2916 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2917 |
test_KErrNone(err); |
0 | 2918 |
|
2919 |
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
|
2920 |
destOtherDrive.Append(_L("source\\")); |
|
2921 |
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive); |
|
2922 |
RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\")); |
|
2923 |
||
2924 |
SetupDirectories(ETrue, &destOtherDrive); |
|
2925 |
||
2926 |
RmDir(destOtherDrive); |
|
2927 |
||
2928 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2929 |
test_KErrNone(err); |
0 | 2930 |
|
2931 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue); |
|
2932 |
destOtherDrive.Append(_L("File1.TXT")); |
|
2933 |
CheckFileExists(destOtherDrive, KErrNone, ETrue); |
|
2934 |
||
2935 |
RmDir(destOtherDrive); |
|
2936 |
RmDir(_L("\\F32-TST\\TFMAN\\source\\")); |
|
2937 |
||
2938 |
// |
|
2939 |
// Test recursive move of complex directory structure into itself (INC078759) |
|
2940 |
// |
|
2941 |
||
2942 |
test.Next(_L("Test recursive move of complex directory structure")); |
|
2943 |
||
2944 |
// Set up the test directory |
|
2945 |
TInt level = 0; |
|
2946 |
for(level=0; level < KNumFiles; level++) |
|
2947 |
{ |
|
2948 |
err = TheFs.MkDirAll(complexFile[level]); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2949 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 2950 |
|
2951 |
RFile file; |
|
2952 |
err = file.Create(TheFs, complexFile[level], EFileRead | EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2953 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
0 | 2954 |
file.Close(); |
2955 |
} |
|
2956 |
||
2957 |
// |
|
2958 |
// Move directory 'dir1' into 'dir12' *without* overwrite flag set |
|
2959 |
// |
|
2960 |
// - This should fail, as 'dir12' already contains a directory called 'dir1' |
|
2961 |
// - No directories should be modified |
|
2962 |
// |
|
2963 |
||
2964 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2965 |
test_Equal(KErrAlreadyExists, err); |
0 | 2966 |
|
2967 |
for(level=0; level < KNumFilesResult1; level++) |
|
2968 |
{ |
|
2969 |
err = TheFs.MkDirAll(complexResult1[level]); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2970 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 2971 |
|
2972 |
RFile file; |
|
2973 |
err = file.Create(TheFs, complexResult1[level], EFileRead | EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2974 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
0 | 2975 |
file.Close(); |
2976 |
} |
|
2977 |
||
2978 |
Compare(_L("\\F32-TST\\TFMAN\\complex_result1\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
|
2979 |
||
2980 |
// |
|
2981 |
// Move directory 'dir1' into 'dir12' *with* overwrite flag set |
|
2982 |
// |
|
2983 |
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse | CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2984 |
test_KErrNone(err); |
0 | 2985 |
|
2986 |
for(level=0; level < KNumFilesResult2; level++) |
|
2987 |
{ |
|
2988 |
err = TheFs.MkDirAll(complexResult2[level]); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2989 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists); |
0 | 2990 |
|
2991 |
RFile file; |
|
2992 |
err = file.Create(TheFs, complexResult2[level], EFileRead | EFileWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
2993 |
test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName); |
0 | 2994 |
file.Close(); |
2995 |
} |
|
2996 |
||
2997 |
Compare(_L("\\F32-TST\\TFMAN\\complex_result2\\*"), _L("\\F32-TST\\TFMAN\\complex\\*")); |
|
2998 |
||
2999 |
// ...tidy up files |
|
3000 |
for(level=0; level < KNumFiles; level++) |
|
3001 |
TheFs.Delete(complexFile[level]); |
|
3002 |
for(level=0; level < KNumFilesResult1; level++) |
|
3003 |
TheFs.Delete(complexResult1[level]); |
|
3004 |
for(level=0; level < KNumFilesResult2; level++) |
|
3005 |
TheFs.Delete(complexResult2[level]); |
|
3006 |
||
3007 |
// ...tidy up directories |
|
3008 |
for(level=0; level < KNumFiles; level++) |
|
3009 |
TheFs.RmDir(complexFile[level]); |
|
3010 |
for(level=0; level < KNumFilesResult1; level++) |
|
3011 |
TheFs.RmDir(complexResult1[level]); |
|
3012 |
for(level=0; level < KNumFilesResult2; level++) |
|
3013 |
TheFs.RmDir(complexResult2[level]); |
|
3014 |
||
3015 |
TheFs.RmDir(_L("C:\\F32-TST\\TFMAN\\")); |
|
3016 |
TheFs.RmDir(_L("C:\\F32-TST\\")); |
|
3017 |
} |
|
3018 |
||
3019 |
class CFileManCopyAllCancel : public CBase, public MFileManObserver |
|
3020 |
{ |
|
3021 |
public: |
|
3022 |
CFileManCopyAllCancel(CFileMan* aFileMan); |
|
3023 |
TControl NotifyFileManStarted(); |
|
3024 |
TControl NotifyFileManEnded(); |
|
3025 |
||
3026 |
private: |
|
3027 |
CFileMan* iFileMan; |
|
3028 |
}; |
|
3029 |
||
3030 |
||
3031 |
CFileManCopyAllCancel::CFileManCopyAllCancel(CFileMan* aFileMan) |
|
3032 |
// |
|
3033 |
// Constructor |
|
3034 |
// |
|
3035 |
{ |
|
3036 |
__DECLARE_NAME(_S("CFileManCopyAllCancel")); |
|
3037 |
iFileMan=aFileMan; |
|
3038 |
} |
|
3039 |
||
3040 |
MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManStarted() |
|
3041 |
// |
|
3042 |
// Observer for TestCopyAllCancel tests |
|
3043 |
// |
|
3044 |
{ |
|
3045 |
return(MFileManObserver::ECancel); |
|
3046 |
} |
|
3047 |
||
3048 |
MFileManObserver::TControl CFileManCopyAllCancel::NotifyFileManEnded() |
|
3049 |
// |
|
3050 |
// Observer for TestCopyAllCancel tests |
|
3051 |
// |
|
3052 |
{ |
|
3053 |
return(MFileManObserver::EContinue); |
|
3054 |
} |
|
3055 |
||
3056 |
||
3057 |
||
3058 |
LOCAL_C void TestCopyAllCancel() |
|
3059 |
// |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3060 |
// Test copy (all cancel) |
0 | 3061 |
// |
3062 |
{ |
|
3063 |
test.Next(_L("Test copy all cancel")); |
|
3064 |
||
3065 |
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\*")); |
|
3066 |
CFileManCopyAllCancel* fManObserver=new(ELeave) CFileManCopyAllCancel(gFileMan); |
|
3067 |
CleanupStack::PushL(fManObserver); |
|
3068 |
gFileMan->SetObserver(fManObserver); |
|
3069 |
||
3070 |
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\")); |
|
3071 |
MakeDir(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EMPTY\\")); |
|
3072 |
MakeFile(_L("\\F32-TST\\TFMAN\\NewDir\\ABC.DEF")); |
|
3073 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT")); |
|
3074 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE2.TXT")); |
|
3075 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE3.TXT")); |
|
3076 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\FILE4.TXT")); |
|
3077 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\DELTEST\\EXE1.BIN")); |
|
3078 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\EXE2.BIN")); |
|
3079 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA1.TXT")); |
|
3080 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA2.TXT")); |
|
3081 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA3.TXT")); |
|
3082 |
MakeFile(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA4.TXT")); |
|
3083 |
||
3084 |
test.Next(_L("Test cancel copy all the files ")); |
|
3085 |
TInt r; |
|
3086 |
||
3087 |
if (!gAsynch) |
|
3088 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0); |
|
3089 |
else |
|
3090 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\file?.txt"),_L("\\F32-TST\\TFMAN\\DELDIR\\rumba?.txt"),0,gStat); |
|
3091 |
TestResult(r,KErrCancel); |
|
3092 |
||
3093 |
if (!gAsynch) |
|
3094 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0); |
|
3095 |
else |
|
3096 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.txt"),_L("\\F32-TST\\TFMAN\\file1.txt"),0,gStat); |
|
3097 |
TestResult(r,KErrCancel); |
|
3098 |
gFileMan->SetObserver(gObserver); |
|
3099 |
CleanupStack::PopAndDestroy(); |
|
3100 |
} |
|
3101 |
||
3102 |
class CFileManObserverOverWrite : public CBase, public MFileManObserver |
|
3103 |
{ |
|
3104 |
public: |
|
3105 |
CFileManObserverOverWrite(CFileMan* aFileMan); |
|
3106 |
TControl NotifyFileManEnded(); |
|
3107 |
private: |
|
3108 |
CFileMan* iFileMan; |
|
3109 |
}; |
|
3110 |
||
3111 |
||
3112 |
CFileManObserverOverWrite::CFileManObserverOverWrite(CFileMan* aFileMan) |
|
3113 |
// |
|
3114 |
// Constructor |
|
3115 |
// |
|
3116 |
{ |
|
3117 |
__DECLARE_NAME(_S("CFileManObserverOverWrite")); |
|
3118 |
iFileMan=aFileMan; |
|
3119 |
} |
|
3120 |
||
3121 |
||
3122 |
MFileManObserver::TControl CFileManObserverOverWrite::NotifyFileManEnded() |
|
3123 |
// |
|
3124 |
// Observer for testoverwrite tests |
|
3125 |
// |
|
3126 |
{ |
|
3127 |
TInt lastError=iFileMan->GetLastError(); |
|
3128 |
if (lastError!=KErrNone) |
|
3129 |
{ |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3130 |
test_Equal(KErrAlreadyExists, lastError); |
0 | 3131 |
if (gAsynch==EFalse) |
3132 |
{ |
|
3133 |
TFileName fileName=iFileMan->CurrentEntry().iName; |
|
3134 |
test.Printf(_L(" %S already exists\n"),&fileName); |
|
3135 |
} |
|
3136 |
} |
|
3137 |
return(MFileManObserver::EContinue); |
|
3138 |
} |
|
3139 |
||
3140 |
LOCAL_C void TestOverWrite() |
|
3141 |
// |
|
3142 |
// Test overwrite for copy and rename |
|
3143 |
// |
|
3144 |
{ |
|
3145 |
test.Next(_L("Test overwrite option")); |
|
3146 |
RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\")); |
|
3147 |
CFileManObserverOverWrite* fManObserver=new(ELeave) CFileManObserverOverWrite(gFileMan); |
|
3148 |
CleanupStack::PushL(fManObserver); |
|
3149 |
gFileMan->SetObserver(fManObserver); |
|
3150 |
||
3151 |
TBuf8<128> contentsFile1=_L8("Test file one contents"); |
|
3152 |
TBuf8<128> contentsFile2=_L8("Test file two contents"); |
|
3153 |
||
3154 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT")); |
|
3155 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT")); |
|
3156 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE1.TXT"),contentsFile1); |
|
3157 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\FILE2.TXT"),contentsFile2); |
|
3158 |
||
3159 |
if (!gAsynch) |
|
3160 |
{ |
|
3161 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3162 |
test_Equal(KErrAlreadyExists, r); |
0 | 3163 |
} |
3164 |
else |
|
3165 |
{ |
|
3166 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3167 |
test_KErrNone(r); |
0 | 3168 |
WaitForResult(KErrAlreadyExists); |
3169 |
} |
|
3170 |
||
3171 |
RFile f; |
|
3172 |
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3173 |
test_KErrNone(r); |
0 | 3174 |
TBuf8<128> data; |
3175 |
r=f.Read(data); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3176 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3177 |
test_Equal(0, data.Length()); |
0 | 3178 |
f.Close(); |
3179 |
||
3180 |
if (!gAsynch) |
|
3181 |
{ |
|
3182 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3183 |
test_KErrNone(r); |
0 | 3184 |
} |
3185 |
else |
|
3186 |
{ |
|
3187 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3188 |
test_KErrNone(r); |
0 | 3189 |
WaitForSuccess(); |
3190 |
} |
|
3191 |
||
3192 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3193 |
test_KErrNone(r); |
0 | 3194 |
r=f.Read(data); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3195 |
test_KErrNone(r); |
0 | 3196 |
test(data==contentsFile1); |
3197 |
f.Close(); |
|
3198 |
||
3199 |
RmDir(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\")); |
|
3200 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT")); |
|
3201 |
MakeFile(_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT")); |
|
3202 |
||
3203 |
if (!gAsynch) |
|
3204 |
{ |
|
3205 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3206 |
test_Equal(KErrAlreadyExists, r); |
0 | 3207 |
} |
3208 |
else |
|
3209 |
{ |
|
3210 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3211 |
test_KErrNone(r); |
0 | 3212 |
WaitForResult(KErrAlreadyExists); |
3213 |
} |
|
3214 |
||
3215 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3216 |
test_KErrNone(r); |
0 | 3217 |
r=f.Read(data); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3218 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3219 |
test_Equal(0, data.Length()); |
0 | 3220 |
f.Close(); |
3221 |
||
3222 |
if (!gAsynch) |
|
3223 |
{ |
|
3224 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3225 |
test_KErrNone(r); |
0 | 3226 |
} |
3227 |
else |
|
3228 |
{ |
|
3229 |
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3230 |
test_KErrNone(r); |
0 | 3231 |
WaitForSuccess(); |
3232 |
} |
|
3233 |
||
3234 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3235 |
test_KErrNone(r); |
0 | 3236 |
r=f.Read(data); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3237 |
test_KErrNone(r); |
0 | 3238 |
test(data==contentsFile2); |
3239 |
f.Close(); |
|
3240 |
gFileMan->SetObserver(gObserver); |
|
3241 |
CleanupStack::PopAndDestroy(); |
|
3242 |
} |
|
3243 |
||
3244 |
LOCAL_C void TestErrorHandling() |
|
3245 |
// |
|
3246 |
// Test bad paths etc |
|
3247 |
// |
|
3248 |
{ |
|
3249 |
test.Next(_L("Test error handling")); |
|
3250 |
if (!gAsynch) |
|
3251 |
{ |
|
3252 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3253 |
test_Equal(KErrPathNotFound, r); |
0 | 3254 |
} |
3255 |
else |
|
3256 |
{ |
|
3257 |
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3258 |
test_KErrNone(r); |
0 | 3259 |
WaitForResult(KErrPathNotFound); |
3260 |
} |
|
3261 |
||
3262 |
CFileMan* fMan=CFileMan::NewL(TheFs); |
|
3263 |
TInt r; |
|
3264 |
{ |
|
3265 |
for(TInt drvNum=EDriveA; drvNum<=EDriveZ; ++drvNum) |
|
3266 |
{ |
|
3267 |
TDriveInfo drvInfo; |
|
3268 |
if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent) |
|
3269 |
{ |
|
3270 |
// found a non-extant drive, test it... |
|
3271 |
_LIT(KBad,"?:\\BADPATH\\*"); |
|
3272 |
TBuf<16> bad(KBad); |
|
3273 |
bad[0] = TUint16('A'+drvNum); |
|
3274 |
TInt r=fMan->Delete(bad); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3275 |
test_Equal(KErrNotReady, r); |
0 | 3276 |
break; |
3277 |
} |
|
3278 |
} |
|
3279 |
} |
|
3280 |
delete fMan; |
|
3281 |
||
3282 |
MakeFile(_L("\\ONE\\TWO\\FILE1.TXT")); |
|
3283 |
MakeFile(_L("\\ONE\\TWO\\FOUR")); |
|
3284 |
test.Next(_L("Test cyclic copy")); |
|
3285 |
if (!gAsynch) |
|
3286 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse); |
|
3287 |
else |
|
3288 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3289 |
test_Equal(KErrArgument, r); |
0 | 3290 |
|
3291 |
test.Next(_L("Test src name == trg name")); |
|
3292 |
if (!gAsynch) |
|
3293 |
{ |
|
3294 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR")); // default aSwitch=EOverWrite |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3295 |
test_KErrNone(r); |
0 | 3296 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"), 0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3297 |
test_Equal(KErrAlreadyExists, r); |
0 | 3298 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3299 |
test_Equal(KErrAlreadyExists, r); |
0 | 3300 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\F*R"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3301 |
test_Equal(KErrAlreadyExists, r); |
0 | 3302 |
} |
3303 |
else |
|
3304 |
{ |
|
3305 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.TXT"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3306 |
test_KErrNone(r); |
0 | 3307 |
WaitForResult(KErrAlreadyExists); |
3308 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\F*R"),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3309 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3310 |
WaitForResult(KErrNone); |
0 | 3311 |
} |
3312 |
RmDir(_L("\\ONE\\")); |
|
3313 |
||
3314 |
test.Next(_L("Test copy missing source and path")); |
|
3315 |
if (!gAsynch) |
|
3316 |
{ |
|
3317 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3318 |
test_Equal(KErrPathNotFound, r); |
0 | 3319 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3320 |
test_Equal(KErrPathNotFound, r); |
0 | 3321 |
} |
3322 |
else |
|
3323 |
{ |
|
3324 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.YYY"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3325 |
test_KErrNone(r); |
0 | 3326 |
WaitForResult(KErrPathNotFound); |
3327 |
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3328 |
test_KErrNone(r); |
0 | 3329 |
WaitForResult(KErrPathNotFound); |
3330 |
} |
|
3331 |
||
3332 |
test.Next(_L("Test copy missing source")); |
|
3333 |
if (!gAsynch) |
|
3334 |
{ |
|
3335 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\*.LPQ"),_L("\\ONE\\TWO\\*.YYY")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3336 |
test_Equal(KErrNotFound, r); |
0 | 3337 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3338 |
test_Equal(KErrNotFound, r); |
0 | 3339 |
} |
3340 |
else |
|
3341 |
{ |
|
3342 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),0,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3343 |
test_KErrNone(r); |
0 | 3344 |
WaitForResult(KErrNotFound); |
3345 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3346 |
test_KErrNone(r); |
0 | 3347 |
WaitForResult(KErrNotFound); |
3348 |
} |
|
3349 |
||
3350 |
RmDir(_L("\\EMPTYSRC\\")); |
|
3351 |
MakeDir(_L("\\EMPTYSRC\\")); |
|
3352 |
RmDir(_L("\\EMPTYTRG\\")); |
|
3353 |
MakeDir(_L("\\EMPTYTRG\\")); |
|
3354 |
test.Next(_L("Test copy empty source directory")); |
|
3355 |
if (!gAsynch) |
|
3356 |
{ |
|
3357 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3358 |
test_Equal(KErrNotFound, r); |
0 | 3359 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3360 |
test_Equal(KErrNotFound, r); |
0 | 3361 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3362 |
test_Equal(KErrNotFound, r); |
0 | 3363 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3364 |
test_Equal(KErrNotFound, r); |
0 | 3365 |
} |
3366 |
else |
|
3367 |
{ |
|
3368 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), 0, gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3369 |
test_KErrNone(r); |
0 | 3370 |
WaitForResult(KErrNotFound); |
3371 |
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3372 |
test_KErrNone(r); |
0 | 3373 |
WaitForResult(KErrNotFound); |
3374 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), 0, gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3375 |
test_KErrNone(r); |
0 | 3376 |
WaitForResult(KErrNotFound); |
3377 |
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3378 |
test_KErrNone(r); |
0 | 3379 |
WaitForResult(KErrNotFound); |
3380 |
} |
|
3381 |
RmDir(_L("\\EMPTYSRC\\")); |
|
3382 |
RmDir(_L("\\EMPTYTRG\\")); |
|
3383 |
||
3384 |
||
3385 |
MakeFile(_L("Dummyfile")); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3386 |
test.Next(_L("Test illegal names")); |
0 | 3387 |
r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3388 |
test_Equal(KErrBadName, r); |
0 | 3389 |
r=gFileMan->Copy(_L(":C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3390 |
test_Equal(KErrBadName, r); |
0 | 3391 |
r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3392 |
test_Equal(KErrBadName, r); |
0 | 3393 |
r=gFileMan->Delete(_L(":C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3394 |
test_Equal(KErrBadName, r); |
0 | 3395 |
r=gFileMan->Move(_L(":C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3396 |
test_Equal(KErrBadName, r); |
0 | 3397 |
r=gFileMan->Move(_L("dummyFile"),_L(":C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3398 |
test_Equal(KErrBadName, r); |
0 | 3399 |
r=gFileMan->Rename(_L(":C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3400 |
test_Equal(KErrBadName, r); |
0 | 3401 |
r=gFileMan->Rename(_L("DummyFile"),_L(":C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3402 |
test_Equal(KErrBadName, r); |
0 | 3403 |
r=gFileMan->RmDir(_L("\\:C:\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3404 |
test_Equal(KErrBadName, r); |
0 | 3405 |
|
3406 |
r=gFileMan->Attribs(_L("::C:"),0,0,TTime(0),0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3407 |
test_Equal(KErrBadName, r); |
0 | 3408 |
r=gFileMan->Copy(_L("::C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3409 |
test_Equal(KErrBadName, r); |
0 | 3410 |
r=gFileMan->Copy(_L("Dummyfile"),_L("::C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3411 |
test_Equal(KErrBadName, r); |
0 | 3412 |
r=gFileMan->Delete(_L("::C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3413 |
test_Equal(KErrBadName, r); |
0 | 3414 |
r=gFileMan->Move(_L("::C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3415 |
test_Equal(KErrBadName, r); |
0 | 3416 |
r=gFileMan->Move(_L("dummyFile"),_L("::C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3417 |
test_Equal(KErrBadName, r); |
0 | 3418 |
r=gFileMan->Rename(_L("::C:"),_L("newname"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3419 |
test_Equal(KErrBadName, r); |
0 | 3420 |
r=gFileMan->Rename(_L("DummyFile"),_L("::C:"),0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3421 |
test_Equal(KErrBadName, r); |
0 | 3422 |
r=gFileMan->RmDir(_L("::C:")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3423 |
test_Equal(KErrBadName, r); |
0 | 3424 |
r=TheFs.Delete(_L("DummyFile")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3425 |
test_KErrNone(r); |
0 | 3426 |
// test copying two files with identical names that do not exist |
3427 |
_LIT(KNonExistent,"\\azzzz.txt"); |
|
3428 |
r=gFileMan->Copy(KNonExistent,KNonExistent,0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3429 |
test_Equal(KErrNotFound, r); |
0 | 3430 |
} |
3431 |
||
3432 |
LOCAL_C void TestNameMangling() |
|
3433 |
// |
|
3434 |
// Synchronous test of name mangling |
|
3435 |
// |
|
3436 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3437 |
test.Next(_L("Test name mangling")); |
0 | 3438 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
3439 |
MakeDir(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\")); |
|
3440 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.def")); |
|
3441 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.def")); |
|
3442 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abc.defgh")); |
|
3443 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\abcdefghijk.defgh")); |
|
3444 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.def")); |
|
3445 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.def")); |
|
3446 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abc.defgh")); |
|
3447 |
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.defgh")); |
|
3448 |
||
3449 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3450 |
test_KErrNone(r); |
0 | 3451 |
Compare(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*")); |
3452 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3453 |
test_KErrNone(r); |
0 | 3454 |
} |
3455 |
||
3456 |
LOCAL_C void TestLongNames() |
|
3457 |
// |
|
3458 |
// Synchronous test of name mangling |
|
3459 |
// |
|
3460 |
{ |
|
3461 |
#if defined(__WINS__) |
|
3462 |
if (gSessionPath[0]=='C') |
|
3463 |
return; |
|
3464 |
#endif |
|
3465 |
||
3466 |
gFileMan->SetObserver(NULL); |
|
3467 |
||
3468 |
// Format the current drive |
|
3469 |
Format(CurrentDrive()); |
|
3470 |
// Create Session Path |
|
3471 |
CreateTestDirectory(_L("\\F32-TST\\TFMAN\\")); |
|
3472 |
||
3473 |
// Create 2 root directories with very long names |
|
3474 |
TInt longFileLength = KMaxFileName-4; |
|
3475 |
test.Next(_L("Test methods on long names")); |
|
3476 |
TFileName longFileNameA; |
|
3477 |
longFileNameA.SetLength(longFileLength); |
|
3478 |
longFileNameA.Fill('A',longFileLength); |
|
3479 |
TFileName longRootDirNameA=_L("\\"); |
|
3480 |
longRootDirNameA+=longFileNameA; |
|
3481 |
longRootDirNameA+=_L("\\"); |
|
3482 |
TInt r=TheFs.MkDir(longRootDirNameA); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3483 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists); |
0 | 3484 |
// Second folder |
3485 |
TFileName longFileNameB; |
|
3486 |
longFileNameB.SetLength(longFileLength); |
|
3487 |
longFileNameB.Fill('B',longFileLength); |
|
3488 |
TFileName longRootDirNameB=_L("\\"); |
|
3489 |
longRootDirNameB+=longFileNameB; |
|
3490 |
longRootDirNameB+=_L("\\"); |
|
3491 |
r=TheFs.MkDir(longRootDirNameB); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3492 |
test_Value(r, r==KErrNone || r==KErrAlreadyExists); |
0 | 3493 |
|
3494 |
TInt longFilePtrLength = KMaxFileName-3; // We do not want the trailing backslash |
|
3495 |
TPtrC ptrLongFileA(longRootDirNameA.Ptr(),longFilePtrLength); |
|
3496 |
TPtrC ptrLongFileB(longRootDirNameB.Ptr(),longFilePtrLength); |
|
3497 |
||
3498 |
// TInt CFileMan::Move(const TDesC& anOld,const TDesC& aNew,TUint aSwitch=EOverWrite); |
|
3499 |
// Tries to move a folder with a long name into another |
|
3500 |
// This test will return KErrGeneral because the new path will exceed the maximum length |
|
3501 |
// See KMaxFileName |
|
3502 |
r=gFileMan->Move(ptrLongFileA,ptrLongFileB); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3503 |
test_Equal(KErrGeneral, r); |
0 | 3504 |
|
3505 |
r=gFileMan->RmDir(longRootDirNameA); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3506 |
test_KErrNone(r); |
0 | 3507 |
r=gFileMan->Rename(ptrLongFileB,ptrLongFileA); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3508 |
test_KErrNone(r); |
0 | 3509 |
r=gFileMan->RmDir(longRootDirNameB); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3510 |
test_Equal(KErrPathNotFound, r); |
0 | 3511 |
r=gFileMan->RmDir(longRootDirNameA); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3512 |
test_KErrNone(r); |
0 | 3513 |
|
3514 |
TFileName longSubDirName=_L("\\Files\\"); |
|
3515 |
TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length()); |
|
3516 |
longSubDirName+=longSubDirFileName; |
|
3517 |
longSubDirName+=_L("\\"); |
|
3518 |
r=TheFs.MkDirAll(longSubDirName); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3519 |
test_KErrNone(r); |
0 | 3520 |
|
3521 |
CDir* dirList; |
|
3522 |
r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3523 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3524 |
test_Equal(0, dirList->Count()); |
0 | 3525 |
delete dirList; |
3526 |
||
3527 |
TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1); |
|
3528 |
TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1); |
|
3529 |
r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3530 |
test_KErrNone(r); |
0 | 3531 |
r=TheFs.MkDir(longRootDirNameB); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3532 |
test_KErrNone(r); |
0 | 3533 |
r=gFileMan->Move(ptrLongSubDirSrc,longRootDirNameB); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3534 |
test_Equal(KErrBadName, r); |
0 | 3535 |
r=TheFs.RmDir(longRootDirNameB); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3536 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3537 |
test_KErrNone(TheFs.RmDir(longSubDirName)); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3538 |
test_KErrNone(TheFs.RmDir(_L("\\Files\\"))); |
0 | 3539 |
gFileMan->SetObserver(gObserver); |
3540 |
} |
|
3541 |
||
3542 |
LOCAL_C void TestFileAttributes() |
|
3543 |
// |
|
3544 |
// Test file attributes are copied and new settings |
|
3545 |
// |
|
3546 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3547 |
test.Next(_L("Test file attributes are copied")); |
0 | 3548 |
gFileMan->Delete(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*")); |
3549 |
MakeDir(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\")); |
|
3550 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonly.def"),KEntryAttReadOnly); |
|
3551 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\readonlyhidden.def"),KEntryAttReadOnly|KEntryAttHidden); |
|
3552 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\hiddensystem.def"),KEntryAttHidden|KEntryAttSystem); |
|
3553 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\systemarchive.def"),KEntryAttArchive|KEntryAttSystem); |
|
3554 |
||
3555 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3556 |
test_KErrNone(r); |
0 | 3557 |
Compare(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*")); |
3558 |
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*"),0,KEntryAttReadOnly,TTime(0)); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3559 |
test_KErrNone(r); |
0 | 3560 |
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"),0,KEntryAttReadOnly,TTime(0)); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3561 |
test_KErrNone(r); |
0 | 3562 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILEATT\\")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3563 |
test_KErrNone(r); |
0 | 3564 |
} |
3565 |
||
3566 |
class CFileManObserverContinue : public CBase, public MFileManObserver |
|
3567 |
{ |
|
3568 |
public: |
|
3569 |
CFileManObserverContinue(CFileMan* aFileMan); |
|
3570 |
TControl NotifyFileManEnded(); |
|
3571 |
private: |
|
3572 |
CFileMan* iFileMan; |
|
3573 |
}; |
|
3574 |
||
3575 |
||
3576 |
CFileManObserverContinue::CFileManObserverContinue(CFileMan* aFileMan) |
|
3577 |
// |
|
3578 |
// Constructor |
|
3579 |
// |
|
3580 |
{ |
|
3581 |
__DECLARE_NAME(_S("CFileManObserverOverWrite")); |
|
3582 |
iFileMan=aFileMan; |
|
3583 |
} |
|
3584 |
||
3585 |
||
3586 |
MFileManObserver::TControl CFileManObserverContinue::NotifyFileManEnded() |
|
3587 |
// |
|
3588 |
// Observer for testoverwrite tests |
|
3589 |
// |
|
3590 |
{ |
|
3591 |
return(MFileManObserver::EContinue); |
|
3592 |
} |
|
3593 |
||
3594 |
LOCAL_C void TestCopyOpenFile() |
|
3595 |
// |
|
3596 |
// Copy a file while it is open |
|
3597 |
// |
|
3598 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3599 |
test.Next(_L("Test copying open files")); |
0 | 3600 |
|
3601 |
CFileManObserverContinue* fManObserver=new(ELeave) CFileManObserverContinue(gFileMan); |
|
3602 |
gFileMan->SetObserver(fManObserver); |
|
3603 |
||
3604 |
TBuf<256> contents; |
|
3605 |
TPtrC8 bufPtr; |
|
3606 |
CreateLongName(contents,gSeed,256); |
|
3607 |
bufPtr.Set((TUint8*)contents.Ptr(),contents.Size()); |
|
3608 |
||
3609 |
MakeFile(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),bufPtr); |
|
3610 |
RFile f; |
|
3611 |
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead|EFileShareReadersOnly); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3612 |
test_KErrNone(r); |
0 | 3613 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3614 |
test_KErrNone(r); |
0 | 3615 |
f.Close(); |
3616 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3617 |
test_KErrNone(r); |
0 | 3618 |
TBuf8<256*sizeof(TText)> temp; |
3619 |
r=f.Read(temp); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3620 |
test_KErrNone(r); |
0 | 3621 |
test(temp==bufPtr); |
3622 |
r=f.Read(temp); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3623 |
test_KErrNone(r); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3624 |
test_Equal(0, temp.Length()); |
0 | 3625 |
f.Close(); |
3626 |
||
3627 |
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3628 |
test_KErrNone(r); |
0 | 3629 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx")); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3630 |
test_Equal(KErrInUse, r); |
0 | 3631 |
f.Close(); |
3632 |
||
3633 |
gFileMan->SetObserver(gObserver); |
|
3634 |
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILECOPY\\")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3635 |
test_KErrNone(r); |
0 | 3636 |
delete fManObserver; |
3637 |
} |
|
3638 |
||
3639 |
void TestINC101844() |
|
3640 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3641 |
test.Next(_L("Test move files and subdirs with different attributes (INC101844)")); |
0 | 3642 |
_LIT(KDest,"C:\\DEST101844\\"); |
3643 |
TBuf<64> source; |
|
3644 |
source.Format(_L("%c:\\INC101844\\"), (TUint) gDriveToTest); |
|
3645 |
TBuf<64> src; |
|
3646 |
RmDir(source); |
|
3647 |
RmDir(KDest); |
|
3648 |
MakeDir(KDest); |
|
3649 |
TInt r; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3650 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3651 |
// Create files and subdirs with different attributes |
0 | 3652 |
src = source; |
3653 |
src.Append(_L("file1")); |
|
3654 |
MakeFile(src, _L8("blah")); |
|
3655 |
TheFs.SetAtt(src, KEntryAttReadOnly, 0); |
|
3656 |
src = source; |
|
3657 |
src.Append(_L("file2")); |
|
3658 |
MakeFile(src, _L8("blah")); |
|
3659 |
TheFs.SetAtt(src, KEntryAttHidden, 0); |
|
3660 |
src = source; |
|
3661 |
src.Append(_L("file3")); |
|
3662 |
MakeFile(src, _L8("blah")); |
|
3663 |
TheFs.SetAtt(src, KEntryAttSystem, 0); |
|
3664 |
src = source; |
|
3665 |
src.Append(_L("subdir1\\file4")); |
|
3666 |
MakeFile(src, _L8("blah")); |
|
3667 |
TheFs.SetAtt(src, KEntryAttArchive, 0); |
|
3668 |
src = source; |
|
3669 |
src.Append(_L("subdir1")); |
|
3670 |
TheFs.SetAtt(src, KEntryAttSystem | KEntryAttHidden, KEntryAttArchive); |
|
3671 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3672 |
// Move directory containing files and subdirs with different attributes |
0 | 3673 |
r = gFileMan->Move(source, KDest, 0); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3674 |
test_KErrNone(r); |
0 | 3675 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3676 |
// Check that the files and subdirs have moved and have the correct attributes |
0 | 3677 |
TEntry entry; |
3678 |
src = KDest; |
|
3679 |
src.Append(_L("file1")); |
|
3680 |
r = TheFs.Entry(src, entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3681 |
test_KErrNone(r); |
0 | 3682 |
test(entry.iAtt&KEntryAttReadOnly); |
3683 |
||
3684 |
src = KDest; |
|
3685 |
src.Append(_L("file2")); |
|
3686 |
r = TheFs.Entry(src, entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3687 |
test_KErrNone(r); |
0 | 3688 |
test(entry.iAtt&KEntryAttHidden); |
3689 |
||
3690 |
src = KDest; |
|
3691 |
src.Append(_L("file3")); |
|
3692 |
r = TheFs.Entry(src, entry); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3693 |
test_KErrNone(r); |
0 | 3694 |
test(entry.iAtt&KEntryAttSystem); |
3695 |
||
3696 |
src = source; |
|
3697 |
src.Append(_L("subdir1\\")); |
|
3698 |
r = gFileMan->Move(src, source, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3699 |
test_KErrNone(r); |
0 | 3700 |
|
3701 |
r = TheFs.RmDir(src); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3702 |
test_KErrNone(r); |
0 | 3703 |
src = source; |
3704 |
src.Append(_L("file4")); |
|
3705 |
r = TheFs.Delete(src); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3706 |
test_KErrNone(r); |
0 | 3707 |
r = TheFs.RmDir(source); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3708 |
test_KErrNone(r); |
0 | 3709 |
RmDir(KDest); |
3710 |
} |
|
3711 |
||
3712 |
LOCAL_C void TestMoveAcrossDrives() |
|
3713 |
// |
|
3714 |
// Move a file from C: to the target drive |
|
3715 |
// |
|
3716 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3717 |
test.Next(_L("Test move across drives")); |
0 | 3718 |
|
3719 |
TFileName trgDrive = _L("\\"); |
|
3720 |
TFileName trgFile = _L("\\Sketch"); |
|
3721 |
TFileName trgDir = _L("\\DRIVEMOVE\\"); |
|
3722 |
TFileName trgDirFile = _L("\\DRIVEMOVE\\Sketch"); |
|
3723 |
||
3724 |
if (gSessionPath[0]=='C') |
|
3725 |
{ |
|
3726 |
#if !defined(__WINS__) |
|
3727 |
trgDrive = _L("D:\\"); |
|
3728 |
trgFile = _L("D:\\Sketch"); |
|
3729 |
trgDir = _L("D:\\DRIVEMOVE\\"); |
|
3730 |
trgDirFile = _L("D:\\DRIVEMOVE\\Sketch"); |
|
3731 |
#else |
|
3732 |
trgDrive = _L("Y:\\"); |
|
3733 |
trgFile = _L("Y:\\Sketch"); |
|
3734 |
trgDir = _L("Y:\\DRIVEMOVE\\"); |
|
3735 |
trgDirFile = _L("Y:\\DRIVEMOVE\\Sketch"); |
|
3736 |
#endif |
|
3737 |
} |
|
3738 |
||
3739 |
RmDir(trgDir); |
|
3740 |
RmDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
|
3741 |
||
3742 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
|
3743 |
||
3744 |
// Move Sketch from the source to target |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3745 |
TInt r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),trgDrive); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3746 |
test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
0 | 3747 |
// Check Sketch no longer exists on source drive |
3748 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrNotFound); |
|
3749 |
// Check Sketch exists on target drive |
|
3750 |
CheckFileExists(trgFile,KErrNone); |
|
3751 |
||
3752 |
MakeFile(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch")); |
|
3753 |
// Move Directory DRIVEMOVE from the source to target |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3754 |
r = gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE"),trgDrive); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3755 |
test.Printf(_L("TestMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
0 | 3756 |
// Check DRIVEMOVE no longer exists on source drive |
3757 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\Sketch"),KErrPathNotFound); |
|
3758 |
// Check Sketch exists on target drive |
|
3759 |
CheckFileExists(trgDirFile,KErrNone); |
|
3760 |
||
3761 |
RmDir(trgDir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3762 |
test_KErrNone(TheFs.Delete(trgFile)); |
0 | 3763 |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3764 |
TestINC101844(); // Test move files and subdirs with different attributes |
0 | 3765 |
} |
3766 |
||
3767 |
class CFileManObserverCopyAbort : public CBase, public MFileManObserver |
|
3768 |
{ |
|
3769 |
public: |
|
3770 |
CFileManObserverCopyAbort(CFileMan* aFileMan); |
|
3771 |
TControl NotifyFileManEnded(); |
|
3772 |
void SetAbortStep(TInt aAbortStep); |
|
3773 |
private: |
|
3774 |
CFileMan* iFileMan; |
|
3775 |
TInt iCurrentStep; |
|
3776 |
}; |
|
3777 |
||
3778 |
||
3779 |
CFileManObserverCopyAbort::CFileManObserverCopyAbort(CFileMan* aFileMan) |
|
3780 |
// |
|
3781 |
// Constructor |
|
3782 |
// |
|
3783 |
: iFileMan(aFileMan), |
|
3784 |
iCurrentStep(0) |
|
3785 |
{ |
|
3786 |
__DECLARE_NAME(_S("CFileManObserverCopyAbort")); |
|
3787 |
} |
|
3788 |
||
3789 |
||
3790 |
void CFileManObserverCopyAbort::SetAbortStep(TInt aAbortStep) |
|
3791 |
// |
|
3792 |
// Set the step at which to cancel the operation |
|
3793 |
// |
|
3794 |
{ |
|
3795 |
iCurrentStep = aAbortStep; |
|
3796 |
} |
|
3797 |
||
3798 |
||
3799 |
MFileManObserver::TControl CFileManObserverCopyAbort::NotifyFileManEnded() |
|
3800 |
// |
|
3801 |
// Observer for testoverwrite tests |
|
3802 |
// |
|
3803 |
{ |
|
3804 |
TInt lastError = iFileMan->GetLastError(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3805 |
test_KErrNone(lastError); |
0 | 3806 |
|
3807 |
TFileName srcfile; |
|
3808 |
iFileMan->GetCurrentSource(srcfile); |
|
3809 |
||
3810 |
TInt action = iFileMan->CurrentAction(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3811 |
test_Value(action, action == CFileMan::EMove || |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3812 |
action == CFileMan::EDelete || |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3813 |
action == CFileMan::ERmDir); |
0 | 3814 |
|
3815 |
iCurrentStep--; |
|
3816 |
return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort); |
|
3817 |
} |
|
3818 |
||
3819 |
LOCAL_C void TestAbortedMoveAcrossDrives() |
|
3820 |
// |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3821 |
// Move a file from C: to D: or Y:, and test various cancel conditions |
0 | 3822 |
// |
3823 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3824 |
test.Next(_L("Test cancel move across drives")); |
0 | 3825 |
|
3826 |
const TInt KNumFiles = 5; |
|
3827 |
||
3828 |
TFileName trgDirRoot = _L("\\F32-TST\\TFMAN\\"); |
|
3829 |
TFileName trgDirFull = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\"); |
|
3830 |
TFileName trgDirFile = _L("\\F32-TST\\TFMAN\\CANCELMOVE\\FILE"); |
|
3831 |
||
3832 |
if (gSessionPath[0]=='C') |
|
3833 |
{ |
|
3834 |
#if !defined(__WINS__) |
|
3835 |
trgDirRoot = _L("D:\\F32-TST\\TFMAN\\"); |
|
3836 |
trgDirFull = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\"); |
|
3837 |
trgDirFile = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE"); |
|
3838 |
#else |
|
3839 |
trgDirRoot = _L("Y:\\F32-TST\\TFMAN\\"); |
|
3840 |
trgDirFull = _L("Y:\\F32-TST\\TFMAN\\CANCELMOVE\\"); |
|
3841 |
trgDirFile = _L("Y:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE"); |
|
3842 |
#endif |
|
3843 |
} |
|
3844 |
||
3845 |
gFileMan->RmDir(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\")); |
|
3846 |
||
3847 |
CFileManObserverCopyAbort* fManObserver=new(ELeave) CFileManObserverCopyAbort(gFileMan); |
|
3848 |
CleanupStack::PushL(fManObserver); |
|
3849 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3850 |
// Check that source files exist when interrupting the copy step |
0 | 3851 |
TInt step = 0; |
3852 |
TInt i = 0; |
|
3853 |
for(step = 1; step <= KNumFiles+1; ++step) |
|
3854 |
{ |
|
3855 |
for (i = 0; i < KNumFiles; i++) |
|
3856 |
{ |
|
3857 |
TFileName sourceFile =_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE"); |
|
3858 |
sourceFile.AppendNum(i); |
|
3859 |
sourceFile.Append(_L(".TXT")); |
|
3860 |
MakeFile(sourceFile); |
|
3861 |
} |
|
3862 |
||
3863 |
gFileMan->RmDir(trgDirFull); |
|
3864 |
||
3865 |
fManObserver->SetAbortStep(step); |
|
3866 |
gFileMan->SetObserver(fManObserver); |
|
3867 |
||
3868 |
TInt r; |
|
3869 |
if (!gAsynch) |
|
3870 |
r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite); |
|
3871 |
else |
|
3872 |
r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE"),trgDirRoot, CFileMan::EOverWrite, gStat); |
|
3873 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3874 |
test.Printf(_L("TestAbortedMoveAcrossDrives(),gFileMan->Move(),r=%d\n"),r); |
0 | 3875 |
TestResult(r, (step <= KNumFiles) ? KErrCancel : KErrNone); |
3876 |
||
3877 |
gFileMan->SetObserver(NULL); |
|
3878 |
||
3879 |
// Check that the expected target files exist... |
|
3880 |
CheckFileExists(trgDirFull, KErrNone, EFalse); |
|
3881 |
for (i = 0; i < Min(step, KNumFiles); i++) |
|
3882 |
{ |
|
3883 |
TFileName trgAfterFile = trgDirFile; |
|
3884 |
trgAfterFile.AppendNum(i); |
|
3885 |
trgAfterFile.Append(_L(".TXT")); |
|
3886 |
CheckFileExists(trgAfterFile, KErrNone); |
|
3887 |
} |
|
3888 |
||
3889 |
// Check that the expected source files still exist after the abort... |
|
3890 |
CheckFileExists(_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\"), (step <= KNumFiles) ? KErrNone : KErrNotFound, EFalse); |
|
3891 |
for (; i < KNumFiles; i++) |
|
3892 |
{ |
|
3893 |
TFileName srcAfterFile =_L("C:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE"); |
|
3894 |
srcAfterFile.AppendNum(i); |
|
3895 |
srcAfterFile.Append(_L(".TXT")); |
|
3896 |
CheckFileExists(srcAfterFile, KErrNone); |
|
3897 |
} |
|
3898 |
} |
|
3899 |
||
3900 |
gFileMan->SetObserver(NULL); |
|
3901 |
CleanupStack::PopAndDestroy(); |
|
3902 |
||
3903 |
RmDir(trgDirRoot); // "?:\\F32-TST\\TFMAN\\" |
|
3904 |
TheFs.RmDir(trgDirRoot.Left(16)); |
|
3905 |
TheFs.RmDir(trgDirRoot.Left(10)); |
|
3906 |
TheFs.RmDir(_L("C:\\F32-TST\\TFMAN\\")); |
|
3907 |
TheFs.RmDir(_L("C:\\F32-TST\\")); |
|
3908 |
} |
|
3909 |
||
3910 |
||
3911 |
LOCAL_C void TestMoveEmptyDirectory() |
|
3912 |
// |
|
3913 |
// "Try to move an empty directory C:\F32-TST\TFMAN\DRIVEMOVE\ to C:\" |
|
3914 |
// |
|
3915 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3916 |
test.Next(_L("Test move empty directory")); |
0 | 3917 |
|
3918 |
#if !defined(__WINS__) |
|
3919 |
TFileName trgDrive=_L("D:\\"); |
|
3920 |
#else |
|
3921 |
if (gSessionPath[0]!='C') |
|
3922 |
return; |
|
3923 |
TFileName trgDrive=_L("C:\\"); |
|
3924 |
#endif |
|
3925 |
||
3926 |
MakeDir(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\")); |
|
3927 |
TInt r=gFileMan->Move(_L("C:\\F32-TST\\TFMAN\\DRIVEMOVE\\*"),trgDrive,CFileMan::ERecurse); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3928 |
test.Printf(_L("TestMoveEmptyDirectory(),gFileMan->Move(),r=%d\n"),r); |
0 | 3929 |
test (r==KErrNotFound); |
3930 |
} |
|
3931 |
||
3932 |
LOCAL_C void TestCopyAndRename() |
|
3933 |
// |
|
3934 |
// Rename while copying files and directories |
|
3935 |
// |
|
3936 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3937 |
test.Next(_L("Test rename while copying files and directories")); |
0 | 3938 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV")); |
3939 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_1.TXT")); |
|
3940 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_2.TXT")); |
|
3941 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\ONE_3.TXT")); |
|
3942 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\TWOTWO.TWO")); |
|
3943 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE_4.TXT")); |
|
3944 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\ONE_5.TXT")); |
|
3945 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.TXT")); |
|
3946 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.GOD")); |
|
3947 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.BAD")); |
|
3948 |
||
3949 |
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\TWO.*"), _L("\\F32-TST\\TFMAN\\THREE.*"), CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3950 |
test_KErrNone(r); |
0 | 3951 |
|
3952 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
|
3953 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone); |
|
3954 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone); |
|
3955 |
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.*")); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3956 |
test_KErrNone(r); |
0 | 3957 |
|
3958 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT")); |
|
3959 |
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT")); |
|
3960 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3961 |
// copy and rename dir |
0 | 3962 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3963 |
test_KErrNone(r); |
0 | 3964 |
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*")); |
3965 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3966 |
// copy and move into another dir |
0 | 3967 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3968 |
test_KErrNone(r); |
0 | 3969 |
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*")); |
3970 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3971 |
// copy and rename files and dirs in current dir |
0 | 3972 |
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse); |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
3973 |
test_KErrNone(r); |
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
3974 |
// Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*")); |
0 | 3975 |
|
3976 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone); |
|
3977 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__1.TXT"), KErrNone); |
|
3978 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO__2.TXT"), KErrNone); |
|
3979 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone); |
|
3980 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone); |
|
3981 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone); |
|
3982 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\THREE1.TXT"), KErrNone); |
|
3983 |
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE\\THREE2.TXT"), KErrNone); |
|
3984 |
||
3985 |
gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\CPMV\\")); |
|
3986 |
} |
|
3987 |
||
3988 |
void TestStackUsage(TInt aLevel, TThreadStackInfo& aStack) |
|
3989 |
{ |
|
3990 |
// DEF104115 |
|
3991 |
_LIT(KDir, "\\DEF104115\\"); |
|
3992 |
_LIT(KFile1, "\\DEF104115\\file1veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylong.txt"); |
|
3993 |
_LIT(KFile2, "\\DEF104115\\SUBDIR\\longfile2.txt"); |
|
3994 |
||
3995 |
if(aLevel==0) |
|
3996 |
{ |
|
3997 |
test.Next(_L("Test stack usage")); |
|
3998 |
RmDir(KDir); |
|
3999 |
MakeFile(KFile1, _L8("123456789012345678901234567890")); |
|
4000 |
MakeFile(KFile2); |
|
4001 |
} |
|
4002 |
TInt r = KErrNone; |
|
4003 |
char* start = NULL; |
|
4004 |
char* end = NULL; |
|
4005 |
TInt available = 0; |
|
4006 |
TInt stacksize = aStack.iBase - aStack.iLimit; |
|
4007 |
start = (char*)aStack.iLimit; |
|
4008 |
end = (char*)&stacksize; |
|
4009 |
available = (TInt)end - (TInt)start; |
|
4010 |
#ifdef __X86__ |
|
4011 |
if(available > 6 * 1024) // X86 uses about twice as much stack as ARM in debug mode, so double the number. |
|
4012 |
#else |
|
4013 |
if(available > 3 * 1024) // don't touch this constant ... fix CFileMan instead!! |
|
4014 |
#endif |
|
4015 |
{ |
|
4016 |
TestStackUsage(aLevel+1, aStack); |
|
4017 |
return; |
|
4018 |
} |
|
4019 |
||
4020 |
test.Printf(_L("Level:%d Available:%d\n"), aLevel, available); |
|
4021 |
||
4022 |
gFileMan->SetObserver(NULL); |
|
4023 |
// Attribs |
|
4024 |
r = gFileMan->Attribs(KDir, 0, 0, 0, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4025 |
test_KErrNone(r); |
0 | 4026 |
|
4027 |
// Move |
|
4028 |
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4029 |
test_Equal(KErrAlreadyExists, r); |
0 | 4030 |
|
4031 |
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse | CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4032 |
test_KErrNone(r); |
0 | 4033 |
|
4034 |
// Copy |
|
4035 |
r = gFileMan->Copy(KFile2, KFile1, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4036 |
test_KErrNone(r); |
0 | 4037 |
|
4038 |
// Rename |
|
4039 |
r = gFileMan->Rename(KFile1, KFile2, 0); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4040 |
test_Equal(KErrAlreadyExists, r); |
0 | 4041 |
|
4042 |
r = gFileMan->Rename(KFile1, KFile2, CFileMan::EOverWrite); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4043 |
test_KErrNone(r); |
0 | 4044 |
|
4045 |
// Delete |
|
4046 |
r = gFileMan->Delete(KFile2, CFileMan::ERecurse); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4047 |
test_KErrNone(r); |
0 | 4048 |
|
4049 |
// RmDir |
|
4050 |
r = gFileMan->RmDir(KDir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4051 |
test_KErrNone(r); |
0 | 4052 |
|
4053 |
gFileMan->SetObserver(gObserver); |
|
4054 |
} |
|
4055 |
||
4056 |
LOCAL_C void InitialiseL() |
|
4057 |
// |
|
4058 |
// Set up test variables |
|
4059 |
// |
|
4060 |
{ |
|
4061 |
gFileMan=CFileMan::NewL(TheFs); |
|
4062 |
gObserver=new(ELeave) CFileManObserver(gFileMan); |
|
4063 |
gFileMan->SetObserver(gObserver); |
|
4064 |
} |
|
4065 |
||
4066 |
LOCAL_C void Cleanup() |
|
4067 |
// |
|
4068 |
// Cleanup test variables |
|
4069 |
// |
|
4070 |
{ |
|
4071 |
delete gFileMan; |
|
4072 |
delete gObserver; |
|
4073 |
} |
|
4074 |
||
4075 |
LOCAL_C void SetupDirStructure(TFileName& aSrcPath,TFileName& aTrgPath) |
|
4076 |
{ |
|
4077 |
TFileName tmpName = aSrcPath; |
|
4078 |
||
4079 |
// Create the TrgPath dirs |
|
4080 |
MakeDir(aTrgPath); |
|
4081 |
||
4082 |
// Create the aSrcPath dirs |
|
4083 |
tmpName = aSrcPath; |
|
4084 |
tmpName.Append(_L("EmptyDir01\\")); |
|
4085 |
MakeDir(tmpName); |
|
4086 |
||
4087 |
tmpName = aSrcPath; |
|
4088 |
tmpName.Append(_L("EmptyDir02\\")); |
|
4089 |
MakeDir(tmpName); |
|
4090 |
||
4091 |
tmpName = aSrcPath; |
|
4092 |
tmpName.Append(_L("EmptyDir03\\")); |
|
4093 |
MakeDir(tmpName); |
|
4094 |
||
4095 |
tmpName = aSrcPath; |
|
4096 |
tmpName.Append(_L("FILE01.TXT")); |
|
4097 |
MakeFile(tmpName); |
|
4098 |
||
4099 |
tmpName = aSrcPath; |
|
4100 |
tmpName.Append(_L("FILE02.TXT")); |
|
4101 |
MakeFile(tmpName); |
|
4102 |
||
4103 |
tmpName = aSrcPath; |
|
4104 |
tmpName.Append(_L("FILE03.TXT")); |
|
4105 |
MakeFile(tmpName); |
|
4106 |
||
4107 |
tmpName = aSrcPath; |
|
4108 |
tmpName.Append(_L("SubDir01\\EmptyDir01\\")); |
|
4109 |
MakeDir(tmpName); |
|
4110 |
||
4111 |
tmpName = aSrcPath; |
|
4112 |
tmpName.Append(_L("SubDir02\\EmptyDir02\\")); |
|
4113 |
MakeDir(tmpName); |
|
4114 |
||
4115 |
tmpName = aSrcPath; |
|
4116 |
tmpName.Append(_L("SubDir03\\EmptyDir03\\")); |
|
4117 |
MakeDir(tmpName); |
|
4118 |
||
4119 |
tmpName = aSrcPath; |
|
4120 |
tmpName.Append(_L("SubDir01\\FILE01.TXT")); |
|
4121 |
MakeFile(tmpName); |
|
4122 |
||
4123 |
tmpName = aSrcPath; |
|
4124 |
tmpName.Append(_L("SubDir01\\FILE02.TXT")); |
|
4125 |
MakeFile(tmpName); |
|
4126 |
||
4127 |
tmpName = aSrcPath; |
|
4128 |
tmpName.Append(_L("SubDir01\\FILE03.TXT")); |
|
4129 |
MakeFile(tmpName); |
|
4130 |
||
4131 |
tmpName = aSrcPath; |
|
4132 |
tmpName.Append(_L("SubDir02\\FILE01.TXT")); |
|
4133 |
MakeFile(tmpName); |
|
4134 |
||
4135 |
tmpName = aSrcPath; |
|
4136 |
tmpName.Append(_L("SubDir02\\FILE02.TXT")); |
|
4137 |
MakeFile(tmpName); |
|
4138 |
||
4139 |
tmpName = aSrcPath; |
|
4140 |
tmpName.Append(_L("SubDir02\\FILE03.TXT")); |
|
4141 |
MakeFile(tmpName); |
|
4142 |
||
4143 |
tmpName = aSrcPath; |
|
4144 |
tmpName.Append(_L("SubDir03\\FILE01.TXT")); |
|
4145 |
MakeFile(tmpName); |
|
4146 |
||
4147 |
tmpName = aSrcPath; |
|
4148 |
tmpName.Append(_L("SubDir03\\FILE02.TXT")); |
|
4149 |
MakeFile(tmpName); |
|
4150 |
||
4151 |
tmpName = aSrcPath; |
|
4152 |
tmpName.Append(_L("SubDir03\\FILE03.TXT")); |
|
4153 |
MakeFile(tmpName); |
|
4154 |
} |
|
4155 |
||
4156 |
LOCAL_C void TestPDEF112148() |
|
4157 |
{ |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4158 |
test.Next(_L("Test recursive and non-recursive move across drives (PDEF112148)")); |
0 | 4159 |
|
4160 |
TInt err = 0; |
|
4161 |
||
4162 |
TFileName trgPath; |
|
4163 |
trgPath.Format(_L("%c:\\F32-TST\\TFMAN\\PDEF112148\\dest\\"), (TUint8)gDriveToTest); |
|
4164 |
TFileName srcPath = _L("C:\\F32-TST\\TFMAN\\PDEF112148\\src\\"); |
|
4165 |
||
4166 |
// Non-Recursive move |
|
4167 |
// clean up before testing |
|
4168 |
RmDir(srcPath); |
|
4169 |
RmDir(trgPath); |
|
4170 |
// Setup the directory structure |
|
4171 |
SetupDirStructure(srcPath, trgPath); |
|
4172 |
if(!gAsynch) |
|
4173 |
err = gFileMan->Move(srcPath, trgPath, 0); |
|
4174 |
else |
|
4175 |
err = gFileMan->Move(srcPath, trgPath, 0, gStat); |
|
4176 |
TestResult(err); |
|
4177 |
||
4178 |
// Verify src contents after move operation |
|
4179 |
CDir *dir = NULL; |
|
4180 |
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4181 |
test_Equal(6, dir->Count()); |
0 | 4182 |
delete dir; |
4183 |
// Verify dest contents after move operation |
|
4184 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4185 |
test_Equal(3, dir->Count()); |
0 | 4186 |
delete dir; |
4187 |
||
4188 |
// Recursive move with "\\" at the end of srcPath |
|
4189 |
// clean up before execution |
|
4190 |
RmDir(srcPath); |
|
4191 |
RmDir(trgPath); |
|
4192 |
// Setup the directory structure |
|
4193 |
SetupDirStructure(srcPath, trgPath); |
|
4194 |
if(!gAsynch) |
|
4195 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse); |
|
4196 |
else |
|
4197 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat); |
|
4198 |
TestResult(err); |
|
4199 |
||
4200 |
// Verify src has no content |
|
4201 |
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4202 |
test_Equal(0, dir->Count()); |
0 | 4203 |
delete dir; |
4204 |
// Verify dest contents after move operation |
|
4205 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4206 |
test_Equal(9, dir->Count()); |
0 | 4207 |
delete dir; |
4208 |
||
4209 |
// Recursive move without "\\" at the end of srcPath |
|
4210 |
// clean up before execution |
|
4211 |
RmDir(srcPath); |
|
4212 |
RmDir(trgPath); |
|
4213 |
// Setup the directory structure |
|
4214 |
SetupDirStructure(srcPath, trgPath); |
|
4215 |
// Remove the "\\" at the end of srcPath for Recursive Move |
|
4216 |
srcPath.Delete(srcPath.Length()-1,1); |
|
4217 |
if(!gAsynch) |
|
4218 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse); |
|
4219 |
else |
|
4220 |
err = gFileMan->Move(srcPath, trgPath, CFileMan::ERecurse, gStat); |
|
4221 |
TestResult(err); |
|
4222 |
||
4223 |
// Add the "\\" at the end of srcPath for verification |
|
4224 |
srcPath.Append(KPathDelimiter); |
|
4225 |
// Verify src doesnt not exist |
|
4226 |
err = gFileMan->RmDir(srcPath); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4227 |
test_Equal(KErrPathNotFound, err); // KErrPathNotFound expected as src has been moved to dest |
0 | 4228 |
// Verify dest after move operation |
4229 |
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4230 |
test_Equal(1, dir->Count()); |
0 | 4231 |
delete dir; |
4232 |
||
4233 |
// clean up before leaving |
|
4234 |
RmDir(srcPath); |
|
4235 |
RmDir(trgPath); |
|
4236 |
} |
|
4237 |
//--------------------------------------------- |
|
4238 |
//! @SYMTestCaseID PBASE-T_FMAN-2398 |
|
4239 |
//! @SYMTestType UT |
|
4240 |
//! @SYMREQ DEF130678 |
|
4241 |
//! @SYMTestCaseDesc Tests that CFileMan::Move itself does not leak any memory |
|
4242 |
//! @SYMTestActions Move files and keep checking the memory usage for each operation. |
|
4243 |
//! @SYMTestExpectedResults Test completes without any crash and hence without any memory leak. |
|
4244 |
//! @SYMTestPriority High |
|
4245 |
//! @SYMTestStatus Implemented |
|
4246 |
//--------------------------------------------- |
|
4247 |
void TestDEF130678() |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4248 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4249 |
test.Next(_L("Test CFileMan::Move does not leak any memory")); |
0 | 4250 |
_LIT(KFromFile,"C:\\TestDEF130678\\FROM\\from_"); |
4251 |
_LIT(KToFile,"C:\\TestDEF130678\\TO\\"); |
|
4252 |
||
4253 |
TInt run; |
|
4254 |
// choose a number that certainly tests all memory allocations. |
|
4255 |
// it is used for memory allocation failure simulation. |
|
4256 |
TInt maxRun = 50; |
|
4257 |
// start OOM loop |
|
4258 |
for(run=1; run<=maxRun; ++run) |
|
4259 |
{ |
|
4260 |
TInt err = KErrNone; |
|
4261 |
TFileName fromFile, toFile; |
|
4262 |
||
4263 |
fromFile.Append(KFromFile); |
|
4264 |
fromFile.AppendNum(run); |
|
4265 |
fromFile.Append(_L(".txt")); |
|
4266 |
MakeFile(fromFile); |
|
4267 |
||
4268 |
MakeDir(_L("C:\\TestDEF130678\\FROM\\")); |
|
4269 |
MakeDir(_L("C:\\TestDEF130678\\TO\\")); |
|
4270 |
toFile.Append(KToFile); |
|
4271 |
||
4272 |
// Check the memory usage |
|
4273 |
__UHEAP_MARK; |
|
4274 |
// set to fail every run-th memory allocation |
|
4275 |
__UHEAP_SETFAIL(RAllocator::EDeterministic, run); |
|
4276 |
||
4277 |
CFileMan* fileMan = NULL; |
|
4278 |
TInt errTrap1 = KErrNone; |
|
4279 |
TRAP(errTrap1,(fileMan=CFileMan::NewL(TheFs))); |
|
4280 |
if (errTrap1 != KErrNone) |
|
4281 |
{ |
|
4282 |
// reset the memory allocation failure and check for any leak |
|
4283 |
__UHEAP_RESET; |
|
4284 |
__UHEAP_MARKEND; |
|
4285 |
continue; |
|
4286 |
} |
|
4287 |
||
4288 |
CleanupStack::PushL(fileMan); |
|
4289 |
TInt errTrap2 = KErrNone; |
|
4290 |
TRAP(errTrap2,(err = fileMan->Move(fromFile,toFile))); |
|
4291 |
if (errTrap2 != KErrNone || err != KErrNone) |
|
4292 |
{ |
|
4293 |
CleanupStack::PopAndDestroy(fileMan); |
|
4294 |
// reset the memory allocation failure and check for any leak |
|
4295 |
__UHEAP_RESET; |
|
4296 |
__UHEAP_MARKEND; |
|
4297 |
continue; |
|
4298 |
} |
|
4299 |
CleanupStack::PopAndDestroy(fileMan); |
|
4300 |
// reset the memory allocation failure and check for any leak |
|
4301 |
__UHEAP_RESET; |
|
4302 |
__UHEAP_MARKEND; |
|
4303 |
} // End of OOM loop |
|
4304 |
||
4305 |
// cleanup |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4306 |
RmDir(_L("C:\\TestDEF130678\\")); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4307 |
} |
0 | 4308 |
|
4309 |
GLDEF_C void CallTestsL() |
|
4310 |
// |
|
4311 |
// Do tests |
|
4312 |
// |
|
4313 |
{ |
|
4314 |
// T_FMAN is independent of all tests so format first |
|
4315 |
#ifndef __WINS__ |
|
4316 |
Format(CurrentDrive()); |
|
4317 |
#endif |
|
4318 |
||
4319 |
InitialiseL(); |
|
4320 |
CreateTestDirectory(_L("\\F32-TST\\TFMAN\\")); |
|
4321 |
// May not be able to test handling of invalid path lengths because F32 fix |
|
4322 |
// to prevent paths >256 ever being created |
|
4323 |
testingInvalidPathLengths = CheckIfShortPathsAreSupported(); |
|
4324 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4325 |
//----------------------------------------------------------------------------------- |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4326 |
// Asynchronous tests |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4327 |
// |
0 | 4328 |
gAsynch=ETrue; |
4329 |
test.Next(_L("Asynchronous tests ...")); |
|
4330 |
TheFs.SetAllocFailure(gAllocFailOff); |
|
4331 |
||
4332 |
TInt uid; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4333 |
test_KErrNone(HAL::Get(HAL::EMachineUid,uid)); |
0 | 4334 |
TBool doTargetTests = (!IsTestingLFFS() && |
4335 |
uid!=HAL::EMachineUid_Cogent && |
|
4336 |
uid!=HAL::EMachineUid_IQ80310 && |
|
4337 |
uid!=HAL::EMachineUid_X86PC); |
|
4338 |
||
4339 |
if (doTargetTests) |
|
4340 |
{ |
|
4341 |
TestMoveAcrossDrives(); |
|
4342 |
TestRecursiveMoveAcrossDrives(); |
|
4343 |
TestMoveEmptyDirectory(); |
|
4344 |
TestAbortedMoveAcrossDrives(); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4345 |
TestPDEF112148(); // Test recursive and non-recursive move across drives |
0 | 4346 |
} |
4347 |
||
4348 |
TestOverWrite(); |
|
4349 |
TestRename(); |
|
4350 |
TestErrorHandling(); |
|
4351 |
||
4352 |
TestRecursiveMove(); |
|
4353 |
TestRecursiveDelete(); |
|
4354 |
TestRecursiveAttribs(); |
|
4355 |
TestRecursiveCopy(); |
|
4356 |
||
4357 |
TestRmDir(); |
|
4358 |
TestSimultaneous(); |
|
4359 |
TestAttribs(); |
|
4360 |
TestDelete(); |
|
4361 |
if (!IsTestingLFFS()) |
|
4362 |
TestCopy(); // ??? |
|
4363 |
TestMove(); |
|
4364 |
TestCopyAllCancel(); |
|
4365 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4366 |
//----------------------------------------------------------------------------------- |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4367 |
// Synchronous tests |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4368 |
// |
0 | 4369 |
gAsynch=EFalse; |
4370 |
test.Next(_L("Synchronous tests ...")); |
|
4371 |
TheFs.SetAllocFailure(gAllocFailOn); |
|
4372 |
||
4373 |
if (doTargetTests) |
|
4374 |
{ |
|
4375 |
TestMoveAcrossDrives(); |
|
4376 |
TestRecursiveMoveAcrossDrives(); |
|
4377 |
TestMoveEmptyDirectory(); |
|
4378 |
TestAbortedMoveAcrossDrives(); |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4379 |
TestPDEF112148(); // Test recursive and non-recursive move across drives |
0 | 4380 |
} |
4381 |
||
4382 |
TestCopyOpenFile(); |
|
4383 |
if(testingInvalidPathLengths) |
|
4384 |
TestLongNames(); |
|
4385 |
TestNameMangling(); |
|
4386 |
TestFileAttributes(); |
|
4387 |
TestOverWrite(); |
|
4388 |
TestRename(); |
|
4389 |
TestErrorHandling(); |
|
4390 |
TestRecursiveMove(); |
|
4391 |
TestRecursiveDelete(); |
|
4392 |
TestRecursiveAttribs(); |
|
4393 |
TestRecursiveCopy(); |
|
4394 |
TestRmDir(); |
|
4395 |
TestSimultaneous(); |
|
4396 |
TestAttribs(); |
|
4397 |
TestDelete(); |
|
4398 |
TestCopy(); |
|
4399 |
TestMove(); |
|
4400 |
TestCopyAndRename(); |
|
4401 |
TestCopyAllCancel(); |
|
4402 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
4403 |
TestDEF130678(); // Test CFileMan::Move does not leak any memory |
0 | 4404 |
#ifndef __WINS__ |
4405 |
RThread t; |
|
4406 |
TThreadStackInfo stack; |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4407 |
test_KErrNone(t.StackInfo(stack)); |
0 | 4408 |
TestStackUsage(0, stack); |
4409 |
#endif |
|
4410 |
||
4411 |
Cleanup(); |
|
4412 |
DeleteTestDirectory(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
4413 |
test_KErrNone(TheFs.RmDir(_L("\\F32-TST\\"))); |
0 | 4414 |
} |
4415 |