[APITESTS]
authorRafal Harabien <rafalh@reactos.org>
Thu, 28 Apr 2011 22:10:51 +0000 (22:10 +0000)
committerRafal Harabien <rafalh@reactos.org>
Thu, 28 Apr 2011 22:10:51 +0000 (22:10 +0000)
* Add GetDriveType tests. Some fails in ReactOS
* Fix few rbuild files

svn path=/trunk/; revision=51484

12 files changed:
rostests/apitests/CMakeLists.txt
rostests/apitests/directory.rbuild
rostests/apitests/kernel32/CMakeLists.txt [new file with mode: 0644]
rostests/apitests/kernel32/GetDriveType.c [new file with mode: 0644]
rostests/apitests/kernel32/kernel32_apitest.rbuild [new file with mode: 0644]
rostests/apitests/kernel32/testlist.c [new file with mode: 0644]
rostests/dibtests/bltrop/bltrop.rbuild
rostests/dibtests/vbltest/vbltest.rbuild
rostests/dxtest/win32kdxtest/win32kdxtest.rbuild
rostests/win32/smss/movefile/movefile.rbuild
rostests/win32/user32/drawcaption/drawcaption.rbuild
rostests/winetests/cryptui/cryptui.rbuild

index 4ac4b30..1251a06 100644 (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)
index 1444637..37c01c3 100644 (file)
        <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">
diff --git a/rostests/apitests/kernel32/CMakeLists.txt b/rostests/apitests/kernel32/CMakeLists.txt
new file mode 100644 (file)
index 0000000..3fc8c86
--- /dev/null
@@ -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)
diff --git a/rostests/apitests/kernel32/GetDriveType.c b/rostests/apitests/kernel32/GetDriveType.c
new file mode 100644 (file)
index 0000000..010eb36
--- /dev/null
@@ -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);
+    }
+}
diff --git a/rostests/apitests/kernel32/kernel32_apitest.rbuild b/rostests/apitests/kernel32/kernel32_apitest.rbuild
new file mode 100644 (file)
index 0000000..81766be
--- /dev/null
@@ -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>
diff --git a/rostests/apitests/kernel32/testlist.c b/rostests/apitests/kernel32/testlist.c
new file mode 100644 (file)
index 0000000..123e1ce
--- /dev/null
@@ -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 }
+};
+
index f19491c..82b0a09 100644 (file)
@@ -4,3 +4,4 @@
        <library>user32</library>
        <file>bltrop.c</file>
        <file>bltrop.rc</file>
+</module>
index d715469..c49b905 100644 (file)
@@ -4,3 +4,4 @@
        <library>gdi32</library>
        <file>vbltest.c</file>
        <file>vbltest.rc</file>
+</module>
\ No newline at end of file
index ad0499a..90122ac 100644 (file)
@@ -11,3 +11,4 @@
        <file>NtGdiDdWaitForVerticalBlank.c</file>
        <file>NtGdiDdCanCreateSurface.c</file>
        <file>dump.c</file>
+</module>
\ No newline at end of file
index 21033a1..9fe8a05 100644 (file)
@@ -4,3 +4,4 @@
        <library>user32</library>
        <file>movefile.cpp</file>
        <file>movefile.rc</file>
+</module>
\ No newline at end of file
index 351250e..026b241 100644 (file)
@@ -16,3 +16,4 @@
        <file>capicon.c</file>
        <file>capicon.rc</file>
 </module>
+</group>
index 2c6daf3..13b7702 100644 (file)
@@ -8,3 +8,4 @@
        <library>crypt32</library>
        <library>user32</library>
        <library>ntdll</library>
+</module>