[APITESTS]

* Add GetDriveType tests. Some fails in ReactOS
* Fix few rbuild files

svn path=/trunk/; revision=51484
This commit is contained in:
Rafal Harabien 2011-04-28 22:10:51 +00:00
parent 16afe3648f
commit ee795b8b1e
12 changed files with 123 additions and 0 deletions

View file

@ -5,6 +5,7 @@ add_subdirectory(dciman32)
add_subdirectory(gdi32)
add_subdirectory(ntdll)
add_subdirectory(user32)
add_subdirectory(kernel32)
if(NOT MSVC)
if(ARCH MATCHES i386)

View file

@ -21,6 +21,10 @@
<directory name="user32">
<xi:include href="user32/user32_apitest.rbuild" />
</directory>
<directory name="kernel32">
<xi:include href="kernel32/kernel32_apitest.rbuild" />
</directory>
<if property="ARCH" value="i386">
<directory name="w32kdll">

View file

@ -0,0 +1,12 @@
add_definitions(-D_DLL -D__USE_CRTIMP)
list(APPEND SOURCE
GetDriveType.c
testlist.c)
add_executable(kernel32_apitest ${SOURCE})
target_link_libraries(kernel32_apitest wine ${PSEH_LIB})
set_module_type(kernel32_apitest win32cui)
add_importlibs(kernel32_apitest gdi32 user32 msvcrt kernel32 ntdll)
add_cab_target(kernel32_apitest 7)

View file

@ -0,0 +1,71 @@
#include <stdio.h>
#include <wine/test.h>
#include <windows.h>
#define IS_DRIVE_TYPE_VALID(type) ((type) != DRIVE_UNKNOWN && (type) != DRIVE_NO_ROOT_DIR)
START_TEST(GetDriveType)
{
UINT Type, Type2, i;
WCHAR Path[MAX_PATH];
/* Note: Successful calls can set last error to at least ERROR_NOT_A_REPARSE_POINT, we don't test it here */
SetLastError(0xdeadbeaf);
Type = GetDriveTypeW(L"");
ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type);
Type = GetDriveTypeW(L"\nC:\\");
ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type);
Type = GetDriveTypeW(L"Z:\\");
ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type);
ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError());
/* Drive root is accepted without ending slash */
Type = GetDriveTypeW(L"C:");
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
Type = GetDriveTypeW(L"C:\\");
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
Type = GetDriveTypeW(NULL);
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
i = GetCurrentDirectoryW(sizeof(Path)/sizeof(Path[0]), Path);
if (i)
{
/* Note: there is no backslash at the end of Path */
SetLastError(0xdeadbeaf);
Type2 = GetDriveTypeW(Path);
ok(Type2 == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type2);
ok(GetLastError() == 0xdeadbeaf, "Expected ERROR_NOT_A_REPARSE_POINT, got %lu\n", GetLastError());
wcscpy(Path+i, L"\\");
Type2 = GetDriveTypeW(Path);
ok(Type == Type2, "Types are not equal: %u != %u\n", Type, Type2);
}
i = GetSystemDirectoryW(Path, sizeof(Path)/sizeof(Path[0]));
if (i)
{
/* Note: there is no backslash at the end of Path */
SetLastError(0xdeadbeaf);
Type = GetDriveTypeW(Path);
ok(Type == DRIVE_NO_ROOT_DIR, "Expected DRIVE_NO_ROOT_DIR, got %u\n", Type);
ok(GetLastError() == 0xdeadbeaf, "Expected no errors, got %lu\n", GetLastError());
wcscpy(Path+i, L"\\");
Type = GetDriveTypeW(Path);
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
wcscpy(Path+i, L"/");
Type = GetDriveTypeW(Path);
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
wcscpy(Path+i, L"\\\\");
Type = GetDriveTypeW(Path);
ok(IS_DRIVE_TYPE_VALID(Type), "Expected valid drive type, got %u\n", Type);
}
}

View file

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
<group>
<module name="kernel32_apitest" type="win32cui" installbase="bin" installname="kernel32_apitest.exe">
<include base="kernel32_apitest">.</include>
<library>wine</library>
<library>ntdll</library>
<library>pseh</library>
<file>testlist.c</file>
<file>GetDriveType.c</file>
</module>
</group>

View file

@ -0,0 +1,16 @@
#define WIN32_LEAN_AND_MEAN
#define __ROS_LONG64__
#include <windows.h>
#define STANDALONE
#include "wine/test.h"
extern void func_GetDriveType(void);
const struct test winetest_testlist[] =
{
{ "GetDriveType", func_GetDriveType },
{ 0, 0 }
};

View file

@ -4,3 +4,4 @@
<library>user32</library>
<file>bltrop.c</file>
<file>bltrop.rc</file>
</module>

View file

@ -4,3 +4,4 @@
<library>gdi32</library>
<file>vbltest.c</file>
<file>vbltest.rc</file>
</module>

View file

@ -11,3 +11,4 @@
<file>NtGdiDdWaitForVerticalBlank.c</file>
<file>NtGdiDdCanCreateSurface.c</file>
<file>dump.c</file>
</module>

View file

@ -4,3 +4,4 @@
<library>user32</library>
<file>movefile.cpp</file>
<file>movefile.rc</file>
</module>

View file

@ -16,3 +16,4 @@
<file>capicon.c</file>
<file>capicon.rc</file>
</module>
</group>

View file

@ -8,3 +8,4 @@
<library>crypt32</library>
<library>user32</library>
<library>ntdll</library>
</module>