Some additional path unit testing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The function GetFullPathNameA supports various combinations of input 
names with drive letters, so test for some of them.

Also, Xilinx tools generate path names with a mix of Unix and DOS path 
formats, which Windows handles fine, so test for them too.

Changelog: Add drive letter and Unix path tests of GetFullPathNameA.

Index: dlls/kernel/tests/path.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/path.c,v
retrieving revision 1.5
diff -u -r1.5 path.c
--- dlls/kernel/tests/path.c	22 Jun 2002 00:08:10 -0000	1.5
+++ dlls/kernel/tests/path.c	1 Jul 2002 01:35:04 -0000
@@ -342,8 +342,11 @@
      "GetTempPathA returned a path that did not end in '\\'");
   lstrcpyA(tmpstr,"aaaaaaaa");
   len1=GetTempPathA(len,tmpstr);
-  ok(len1==len+1,
-     "GetTempPathA should return string length %ld instead of %ld",len+1,len1);
+  todo_wine {
+    ok(len1==len+1,
+       "GetTempPathA should return string length %ld \"%s\" instead of %ld \"%s\"",
+       len+1, tmppath ,len1, tmpstr);
+  }
   if(WIN2K_PLUS(version)) {
 /* in Win2k, the path won't be modified, but in win98, wine  it is */
     todo_wine {
@@ -483,6 +486,7 @@
   CHAR curdir_short[MAX_PATH],
        longdir_short[MAX_PATH];
   CHAR tmpstr[MAX_PATH],tmpstr1[MAX_PATH];
+  LPSTR strptr;                 /*ptr to the filename portion of the path */
   DWORD len;
   INT i;
   CHAR dir[MAX_PATH],eight[MAX_PATH],three[MAX_PATH];
@@ -656,6 +660,59 @@
        "GetLongPathA returned %ld and not 'ERROR_FILE_NOT_FOUND'",
        passfail.longerror);
   }
+/* Test GetFullPathNameA with drive letters */
+  sprintf(tmpstr,"C:\\%s\\%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+      "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+/* Without a leading slash, insert the current directory if on the current drive */
+  sprintf(tmpstr,"C:%s\\%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
+  ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+      "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+/* Otherwise insert the missing leading slash */
+  sprintf(tmpstr,"D:%s\\%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  sprintf(tmpstr,"D:\\%s\\%s",SHORTDIR,SHORTFILE);
+  ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+      "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+/* Xilinx tools like to mix Unix and DOS formats, which Windows handles fine.
+   So test for them. */
+  sprintf(tmpstr,"C:/%s\\%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  sprintf(tmpstr,"C:\\%s\\%s",SHORTDIR,SHORTFILE);
+  ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+      "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+/**/
+  sprintf(tmpstr,"C:%s/%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  sprintf(tmpstr,"%s\\%s\\%s",curdir,SHORTDIR,SHORTFILE);
+  ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+      "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+/* Windows will insert a drive letter in front of an absolute UNIX path, but
+    Wine probably shouldn't. */
+  sprintf(tmpstr,"/%s/%s",SHORTDIR,SHORTFILE);
+  ok(GetFullPathNameA(tmpstr,MAX_PATH,tmpstr1,&strptr),"GetFullPathNameA failed");
+  todo_wine {
+    sprintf(tmpstr,"C:\\%s\\%s",SHORTDIR,SHORTFILE);
+    ok(lstrcmpiA(tmpstr,tmpstr1)==0,
+        "GetLongPathNameA returned '%s' instead of '%s'",tmpstr1,tmpstr);
+  }
+/* This passes in Wine because it still contains the pointer from the previous test */
+  ok(lstrcmpiA(SHORTFILE,strptr)==0,
+      "GetLongPathNameA returned part '%s' instead of '%s'",strptr,SHORTFILE);
+  
 /* Now try some relative paths */
   ok(GetShortPathNameA(LONGDIR,tmpstr,MAX_PATH),"GetShortPathNameA failed");
   test_SplitShortPathA(tmpstr,dir,eight,three);

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux