wine/dlls/version/tests Makefile.in .cvsignore ...
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Nov 12 13:09:19 CST 2005
ChangeSet ID: 21228
CVSROOT: /opt/cvs-commit
Module name: wine
Changes by: julliard at winehq.org 2005/11/12 13:09:18
Modified files:
dlls/version/tests: Makefile.in .cvsignore
Added files:
dlls/version/tests: install.c
Log message:
Stefan Leichter <Stefan.Leichter at camLine.com>
Added some tests for VerFindFileA.
Patch: http://cvs.winehq.org/patch.py?id=21228
Old revision New revision Changes Path
1.3 1.4 +2 -1 wine/dlls/version/tests/Makefile.in
1.2 1.3 +1 -0 wine/dlls/version/tests/.cvsignore
Added 1.1 +0 -0 wine/dlls/version/tests/install.c
Index: wine/dlls/version/tests/Makefile.in
diff -u -p wine/dlls/version/tests/Makefile.in:1.3 wine/dlls/version/tests/Makefile.in:1.4
--- wine/dlls/version/tests/Makefile.in:1.3 12 Nov 2005 19: 9:18 -0000
+++ wine/dlls/version/tests/Makefile.in 12 Nov 2005 19: 9:18 -0000
@@ -6,7 +6,8 @@ TESTDLL = version.dll
IMPORTS = version kernel32
CTESTS = \
- info.c
+ info.c \
+ install.c
RC_SRCS = version.rc
Index: wine/dlls/version/tests/.cvsignore
diff -u -p wine/dlls/version/tests/.cvsignore:1.2 wine/dlls/version/tests/.cvsignore:1.3
--- wine/dlls/version/tests/.cvsignore:1.2 12 Nov 2005 19: 9:19 -0000
+++ wine/dlls/version/tests/.cvsignore 12 Nov 2005 19: 9:19 -0000
@@ -1,4 +1,5 @@
Makefile
info.ok
+install.ok
testlist.c
version.res
Index: wine/dlls/version/tests/install.c
diff -u -p /dev/null wine/dlls/version/tests/install.c:1.1
--- /dev/null 12 Nov 2005 19: 9:19 -0000
+++ wine/dlls/version/tests/install.c 12 Nov 2005 19: 9:19 -0000
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2005 Stefan Leichter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "wine/test.h"
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "winver.h"
+
+static void test_find_file(void)
+{
+ DWORD ret;
+ UINT dwCur, dwOut ;
+ char appdir[MAX_PATH];
+ char curdir[MAX_PATH];
+ char filename[MAX_PATH];
+ char outBuf[MAX_PATH];
+ char windir[MAX_PATH];
+
+ memset(appdir, 0, MAX_PATH);
+ memset(windir, 0, MAX_PATH);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(curdir, 0, MAX_PATH);
+ memset(outBuf, 0, MAX_PATH);
+ ret = VerFindFileA(0, "regedit", "", "", curdir, &dwCur, outBuf, &dwOut);
+ ok(!ret, "VerFindFileA should fail for a known program without extension\n");
+ ok(dwCur == 1, "expected length 1 got %d\n", dwCur);
+ ok(dwOut == 1, "expected length 1 got %d\n", dwOut);
+
+ if(!GetWindowsDirectoryA(windir, MAX_PATH))
+ trace("GetWindowsDirectoryA failed\n");
+ else {
+ sprintf(appdir, "%s\\regedit.exe", windir);
+ if(INVALID_FILE_ATTRIBUTES == GetFileAttributesA(appdir))
+ trace("GetFileAttributesA(%s) failed\n", appdir);
+ else {
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(curdir, 0, MAX_PATH);
+ memset(outBuf, 0, MAX_PATH);
+ ret = VerFindFileA(0, "regedit.exe", "", "", curdir, &dwCur, outBuf, &dwOut);
+ todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %lx expected VFF_CURNEDEST\n", ret);
+ todo_wine ok(dwCur == 1 + strlen(windir), "Wrong length of buffer for current location: "
+ "got %d(%s) expected %d\n", dwCur, curdir, strlen(windir)+1);
+ ok(dwOut == 1, "Wrong length of buffer for the recommended installation location"
+ "got %d(%s) expected 1\n", dwOut, outBuf);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(curdir, 0, MAX_PATH);
+ memset(outBuf, 0, MAX_PATH);
+ ret = VerFindFileA(0, "regedit.exe", NULL, NULL, curdir, &dwCur, outBuf, &dwOut);
+ todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %lx expected VFF_CURNEDEST\n", ret);
+ todo_wine ok(dwCur == 1 + strlen(windir), "Wrong length of buffer for current location: "
+ "got %d(%s) expected %d\n", dwCur, curdir, strlen(windir)+1);
+ ok(dwOut == 1, "Wrong length of buffer for the recommended installation location"
+ "got %d(%s) expected 1\n", dwOut, outBuf);
+ }
+ }
+ if(!GetModuleFileNameA(NULL, filename, MAX_PATH) ||
+ !GetSystemDirectoryA(windir, MAX_PATH) ||
+ !GetTempPathA(MAX_PATH, appdir))
+ trace("GetModuleFileNameA, GetSystemDirectoryA or GetTempPathA failed\n");
+ else {
+ char *p = strrchr(filename, '\\');
+ if(p++) memmove(filename, p, 1 + strlen(p));
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(outBuf, 0, MAX_PATH);
+ memset(curdir, 0, MAX_PATH);
+ ret = VerFindFileA(0, filename, NULL, NULL, curdir, &dwCur, outBuf, &dwOut);
+ todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %lx expected VFF_CURNEDEST\n", ret);
+ ok(dwOut == 1, "Wrong length of buffer for the recommended installation location"
+ "got %d(%s) expected 1\n", dwOut, outBuf);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(outBuf, 0, MAX_PATH);
+ memset(curdir, 0, MAX_PATH);
+ ret = VerFindFileA(VFFF_ISSHAREDFILE, filename, NULL, appdir, curdir, &dwCur, outBuf, &dwOut);
+ todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %lx expected VFF_CURNEDEST\n", ret);
+ ok(dwOut == 1 + strlen(windir), "Wrong length of buffer for current location: "
+ "got %d(%s) expected %d\n", dwOut, outBuf, strlen(windir)+1);
+
+ dwCur=MAX_PATH;
+ dwOut=MAX_PATH;
+ memset(outBuf, 0, MAX_PATH);
+ memset(curdir, 0, MAX_PATH);
+ ret = VerFindFileA(0, filename, NULL, appdir, curdir, &dwCur, outBuf, &dwOut);
+ todo_wine ok(VFF_CURNEDEST == ret, "Wrong return value got %lx expected VFF_CURNEDEST\n", ret);
+ ok(dwOut == 1 + strlen(appdir), "Wrong length of buffer for current location: "
+ "got %d(%s) expected %d\n", dwOut, outBuf, strlen(appdir)+1);
+ }
+}
+
+START_TEST(install)
+{
+ test_find_file();
+}
More information about the wine-cvs
mailing list