From 770f1576a527d725f0589560be1506c738f518a8 Mon Sep 17 00:00:00 2001 From: James Tabor Date: Mon, 11 Oct 2010 15:12:47 +0000 Subject: [PATCH] [Wine Tests] - Update the only two tests that I tested and know that does not have RTL support. The Right To Left support will be another comprehensive change that can be done in a non intrusive way as long no one uses it. svn path=/trunk/; revision=49117 --- rostests/winetests/user32/class.c | 83 +++++++++++++++++++++++++++++- rostests/winetests/user32/dialog.c | 31 ++++++++--- 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/rostests/winetests/user32/class.c b/rostests/winetests/user32/class.c index 33c78bfa89b..7149163fbd3 100755 --- a/rostests/winetests/user32/class.c +++ b/rostests/winetests/user32/class.c @@ -19,7 +19,7 @@ */ /* To get CS_DROPSHADOW with the MSVC headers */ -#define _WIN32_WINNT 0x0501 +//#define _WIN32_WINNT 0x0501 #include #include @@ -315,6 +315,7 @@ static void check_thread_instance( const char *name, HINSTANCE inst, HINSTANCE i static void test_instances(void) { WNDCLASSA cls, wc; + WNDCLASSEXA wcexA; HWND hwnd, hwnd2; const char *name = "__test__"; HINSTANCE kernel32 = GetModuleHandleA("kernel32"); @@ -348,6 +349,25 @@ static void test_instances(void) check_thread_instance( name, kernel32, kernel32, kernel32 ); ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" ); + ZeroMemory(&wcexA, sizeof(wcexA)); + wcexA.lpfnWndProc = DefWindowProcA; + wcexA.lpszClassName = "__classex_test__"; + SetLastError(0xdeadbeef); + wcexA.cbSize = sizeof(wcexA) - 1; + ok( ((RegisterClassExA( &wcexA ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)), + "Succeeded with invalid number of cbSize bytes\n"); + SetLastError(0xdeadbeef); + wcexA.cbSize = sizeof(wcexA) + 1; + ok( ((RegisterClassExA( &wcexA ) == 0) && (GetLastError() == ERROR_INVALID_PARAMETER)), + "Succeeded with invalid number of cbSize bytes\n"); + SetLastError(0xdeadbeef); + wcexA.cbSize = sizeof(wcexA); + ok( RegisterClassExA( &wcexA ), "Failed with valid number of cbSize bytes\n"); + wcexA.cbSize = 0xdeadbeef; + ok( GetClassInfoEx(main_module, wcexA.lpszClassName, &wcexA), "GetClassInfoEx failed\n"); + ok( wcexA.cbSize == 0xdeadbeef, "GetClassInfoEx returned wrong cbSize value %d\n", wcexA.cbSize); + UnregisterClassA(wcexA.lpszClassName, main_module); + /* Bug 2631 - Supplying an invalid number of bytes fails */ cls.cbClsExtra = 0; cls.cbWndExtra = -1; @@ -880,10 +900,71 @@ static void test_extra_values(void) } } +static void test_GetClassInfo(void) +{ + static const WCHAR staticW[] = {'s','t','a','t','i','c',0}; + WNDCLASSA wc; + WNDCLASSEXA wcx; + BOOL ret; + + SetLastError(0xdeadbeef); + ret = GetClassInfoA(0, "static", &wc); + ok(ret, "GetClassInfoA() error %d\n", GetLastError()); + +if (0) { /* crashes under XP */ + SetLastError(0xdeadbeef); + ret = GetClassInfoA(0, "static", NULL); + ok(ret, "GetClassInfoA() error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = GetClassInfoW(0, staticW, NULL); + ok(ret, "GetClassInfoW() error %d\n", GetLastError()); +} + + wcx.cbSize = sizeof(wcx); + SetLastError(0xdeadbeef); + ret = GetClassInfoExA(0, "static", &wcx); + ok(ret, "GetClassInfoExA() error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = GetClassInfoExA(0, "static", NULL); + ok(!ret, "GetClassInfoExA() should fail\n"); + ok(GetLastError() == ERROR_NOACCESS || + broken(GetLastError() == 0xdeadbeef), /* win9x */ + "expected ERROR_NOACCESS, got %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = GetClassInfoExW(0, staticW, NULL); + ok(!ret, "GetClassInfoExW() should fail\n"); + ok(GetLastError() == ERROR_NOACCESS || + broken(GetLastError() == 0xdeadbeef) /* NT4 */ || + broken(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), /* win9x */ + "expected ERROR_NOACCESS, got %d\n", GetLastError()); + + wcx.cbSize = 0; + SetLastError(0xdeadbeef); + ret = GetClassInfoExA(0, "static", &wcx); + ok(ret, "GetClassInfoExA() error %d\n", GetLastError()); + ok(wcx.cbSize == 0, "expected 0, got %u\n", wcx.cbSize); + + wcx.cbSize = sizeof(wcx) - 1; + SetLastError(0xdeadbeef); + ret = GetClassInfoExA(0, "static", &wcx); + ok(ret, "GetClassInfoExA() error %d\n", GetLastError()); + ok(wcx.cbSize == sizeof(wcx) - 1, "expected sizeof(wcx)-1, got %u\n", wcx.cbSize); + + wcx.cbSize = sizeof(wcx) + 1; + SetLastError(0xdeadbeef); + ret = GetClassInfoExA(0, "static", &wcx); + ok(ret, "GetClassInfoExA() error %d\n", GetLastError()); + ok(wcx.cbSize == sizeof(wcx) + 1, "expected sizeof(wcx)+1, got %u\n", wcx.cbSize); +} + START_TEST(class) { HANDLE hInstance = GetModuleHandleA( NULL ); + test_GetClassInfo(); test_extra_values(); if (!GetModuleHandleW(0)) diff --git a/rostests/winetests/user32/dialog.c b/rostests/winetests/user32/dialog.c index cc80c27c86f..736c99d784e 100755 --- a/rostests/winetests/user32/dialog.c +++ b/rostests/winetests/user32/dialog.c @@ -760,12 +760,7 @@ static INT_PTR CALLBACK focusDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, return TRUE; case WM_COMMAND: - if (LOWORD(wParam) == IDCANCEL) - { - EndDialog(hDlg, LOWORD(wParam)); - return TRUE; - } - else if (LOWORD(wParam) == 200) + if (LOWORD(wParam) == 200) { if (HIWORD(wParam) == EN_SETFOCUS) g_hwndInitialFocusT1 = (HWND)lParam; @@ -1005,6 +1000,28 @@ static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, return FALSE; } +static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg, + WPARAM wParam, LPARAM lParam) +{ + static int received_idok = 0; + switch (uiMsg) + { + case WM_INITDIALOG: + { + MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001}; + IsDialogMessage(hDlg, &msg); + } + ok(received_idok, "WM_COMMAND not received\n"); + EndDialog(hDlg, 0); + return TRUE; + case WM_COMMAND: + ok(wParam==IDOK, "Expected IDOK\n"); + received_idok = 1; + return TRUE; + } + return FALSE; +} + static void test_DialogBoxParamA(void) { INT_PTR ret; @@ -1049,6 +1066,8 @@ static void test_DialogBoxParamA(void) ret = DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0); ok(ret == IDOK, "Expected IDOK\n"); + + DialogBoxParamA(GetModuleHandle(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0); } static void test_DisabledDialogTest(void)