mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-26 19:33:31 +00:00
[USER32_WINETEST] Sync user32 winetest to wine-10.0
- [USER32_WINETEST] Sync to wine-10.0. - [USER32_WINETEST] Define out some function definitions we can't build yet. - [USER32_WINETEST] Skip parts of test that crash on ReactOS or Windows - [USER32_WINETEST] Pass behaviors from WS03-Win10 1607
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
|
||||
add_definitions(-D__ROS_LONG64__)
|
||||
|
||||
remove_definitions(-DWINVER=0x502 -D_WIN32_WINNT=0x502)
|
||||
add_definitions(-DWINVER=0x602 -D_WIN32_WINNT=0x602)
|
||||
add_definitions(-DWINVER=0x0A00 -D_WIN32_WINNT=0x0A00 -DNTDDI_VERSION=0x0A000005)
|
||||
|
||||
list(APPEND SOURCE
|
||||
broadcast.c
|
||||
@@ -20,7 +18,6 @@ list(APPEND SOURCE
|
||||
menu.c
|
||||
monitor.c
|
||||
msg.c
|
||||
rawinput.c
|
||||
resource.c
|
||||
scroll.c
|
||||
static.c
|
||||
@@ -40,15 +37,21 @@ add_executable(user32_winetest
|
||||
resource.rc)
|
||||
|
||||
if(MSVC)
|
||||
# Disable warning C4477 (printf format warnings)
|
||||
target_compile_options(user32_winetest PRIVATE "/wd4005")
|
||||
target_compile_options(user32_winetest PRIVATE "/wd4024")
|
||||
target_compile_options(user32_winetest PRIVATE "/wd4047")
|
||||
target_compile_options(user32_winetest PRIVATE "/wd4098")
|
||||
remove_target_compile_option(user32_winetest "/we4477")
|
||||
endif()
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
target_compile_options(user32_winetest PRIVATE -Wno-format-overflow)
|
||||
target_compile_options(user32_winetest PRIVATE
|
||||
-Wno-format
|
||||
-Wno-int-conversion)
|
||||
endif()
|
||||
|
||||
add_pch(user32_winetest precomp.h "${PCH_SKIP_SOURCE}")
|
||||
target_compile_definitions(user32_winetest PRIVATE wcsicmp=_wcsicmp)
|
||||
set_module_type(user32_winetest win32cui)
|
||||
add_importlibs(user32_winetest user32 gdi32 advapi32 msvcrt kernel32)
|
||||
add_importlibs(user32_winetest user32 gdi32 advapi32 imm32 hid msvcrt kernel32 ntdll)
|
||||
add_pch(user32_winetest precomp.h "${PCH_SKIP_SOURCE}")
|
||||
add_rostests_file(TARGET user32_winetest)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 58 B |
@@ -37,13 +37,13 @@ static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPAR
|
||||
{
|
||||
if (msg == WM_NULL)
|
||||
{
|
||||
trace("main_window_procA: Sleeping for %lu ms\n", wparam);
|
||||
trace("main_window_procA: Sleeping for %Iu ms\n", wparam);
|
||||
if (wparam)
|
||||
{
|
||||
if (WaitForSingleObject(hevent, wparam) == WAIT_TIMEOUT)
|
||||
SetEvent(hevent);
|
||||
}
|
||||
trace("main_window_procA: Returning WM_NULL with parameter %08lx\n", lparam);
|
||||
trace("main_window_procA: Returning WM_NULL with parameter %08Ix\n", lparam);
|
||||
return lparam;
|
||||
}
|
||||
|
||||
@@ -90,52 +90,52 @@ static void test_parameters(PBROADCAST broadcast, const char *functionname)
|
||||
win_skip("%s is not implemented\n", functionname);
|
||||
return;
|
||||
}
|
||||
ok(!ret || broken(ret), "Returned: %d\n", ret);
|
||||
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
|
||||
ok(!ret || broken(ret), "Returned: %ld\n", ret);
|
||||
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( 0x80000000, &recips, WM_NULL, 0, 0 );
|
||||
ok(!ret || broken(ret), "Returned: %d\n", ret);
|
||||
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
|
||||
ok(!ret || broken(ret), "Returned: %ld\n", ret);
|
||||
if (!ret) ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
|
||||
|
||||
if (0) /* TODO: Check the hang flags */
|
||||
{
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0 );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0 );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
}
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0 );
|
||||
ok(ret==1, "Returned: %d\n", ret);
|
||||
ok(ret==1, "Returned: %ld\n", ret);
|
||||
ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
|
||||
PulseEvent(hevent);
|
||||
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcast( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY );
|
||||
ok(ret==1, "Returned: %d\n", ret);
|
||||
ok(ret==1, "Returned: %ld\n", ret);
|
||||
ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
|
||||
PulseEvent(hevent);
|
||||
}
|
||||
@@ -152,51 +152,51 @@ static void test_parametersEx(PBROADCASTEX broadcastex)
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
|
||||
ok(!ret, "Returned: %d\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
|
||||
ok(!ret, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( 0x80000000, &recips, WM_NULL, 0, 0, NULL );
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08x\n", GetLastError());
|
||||
ok(!ret, "Returned: %d\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Last error: %08lx\n", GetLastError());
|
||||
ok(!ret, "Returned: %ld\n", ret);
|
||||
|
||||
if (0) /* TODO: Check the hang flags */
|
||||
{
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_QUERY|(BSF_NOHANG|BSF_NOTIMEOUTIFNOTHUNG), &recips, WM_NULL, 30000, 0, NULL );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_QUERY|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
|
||||
SetLastError(0xcafebabe);
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_POSTMESSAGE|(BSF_NOTIMEOUTIFNOTHUNG|BSF_FORCEIFHUNG), &recips, WM_NULL, 30000, 0, NULL );
|
||||
ok(0, "Last error: %08x\n", GetLastError());
|
||||
ok(0, "Returned: %d\n", ret);
|
||||
ok(0, "Last error: %08lx\n", GetLastError());
|
||||
ok(0, "Returned: %ld\n", ret);
|
||||
}
|
||||
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_POSTMESSAGE|BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, 0, NULL );
|
||||
ok(ret==1, "Returned: %d\n", ret);
|
||||
ok(ret==1, "Returned: %ld\n", ret);
|
||||
ok(WaitForSingleObject(hevent, 0) != WAIT_OBJECT_0, "Synchronous message sent instead\n");
|
||||
PulseEvent(hevent);
|
||||
|
||||
recips = BSM_APPLICATIONS;
|
||||
ret = broadcastex( BSF_SENDNOTIFYMESSAGE, &recips, WM_NULL, 100, BROADCAST_QUERY_DENY, NULL );
|
||||
ok(ret==1, "Returned: %d\n", ret);
|
||||
ok(ret==1, "Returned: %ld\n", ret);
|
||||
ok(WaitForSingleObject(hevent, 0) != WAIT_TIMEOUT, "Asynchronous message sent instead\n");
|
||||
PulseEvent(hevent);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#define WIN32_NO_STATUS
|
||||
#include <ntndk.h>
|
||||
#endif
|
||||
#include "wine/test.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
@@ -29,6 +33,9 @@
|
||||
#include "winreg.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#ifndef __REACTOS__
|
||||
#include "winternl.h"
|
||||
#endif
|
||||
#include "commctrl.h"
|
||||
|
||||
#define NUMCLASSWORDS 4
|
||||
@@ -37,16 +44,18 @@
|
||||
|
||||
#ifdef __i386__
|
||||
#define ARCH "x86"
|
||||
#elif defined __aarch64__ || defined__arm64ec__
|
||||
#define ARCH "arm64"
|
||||
#elif defined __x86_64__
|
||||
#define ARCH "amd64"
|
||||
#elif defined __arm__
|
||||
#define ARCH "arm"
|
||||
#elif defined __aarch64__
|
||||
#define ARCH "arm64"
|
||||
#else
|
||||
#define ARCH "none"
|
||||
#endif
|
||||
|
||||
static const BOOL is_win64 = (sizeof(void *) > sizeof(int));
|
||||
|
||||
static const char comctl32_manifest[] =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
|
||||
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
|
||||
@@ -90,11 +99,14 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
|
||||
WNDCLASSW cls, wc;
|
||||
static const WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0};
|
||||
static const WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0};
|
||||
WNDCLASSW info;
|
||||
ATOM test_atom;
|
||||
HWND hTestWnd;
|
||||
LONG i;
|
||||
WCHAR str[20];
|
||||
ATOM classatom;
|
||||
HINSTANCE hInstance2;
|
||||
BOOL ret;
|
||||
|
||||
cls.style = CS_HREDRAW | CS_VREDRAW | (global?CS_GLOBALCLASS:0);
|
||||
cls.lpfnWndProc = ClassTest_WndProc;
|
||||
@@ -118,6 +130,26 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
|
||||
"RegisterClass of the same class should fail for the second time\n");
|
||||
|
||||
/* Setup windows */
|
||||
hInstance2 = (HINSTANCE)(((ULONG_PTR)hInstance & ~0xffff) | 0xdead);
|
||||
|
||||
hTestWnd = CreateWindowW (className, winName,
|
||||
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
|
||||
0, hInstance2, 0);
|
||||
ok(hTestWnd != 0, "Failed to create window for hInstance %p\n", hInstance2);
|
||||
|
||||
ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
|
||||
"Wrong GCL instance %p != %p\n",
|
||||
(HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
|
||||
ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance2,
|
||||
"Wrong GWL instance %p != %p\n",
|
||||
(HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance2);
|
||||
|
||||
DestroyWindow(hTestWnd);
|
||||
|
||||
ret = GetClassInfoW(hInstance2, className, &info);
|
||||
ok(ret, "GetClassInfoW failed: %lu\n", GetLastError());
|
||||
|
||||
hTestWnd = CreateWindowW (className, winName,
|
||||
WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL,
|
||||
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
|
||||
@@ -125,6 +157,14 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
|
||||
|
||||
ok(hTestWnd!=0, "Failed to create window\n");
|
||||
|
||||
ok((HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE) == hInstance,
|
||||
"Wrong GCL instance %p/%p\n",
|
||||
(HINSTANCE)GetClassLongPtrA(hTestWnd, GCLP_HMODULE), hInstance);
|
||||
ok((HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE) == hInstance,
|
||||
"Wrong GWL instance %p/%p\n",
|
||||
(HINSTANCE)GetWindowLongPtrA(hTestWnd, GWLP_HINSTANCE), hInstance);
|
||||
|
||||
|
||||
/* test initial values of valid classwords */
|
||||
for(i=0; i<NUMCLASSWORDS; i++)
|
||||
{
|
||||
@@ -152,9 +192,9 @@ static void ClassTest(HINSTANCE hInstance, BOOL global)
|
||||
{
|
||||
SetLastError(0);
|
||||
ok(!SetClassLongW(hTestWnd,i*sizeof(DWORD),i+1),
|
||||
"GetClassLongW(%d) initial value nonzero!\n",i);
|
||||
"GetClassLongW(%ld) initial value nonzero!\n",i);
|
||||
ok(!GetLastError(),
|
||||
"SetClassLongW(%d) failed!\n",i);
|
||||
"SetClassLongW(%ld) failed!\n",i);
|
||||
}
|
||||
|
||||
/* test values of valid classwords that we set */
|
||||
@@ -308,7 +348,7 @@ static void check_instance_( int line, const char *name, HINSTANCE inst,
|
||||
ok_(__FILE__,line)(!UnregisterClassA(name, inst),
|
||||
"UnregisterClassA should fail while exists a class window\n");
|
||||
ok_(__FILE__,line)(GetLastError() == ERROR_CLASS_HAS_WINDOWS,
|
||||
"GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %d\n", GetLastError());
|
||||
"GetLastError() should be set to ERROR_CLASS_HAS_WINDOWS not %ld\n", GetLastError());
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
#define check_instance(name,inst,info_inst,gcl_inst) check_instance_(__LINE__,name,inst,info_inst,gcl_inst)
|
||||
@@ -340,7 +380,7 @@ static void check_thread_instance( const char *name, HINSTANCE inst, HINSTANCE i
|
||||
class_info.gcl_inst = gcl_inst;
|
||||
|
||||
hThread = CreateThread(NULL, 0, thread_proc, &class_info, 0, &tid);
|
||||
ok(hThread != NULL, "CreateThread failed, error %d\n", GetLastError());
|
||||
ok(hThread != NULL, "CreateThread failed, error %ld\n", GetLastError());
|
||||
ok(WaitForSingleObject(hThread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
@@ -427,7 +467,7 @@ static void test_instances(void)
|
||||
|
||||
/* setting global flag doesn't change status of class */
|
||||
hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
|
||||
ok( hwnd != 0, "CreateWindow failed error %u\n", GetLastError());
|
||||
ok( hwnd != 0, "CreateWindow failed error %lu\n", GetLastError());
|
||||
SetClassLongA( hwnd, GCL_STYLE, CS_GLOBALCLASS );
|
||||
cls.lpszMenuName = "kernel32";
|
||||
cls.hInstance = kernel32;
|
||||
@@ -494,7 +534,7 @@ static void test_instances(void)
|
||||
DestroyWindow( hwnd2 );
|
||||
|
||||
r = GetClassNameA( hwnd, buffer, 4 );
|
||||
ok( r == 3, "expected 3, got %d\n", r );
|
||||
ok( r == 3, "expected 3, got %ld\n", r );
|
||||
ok( !strcmp( buffer, "__t"), "name wrong: %s\n", buffer );
|
||||
|
||||
ok( UnregisterClassA( name, kernel32 ), "Unregister failed for kernel32\n" );
|
||||
@@ -511,7 +551,7 @@ static void test_instances(void)
|
||||
cls.lpszMenuName = "null";
|
||||
cls.hInstance = 0;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering local class for null instance\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
|
||||
ok( UnregisterClassA( name, main_module ), "Unregister failed for main module\n" );
|
||||
|
||||
ok( RegisterClassA( &cls ), "Failed to register local class for null instance\n" );
|
||||
@@ -520,17 +560,17 @@ static void test_instances(void)
|
||||
check_instance( name, main_module, main_module, main_module );
|
||||
check_thread_instance( name, main_module, main_module, main_module );
|
||||
ok( !GetClassInfoA( 0, name, &wc ), "Class found with null instance\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
|
||||
ok( UnregisterClassA( name, 0 ), "Unregister failed for null instance\n" );
|
||||
|
||||
/* registering for user32 always fails */
|
||||
cls.lpszMenuName = "user32";
|
||||
cls.hInstance = user32;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering local class for user32\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
|
||||
cls.style |= CS_GLOBALCLASS;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering global class for user32\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER, "Wrong error code %ld\n", GetLastError() );
|
||||
|
||||
/* unregister is OK though */
|
||||
cls.hInstance = main_module;
|
||||
@@ -545,12 +585,12 @@ static void test_instances(void)
|
||||
cls.lpszMenuName = "kernel32";
|
||||
cls.hInstance = kernel32;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
|
||||
/* even if global flag is cleared */
|
||||
hwnd = CreateWindowExA( 0, name, "test", 0, 0, 0, 0, 0, 0, 0, main_module, 0 );
|
||||
SetClassLongA( hwnd, GCL_STYLE, 0 );
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering local class for kernel32\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
|
||||
|
||||
check_class( main_module, name, "main_module" );
|
||||
check_class( kernel32, name, "main_module" );
|
||||
@@ -571,7 +611,7 @@ static void test_instances(void)
|
||||
DestroyWindow( hwnd );
|
||||
ok( UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister failed for main module global\n" );
|
||||
ok( !UnregisterClassA( name, (HINSTANCE)0x87654321 ), "Unregister succeeded the second time\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
|
||||
|
||||
cls.hInstance = (HINSTANCE)0x12345678;
|
||||
ok( RegisterClassA( &cls ), "Failed to register global class for dummy instance\n" );
|
||||
@@ -589,10 +629,10 @@ static void test_instances(void)
|
||||
cls.lpszClassName = "BUTTON";
|
||||
cls.hInstance = main_module;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering global button class for main module\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
|
||||
cls.hInstance = kernel32;
|
||||
ok( !RegisterClassA( &cls ), "Succeeded registering global button class for kernel32\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_ALREADY_EXISTS, "Wrong error code %ld\n", GetLastError() );
|
||||
|
||||
/* local class is OK however */
|
||||
cls.style &= ~CS_GLOBALCLASS;
|
||||
@@ -620,7 +660,7 @@ static void test_instances(void)
|
||||
ok( GetClassInfoA( kernel32, "BUTTON", &wc ), "Button class not found with kernel32\n" );
|
||||
ok( UnregisterClassA( "BUTTON", (HINSTANCE)0x12345678 ), "Failed to unregister button\n" );
|
||||
ok( !UnregisterClassA( "BUTTON", (HINSTANCE)0x87654321 ), "Unregistered button a second time\n" );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_CLASS_DOES_NOT_EXIST, "Wrong error code %ld\n", GetLastError() );
|
||||
ok( !GetClassInfoA( 0, "BUTTON", &wc ), "Button still exists\n" );
|
||||
/* last error not set reliably */
|
||||
|
||||
@@ -650,7 +690,6 @@ static void test_builtinproc(void)
|
||||
static const WCHAR classW[] = {'d','e','f','t','e','s','t',0};
|
||||
WCHAR unistring[] = {0x142, 0x40e, 0x3b4, 0}; /* a string that would be destroyed by a W->A->W conversion */
|
||||
WNDPROC pDefWindowProcA, pDefWindowProcW;
|
||||
WNDPROC pNtdllDefWindowProcA, pNtdllDefWindowProcW;
|
||||
WNDPROC oldproc;
|
||||
WNDCLASSEXA cls; /* the memory layout of WNDCLASSEXA and WNDCLASSEXW is the same */
|
||||
WCHAR buf[128];
|
||||
@@ -660,57 +699,6 @@ static void test_builtinproc(void)
|
||||
|
||||
pDefWindowProcA = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcA");
|
||||
pDefWindowProcW = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcW");
|
||||
pNtdllDefWindowProcA = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtdllDefWindowProc_A");
|
||||
pNtdllDefWindowProcW = (void *)GetProcAddress(GetModuleHandleA("ntdll.dll"), "NtdllDefWindowProc_W");
|
||||
|
||||
/* On Vista+, the user32.dll export DefWindowProcA/W is forwarded to */
|
||||
/* ntdll.NtdllDefWindowProc_A/W. However, the wndproc returned by */
|
||||
/* GetClassLong/GetWindowLong points to an unexported user32 function */
|
||||
if (pDefWindowProcA == pNtdllDefWindowProcA &&
|
||||
pDefWindowProcW == pNtdllDefWindowProcW)
|
||||
skip("user32.DefWindowProcX forwarded to ntdll.NtdllDefWindowProc_X\n");
|
||||
else
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
ZeroMemory(&cls, sizeof(cls));
|
||||
cls.cbSize = sizeof(cls);
|
||||
cls.hInstance = GetModuleHandleA(NULL);
|
||||
cls.hbrBackground = GetStockObject (WHITE_BRUSH);
|
||||
if (i & 1)
|
||||
cls.lpfnWndProc = pDefWindowProcA;
|
||||
else
|
||||
cls.lpfnWndProc = pDefWindowProcW;
|
||||
|
||||
if (i & 2)
|
||||
{
|
||||
cls.lpszClassName = classA;
|
||||
atom = RegisterClassExA(&cls);
|
||||
}
|
||||
else
|
||||
{
|
||||
cls.lpszClassName = (LPCSTR)classW;
|
||||
atom = RegisterClassExW((WNDCLASSEXW *)&cls);
|
||||
}
|
||||
ok(atom != 0, "Couldn't register class, i=%d, %d\n", i, GetLastError());
|
||||
|
||||
hwnd = CreateWindowA(classA, NULL, 0, 0, 0, 100, 100, NULL, NULL, GetModuleHandleA(NULL), NULL);
|
||||
ok(hwnd != NULL, "Couldn't create window i=%d\n", i);
|
||||
|
||||
ok(GetWindowLongPtrA(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
|
||||
(void *)GetWindowLongPtrA(hwnd, GWLP_WNDPROC), pDefWindowProcA);
|
||||
ok(GetClassLongPtrA(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcA, "Wrong ANSI wndproc: %p vs %p\n",
|
||||
(void *)GetClassLongPtrA(hwnd, GCLP_WNDPROC), pDefWindowProcA);
|
||||
|
||||
ok(GetWindowLongPtrW(hwnd, GWLP_WNDPROC) == (LONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
|
||||
(void *)GetWindowLongPtrW(hwnd, GWLP_WNDPROC), pDefWindowProcW);
|
||||
ok(GetClassLongPtrW(hwnd, GCLP_WNDPROC) == (ULONG_PTR)pDefWindowProcW, "Wrong Unicode wndproc: %p vs %p\n",
|
||||
(void *)GetClassLongPtrW(hwnd, GCLP_WNDPROC), pDefWindowProcW);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClassA((LPSTR)(DWORD_PTR)atom, GetModuleHandleA(NULL));
|
||||
}
|
||||
}
|
||||
|
||||
/* built-in winproc - window A/W type automatically detected */
|
||||
ZeroMemory(&cls, sizeof(cls));
|
||||
@@ -876,6 +864,163 @@ static void test_builtinproc(void)
|
||||
}
|
||||
|
||||
|
||||
static void test_ntdll_wndprocs(void)
|
||||
{
|
||||
static const char *classes[] =
|
||||
{
|
||||
"ScrollBar",
|
||||
"Message",
|
||||
"#32768", /* menu */
|
||||
"#32769", /* desktop */
|
||||
"DefWindowProc", /* not a real class */
|
||||
"#32772", /* icon title */
|
||||
"??", /* ?? */
|
||||
"Button",
|
||||
"ComboBox",
|
||||
"ComboLBox",
|
||||
"#32770", /* dialog */
|
||||
"Edit",
|
||||
"ListBox",
|
||||
"MDIClient",
|
||||
"Static",
|
||||
"IME",
|
||||
"Ghost",
|
||||
};
|
||||
unsigned int i;
|
||||
void *procsA[ARRAY_SIZE(classes)] = { NULL };
|
||||
void *procsW[ARRAY_SIZE(classes)] = { NULL };
|
||||
const UINT64 *ptr_A, *ptr_W, *ptr_workers;
|
||||
NTSTATUS (WINAPI *pRtlRetrieveNtUserPfn)(const UINT64**,const UINT64**,const UINT64 **);
|
||||
|
||||
pRtlRetrieveNtUserPfn = (void *)GetProcAddress( GetModuleHandleA("ntdll.dll"), "RtlRetrieveNtUserPfn" );
|
||||
if (!pRtlRetrieveNtUserPfn || pRtlRetrieveNtUserPfn( &ptr_A, &ptr_W, &ptr_workers ))
|
||||
{
|
||||
win_skip( "RtlRetrieveNtUserPfn not supported\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(classes); i++)
|
||||
{
|
||||
WNDCLASSA wcA;
|
||||
WNDCLASSW wcW;
|
||||
WCHAR buffer[20];
|
||||
|
||||
MultiByteToWideChar( CP_ACP, 0, classes[i], -1, buffer, ARRAY_SIZE(buffer) );
|
||||
if (GetClassInfoA( 0, classes[i], &wcA )) procsA[i] = wcA.lpfnWndProc;
|
||||
if (GetClassInfoW( 0, buffer, &wcW )) procsW[i] = wcW.lpfnWndProc;
|
||||
}
|
||||
procsA[4] = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcA");
|
||||
procsW[4] = (void *)GetProcAddress(GetModuleHandleA("user32.dll"), "DefWindowProcW");
|
||||
|
||||
if (!is_win64 && ptr_A[0] >> 32) /* some older versions use 32-bit pointers */
|
||||
{
|
||||
const void **ptr_A32 = (const void **)ptr_A, **ptr_W32 = (const void **)ptr_W;
|
||||
for (i = 0; i < ARRAY_SIZE(procsA); i++)
|
||||
{
|
||||
ok( !procsA[i] || procsA[i] == ptr_A32[i],
|
||||
"wrong ptr A %u %s: %p / %p\n", i, classes[i], procsA[i], ptr_A32[i] );
|
||||
ok( !procsW[i] || procsW[i] == ptr_W32[i] ||
|
||||
broken(i == 4), /* DefWindowProcW can be different on wow64 */
|
||||
"wrong ptr W %u %s: %p / %p\n", i, classes[i], procsW[i], ptr_W32[i] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < ARRAY_SIZE(procsA); i++)
|
||||
{
|
||||
ok( !procsA[i] || (ULONG_PTR)procsA[i] == ptr_A[i],
|
||||
"wrong ptr A %u %s: %p / %I64x\n", i, classes[i], procsA[i], ptr_A[i] );
|
||||
ok( !procsW[i] || (ULONG_PTR)procsW[i] == ptr_W[i] ||
|
||||
broken( !is_win64 && i == 4 ), /* DefWindowProcW can be different on wow64 */
|
||||
"wrong ptr W %u %s: %p / %I64x\n", i, classes[i], procsW[i], ptr_W[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void test_wndproc_forwards(void)
|
||||
{
|
||||
WCHAR path[MAX_PATH];
|
||||
HMODULE user32 = GetModuleHandleA( "user32.dll" );
|
||||
HANDLE map, file;
|
||||
char *base;
|
||||
ULONG i, size, *names, *functions;
|
||||
WORD *ordinals;
|
||||
IMAGE_EXPORT_DIRECTORY *exp;
|
||||
|
||||
/* file on disk contains forwards */
|
||||
|
||||
GetModuleFileNameW( user32, path, ARRAY_SIZE(path) );
|
||||
file = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||
ok( file != INVALID_HANDLE_VALUE, "cannot open %s err %lu\n", debugstr_w(path), GetLastError() );
|
||||
map = CreateFileMappingW( file, NULL, PAGE_READONLY | SEC_IMAGE, 0, 0, 0 );
|
||||
ok( map != NULL, "failed to create mapping %lu\n", GetLastError() );
|
||||
base = MapViewOfFile( map, FILE_MAP_READ, 0, 0, 0 );
|
||||
ok( base != NULL, "failed to map file %lu\n", GetLastError() );
|
||||
exp = RtlImageDirectoryEntryToData( (HMODULE)base, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size );
|
||||
ok( exp != NULL, "no exports\n" );
|
||||
functions = (ULONG *)(base + exp->AddressOfFunctions);
|
||||
names = (ULONG *)(base + exp->AddressOfNames);
|
||||
ordinals = (WORD *)(base + exp->AddressOfNameOrdinals);
|
||||
for (i = 0; i < exp->NumberOfNames; i++)
|
||||
{
|
||||
const char *name = base + names[i];
|
||||
const char *forward = base + functions[ordinals[i]];
|
||||
if (strcmp( name, "DefDlgProcA" ) &&
|
||||
strcmp( name, "DefDlgProcW" ) &&
|
||||
strcmp( name, "DefWindowProcA" ) &&
|
||||
strcmp( name, "DefWindowProcW" )) continue;
|
||||
|
||||
if (!strcmp( name, "DefDlgProcA" ) && !(forward >= (char *)exp && forward < (char *)exp + size))
|
||||
{
|
||||
win_skip( "Windows version too old, not using forwards\n" );
|
||||
UnmapViewOfFile( base );
|
||||
CloseHandle( file );
|
||||
CloseHandle( map );
|
||||
return;
|
||||
}
|
||||
ok( forward >= (char *)exp && forward < (char *)exp + size,
|
||||
"not a forward %s %lx\n", name, functions[ordinals[i]] );
|
||||
ok( !strncmp( forward, "NTDLL.Ntdll", 11 ), "wrong forward %s -> %s\n", name, forward );
|
||||
}
|
||||
UnmapViewOfFile( base );
|
||||
CloseHandle( file );
|
||||
CloseHandle( map );
|
||||
|
||||
/* loaded dll is patched to avoid forwards (on 32-bit) */
|
||||
|
||||
base = (char *)user32;
|
||||
exp = RtlImageDirectoryEntryToData( (HMODULE)base, TRUE, IMAGE_DIRECTORY_ENTRY_EXPORT, &size );
|
||||
ok( exp != NULL, "no exports\n" );
|
||||
functions = (ULONG *)(base + exp->AddressOfFunctions);
|
||||
names = (ULONG *)(base + exp->AddressOfNames);
|
||||
ordinals = (WORD *)(base + exp->AddressOfNameOrdinals);
|
||||
for (i = 0; i < exp->NumberOfNames; i++)
|
||||
{
|
||||
const char *name = base + names[i];
|
||||
const char *forward = base + functions[ordinals[i]];
|
||||
if (strcmp( name, "DefDlgProcA" ) &&
|
||||
strcmp( name, "DefDlgProcW" ) &&
|
||||
strcmp( name, "DefWindowProcA" ) &&
|
||||
strcmp( name, "DefWindowProcW" )) continue;
|
||||
if (is_win64)
|
||||
{
|
||||
ok( forward >= (char *)exp && forward < (char *)exp + size,
|
||||
"not a forward %s %lx\n", name, functions[ordinals[i]] );
|
||||
ok( !strncmp( forward, "NTDLL.Ntdll", 11 ), "wrong forward %s -> %s\n", name, forward );
|
||||
}
|
||||
else
|
||||
{
|
||||
void *expect = GetProcAddress( user32, name );
|
||||
ok( !(forward >= (char *)exp && forward < (char *)exp + size),
|
||||
"%s %lx is a forward\n", name, functions[ordinals[i]] );
|
||||
ok( forward == expect ||
|
||||
broken( !strcmp( name, "DefWindowProcW" )), /* DefWindowProcW can be hooked on first run */
|
||||
"wrong function %s %p / %p\n", name, forward, expect );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static LRESULT WINAPI TestDlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
return DefDlgProcA(hWnd, uMsg, wParam, lParam);
|
||||
@@ -926,15 +1071,11 @@ static const struct
|
||||
{
|
||||
const char name[9];
|
||||
int value;
|
||||
int badvalue;
|
||||
int value64; /* 64-bit Windows use 64-bit size also for 32-bit applications */
|
||||
} extra_values[] =
|
||||
{
|
||||
{"#32770",30,30}, /* Dialog */
|
||||
#ifdef _WIN64
|
||||
{"Edit",8,8},
|
||||
#else
|
||||
{"Edit",6,8}, /* Windows XP 64-bit returns 8 also to 32-bit applications */
|
||||
#endif
|
||||
{"Edit",6,8},
|
||||
};
|
||||
|
||||
static void test_extra_values(void)
|
||||
@@ -947,7 +1088,7 @@ static void test_extra_values(void)
|
||||
|
||||
ok( ret, "GetClassInfo (0) failed for global class %s\n", extra_values[i].name);
|
||||
if (!ret) continue;
|
||||
ok(extra_values[i].value == wcx.cbWndExtra || broken(extra_values[i].badvalue == wcx.cbWndExtra),
|
||||
ok(extra_values[i].value == wcx.cbWndExtra || extra_values[i].value64 == wcx.cbWndExtra,
|
||||
"expected %d, got %d\n", extra_values[i].value, wcx.cbWndExtra);
|
||||
}
|
||||
}
|
||||
@@ -961,29 +1102,29 @@ static void test_GetClassInfo(void)
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoA(0, "static", &wc);
|
||||
ok(ret, "GetClassInfoA() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
|
||||
|
||||
if (0) { /* crashes under XP */
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoA(0, "static", NULL);
|
||||
ok(ret, "GetClassInfoA() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoA() error %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoW(0, staticW, NULL);
|
||||
ok(ret, "GetClassInfoW() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoW() error %ld\n", GetLastError());
|
||||
}
|
||||
|
||||
wcx.cbSize = sizeof(wcx);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoExA(0, "static", &wcx);
|
||||
ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoExA() error %ld\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());
|
||||
"expected ERROR_NOACCESS, got %ld\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoExW(0, staticW, NULL);
|
||||
@@ -991,14 +1132,14 @@ if (0) { /* crashes under XP */
|
||||
ok(GetLastError() == ERROR_NOACCESS ||
|
||||
broken(GetLastError() == 0xdeadbeef) /* NT4 */ ||
|
||||
broken(GetLastError() == ERROR_CALL_NOT_IMPLEMENTED), /* win9x */
|
||||
"expected ERROR_NOACCESS, got %d\n", GetLastError());
|
||||
"expected ERROR_NOACCESS, got %ld\n", GetLastError());
|
||||
|
||||
wcx.cbSize = 0;
|
||||
wcx.lpfnWndProc = NULL;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoExA(0, "static", &wcx);
|
||||
ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Unexpected error code %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "Unexpected error code %ld\n", GetLastError());
|
||||
ok(wcx.cbSize == 0, "expected 0, got %u\n", wcx.cbSize);
|
||||
ok(wcx.lpfnWndProc != NULL, "got null proc\n");
|
||||
|
||||
@@ -1006,7 +1147,7 @@ if (0) { /* crashes under XP */
|
||||
wcx.lpfnWndProc = NULL;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoExA(0, "static", &wcx);
|
||||
ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
|
||||
ok(wcx.cbSize == sizeof(wcx) - 1, "expected sizeof(wcx)-1, got %u\n", wcx.cbSize);
|
||||
ok(wcx.lpfnWndProc != NULL, "got null proc\n");
|
||||
|
||||
@@ -1014,9 +1155,14 @@ if (0) { /* crashes under XP */
|
||||
wcx.lpfnWndProc = NULL;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetClassInfoExA(0, "static", &wcx);
|
||||
ok(ret, "GetClassInfoExA() error %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfoExA() error %ld\n", GetLastError());
|
||||
ok(wcx.cbSize == sizeof(wcx) + 1, "expected sizeof(wcx)+1, got %u\n", wcx.cbSize);
|
||||
ok(wcx.lpfnWndProc != NULL, "got null proc\n");
|
||||
|
||||
wcx.cbSize = sizeof(wcx);
|
||||
ret = GetClassInfoExA(0, "stati", &wcx);
|
||||
ok(!ret && GetLastError() == ERROR_CLASS_DOES_NOT_EXIST,
|
||||
"GetClassInfoExA() returned %x %ld\n", ret, GetLastError());
|
||||
}
|
||||
|
||||
static void test_icons(void)
|
||||
@@ -1086,7 +1232,7 @@ static void create_manifest_file(const char *filename, const char *manifest)
|
||||
|
||||
MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH );
|
||||
file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
|
||||
WriteFile(file, manifest, strlen(manifest), &size, NULL);
|
||||
CloseHandle(file);
|
||||
}
|
||||
@@ -1103,10 +1249,10 @@ static HANDLE create_test_actctx(const char *file)
|
||||
actctx.lpSource = path;
|
||||
|
||||
handle = CreateActCtxW(&actctx);
|
||||
ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %u\n", GetLastError());
|
||||
ok(handle != INVALID_HANDLE_VALUE, "failed to create context, error %lu\n", GetLastError());
|
||||
|
||||
ok(actctx.cbSize == sizeof(actctx), "cbSize=%d\n", actctx.cbSize);
|
||||
ok(actctx.dwFlags == 0, "dwFlags=%d\n", actctx.dwFlags);
|
||||
ok(actctx.cbSize == sizeof(actctx), "cbSize=%ld\n", actctx.cbSize);
|
||||
ok(actctx.dwFlags == 0, "dwFlags=%ld\n", actctx.dwFlags);
|
||||
ok(actctx.lpSource == path, "lpSource=%p\n", actctx.lpSource);
|
||||
ok(actctx.wProcessorArchitecture == 0, "wProcessorArchitecture=%d\n", actctx.wProcessorArchitecture);
|
||||
ok(actctx.wLangId == 0, "wLangId=%d\n", actctx.wLangId);
|
||||
@@ -1140,7 +1286,7 @@ static void test_comctl32_class( const char *name )
|
||||
create_manifest_file(path, comctl32_manifest);
|
||||
context = create_test_actctx(path);
|
||||
ret = DeleteFileA(path);
|
||||
ok(ret, "Failed to delete manifest file, error %d.\n", GetLastError());
|
||||
ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
|
||||
|
||||
module = GetModuleHandleA( "comctl32" );
|
||||
ok( !module, "comctl32 already loaded\n" );
|
||||
@@ -1251,7 +1397,7 @@ static void test_comctl32_classes(void)
|
||||
sprintf( path_name, "%s class %s", argv[0], classes[i] );
|
||||
ok( CreateProcessA( NULL, path_name, NULL, NULL, FALSE, 0, NULL, NULL, &startup, &info ),
|
||||
"CreateProcess failed.\n" );
|
||||
winetest_wait_child_process( info.hProcess );
|
||||
wait_child_process( info.hProcess );
|
||||
CloseHandle( info.hProcess );
|
||||
CloseHandle( info.hThread );
|
||||
}
|
||||
@@ -1277,10 +1423,10 @@ static void test_IME(void)
|
||||
ok(GetModuleHandleA("imm32") != 0, "imm32.dll is not loaded\n");
|
||||
|
||||
ret = GetClassInfoA(NULL, "IME", &wnd_class);
|
||||
ok(ret, "GetClassInfo failed: %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
|
||||
|
||||
size = VirtualQuery(wnd_class.lpfnWndProc, &mbi, sizeof(mbi));
|
||||
ok(size == sizeof(mbi), "VirtualQuery returned %ld\n", size);
|
||||
ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
|
||||
if (size == sizeof(mbi)) {
|
||||
size = GetModuleFileNameA(mbi.AllocationBase, module_name, sizeof(module_name));
|
||||
ok(size, "GetModuleFileName failed\n");
|
||||
@@ -1291,10 +1437,10 @@ static void test_IME(void)
|
||||
}
|
||||
|
||||
ret = GetClassInfoW(NULL, ime_classW, &wnd_classw);
|
||||
ok(ret, "GetClassInfo failed: %d\n", GetLastError());
|
||||
ok(ret, "GetClassInfo failed: %ld\n", GetLastError());
|
||||
|
||||
size = VirtualQuery(wnd_classw.lpfnWndProc, &mbi, sizeof(mbi));
|
||||
ok(size == sizeof(mbi), "VirtualQuery returned %ld\n", size);
|
||||
ok(size == sizeof(mbi), "VirtualQuery returned %Id\n", size);
|
||||
size = GetModuleFileNameA(mbi.AllocationBase, module_name, sizeof(module_name));
|
||||
ok(size, "GetModuleFileName failed\n");
|
||||
for (ptr = module_name+size-1; ptr > module_name; ptr--)
|
||||
@@ -1329,7 +1475,7 @@ static void test_actctx_classes(void)
|
||||
create_manifest_file(path, main_manifest);
|
||||
context = create_test_actctx(path);
|
||||
ret = DeleteFileA(path);
|
||||
ok(ret, "Failed to delete manifest file, error %d.\n", GetLastError());
|
||||
ok(ret, "Failed to delete manifest file, error %ld.\n", GetLastError());
|
||||
|
||||
ret = ActivateActCtx(context, &cookie);
|
||||
ok(ret, "Failed to activate context.\n");
|
||||
@@ -1464,6 +1610,108 @@ static void test_actctx_classes(void)
|
||||
ReleaseActCtx(context);
|
||||
}
|
||||
|
||||
static void test_uxtheme(void)
|
||||
{
|
||||
static const CHAR *class_name = "test_uxtheme_class";
|
||||
BOOL (WINAPI * pIsThemeActive)(void);
|
||||
BOOL dll_loaded, is_theme_active;
|
||||
WNDCLASSEXA class;
|
||||
HMODULE uxtheme;
|
||||
ATOM atom;
|
||||
HWND hwnd;
|
||||
|
||||
memset(&class, 0, sizeof(class));
|
||||
class.cbSize = sizeof(class);
|
||||
class.lpfnWndProc = DefWindowProcA;
|
||||
class.hInstance = GetModuleHandleA(NULL);
|
||||
class.lpszClassName = class_name;
|
||||
atom = RegisterClassExA(&class);
|
||||
ok(atom, "RegisterClassExA failed, error %lu.\n", GetLastError());
|
||||
|
||||
dll_loaded = !!GetModuleHandleA("comctl32.dll");
|
||||
ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
|
||||
dll_loaded = !!GetModuleHandleA("uxtheme.dll");
|
||||
todo_wine_if(dll_loaded)
|
||||
ok(!dll_loaded, "Expected uxtheme.dll not loaded.\n");
|
||||
|
||||
/* Creating a window triggers uxtheme load when theming is active */
|
||||
hwnd = CreateWindowA(class_name, "Test", WS_POPUP, 0, 0, 1, 1, NULL, NULL,
|
||||
GetModuleHandleA(NULL), NULL);
|
||||
ok(!!hwnd, "Failed to create a test window, error %lu.\n", GetLastError());
|
||||
|
||||
dll_loaded = !!GetModuleHandleA("comctl32.dll");
|
||||
ok(!dll_loaded, "Expected comctl32.dll not loaded.\n");
|
||||
|
||||
/* Uxtheme is loaded when theming is active */
|
||||
dll_loaded = !!GetModuleHandleA("uxtheme.dll");
|
||||
|
||||
uxtheme = LoadLibraryA("uxtheme.dll");
|
||||
ok(!!uxtheme, "Failed to load uxtheme.dll, error %lu.\n", GetLastError());
|
||||
pIsThemeActive = (void *)GetProcAddress(uxtheme, "IsThemeActive");
|
||||
ok(!!pIsThemeActive, "Failed to load IsThemeActive, error %lu.\n", GetLastError());
|
||||
is_theme_active = pIsThemeActive();
|
||||
FreeLibrary(uxtheme);
|
||||
|
||||
ok(dll_loaded == is_theme_active, "Expected uxtheme %s when theming is %s.\n",
|
||||
is_theme_active ? "loaded" : "not loaded", is_theme_active ? "active" : "inactive");
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClassA(class_name, GetModuleHandleA(NULL));
|
||||
}
|
||||
|
||||
static void test_class_name(void)
|
||||
{
|
||||
WCHAR class_name[] = L"ClassNameTest";
|
||||
HINSTANCE hinst = GetModuleHandleW(0);
|
||||
WNDCLASSEXW wcex;
|
||||
const WCHAR *nameW;
|
||||
const char *nameA;
|
||||
UINT_PTR res;
|
||||
HWND hwnd;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (is_reactos()) {
|
||||
ok(FALSE, "FIXME: ReactOS crashes on test_class_name()!\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
memset(&wcex, 0, sizeof wcex);
|
||||
wcex.cbSize = sizeof wcex;
|
||||
wcex.lpfnWndProc = ClassTest_WndProc;
|
||||
wcex.hIcon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
|
||||
wcex.hInstance = hinst;
|
||||
wcex.lpszClassName = class_name;
|
||||
wcex.lpszMenuName = L"menu name";
|
||||
ok(RegisterClassExW(&wcex), "RegisterClassExW returned 0\n");
|
||||
hwnd = CreateWindowExW(0, class_name, NULL, WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 0, 0, NULL, NULL, hinst, 0);
|
||||
ok(hwnd != NULL, "Window was not created\n");
|
||||
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "menu name"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"menu name"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
res = SetClassLongPtrA(hwnd, GCLP_MENUNAME, (LONG_PTR)"nameA");
|
||||
todo_wine
|
||||
ok(res, "SetClassLongPtrA returned 0\n");
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "nameA"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"nameA"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
res = SetClassLongPtrW(hwnd, GCLP_MENUNAME, (LONG_PTR)L"nameW");
|
||||
todo_wine
|
||||
ok(res, "SetClassLongPtrW returned 0\n");
|
||||
nameA = (const char *)GetClassLongPtrA(hwnd, GCLP_MENUNAME);
|
||||
ok(!strcmp(nameA, "nameW"), "unexpected class name %s\n", debugstr_a(nameA));
|
||||
nameW = (const WCHAR *)GetClassLongPtrW(hwnd, GCLP_MENUNAME);
|
||||
ok(!wcscmp(nameW, L"nameW"), "unexpected class name %s\n", debugstr_w(nameW));
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
UnregisterClassW(class_name, hinst);
|
||||
}
|
||||
|
||||
START_TEST(class)
|
||||
{
|
||||
char **argv;
|
||||
@@ -1476,6 +1724,7 @@ START_TEST(class)
|
||||
return;
|
||||
}
|
||||
|
||||
test_uxtheme();
|
||||
test_IME();
|
||||
test_GetClassInfo();
|
||||
test_extra_values();
|
||||
@@ -1488,12 +1737,17 @@ START_TEST(class)
|
||||
|
||||
ClassTest(hInstance,FALSE);
|
||||
ClassTest(hInstance,TRUE);
|
||||
ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), FALSE);
|
||||
ClassTest((HANDLE)((ULONG_PTR)hInstance | 0x1234), TRUE);
|
||||
CreateDialogParamTest(hInstance);
|
||||
test_styles();
|
||||
test_builtinproc();
|
||||
test_ntdll_wndprocs();
|
||||
test_wndproc_forwards();
|
||||
test_icons();
|
||||
test_comctl32_classes();
|
||||
test_actctx_classes();
|
||||
test_class_name();
|
||||
|
||||
/* this test unregisters the Button class so it should be executed at the end */
|
||||
test_instances();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,9 @@
|
||||
#define STRICT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#ifdef __REACTOS__
|
||||
#include <windowsx.h>
|
||||
#endif
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
@@ -43,7 +46,7 @@ static HWND build_combo(DWORD style)
|
||||
return CreateWindowA("ComboBox", "Combo", WS_VISIBLE|WS_CHILD|style, 5, 5, 100, 100, hMainWnd, (HMENU)COMBO_ID, NULL, 0);
|
||||
}
|
||||
|
||||
static int font_height(HFONT hFont)
|
||||
static int get_font_height(HFONT hFont)
|
||||
{
|
||||
TEXTMETRICA tm;
|
||||
HFONT hFontOld;
|
||||
@@ -74,12 +77,13 @@ static BOOL is_font_installed(const char *name)
|
||||
static void test_setitemheight(DWORD style)
|
||||
{
|
||||
HWND hCombo = build_combo(style);
|
||||
int i, font_height, height;
|
||||
HFONT hFont;
|
||||
RECT r;
|
||||
int i;
|
||||
|
||||
trace("Style %x\n", style);
|
||||
trace("Style %lx\n", style);
|
||||
GetClientRect(hCombo, &r);
|
||||
expect_rect(r, 0, 0, 100, font_height(GetStockObject(SYSTEM_FONT)) + 8);
|
||||
expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
|
||||
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105);
|
||||
@@ -92,6 +96,22 @@ static void test_setitemheight(DWORD style)
|
||||
}
|
||||
|
||||
DestroyWindow(hCombo);
|
||||
|
||||
/* Set item height below text height, force resize. */
|
||||
hCombo = build_combo(style);
|
||||
|
||||
hFont = (HFONT)SendMessageA(hCombo, WM_GETFONT, 0, 0);
|
||||
font_height = get_font_height(hFont);
|
||||
SendMessageA(hCombo, CB_SETITEMHEIGHT, -1, font_height / 2);
|
||||
height = SendMessageA(hCombo, CB_GETITEMHEIGHT, -1, 0);
|
||||
todo_wine
|
||||
ok(height == font_height / 2, "Unexpected item height %d, expected %d.\n", height, font_height / 2);
|
||||
|
||||
SetWindowPos(hCombo, NULL, 10, 10, 150, 5 * font_height, SWP_SHOWWINDOW);
|
||||
height = SendMessageA(hCombo, CB_GETITEMHEIGHT, -1, 0);
|
||||
ok(height > font_height, "Unexpected item height %d, font height %d.\n", height, font_height);
|
||||
|
||||
DestroyWindow(hCombo);
|
||||
}
|
||||
|
||||
static void test_setfont(DWORD style)
|
||||
@@ -107,14 +127,14 @@ static void test_setfont(DWORD style)
|
||||
return;
|
||||
}
|
||||
|
||||
trace("Style %x\n", style);
|
||||
trace("Style %lx\n", style);
|
||||
|
||||
hCombo = build_combo(style);
|
||||
hFont1 = CreateFontA(10, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
|
||||
hFont2 = CreateFontA(8, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
|
||||
|
||||
GetClientRect(hCombo, &r);
|
||||
expect_rect(r, 0, 0, 100, font_height(GetStockObject(SYSTEM_FONT)) + 8);
|
||||
expect_rect(r, 0, 0, 100, get_font_height(GetStockObject(SYSTEM_FONT)) + 8);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
|
||||
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105);
|
||||
@@ -123,39 +143,39 @@ static void test_setfont(DWORD style)
|
||||
of the window when it was created. The size of the calculated
|
||||
dropped area changes only by how much the selection area
|
||||
changes, not by how much the list area changes. */
|
||||
if (font_height(hFont1) == 10 && font_height(hFont2) == 8)
|
||||
if (get_font_height(hFont1) == 10 && get_font_height(hFont2) == 8)
|
||||
{
|
||||
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
|
||||
GetClientRect(hCombo, &r);
|
||||
expect_rect(r, 0, 0, 100, 18);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
|
||||
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1)));
|
||||
|
||||
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont2, FALSE);
|
||||
GetClientRect(hCombo, &r);
|
||||
expect_rect(r, 0, 0, 100, 16);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
|
||||
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont2)));
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont2)));
|
||||
|
||||
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont1, FALSE);
|
||||
GetClientRect(hCombo, &r);
|
||||
expect_rect(r, 0, 0, 100, 18);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&r);
|
||||
MapWindowPoints(HWND_DESKTOP, hMainWnd, (LPPOINT)&r, 2);
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (font_height(GetStockObject(SYSTEM_FONT)) - font_height(hFont1)));
|
||||
todo_wine expect_rect(r, 5, 5, 105, 105 - (get_font_height(GetStockObject(SYSTEM_FONT)) - get_font_height(hFont1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(0, "Expected Marlett font heights 10/8, got %d/%d\n",
|
||||
font_height(hFont1), font_height(hFont2));
|
||||
get_font_height(hFont1), get_font_height(hFont2));
|
||||
}
|
||||
|
||||
for (i = 1; i < 30; i++)
|
||||
{
|
||||
HFONT hFont = CreateFontA(i, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, SYMBOL_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Marlett");
|
||||
int height = font_height(hFont);
|
||||
int height = get_font_height(hFont);
|
||||
|
||||
SendMessageA(hCombo, WM_SETFONT, (WPARAM)hFont, FALSE);
|
||||
GetClientRect(hCombo, &r);
|
||||
@@ -173,6 +193,8 @@ static LRESULT (CALLBACK *old_parent_proc)(HWND hwnd, UINT msg, WPARAM wparam, L
|
||||
static LPCSTR expected_edit_text;
|
||||
static LPCSTR expected_list_text;
|
||||
static BOOL selchange_fired;
|
||||
static HWND lparam_for_WM_CTLCOLOR;
|
||||
static HBRUSH brush_red;
|
||||
|
||||
static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
@@ -204,6 +226,20 @@ static LRESULT CALLBACK parent_wnd_proc(HWND hwnd, UINT msg, WPARAM wparam, LPAR
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case WM_CTLCOLOR:
|
||||
case WM_CTLCOLORMSGBOX:
|
||||
case WM_CTLCOLOREDIT:
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORBTN:
|
||||
case WM_CTLCOLORDLG:
|
||||
case WM_CTLCOLORSCROLLBAR:
|
||||
case WM_CTLCOLORSTATIC:
|
||||
if (lparam_for_WM_CTLCOLOR)
|
||||
{
|
||||
ok(lparam_for_WM_CTLCOLOR == (HWND)lparam, "Expected %p, got %p\n", lparam_for_WM_CTLCOLOR, (HWND)lparam);
|
||||
return (LRESULT) brush_red;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProcA(old_parent_proc, hwnd, msg, wparam, lparam);
|
||||
@@ -301,7 +337,7 @@ static void test_WM_LBUTTONDOWN(void)
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &cbInfo);
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%d\n",
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
|
||||
GetLastError());
|
||||
hEdit = cbInfo.hwndItem;
|
||||
hList = cbInfo.hwndList;
|
||||
@@ -313,7 +349,7 @@ static void test_WM_LBUTTONDOWN(void)
|
||||
x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
|
||||
y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
|
||||
result = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
|
||||
ok(result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
|
||||
ok(result, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
|
||||
"The dropdown list should have appeared after clicking the button.\n");
|
||||
@@ -321,7 +357,7 @@ static void test_WM_LBUTTONDOWN(void)
|
||||
ok(GetFocus() == hEdit,
|
||||
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
|
||||
result = SendMessageA(hCombo, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
|
||||
ok(result, "WM_LBUTTONUP was not processed. LastError=%d\n",
|
||||
ok(result, "WM_LBUTTONUP was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(GetFocus() == hEdit,
|
||||
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
|
||||
@@ -332,13 +368,13 @@ static void test_WM_LBUTTONDOWN(void)
|
||||
x = rect.left + (rect.right-rect.left)/2;
|
||||
y = item_height/2 + item_height*4;
|
||||
result = SendMessageA(hList, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
|
||||
ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
|
||||
ok(!result, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(GetFocus() == hEdit,
|
||||
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
|
||||
|
||||
result = SendMessageA(hList, WM_MOUSEMOVE, 0, MAKELPARAM(x, y));
|
||||
ok(!result, "WM_MOUSEMOVE was not processed. LastError=%d\n",
|
||||
ok(!result, "WM_MOUSEMOVE was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(GetFocus() == hEdit,
|
||||
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
|
||||
@@ -346,7 +382,7 @@ static void test_WM_LBUTTONDOWN(void)
|
||||
"The dropdown list should still be visible.\n");
|
||||
|
||||
result = SendMessageA(hList, WM_LBUTTONUP, 0, MAKELPARAM(x, y));
|
||||
ok(!result, "WM_LBUTTONUP was not processed. LastError=%d\n",
|
||||
ok(!result, "WM_LBUTTONUP was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(GetFocus() == hEdit,
|
||||
"Focus not on ComboBox's Edit Control, instead on %p\n", GetFocus());
|
||||
@@ -374,29 +410,29 @@ static void test_changesize( DWORD style)
|
||||
/* first make it slightly smaller */
|
||||
MoveWindow( hCombo, 10, 10, clwidth - 2, clheight - 2, TRUE);
|
||||
GetClientRect( hCombo, &rc);
|
||||
ok( rc.right - rc.left == clwidth - 2, "clientrect width is %d vs %d\n",
|
||||
ok( rc.right - rc.left == clwidth - 2, "clientrect width is %ld vs %d\n",
|
||||
rc.right - rc.left, clwidth - 2);
|
||||
ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
|
||||
ok( rc.bottom - rc.top == clheight, "clientrect height is %ld vs %d\n",
|
||||
rc.bottom - rc.top, clheight);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
|
||||
ok( rc.right - rc.left == clwidth - 2, "drop-down rect width is %d vs %d\n",
|
||||
ok( rc.right - rc.left == clwidth - 2, "drop-down rect width is %ld vs %d\n",
|
||||
rc.right - rc.left, clwidth - 2);
|
||||
ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %d vs %d\n",
|
||||
ok( rc.bottom - rc.top == ddheight, "drop-down rect height is %ld vs %d\n",
|
||||
rc.bottom - rc.top, ddheight);
|
||||
ok( rc.right - rc.left == ddwidth -2, "drop-down rect width is %d vs %d\n",
|
||||
ok( rc.right - rc.left == ddwidth -2, "drop-down rect width is %ld vs %d\n",
|
||||
rc.right - rc.left, ddwidth - 2);
|
||||
/* new cx, cy is slightly bigger than the initial values */
|
||||
MoveWindow( hCombo, 10, 10, clwidth + 2, clheight + 2, TRUE);
|
||||
GetClientRect( hCombo, &rc);
|
||||
ok( rc.right - rc.left == clwidth + 2, "clientrect width is %d vs %d\n",
|
||||
ok( rc.right - rc.left == clwidth + 2, "clientrect width is %ld vs %d\n",
|
||||
rc.right - rc.left, clwidth + 2);
|
||||
ok( rc.bottom - rc.top == clheight, "clientrect height is %d vs %d\n",
|
||||
ok( rc.bottom - rc.top == clheight, "clientrect height is %ld vs %d\n",
|
||||
rc.bottom - rc.top, clheight);
|
||||
SendMessageA(hCombo, CB_GETDROPPEDCONTROLRECT, 0, (LPARAM)&rc);
|
||||
ok( rc.right - rc.left == clwidth + 2, "drop-down rect width is %d vs %d\n",
|
||||
ok( rc.right - rc.left == clwidth + 2, "drop-down rect width is %ld vs %d\n",
|
||||
rc.right - rc.left, clwidth + 2);
|
||||
todo_wine {
|
||||
ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %d vs %d\n",
|
||||
ok( rc.bottom - rc.top == clheight + 2, "drop-down rect height is %ld vs %d\n",
|
||||
rc.bottom - rc.top, clheight + 2);
|
||||
}
|
||||
|
||||
@@ -448,7 +484,7 @@ static void test_editselection(void)
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &cbInfo);
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%d\n",
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
|
||||
GetLastError());
|
||||
hEdit = cbInfo.hwndItem;
|
||||
|
||||
@@ -502,7 +538,7 @@ static void test_editselection(void)
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &cbInfo);
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%d\n",
|
||||
ok(ret, "Failed to get combobox info structure. LastError=%ld\n",
|
||||
GetLastError());
|
||||
hEdit = cbInfo.hwndItem;
|
||||
|
||||
@@ -581,7 +617,7 @@ static void test_editselection_focus(DWORD style)
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &cbInfo);
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
|
||||
hEdit = cbInfo.hwndItem;
|
||||
|
||||
hButton = CreateWindowA("Button", "OK", WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON,
|
||||
@@ -652,8 +688,8 @@ static void test_listbox_styles(DWORD cb_style)
|
||||
|
||||
style = GetWindowLongW( info.hwndList, GWL_STYLE );
|
||||
exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
|
||||
ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
|
||||
ok(style == expect_style, "%08lx: got %08lx\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
|
||||
|
||||
if (cb_style != CBS_SIMPLE)
|
||||
expect_exstyle |= WS_EX_TOPMOST;
|
||||
@@ -661,14 +697,14 @@ static void test_listbox_styles(DWORD cb_style)
|
||||
SendMessageW(combo, CB_SHOWDROPDOWN, TRUE, 0 );
|
||||
style = GetWindowLongW( info.hwndList, GWL_STYLE );
|
||||
exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
|
||||
ok(style == (expect_style | WS_VISIBLE), "%08x: got %08x\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
|
||||
ok(style == (expect_style | WS_VISIBLE), "%08lx: got %08lx\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
|
||||
|
||||
SendMessageW(combo, CB_SHOWDROPDOWN, FALSE, 0 );
|
||||
style = GetWindowLongW( info.hwndList, GWL_STYLE );
|
||||
exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
|
||||
ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
|
||||
ok(style == expect_style, "%08lx: got %08lx\n", cb_style, style);
|
||||
ok(exstyle == expect_exstyle, "%08lx: got %08lx\n", cb_style, exstyle);
|
||||
|
||||
DestroyWindow(combo);
|
||||
}
|
||||
@@ -726,7 +762,7 @@ static void test_listbox_size(DWORD style)
|
||||
cbInfo.cbSize = sizeof(COMBOBOXINFO);
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &cbInfo);
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
|
||||
|
||||
hList = cbInfo.hwndList;
|
||||
for (i = 0; i < info_test->num_items; i++)
|
||||
@@ -736,7 +772,7 @@ static void test_listbox_size(DWORD style)
|
||||
x = cbInfo.rcButton.left + (cbInfo.rcButton.right-cbInfo.rcButton.left)/2;
|
||||
y = cbInfo.rcButton.top + (cbInfo.rcButton.bottom-cbInfo.rcButton.top)/2;
|
||||
ret = SendMessageA(hCombo, WM_LBUTTONDOWN, 0, MAKELPARAM(x, y));
|
||||
ok(ret, "WM_LBUTTONDOWN was not processed. LastError=%d\n",
|
||||
ok(ret, "WM_LBUTTONDOWN was not processed. LastError=%ld\n",
|
||||
GetLastError());
|
||||
ok(SendMessageA(hCombo, CB_GETDROPPEDSTATE, 0, 0),
|
||||
"The dropdown list should have appeared after clicking the button.\n");
|
||||
@@ -782,7 +818,7 @@ static void test_WS_VSCROLL(void)
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetComboBoxInfo(hCombo, &info);
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %u\n", GetLastError());
|
||||
ok(ret, "Failed to get COMBOBOXINFO structure; LastError: %lu\n", GetLastError());
|
||||
hList = info.hwndList;
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
@@ -804,8 +840,87 @@ static void test_WS_VSCROLL(void)
|
||||
DestroyWindow(hCombo);
|
||||
}
|
||||
|
||||
static void test_combo_ctlcolor(void)
|
||||
{
|
||||
static const int messages[] =
|
||||
{
|
||||
WM_CTLCOLOR,
|
||||
WM_CTLCOLORMSGBOX,
|
||||
WM_CTLCOLOREDIT,
|
||||
WM_CTLCOLORLISTBOX,
|
||||
WM_CTLCOLORBTN,
|
||||
WM_CTLCOLORDLG,
|
||||
WM_CTLCOLORSCROLLBAR,
|
||||
WM_CTLCOLORSTATIC,
|
||||
};
|
||||
|
||||
HBRUSH brush, global_brush;
|
||||
unsigned int i, ret;
|
||||
COMBOBOXINFO info;
|
||||
HWND combo;
|
||||
|
||||
combo = build_combo(CBS_DROPDOWN);
|
||||
ok(!!combo, "Failed to create combo window.\n");
|
||||
|
||||
old_parent_proc = (void *)SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)parent_wnd_proc);
|
||||
|
||||
info.cbSize = sizeof(COMBOBOXINFO);
|
||||
ret = GetComboBoxInfo(combo, &info);
|
||||
ok(ret, "Failed to get combobox info structure.\n");
|
||||
|
||||
lparam_for_WM_CTLCOLOR = info.hwndItem;
|
||||
|
||||
/* Parent returns valid brush handle. */
|
||||
for (i = 0; i < ARRAY_SIZE(messages); ++i)
|
||||
{
|
||||
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
|
||||
ok(brush == brush_red, "%u: unexpected brush %p, expected got %p.\n", i, brush, brush_red);
|
||||
}
|
||||
|
||||
/* Parent returns NULL brush. */
|
||||
global_brush = brush_red;
|
||||
brush_red = NULL;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(messages); ++i)
|
||||
{
|
||||
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
|
||||
ok(!brush, "%u: unexpected brush %p.\n", i, brush);
|
||||
}
|
||||
|
||||
brush_red = global_brush;
|
||||
|
||||
lparam_for_WM_CTLCOLOR = 0;
|
||||
|
||||
/* Parent does default processing. */
|
||||
for (i = 0; i < ARRAY_SIZE(messages); ++i)
|
||||
{
|
||||
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
|
||||
ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush);
|
||||
}
|
||||
|
||||
SetWindowLongPtrA(hMainWnd, GWLP_WNDPROC, (ULONG_PTR)old_parent_proc);
|
||||
DestroyWindow(combo);
|
||||
|
||||
/* Combo without a parent. */
|
||||
combo = CreateWindowA("ComboBox", "Combo", CBS_DROPDOWN, 5, 5, 100, 100, NULL, NULL, NULL, 0);
|
||||
ok(!!combo, "Failed to create combo window.\n");
|
||||
|
||||
info.cbSize = sizeof(COMBOBOXINFO);
|
||||
ret = GetComboBoxInfo(combo, &info);
|
||||
ok(ret, "Failed to get combobox info structure.\n");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(messages); ++i)
|
||||
{
|
||||
brush = (HBRUSH)SendMessageA(combo, messages[i], 0, (LPARAM)info.hwndItem);
|
||||
ok(!!brush && brush != brush_red, "%u: unexpected brush %p.\n", i, brush);
|
||||
}
|
||||
|
||||
DestroyWindow(combo);
|
||||
}
|
||||
|
||||
START_TEST(combo)
|
||||
{
|
||||
brush_red = CreateSolidBrush(RGB(255, 0, 0));
|
||||
hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
|
||||
ShowWindow(hMainWnd, SW_SHOW);
|
||||
|
||||
@@ -825,6 +940,8 @@ START_TEST(combo)
|
||||
test_listbox_styles(CBS_DROPDOWN);
|
||||
test_listbox_styles(CBS_DROPDOWNLIST);
|
||||
test_listbox_size(CBS_DROPDOWN);
|
||||
test_combo_ctlcolor();
|
||||
|
||||
DestroyWindow(hMainWnd);
|
||||
DeleteObject(brush_red);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ static void test_dc_attributes(void)
|
||||
|
||||
ok( WindowFromDC( hdc ) == hwnd_cache, "wrong window\n" );
|
||||
ReleaseDC( hwnd_cache, hdc );
|
||||
ok( WindowFromDC( hdc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( hdc ) != hwnd_cache, "wrong window\n" );
|
||||
hdc = GetDC( hwnd_cache );
|
||||
rop = GetROP2( hdc );
|
||||
ok( rop == def_rop, "wrong ROP2 %d after release\n", rop );
|
||||
@@ -124,7 +124,7 @@ static void test_dc_attributes(void)
|
||||
ok( caps == 0, "got %d\n", caps );
|
||||
caps = GetDeviceCaps( old_hdc, NUMCOLORS );
|
||||
ok( caps == 0, "got %d\n", caps );
|
||||
ok( WindowFromDC( old_hdc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( old_hdc ) != hwnd_cache, "wrong window\n" );
|
||||
|
||||
hdc = GetDC(0);
|
||||
caps = GetDeviceCaps( hdc, HORZRES );
|
||||
@@ -369,6 +369,7 @@ static void test_dc_visrgn(void)
|
||||
/* parent DC */
|
||||
hdc = GetDC( hwnd_parentdc );
|
||||
GetClipBox( hdc, &rect );
|
||||
MapWindowPoints(hwnd_parentdc, hwnd_parent, (POINT *)&rect, 2);
|
||||
ReleaseDC( hwnd_parentdc, hdc );
|
||||
|
||||
hdc = GetDC( hwnd_parent );
|
||||
@@ -384,7 +385,7 @@ static void test_dc_visrgn(void)
|
||||
static void test_begin_paint(void)
|
||||
{
|
||||
HDC old_hdc, hdc;
|
||||
RECT rect, parent_rect;
|
||||
RECT rect, parent_rect, client_rect;
|
||||
PAINTSTRUCT ps;
|
||||
COLORREF cr;
|
||||
|
||||
@@ -401,6 +402,33 @@ static void test_begin_paint(void)
|
||||
"invalid clip box %s\n", wine_dbgstr_rect( &rect ));
|
||||
EndPaint( hwnd_cache, &ps );
|
||||
|
||||
SetWindowPos( hwnd_cache, 0, 0, 0, 100, 100, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
RedrawWindow( hwnd_cache, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
SetRect( &rect, 0, 0, 150, 150 );
|
||||
RedrawWindow( hwnd_cache, &rect, 0, RDW_INVALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
hdc = BeginPaint( hwnd_cache, &ps );
|
||||
GetClipBox( hdc, &rect );
|
||||
GetClientRect( hwnd_cache, &client_rect );
|
||||
ok( EqualRect( &rect, &client_rect ), "clip box = %s, expected %s\n",
|
||||
wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &client_rect ));
|
||||
SetWindowPos( hwnd_cache, 0, 0, 0, 200, 200, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
GetClipBox( hdc, &rect );
|
||||
GetClientRect( hwnd_cache, &client_rect );
|
||||
todo_wine ok( (!rect.left && !rect.top && rect.right == 150 && rect.bottom == 150) ||
|
||||
broken( EqualRect( &rect, &client_rect )),
|
||||
"clip box = %s\n", wine_dbgstr_rect( &rect ));
|
||||
EndPaint( hwnd_cache, &ps );
|
||||
|
||||
SetWindowPos( hwnd_cache, 0, 0, 0, 100, 100, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
RedrawWindow( hwnd_cache, NULL, 0, RDW_INVALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
hdc = BeginPaint( hwnd_cache, &ps );
|
||||
SetWindowPos( hwnd_cache, 0, 0, 0, 200, 200, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
GetClipBox( hdc, &rect );
|
||||
GetClientRect( hwnd_cache, &client_rect );
|
||||
todo_wine ok( EqualRect( &rect, &client_rect ), "clip box = %s, expected %s\n",
|
||||
wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &client_rect ));
|
||||
EndPaint( hwnd_cache, &ps );
|
||||
|
||||
/* window DC */
|
||||
|
||||
RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
@@ -440,6 +468,21 @@ static void test_begin_paint(void)
|
||||
ok( !(rect.left >= 10 && rect.top >= 10 && rect.right <= 20 && rect.bottom <= 20),
|
||||
"clip box should still be the whole window %s\n", wine_dbgstr_rect( &rect ));
|
||||
|
||||
SetWindowPos( hwnd_owndc, 0, 0, 0, 100, 100, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
RedrawWindow( hwnd_owndc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
SetRect( &rect, 0, 0, 50, 50 );
|
||||
RedrawWindow( hwnd_owndc, &rect, 0, RDW_INVALIDATE|RDW_ERASE );
|
||||
hdc = BeginPaint( hwnd_owndc, &ps );
|
||||
GetClipBox( hdc, &rect );
|
||||
ok( !rect.left && !rect.top && rect.right == 50 && rect.bottom == 50,
|
||||
"clip box = %s\n", wine_dbgstr_rect( &rect ));
|
||||
SetWindowPos( hwnd_owndc, 0, 0, 0, 200, 200, SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE );
|
||||
GetClipBox( hdc, &rect );
|
||||
GetClientRect( hwnd_owndc, &client_rect );
|
||||
ok( EqualRect( &rect, &client_rect ), "clip box = %s, expected %s\n",
|
||||
wine_dbgstr_rect( &rect ), wine_dbgstr_rect( &client_rect ));
|
||||
EndPaint( hwnd_owndc, &ps );
|
||||
|
||||
/* class DC */
|
||||
|
||||
RedrawWindow( hwnd_classdc, NULL, 0, RDW_VALIDATE|RDW_NOFRAME|RDW_NOERASE );
|
||||
@@ -466,18 +509,19 @@ static void test_begin_paint(void)
|
||||
RedrawWindow( hwnd_parentdc, NULL, 0, RDW_INVALIDATE );
|
||||
hdc = BeginPaint( hwnd_parentdc, &ps );
|
||||
GetClipBox( hdc, &rect );
|
||||
MapWindowPoints(hwnd_parentdc, hwnd_parent, (POINT *)&rect, 2);
|
||||
cr = SetPixel( hdc, 10, 10, RGB(255, 0, 0) );
|
||||
ok( cr != -1, "error drawing outside of window client area\n" );
|
||||
EndPaint( hwnd_parentdc, &ps );
|
||||
GetClientRect( hwnd_parent, &parent_rect );
|
||||
|
||||
ok( rect.left == parent_rect.left, "rect.left = %d, expected %d\n", rect.left, parent_rect.left );
|
||||
ok( rect.top == parent_rect.top, "rect.top = %d, expected %d\n", rect.top, parent_rect.top );
|
||||
todo_wine ok( rect.right == parent_rect.right, "rect.right = %d, expected %d\n", rect.right, parent_rect.right );
|
||||
todo_wine ok( rect.bottom == parent_rect.bottom, "rect.bottom = %d, expected %d\n", rect.bottom, parent_rect.bottom );
|
||||
todo_wine ok( rect.left == parent_rect.left, "rect.left = %ld, expected %ld\n", rect.left, parent_rect.left );
|
||||
todo_wine ok( rect.top == parent_rect.top, "rect.top = %ld, expected %ld\n", rect.top, parent_rect.top );
|
||||
todo_wine ok( rect.right == parent_rect.right, "rect.right = %ld, expected %ld\n", rect.right, parent_rect.right );
|
||||
todo_wine ok( rect.bottom == parent_rect.bottom, "rect.bottom = %ld, expected %ld\n", rect.bottom, parent_rect.bottom );
|
||||
|
||||
hdc = GetDC( hwnd_parent );
|
||||
todo_wine ok( GetPixel( hdc, 10, 10 ) == cr, "error drawing outside of window client area\n" );
|
||||
todo_wine ok( GetPixel( hdc, 60, 60 ) == cr, "error drawing outside of window client area\n" );
|
||||
ReleaseDC( hwnd_parent, hdc );
|
||||
}
|
||||
|
||||
@@ -550,24 +594,13 @@ static void test_invisible_create(void)
|
||||
|
||||
static void test_dc_layout(void)
|
||||
{
|
||||
DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
|
||||
DWORD (WINAPI *pGetLayout)(HDC hdc);
|
||||
HWND hwnd_cache_rtl, hwnd_owndc_rtl, hwnd_classdc_rtl, hwnd_classdc2_rtl;
|
||||
HDC hdc;
|
||||
DWORD layout;
|
||||
HMODULE mod = GetModuleHandleA("gdi32.dll");
|
||||
|
||||
pGetLayout = (void *)GetProcAddress( mod, "GetLayout" );
|
||||
pSetLayout = (void *)GetProcAddress( mod, "SetLayout" );
|
||||
if (!pGetLayout || !pSetLayout)
|
||||
{
|
||||
win_skip( "Don't have SetLayout\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
hdc = GetDC( hwnd_cache );
|
||||
pSetLayout( hdc, LAYOUT_RTL );
|
||||
layout = pGetLayout( hdc );
|
||||
SetLayout( hdc, LAYOUT_RTL );
|
||||
layout = GetLayout( hdc );
|
||||
ReleaseDC( hwnd_cache, hdc );
|
||||
if (!layout)
|
||||
{
|
||||
@@ -584,43 +617,43 @@ static void test_dc_layout(void)
|
||||
hwnd_classdc2_rtl = CreateWindowExA(WS_EX_LAYOUTRTL, "classdc_class", NULL, WS_OVERLAPPED | WS_VISIBLE,
|
||||
200, 200, 100, 100, 0, 0, GetModuleHandleA(0), NULL );
|
||||
hdc = GetDC( hwnd_cache_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
layout = GetLayout( hdc );
|
||||
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
pSetLayout( hdc, 0 );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
SetLayout( hdc, 0 );
|
||||
ReleaseDC( hwnd_cache_rtl, hdc );
|
||||
hdc = GetDC( hwnd_owndc_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
ReleaseDC( hwnd_cache_rtl, hdc );
|
||||
|
||||
hdc = GetDC( hwnd_cache );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == 0, "wrong layout %x\n", layout );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == 0, "wrong layout %lx\n", layout );
|
||||
ReleaseDC( hwnd_cache, hdc );
|
||||
|
||||
hdc = GetDC( hwnd_owndc_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
pSetLayout( hdc, 0 );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
SetLayout( hdc, 0 );
|
||||
ReleaseDC( hwnd_owndc_rtl, hdc );
|
||||
hdc = GetDC( hwnd_owndc_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
ReleaseDC( hwnd_owndc_rtl, hdc );
|
||||
|
||||
hdc = GetDC( hwnd_classdc_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
pSetLayout( hdc, 0 );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
SetLayout( hdc, 0 );
|
||||
ReleaseDC( hwnd_classdc_rtl, hdc );
|
||||
hdc = GetDC( hwnd_classdc2_rtl );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
ReleaseDC( hwnd_classdc2_rtl, hdc );
|
||||
hdc = GetDC( hwnd_classdc );
|
||||
layout = pGetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %x\n", layout );
|
||||
layout = GetLayout( hdc );
|
||||
ok( layout == LAYOUT_RTL, "wrong layout %lx\n", layout );
|
||||
ReleaseDC( hwnd_classdc_rtl, hdc );
|
||||
|
||||
DestroyWindow(hwnd_classdc2_rtl);
|
||||
@@ -632,8 +665,7 @@ static void test_dc_layout(void)
|
||||
static void test_destroyed_window(void)
|
||||
{
|
||||
HDC dc, old_dc;
|
||||
HDC hdcs[30];
|
||||
int i, rop;
|
||||
int rop;
|
||||
|
||||
dc = GetDC( hwnd_cache );
|
||||
SetROP2( dc, R2_WHITE );
|
||||
@@ -645,19 +677,11 @@ static void test_destroyed_window(void)
|
||||
DestroyWindow( hwnd_cache );
|
||||
rop = GetROP2( dc );
|
||||
ok( rop == 0, "wrong ROP2 %d\n", rop );
|
||||
ok( WindowFromDC( dc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( dc ) != hwnd_cache, "wrong window\n" );
|
||||
ok( !ReleaseDC( hwnd_cache, dc ), "ReleaseDC succeeded\n" );
|
||||
dc = GetDC( hwnd_cache );
|
||||
ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
|
||||
|
||||
for (i = 0; i < 30; i++)
|
||||
{
|
||||
dc = hdcs[i] = GetDCEx( hwnd_parent, 0, DCX_CACHE | DCX_USESTYLE );
|
||||
if (dc == old_dc) break;
|
||||
}
|
||||
ok( i < 30, "DC for destroyed window not reused\n" );
|
||||
while (i > 0) ReleaseDC( hwnd_parent, hdcs[--i] );
|
||||
|
||||
dc = GetDC( hwnd_classdc );
|
||||
SetROP2( dc, R2_WHITE );
|
||||
rop = GetROP2( dc );
|
||||
@@ -674,7 +698,7 @@ static void test_destroyed_window(void)
|
||||
|
||||
rop = GetROP2( dc );
|
||||
ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
|
||||
ok( WindowFromDC( dc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( dc ) != hwnd_classdc2, "wrong window\n" );
|
||||
ok( !ReleaseDC( hwnd_classdc2, dc ), "ReleaseDC succeeded\n" );
|
||||
dc = GetDC( hwnd_classdc2 );
|
||||
ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
|
||||
@@ -688,7 +712,7 @@ static void test_destroyed_window(void)
|
||||
|
||||
rop = GetROP2( dc );
|
||||
ok( rop == R2_WHITE, "wrong ROP2 %d\n", rop );
|
||||
ok( WindowFromDC( dc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( dc ) != hwnd_classdc, "wrong window\n" );
|
||||
ok( !ReleaseDC( hwnd_classdc, dc ), "ReleaseDC succeeded\n" );
|
||||
dc = GetDC( hwnd_classdc );
|
||||
ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
|
||||
@@ -702,7 +726,7 @@ static void test_destroyed_window(void)
|
||||
|
||||
rop = GetROP2( dc );
|
||||
ok( rop == 0, "wrong ROP2 %d\n", rop );
|
||||
ok( WindowFromDC( dc ) == 0, "wrong window\n" );
|
||||
ok( WindowFromDC( dc ) != hwnd_owndc, "wrong window\n" );
|
||||
ok( !ReleaseDC( hwnd_owndc, dc ), "ReleaseDC succeeded\n" );
|
||||
dc = GetDC( hwnd_owndc );
|
||||
ok( !dc, "Got a non-NULL DC (%p) for a destroyed window\n", dc );
|
||||
@@ -750,7 +774,7 @@ START_TEST(dce)
|
||||
hwnd_parent = CreateWindowA("static", NULL, WS_OVERLAPPED | WS_VISIBLE,
|
||||
400, 0, 100, 100, 0, 0, 0, NULL );
|
||||
hwnd_parentdc = CreateWindowA("parentdc_class", NULL, WS_CHILD | WS_VISIBLE,
|
||||
0, 0, 1, 1, hwnd_parent, 0, 0, NULL );
|
||||
50, 50, 1, 1, hwnd_parent, 0, 0, NULL );
|
||||
|
||||
test_dc_attributes();
|
||||
test_parameters();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -32,6 +32,35 @@
|
||||
#define ID_EDITTEST2 99
|
||||
#define MAXLEN 200
|
||||
|
||||
static BOOL open_clipboard(HWND hwnd)
|
||||
{
|
||||
DWORD start = GetTickCount();
|
||||
while (1)
|
||||
{
|
||||
BOOL ret = OpenClipboard(hwnd);
|
||||
if (ret || GetLastError() != ERROR_ACCESS_DENIED)
|
||||
return ret;
|
||||
if (GetTickCount() - start > 100)
|
||||
{
|
||||
char classname[256];
|
||||
DWORD le = GetLastError();
|
||||
HWND clipwnd = GetOpenClipboardWindow();
|
||||
/* Provide a hint as to the source of interference:
|
||||
* - The class name would typically be CLIPBRDWNDCLASS if the
|
||||
* clipboard was opened by a Windows application using the
|
||||
* ole32 API.
|
||||
* - And it would be __wine_clipboard_manager if it was opened in
|
||||
* response to a native application.
|
||||
*/
|
||||
GetClassNameA(clipwnd, classname, ARRAY_SIZE(classname));
|
||||
trace("%p (%s) opened the clipboard\n", clipwnd, classname);
|
||||
SetLastError(le);
|
||||
return ret;
|
||||
}
|
||||
Sleep(15);
|
||||
}
|
||||
}
|
||||
|
||||
struct edit_notify {
|
||||
int en_change, en_maxtext, en_update;
|
||||
};
|
||||
@@ -661,7 +690,7 @@ static void set_client_height(HWND Wnd, unsigned Height)
|
||||
|
||||
GetClientRect(Wnd, &ClientRect);
|
||||
ok(ClientRect.bottom - ClientRect.top == Height,
|
||||
"The client height should be %d, but is %d\n",
|
||||
"The client height should be %d, but is %ld\n",
|
||||
Height, ClientRect.bottom - ClientRect.top);
|
||||
}
|
||||
|
||||
@@ -677,52 +706,52 @@ static void test_edit_control_1(void)
|
||||
trace("EDIT: Single line\n");
|
||||
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%x\n", r);
|
||||
ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL), "Wrong style expected 0xc0 got: 0x%lx\n", r);
|
||||
for (i=0;i<65535;i++)
|
||||
{
|
||||
msMessage.wParam = i;
|
||||
r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
|
||||
ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS),
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
|
||||
}
|
||||
DestroyWindow (hwEdit);
|
||||
|
||||
trace("EDIT: Single line want returns\n");
|
||||
hwEdit = create_editcontrol(ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%x\n", r);
|
||||
ok(r == (ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN), "Wrong style expected 0x10c0 got: 0x%lx\n", r);
|
||||
for (i=0;i<65535;i++)
|
||||
{
|
||||
msMessage.wParam = i;
|
||||
r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
|
||||
ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS),
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %x\n", r);
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTARROWS got %lx\n", r);
|
||||
}
|
||||
DestroyWindow (hwEdit);
|
||||
|
||||
trace("EDIT: Multiline line\n");
|
||||
hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%x\n", r);
|
||||
ok(r == (ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0xc4 got: 0x%lx\n", r);
|
||||
for (i=0;i<65535;i++)
|
||||
{
|
||||
msMessage.wParam = i;
|
||||
r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
|
||||
ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS),
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
|
||||
}
|
||||
DestroyWindow (hwEdit);
|
||||
|
||||
trace("EDIT: Multi line want returns\n");
|
||||
hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%x\n", r);
|
||||
ok(r == (ES_WANTRETURN | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE), "Wrong style expected 0x10c4 got: 0x%lx\n", r);
|
||||
for (i=0;i<65535;i++)
|
||||
{
|
||||
msMessage.wParam = i;
|
||||
r = SendMessageA(hwEdit, WM_GETDLGCODE, 0, (LPARAM) &msMessage);
|
||||
ok(r == (DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS),
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %x\n", r);
|
||||
"Expected DLGC_WANTCHARS | DLGC_HASSETSEL | DLGC_WANTALLKEYS | DLGC_WANTARROWS got %lx\n", r);
|
||||
}
|
||||
DestroyWindow (hwEdit);
|
||||
}
|
||||
@@ -758,11 +787,11 @@ static void test_edit_control_2(void)
|
||||
trace("EDIT: SETTEXT atomicity\n");
|
||||
/* Send messages to "type" in the word 'foo'. */
|
||||
r = SendMessageA(hwndET2, WM_CHAR, 'f', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
r = SendMessageA(hwndET2, WM_CHAR, 'o', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
/* 'foo' should have been changed to 'bar' by the UPDATE handler. */
|
||||
GetWindowTextA(hwndET2, szLocalString, MAXLEN);
|
||||
ok(strcmp(szLocalString, "bar")==0,
|
||||
@@ -770,34 +799,34 @@ static void test_edit_control_2(void)
|
||||
|
||||
/* try setting the caret before it's visible */
|
||||
r = SetCaretPos(0, 0);
|
||||
todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %d\n", r);
|
||||
todo_wine ok(0 == r, "SetCaretPos succeeded unexpectedly, expected: 0, got: %ld\n", r);
|
||||
phwnd = SetFocus(hwndET2);
|
||||
ok(phwnd != NULL, "SetFocus failed unexpectedly, expected non-zero, got NULL\n");
|
||||
r = SetCaretPos(0, 0);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
r = GetCaretPos(&cpos);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%d,%d)\n", cpos.x, cpos.y);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
ok(cpos.x == 0 && cpos.y == 0, "Wrong caret position, expected: (0,0), got: (%ld,%ld)\n", cpos.x, cpos.y);
|
||||
r = SetCaretPos(-1, -1);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
r = GetCaretPos(&cpos);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%d,%d)\n", cpos.x, cpos.y);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
ok(cpos.x == -1 && cpos.y == -1, "Wrong caret position, expected: (-1,-1), got: (%ld,%ld)\n", cpos.x, cpos.y);
|
||||
r = SetCaretPos(w << 1, h << 1);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
r = GetCaretPos(&cpos);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w << 1, h << 1, cpos.x, cpos.y);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
ok(cpos.x == (w << 1) && cpos.y == (h << 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w << 1, h << 1, cpos.x, cpos.y);
|
||||
r = SetCaretPos(w, h);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
r = GetCaretPos(&cpos);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w, h, cpos.x, cpos.y);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
ok(cpos.x == w && cpos.y == h, "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w, h, cpos.x, cpos.y);
|
||||
r = SetCaretPos(w - 1, h - 1);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(1 == r, "SetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
r = GetCaretPos(&cpos);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %d\n", r);
|
||||
ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%d,%d), got: (%d,%d)\n", w - 1, h - 1, cpos.x, cpos.y);
|
||||
ok(1 == r, "GetCaretPos failed unexpectedly, expected: 1, got: %ld\n", r);
|
||||
ok(cpos.x == (w - 1) && cpos.y == (h - 1), "Wrong caret position, expected: (%ld,%ld), got: (%ld,%ld)\n", w - 1, h - 1, cpos.x, cpos.y);
|
||||
|
||||
/* OK, done! */
|
||||
DestroyWindow (hwndET2);
|
||||
@@ -1136,27 +1165,29 @@ static void test_edit_control_3(void)
|
||||
|
||||
/* Test EM_CHARFROMPOS and EM_POSFROMCHAR
|
||||
*/
|
||||
static void test_edit_control_4(void)
|
||||
static void test_char_from_pos(void)
|
||||
{
|
||||
HWND hwEdit;
|
||||
int lo, hi, mid;
|
||||
int ret;
|
||||
int i;
|
||||
HDC dc;
|
||||
SIZE size;
|
||||
|
||||
trace("EDIT: Test EM_CHARFROMPOS and EM_POSFROMCHAR\n");
|
||||
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2;
|
||||
mid = lo + (hi - lo + 1) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(0 == ret, "expected 0 got %d\n", ret);
|
||||
ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
@@ -1166,15 +1197,15 @@ static void test_edit_control_4(void)
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2;
|
||||
mid = lo + (hi - lo + 1) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(0 == ret, "expected 0 got %d\n", ret);
|
||||
ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
@@ -1184,15 +1215,15 @@ static void test_edit_control_4(void)
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2;
|
||||
mid = lo + (hi - lo + 1) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(0 == ret, "expected 0 got %d\n", ret);
|
||||
ok(0 == ret, "%d/%d/%d: expected 0 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
@@ -1202,15 +1233,20 @@ static void test_edit_control_4(void)
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2 +1;
|
||||
mid = lo + (hi - lo + 1) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
|
||||
ok(0 == ret || 1 == ret /* Vista */,
|
||||
"%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
#ifdef __REACTOS__
|
||||
ok(1 == ret || broken(0 == ret) /* Vista */, "%d/%d/%d: expected 0 or 1 got %d\n", mid, i, hi, ret);
|
||||
#else
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
#endif
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
@@ -1220,15 +1256,20 @@ static void test_edit_control_4(void)
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2 +1;
|
||||
mid = lo + (hi - lo + 1) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
|
||||
ok(0 == ret || 1 == ret /* Vista */,
|
||||
"%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
#ifdef __REACTOS__
|
||||
ok(1 == ret || broken(0 == ret) /* Vista */, "%d/%d/%d: expected 0 or 1 got %d\n", mid, i, hi, ret);
|
||||
#else
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
#endif
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
@@ -1238,19 +1279,38 @@ static void test_edit_control_4(void)
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM) "aa");
|
||||
lo = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 0, 0));
|
||||
hi = LOWORD(SendMessageA(hwEdit, EM_POSFROMCHAR, 1, 0));
|
||||
mid = lo + (hi - lo) / 2 +1;
|
||||
mid = lo + (hi - lo + 2) / 2;
|
||||
|
||||
for (i = lo; i < mid; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
|
||||
ok(0 == ret || 1 == ret /* Vista */,
|
||||
"%d/%d/%d: expected 0 or 1 got %d\n", lo, i, mid, ret);
|
||||
}
|
||||
for (i = mid; i <= hi; i++) {
|
||||
ret = LOWORD(SendMessageA(hwEdit, EM_CHARFROMPOS, 0, i));
|
||||
ok(1 == ret, "expected 1 got %d\n", ret);
|
||||
ok(1 == ret, "%d/%d/%d: expected 1 got %d\n", mid, i, hi, ret);
|
||||
}
|
||||
ret = SendMessageA(hwEdit, EM_POSFROMCHAR, 2, 0);
|
||||
ok(-1 == ret, "expected -1 got %d\n", ret);
|
||||
DestroyWindow(hwEdit);
|
||||
|
||||
/* Scrolled to the right with partially visible line, position on next line. */
|
||||
hwEdit = create_editcontrol(ES_MULTILINE | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
|
||||
dc = GetDC(hwEdit);
|
||||
GetTextExtentPoint32A(dc, "w", 1, &size);
|
||||
ReleaseDC(hwEdit, dc);
|
||||
|
||||
SetWindowPos(hwEdit, NULL, 0, 0, size.cx * 15, size.cy * 5, SWP_NOMOVE | SWP_NOZORDER);
|
||||
SendMessageA(hwEdit, WM_SETTEXT, 0, (LPARAM)"wwwwwwwwwwwwwwwwwwww\r\n\r\n");
|
||||
SendMessageA(hwEdit, EM_SETSEL, 40, 40);
|
||||
|
||||
lo = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 22, 0);
|
||||
ret = (short)SendMessageA(hwEdit, EM_POSFROMCHAR, 20, 0);
|
||||
ret -= 20 * size.cx; /* Calculate expected position, 20 characters back. */
|
||||
ok(ret == lo, "Unexpected position %d vs %d.\n", lo, ret);
|
||||
|
||||
DestroyWindow(hwEdit);
|
||||
}
|
||||
|
||||
/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL
|
||||
@@ -1275,7 +1335,7 @@ static void test_edit_control_5(void)
|
||||
assert(hWnd);
|
||||
/* size of non-child edit control is (much) bigger than requested */
|
||||
GetWindowRect( hWnd, &rc);
|
||||
ok( rc.right - rc.left > 20, "size of the window (%d) is smaller than expected\n",
|
||||
ok( rc.right - rc.left > 20, "size of the window (%ld) is smaller than expected\n",
|
||||
rc.right - rc.left);
|
||||
DestroyWindow(hWnd);
|
||||
/* so create a parent, and give it edit controls children to test with */
|
||||
@@ -1338,21 +1398,21 @@ static void test_edit_control_6(void)
|
||||
assert(hWnd);
|
||||
|
||||
ret = SendMessageA(hWnd, WM_SETTEXT, 0, (LPARAM)str);
|
||||
ok(ret == TRUE, "Expected %d, got %d\n", TRUE, ret);
|
||||
ok(ret == TRUE, "Expected %d, got %ld\n", TRUE, ret);
|
||||
ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
|
||||
ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
|
||||
ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
|
||||
ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
|
||||
buf[0] = 0;
|
||||
ret = SendMessageA(hWnd, WM_DESTROY, 0, 0);
|
||||
ok(ret == 0, "Expected 0, got %d\n", ret);
|
||||
ok(ret == 0, "Expected 0, got %ld\n", ret);
|
||||
ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
|
||||
ok(ret == strlen(str), "Expected %s, got len %d\n", str, ret);
|
||||
ok(ret == strlen(str), "Expected %s, got len %ld\n", str, ret);
|
||||
ok(!strcmp(buf, str), "Expected %s, got %s\n", str, buf);
|
||||
buf[0] = 0;
|
||||
ret = SendMessageA(hWnd, WM_NCDESTROY, 0, 0);
|
||||
ok(ret == 0, "Expected 0, got %d\n", ret);
|
||||
ok(ret == 0, "Expected 0, got %ld\n", ret);
|
||||
ret = SendMessageA(hWnd, WM_GETTEXT, MAXLEN, (LPARAM)buf);
|
||||
ok(ret == 0, "Expected 0, got len %d\n", ret);
|
||||
ok(ret == 0, "Expected 0, got len %ld\n", ret);
|
||||
ok(!strcmp(buf, ""), "Expected empty string, got %s\n", buf);
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
@@ -1367,20 +1427,20 @@ static void test_edit_control_limittext(void)
|
||||
trace("EDIT: buffer limit for single-line\n");
|
||||
hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
|
||||
ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
|
||||
ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
|
||||
SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
|
||||
r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
|
||||
ok( r == 2147483646, "got limit %u (expected 2147483646)\n", r);
|
||||
ok( r == 2147483646, "got limit %lu (expected 2147483646)\n", r);
|
||||
DestroyWindow(hwEdit);
|
||||
|
||||
/* Test default limit for multi-line control */
|
||||
trace("EDIT: buffer limit for multi-line\n");
|
||||
hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
|
||||
ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r);
|
||||
ok(r == 30000, "Incorrect default text limit, expected 30000 got %lu\n", r);
|
||||
SendMessageA(hwEdit, EM_SETLIMITTEXT, 0, 0);
|
||||
r = SendMessageA(hwEdit, EM_GETLIMITTEXT, 0, 0);
|
||||
ok( r == 4294967295U, "got limit %u (expected 4294967295)\n", r);
|
||||
ok( r == 4294967295U, "got limit %lu (expected 4294967295)\n", r);
|
||||
DestroyWindow(hwEdit);
|
||||
}
|
||||
|
||||
@@ -1405,16 +1465,16 @@ static void test_edit_control_scroll(void)
|
||||
assert(hwEdit);
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
ok(!ret, "Returned %lx, expected 0.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
ok(!ret, "Returned %lx, expected 0.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEUP, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
ok(!ret, "Returned %lx, expected 0.\n", ret);
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
ok(!ret, "Returned %lx, expected 0.\n", ret);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
|
||||
@@ -1430,7 +1490,7 @@ static void test_edit_control_scroll(void)
|
||||
assert(hwEdit);
|
||||
|
||||
ret = SendMessageA(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
|
||||
ok(!ret, "Returned %x, expected 0.\n", ret);
|
||||
ok(!ret, "Returned %lx, expected 0.\n", ret);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
}
|
||||
@@ -1723,6 +1783,81 @@ static BOOL is_font_installed(const char*name)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static WNDPROC orig_class_proc;
|
||||
|
||||
static LRESULT CALLBACK test_class_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
RECT rect;
|
||||
LRESULT result, r;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_NCCREATE:
|
||||
result = CallWindowProcA(orig_class_proc, hwnd, message, wParam, lParam);
|
||||
|
||||
memset(&rect, 0, sizeof(rect));
|
||||
SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rect);
|
||||
ok(!rect.right && !rect.bottom, "Invalid size after NCCREATE: %ld x %ld\n", rect.right, rect.bottom);
|
||||
|
||||
/* test that messages between WM_NCCREATE and WM_CREATE
|
||||
don't crash or cause unexpected behavior */
|
||||
r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
|
||||
ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
|
||||
todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
|
||||
ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
|
||||
return result;
|
||||
|
||||
case WM_CREATE:
|
||||
/* test that messages between WM_NCCREATE and WM_CREATE
|
||||
don't crash or cause unexpected behavior */
|
||||
r = SendMessageA(hwnd, EM_SETSEL, 0, 0);
|
||||
ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
r = SendMessageA(hwnd, WM_SIZE, 0, 0x00100010);
|
||||
todo_wine ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
r = SendMessageA(hwnd, EM_LINESCROLL, 1, 1);
|
||||
ok(r == 1, "Returned %Id, expected 1.\n", r);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return CallWindowProcA(orig_class_proc, hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
static void test_initialization(void)
|
||||
{
|
||||
BOOL ret;
|
||||
ATOM atom;
|
||||
HWND hwEdit;
|
||||
WNDCLASSA cls;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (is_reactos()) {
|
||||
ok(FALSE, "FIXME: ReactOS crashes on this test!\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
ret = GetClassInfoA(NULL, "Edit", &cls);
|
||||
ok(ret, "Failed to get class info.\n");
|
||||
|
||||
orig_class_proc = cls.lpfnWndProc;
|
||||
cls.lpfnWndProc = test_class_proc;
|
||||
cls.lpszClassName = "TestClassName";
|
||||
|
||||
atom = RegisterClassA(&cls);
|
||||
ok(atom != 0, "Failed to register class.\n");
|
||||
|
||||
hwEdit = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atom), "Text Text",
|
||||
ES_MULTILINE | WS_BORDER | ES_AUTOHSCROLL | ES_AUTOVSCROLL | WS_VSCROLL,
|
||||
10, 10, 300, 300, NULL, NULL, hinst, NULL);
|
||||
ok(hwEdit != NULL, "Failed to create a window.\n");
|
||||
|
||||
DestroyWindow(hwEdit);
|
||||
UnregisterClassA((LPCSTR)MAKEINTATOM(atom), hinst);
|
||||
}
|
||||
|
||||
static void test_margins(void)
|
||||
{
|
||||
HWND hwEdit;
|
||||
@@ -1929,8 +2064,11 @@ static void test_margins_font_change(void)
|
||||
|
||||
}
|
||||
|
||||
#define edit_pos_ok(exp, got, txt) \
|
||||
ok(exp == got, "wrong " #txt " expected %d got %d\n", exp, got);
|
||||
#define edit_pos_ok(exp, got, txt) edit_pos_ok_(__LINE__, exp, got, #txt)
|
||||
static inline void edit_pos_ok_(unsigned line, DWORD exp, DWORD got, const char* txt)
|
||||
{
|
||||
ok_(__FILE__, line)(exp == got, "wrong %s expected %ld got %ld\n", txt, exp, got);
|
||||
}
|
||||
|
||||
#define check_pos(hwEdit, set_height, test_top, test_height, test_left) \
|
||||
do { \
|
||||
@@ -2082,39 +2220,39 @@ static void test_espassword(void)
|
||||
|
||||
hwEdit = create_editcontrol(ES_PASSWORD, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%x\n", r);
|
||||
ok(r == ES_PASSWORD, "Wrong style expected ES_PASSWORD got: 0x%lx\n", r);
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) password);
|
||||
ok(r == TRUE, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(r == TRUE, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
/* select all, cut (ctrl-x) */
|
||||
SendMessageA(hwEdit, EM_SETSEL, 0, -1);
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
|
||||
ok(r == strlen(password), "Expected: %s, got len %d\n", password, r);
|
||||
ok(r == strlen(password), "Expected: %s, got len %ld\n", password, r);
|
||||
ok(strcmp(buffer, password) == 0, "expected %s, got %s\n", password, buffer);
|
||||
|
||||
r = OpenClipboard(hwEdit);
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
r = open_clipboard(hwEdit);
|
||||
ok(r == TRUE, "expected %d, got %ld le=%lu\n", TRUE, r, GetLastError());
|
||||
r = EmptyClipboard();
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
|
||||
r = CloseClipboard();
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
ok(r == TRUE, "expected %d, got %ld\n", TRUE, r);
|
||||
|
||||
/* select all, copy (ctrl-c) and paste (ctrl-v) */
|
||||
SendMessageA(hwEdit, EM_SETSEL, 0, -1);
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 3, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 22, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
|
||||
ok(r == 0, "Expected: 0, got: %d\n", r);
|
||||
ok(r == 0, "Expected: 0, got: %ld\n", r);
|
||||
ok(strcmp(buffer, "") == 0, "expected empty string, got %s\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2130,48 +2268,48 @@ static void test_undo(void)
|
||||
|
||||
hwEdit = create_editcontrol(0, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) text);
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
/* select all, */
|
||||
cpMin = cpMax = 0xdeadbeef;
|
||||
SendMessageA(hwEdit, EM_SETSEL, 0, -1);
|
||||
r = SendMessageA(hwEdit, EM_GETSEL, (WPARAM) &cpMin, (LPARAM) &cpMax);
|
||||
ok((strlen(text) << 16) == r, "Unexpected length %d\n", r);
|
||||
ok(0 == cpMin, "Expected: %d, got %d\n", 0, cpMin);
|
||||
ok(9 == cpMax, "Expected: %d, got %d\n", 9, cpMax);
|
||||
ok((strlen(text) << 16) == r, "Unexpected length %ld\n", r);
|
||||
ok(0 == cpMin, "Expected: %d, got %ld\n", 0, cpMin);
|
||||
ok(9 == cpMax, "Expected: %d, got %ld\n", 9, cpMax);
|
||||
|
||||
/* cut (ctrl-x) */
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 24, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
|
||||
ok(0 == r, "Expected: %d, got len %d\n", 0, r);
|
||||
ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
|
||||
ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
|
||||
|
||||
/* undo (ctrl-z) */
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
|
||||
ok(strlen(text) == r, "Unexpected length %d\n", r);
|
||||
ok(strlen(text) == r, "Unexpected length %ld\n", r);
|
||||
ok(0 == strcmp(buffer, text), "expected %s, got %s\n", text, buffer);
|
||||
|
||||
/* undo again (ctrl-z) */
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 26, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
|
||||
ok(r == 0, "Expected: %d, got len %d\n", 0, r);
|
||||
ok(r == 0, "Expected: %d, got len %ld\n", 0, r);
|
||||
ok(0 == strcmp(buffer, ""), "expected %s, got %s\n", "", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2186,19 +2324,19 @@ static void test_enter(void)
|
||||
/* multiline */
|
||||
hwEdit = create_editcontrol(ES_MULTILINE, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%x\n", r);
|
||||
ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
|
||||
ok(2 == r, "Expected: %d, got len %d\n", 2, r);
|
||||
ok(2 == r, "Expected: %d, got len %ld\n", 2, r);
|
||||
ok(0 == strcmp(buffer, "\r\n"), "expected \"\\r\\n\", got \"%s\"\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2206,19 +2344,19 @@ static void test_enter(void)
|
||||
/* single line */
|
||||
hwEdit = create_editcontrol(0, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
|
||||
ok(0 == r, "Expected: %d, got len %d\n", 0, r);
|
||||
ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
|
||||
ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2226,19 +2364,19 @@ static void test_enter(void)
|
||||
/* single line with ES_WANTRETURN */
|
||||
hwEdit = create_editcontrol(ES_WANTRETURN, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%x\n", r);
|
||||
ok(ES_WANTRETURN == r, "Wrong style expected ES_WANTRETURN got: 0x%lx\n", r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, VK_RETURN, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
|
||||
ok(0 == r, "Expected: %d, got len %d\n", 0, r);
|
||||
ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
|
||||
ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2253,19 +2391,19 @@ static void test_tab(void)
|
||||
/* multiline */
|
||||
hwEdit = create_editcontrol(ES_MULTILINE, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%x\n", r);
|
||||
ok(ES_MULTILINE == r, "Wrong style expected ES_MULTILINE got: 0x%lx\n", r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
|
||||
ok(1 == r, "Expected: %d, got len %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got len %ld\n", 1, r);
|
||||
ok(0 == strcmp(buffer, "\t"), "expected \"\\t\", got \"%s\"\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2273,19 +2411,19 @@ static void test_tab(void)
|
||||
/* single line */
|
||||
hwEdit = create_editcontrol(0, 0);
|
||||
r = get_edit_style(hwEdit);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%x\n", 0, r);
|
||||
ok(0 == r, "Wrong style expected 0x%x got: 0x%lx\n", 0, r);
|
||||
|
||||
/* set text */
|
||||
r = SendMessageA(hwEdit , WM_SETTEXT, 0, (LPARAM) "");
|
||||
ok(TRUE == r, "Expected: %d, got: %d\n", TRUE, r);
|
||||
ok(TRUE == r, "Expected: %d, got: %ld\n", TRUE, r);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, VK_TAB, 0);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
/* get text */
|
||||
buffer[0] = 0;
|
||||
r = SendMessageA(hwEdit, WM_GETTEXT, 16, (LPARAM) buffer);
|
||||
ok(0 == r, "Expected: %d, got len %d\n", 0, r);
|
||||
ok(0 == r, "Expected: %d, got len %ld\n", 0, r);
|
||||
ok(0 == strcmp(buffer, ""), "expected \"\", got \"%s\"\n", buffer);
|
||||
|
||||
DestroyWindow (hwEdit);
|
||||
@@ -2727,11 +2865,11 @@ static void test_fontsize(void)
|
||||
ShowWindow (hwEdit, SW_SHOW);
|
||||
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 'A', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 'B', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
r = SendMessageA(hwEdit, WM_CHAR, 'C', 1);
|
||||
ok(1 == r, "Expected: %d, got: %d\n", 1, r);
|
||||
ok(1 == r, "Expected: %d, got: %ld\n", 1, r);
|
||||
|
||||
GetWindowTextA(hwEdit, szLocalString, MAXLEN);
|
||||
ok(strcmp(szLocalString, "ABC")==0,
|
||||
@@ -2917,7 +3055,7 @@ static void test_dialogmode(void)
|
||||
|
||||
hwButton = CreateWindowA("BUTTON", "OK", WS_VISIBLE|WS_CHILD|BS_PUSHBUTTON,
|
||||
100, 100, 50, 20, hwParent, (HMENU)ID_EDITTESTDBUTTON, hinst, NULL);
|
||||
ok(hwButton!=NULL, "CreateWindow failed with error code %d\n", GetLastError());
|
||||
ok(hwButton!=NULL, "CreateWindow failed with error code %ld\n", GetLastError());
|
||||
|
||||
r = SendMessageA(hwEdit, WM_KEYDOWN, VK_RETURN, 0x1c0001);
|
||||
ok(1 == r, "expected 1, got %d\n", r);
|
||||
@@ -3080,12 +3218,32 @@ static void test_EM_GETHANDLE(void)
|
||||
DestroyWindow(hEdit);
|
||||
}
|
||||
|
||||
/* In Windows 10+, the WM_PASTE message isn't always successful.
|
||||
* So retry in case of failure.
|
||||
*/
|
||||
#define check_paste(a, b) _check_paste(__LINE__, (a), (b))
|
||||
static void _check_paste(unsigned int line, HWND hedit, const char *content)
|
||||
{
|
||||
/* only retry on windows platform */
|
||||
int tries = strcmp(winetest_platform, "wine") ? 3 : 1;
|
||||
int len = 0;
|
||||
|
||||
SendMessageA(hedit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
do
|
||||
{
|
||||
SendMessageA(hedit, WM_PASTE, 0, 0);
|
||||
if ((len = SendMessageA(hedit, WM_GETTEXTLENGTH, 0, 0))) break;
|
||||
Sleep(1);
|
||||
} while (--tries > 0);
|
||||
ok_(__FILE__, line)(len == strlen(content), "Unexpected len %u in edit\n", len);
|
||||
}
|
||||
|
||||
static void test_paste(void)
|
||||
{
|
||||
HWND hEdit, hMultilineEdit;
|
||||
HANDLE hmem, hmem_ret;
|
||||
char *buffer;
|
||||
int r, len;
|
||||
int r;
|
||||
static const char *str = "this is a simple text";
|
||||
static const char *str2 = "first line\r\nsecond line";
|
||||
|
||||
@@ -3100,8 +3258,8 @@ static void test_paste(void)
|
||||
strcpy(buffer, str);
|
||||
GlobalUnlock(hmem);
|
||||
|
||||
r = OpenClipboard(hEdit);
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
r = open_clipboard(hEdit);
|
||||
ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
|
||||
r = EmptyClipboard();
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
hmem_ret = SetClipboardData(CF_TEXT, hmem);
|
||||
@@ -3110,10 +3268,7 @@ static void test_paste(void)
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
|
||||
/* Paste single line */
|
||||
SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
r = SendMessageA(hEdit, WM_PASTE, 0, 0);
|
||||
len = SendMessageA(hEdit, WM_GETTEXTLENGTH, 0, 0);
|
||||
ok(strlen(str) == len, "got %d\n", len);
|
||||
check_paste(hEdit, str);
|
||||
|
||||
/* Prepare clipboard data with multiline text */
|
||||
hmem = GlobalAlloc(GMEM_MOVEABLE, 255);
|
||||
@@ -3123,8 +3278,8 @@ static void test_paste(void)
|
||||
strcpy(buffer, str2);
|
||||
GlobalUnlock(hmem);
|
||||
|
||||
r = OpenClipboard(hEdit);
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
r = open_clipboard(hEdit);
|
||||
ok(r == TRUE, "expected %d, got %d le=%lu\n", TRUE, r, GetLastError());
|
||||
r = EmptyClipboard();
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
hmem_ret = SetClipboardData(CF_TEXT, hmem);
|
||||
@@ -3133,16 +3288,10 @@ static void test_paste(void)
|
||||
ok(r == TRUE, "expected %d, got %d\n", TRUE, r);
|
||||
|
||||
/* Paste multiline text in singleline edit - should be cut */
|
||||
SendMessageA(hEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
r = SendMessageA(hEdit, WM_PASTE, 0, 0);
|
||||
len = SendMessageA(hEdit, WM_GETTEXTLENGTH, 0, 0);
|
||||
ok(strlen("first line") == len, "got %d\n", len);
|
||||
check_paste(hEdit, "first line");
|
||||
|
||||
/* Paste multiline text in multiline edit */
|
||||
SendMessageA(hMultilineEdit, WM_SETTEXT, 0, (LPARAM)"");
|
||||
r = SendMessageA(hMultilineEdit, WM_PASTE, 0, 0);
|
||||
len = SendMessageA(hMultilineEdit, WM_GETTEXTLENGTH, 0, 0);
|
||||
ok(strlen(str2) == len, "got %d\n", len);
|
||||
check_paste(hMultilineEdit, str2);
|
||||
|
||||
/* Cleanup */
|
||||
DestroyWindow(hEdit);
|
||||
@@ -3217,13 +3366,13 @@ static void test_wordbreak_proc(void)
|
||||
ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
|
||||
|
||||
ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)test_wordbreak_procA);
|
||||
ok(ret == 1, "Unexpected return value %ld.\n", ret);
|
||||
ok(ret == 1, "Unexpected return value %Id.\n", ret);
|
||||
|
||||
proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
|
||||
ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc);
|
||||
|
||||
ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, 0);
|
||||
ok(ret == 1, "Unexpected return value %ld.\n", ret);
|
||||
ok(ret == 1, "Unexpected return value %Id.\n", ret);
|
||||
|
||||
proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0);
|
||||
ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc);
|
||||
@@ -3231,6 +3380,114 @@ static void test_wordbreak_proc(void)
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_dbcs_WM_CHAR(void)
|
||||
{
|
||||
HKL hkl;
|
||||
UINT cp;
|
||||
WCHAR textW[] = { 0x4e00, 0x4e8c, 0x4e09, 0 }; /* one, two, three */
|
||||
unsigned char bytes[7];
|
||||
BOOL hasdefault;
|
||||
HWND hwnd[2];
|
||||
int i;
|
||||
|
||||
hkl = GetKeyboardLayout( 0 );
|
||||
if (!GetLocaleInfoW(LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR)))
|
||||
cp = CP_ACP;
|
||||
|
||||
WideCharToMultiByte(cp, WC_NO_BEST_FIT_CHARS, textW, -1, (char *)bytes, ARRAY_SIZE(bytes), NULL, &hasdefault);
|
||||
if (hasdefault || !IsDBCSLeadByteEx(cp, bytes[0]))
|
||||
{
|
||||
skip("Skipping DBCS WM_CHAR test in the %d codepage\n", cp);
|
||||
return;
|
||||
}
|
||||
hwnd[0] = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
hwnd[1] = create_editcontrolW(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hwnd); i++)
|
||||
{
|
||||
const unsigned char* p;
|
||||
WCHAR strW[4];
|
||||
char str[7];
|
||||
MSG msg;
|
||||
BOOL r;
|
||||
int n;
|
||||
|
||||
winetest_push_context("%c", i ? 'W' : 'A');
|
||||
|
||||
r = SetWindowTextA(hwnd[i], "");
|
||||
ok(r, "SetWindowText failed\n");
|
||||
|
||||
/* sending the lead byte separately works for DBCS locales */
|
||||
for (p = bytes; *p; p++)
|
||||
PostMessageA(hwnd[i], WM_CHAR, *p, 1);
|
||||
|
||||
while (PeekMessageA(&msg, hwnd[i], 0, 0, PM_REMOVE))
|
||||
DispatchMessageA(&msg);
|
||||
|
||||
n = GetWindowTextW(hwnd[i], strW, ARRAY_SIZE(strW));
|
||||
ok(n > 0, "GetWindowTextW failed\n");
|
||||
ok(!wcscmp(strW, textW), "got %s, expected %s\n",
|
||||
wine_dbgstr_w(strW), wine_dbgstr_w(textW));
|
||||
|
||||
n = GetWindowTextA(hwnd[i], str, ARRAY_SIZE(str));
|
||||
ok(n > 0, "GetWindowText failed\n");
|
||||
ok(!strcmp(str, (char*)bytes), "got %s, expected %s\n",
|
||||
wine_dbgstr_a(str), wine_dbgstr_a((char *)bytes));
|
||||
|
||||
DestroyWindow(hwnd[i]);
|
||||
|
||||
winetest_pop_context();
|
||||
}
|
||||
}
|
||||
|
||||
static void test_format_rect(void)
|
||||
{
|
||||
HWND edit;
|
||||
RECT rect, old_rect;
|
||||
|
||||
static const struct
|
||||
{
|
||||
int style_ex;
|
||||
RECT input;
|
||||
int expected_equal;
|
||||
}
|
||||
tests[] =
|
||||
{
|
||||
{0, {0, 0, 0, 0}, 1},
|
||||
{0, {0, 0, 10, 10}, 1},
|
||||
{0, {1, 1, 10, 10}, 1},
|
||||
{0, {1, 1, 10, 250}, 1},
|
||||
{0, {1, 1, 250, 10}, 1},
|
||||
{0, {1, 1, 10, 1000}, 1},
|
||||
{0, {1, 1, 1000, 10}, 1},
|
||||
{0, {1, 1, 1000, 1000}, 0},
|
||||
{WS_EX_CLIENTEDGE, {0, 0, 0, 0}, 1},
|
||||
{WS_EX_CLIENTEDGE, {0, 0, 10, 10}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 10, 10}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 10, 250}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 250, 10}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 10, 1000}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 1000, 10}, 1},
|
||||
{WS_EX_CLIENTEDGE, {1, 1, 1000, 1000}, 0}
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
edit = create_editcontrol(ES_MULTILINE | WS_VISIBLE, tests[i].style_ex);
|
||||
|
||||
SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&old_rect);
|
||||
SetWindowTextA(edit, "Test Test Test\r\n\r\nTest Test Test Test Test Test Test Test Test Test Test Test\r\n\r\nTest Test Test");
|
||||
SendMessageA(edit, EM_SETRECT, 0, (LPARAM)&tests[i].input);
|
||||
SendMessageA(edit, EM_GETRECT, 0, (LPARAM)&rect);
|
||||
|
||||
if (tests[i].expected_equal)
|
||||
ok(EqualRect(&old_rect, &rect), "Expected format rectangle to be equal to client rectangle.\n");
|
||||
else
|
||||
ok((rect.right - rect.left) > (old_rect.right - old_rect.left), "Expected format rect to be larger than client rectangle.\n");
|
||||
DestroyWindow(edit);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(edit)
|
||||
{
|
||||
BOOL b;
|
||||
@@ -3243,11 +3500,12 @@ START_TEST(edit)
|
||||
test_edit_control_1();
|
||||
test_edit_control_2();
|
||||
test_edit_control_3();
|
||||
test_edit_control_4();
|
||||
test_char_from_pos();
|
||||
test_edit_control_5();
|
||||
test_edit_control_6();
|
||||
test_edit_control_limittext();
|
||||
test_edit_control_scroll();
|
||||
test_initialization();
|
||||
test_margins();
|
||||
test_margins_font_change();
|
||||
test_text_position();
|
||||
@@ -3267,6 +3525,8 @@ START_TEST(edit)
|
||||
test_paste();
|
||||
test_EM_GETLINE();
|
||||
test_wordbreak_proc();
|
||||
test_dbcs_WM_CHAR();
|
||||
test_format_rect();
|
||||
|
||||
UnregisterWindowClasses();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
|
||||
# define _TYPE_ALIGNMENT(type) __alignof(type)
|
||||
#elif defined(__GNUC__)
|
||||
#elif defined(__GNUC__) || defined(__clang__)
|
||||
# define _TYPE_ALIGNMENT(type) __alignof__(type)
|
||||
#else
|
||||
/*
|
||||
@@ -47,23 +47,23 @@
|
||||
* Test helper macros
|
||||
*/
|
||||
|
||||
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
|
||||
#define TEST_TYPE_SIZE(type, size) C_ASSERT(sizeof(type) == size);
|
||||
|
||||
#ifdef TYPE_ALIGNMENT
|
||||
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
|
||||
# define TEST_TYPE_ALIGN(type, align) C_ASSERT(TYPE_ALIGNMENT(type) == align);
|
||||
#else
|
||||
# define TEST_TYPE_ALIGN(type, align)
|
||||
#endif
|
||||
|
||||
#ifdef _TYPE_ALIGNMENT
|
||||
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
|
||||
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
|
||||
# define TEST_TARGET_ALIGN(type, align) C_ASSERT(_TYPE_ALIGNMENT(*(type)0) == align);
|
||||
# define TEST_FIELD_ALIGN(type, field, align) C_ASSERT(_TYPE_ALIGNMENT(((type*)0)->field) == align);
|
||||
#else
|
||||
# define TEST_TARGET_ALIGN(type, align)
|
||||
# define TEST_FIELD_ALIGN(type, field, align)
|
||||
#endif
|
||||
|
||||
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
|
||||
#define TEST_FIELD_OFFSET(type, field, offset) C_ASSERT(FIELD_OFFSET(type, field) == offset);
|
||||
|
||||
#define TEST_TARGET_SIZE(type, size) TEST_TYPE_SIZE(*(type)0, size)
|
||||
#define TEST_FIELD_SIZE(type, field, size) TEST_TYPE_SIZE((((type*)0)->field), size)
|
||||
|
||||
+4985
-1891
File diff suppressed because it is too large
Load Diff
@@ -128,7 +128,7 @@ keypress (HWND handle, WPARAM keycode, BYTE scancode, BOOL extended)
|
||||
}
|
||||
|
||||
#define listbox_field_ok(t, s, f, got) \
|
||||
ok (t.s.f==got.f, "style %#x, step " #s ", field " #f \
|
||||
ok (t.s.f==got.f, "style %#lx, step " #s ", field " #f \
|
||||
": expected %d, got %d\n", style, t.s.f, got.f)
|
||||
|
||||
#define listbox_todo_field_ok(t, s, f, got) \
|
||||
@@ -178,18 +178,18 @@ check (DWORD style, const struct listbox_test test)
|
||||
WCHAR *txtw;
|
||||
int resA, resW;
|
||||
|
||||
txt = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, size+1);
|
||||
txt = calloc(1, size + 1);
|
||||
resA=SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt);
|
||||
ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
|
||||
|
||||
txtw = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, 2*size+2);
|
||||
txtw = calloc(1, 2 * size + 2);
|
||||
resW=SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw);
|
||||
ok(resA == resW, "Unexpected text length.\n");
|
||||
WideCharToMultiByte( CP_ACP, 0, txtw, -1, txt, size, NULL, NULL );
|
||||
ok(!strcmp (txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
|
||||
|
||||
HeapFree (GetProcessHeap(), 0, txtw);
|
||||
HeapFree (GetProcessHeap(), 0, txt);
|
||||
free(txtw);
|
||||
free(txt);
|
||||
}
|
||||
|
||||
/* Confirm the count of items, and that an invalid delete does not remove anything */
|
||||
@@ -223,7 +223,7 @@ static void check_item_height(void)
|
||||
ok (SendMessageA(hLB, WM_SETFONT, (WPARAM)font, 0) == 0, "Can't set font\n");
|
||||
|
||||
itemHeight = SendMessageA(hLB, LB_GETITEMHEIGHT, 0, 0);
|
||||
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %d\n", itemHeight, tm.tmHeight);
|
||||
ok (itemHeight == tm.tmHeight, "Item height wrong, got %d, expecting %ld\n", itemHeight, tm.tmHeight);
|
||||
|
||||
DestroyWindow (hLB);
|
||||
|
||||
@@ -238,7 +238,7 @@ static void check_item_height(void)
|
||||
DestroyWindow (hLB);
|
||||
}
|
||||
|
||||
static int got_selchange;
|
||||
static unsigned int got_selchange, got_drawitem;
|
||||
|
||||
static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
DWORD style = GetWindowLongA(GetWindow(hwnd, GW_CHILD), GWL_STYLE);
|
||||
MEASUREITEMSTRUCT *mi = (void*)lparam;
|
||||
|
||||
ok(wparam == mi->CtlID, "got wParam=%08lx, expected %08x\n", wparam, mi->CtlID);
|
||||
ok(wparam == mi->CtlID, "got wParam=%08Ix, expected %08x\n", wparam, mi->CtlID);
|
||||
ok(mi->CtlType == ODT_LISTBOX, "mi->CtlType = %u\n", mi->CtlType);
|
||||
ok(mi->CtlID == 1, "mi->CtlID = %u\n", mi->CtlID);
|
||||
ok(mi->itemHeight, "mi->itemHeight = 0\n");
|
||||
@@ -265,7 +265,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
else
|
||||
{
|
||||
ok((void*)mi->itemData == strings[mi->itemID],
|
||||
"mi->itemData = %08lx, expected %p\n", mi->itemData, strings[mi->itemID]);
|
||||
"mi->itemData = %08Ix, expected %p\n", mi->itemData, strings[mi->itemID]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -274,9 +274,9 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
RECT rc_item, rc_client, rc_clip;
|
||||
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lparam;
|
||||
|
||||
trace("%p WM_DRAWITEM %08lx %08lx\n", hwnd, wparam, lparam);
|
||||
trace("%p WM_DRAWITEM %08Ix %08Ix\n", hwnd, wparam, lparam);
|
||||
|
||||
ok(wparam == dis->CtlID, "got wParam=%08lx instead of %08x\n",
|
||||
ok(wparam == dis->CtlID, "got wParam=%08Ix instead of %08x\n",
|
||||
wparam, dis->CtlID);
|
||||
ok(dis->CtlType == ODT_LISTBOX, "wrong CtlType %04x\n", dis->CtlType);
|
||||
|
||||
@@ -293,6 +293,7 @@ static LRESULT WINAPI main_window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARA
|
||||
trace("item rect %s\n", wine_dbgstr_rect(&rc_item));
|
||||
ok(EqualRect(&dis->rcItem, &rc_item), "item rects are not equal\n");
|
||||
|
||||
got_drawitem++;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -343,6 +344,19 @@ static void test_ownerdraw(void)
|
||||
0,
|
||||
LBS_NODATA
|
||||
};
|
||||
static const struct {
|
||||
UINT message;
|
||||
WPARAM wparam;
|
||||
LPARAM lparam;
|
||||
UINT drawitem;
|
||||
} testcase[] = {
|
||||
{ WM_NULL, 0, 0, 0 },
|
||||
{ WM_PAINT, 0, 0, 0 },
|
||||
{ LB_GETCOUNT, 0, 0, 0 },
|
||||
{ LB_SETCOUNT, ARRAY_SIZE(strings), 0, ARRAY_SIZE(strings) },
|
||||
{ LB_ADDSTRING, 0, (LPARAM)"foo", ARRAY_SIZE(strings)+1 },
|
||||
{ LB_DELETESTRING, 0, 0, ARRAY_SIZE(strings)-1 },
|
||||
};
|
||||
HWND parent, hLB;
|
||||
INT ret;
|
||||
RECT rc;
|
||||
@@ -372,14 +386,14 @@ static void test_ownerdraw(void)
|
||||
SendMessageA(hLB, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||
trace("item 0 rect %s\n", wine_dbgstr_rect(&rc));
|
||||
ok(!IsRectEmpty(&rc), "empty item rect\n");
|
||||
ok(rc.top < 0, "rc.top is not negative (%d)\n", rc.top);
|
||||
ok(rc.top < 0, "rc.top is not negative (%ld)\n", rc.top);
|
||||
|
||||
DestroyWindow(hLB);
|
||||
|
||||
/* Both FIXED and VARIABLE, FIXED should override VARIABLE. */
|
||||
hLB = CreateWindowA("listbox", "TestList", LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE | styles[i],
|
||||
0, 0, 100, 100, NULL, NULL, NULL, 0);
|
||||
ok(hLB != NULL, "last error 0x%08x\n", GetLastError());
|
||||
ok(hLB != NULL, "last error 0x%08lx\n", GetLastError());
|
||||
|
||||
ok(GetWindowLongA(hLB, GWL_STYLE) & LBS_OWNERDRAWVARIABLE, "Unexpected window style.\n");
|
||||
|
||||
@@ -405,6 +419,40 @@ static void test_ownerdraw(void)
|
||||
|
||||
DestroyWindow (hLB);
|
||||
}
|
||||
|
||||
/* test pending redraw state */
|
||||
for (i = 0; i < ARRAY_SIZE(testcase); i++)
|
||||
{
|
||||
winetest_push_context("%d", i);
|
||||
hLB = create_listbox(LBS_OWNERDRAWFIXED | LBS_NODATA | WS_CHILD | WS_VISIBLE, parent);
|
||||
assert(hLB);
|
||||
|
||||
ret = SendMessageA(hLB, WM_SETREDRAW, FALSE, 0);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
ret = SendMessageA(hLB, testcase[i].message, testcase[i].wparam, testcase[i].lparam);
|
||||
if (testcase[i].message >= LB_ADDSTRING && testcase[i].message < LB_MSGMAX &&
|
||||
testcase[i].message != LB_SETCOUNT)
|
||||
ok(ret > 0, "expected > 0, got %d\n", ret);
|
||||
else
|
||||
ok(!ret, "expected 0, got %d\n", ret);
|
||||
|
||||
got_drawitem = 0;
|
||||
ret = RedrawWindow(hLB, NULL, 0, RDW_UPDATENOW);
|
||||
ok(ret, "RedrawWindow failed\n");
|
||||
ok(!got_drawitem, "got %u\n", got_drawitem);
|
||||
|
||||
ret = SendMessageA(hLB, WM_SETREDRAW, TRUE, 0);
|
||||
ok(!ret, "got %d\n", ret);
|
||||
|
||||
got_drawitem = 0;
|
||||
ret = RedrawWindow(hLB, NULL, 0, RDW_UPDATENOW);
|
||||
ok(ret, "RedrawWindow failed\n");
|
||||
ok(got_drawitem == testcase[i].drawitem, "expected %u, got %u\n", testcase[i].drawitem, got_drawitem);
|
||||
|
||||
DestroyWindow(hLB);
|
||||
winetest_pop_context();
|
||||
}
|
||||
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
@@ -583,21 +631,29 @@ static void test_LB_SETSEL(void)
|
||||
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == -1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
DestroyWindow(list);
|
||||
|
||||
@@ -607,21 +663,29 @@ static void test_LB_SETSEL(void)
|
||||
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == -1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, TRUE, 0);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 0, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, TRUE, 1);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
ret = SendMessageA(list, LB_SETSEL, FALSE, 1);
|
||||
ok(ret == 0, "Unexpected return value %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETANCHORINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected anchor index %d.\n", ret);
|
||||
ret = SendMessageA(list, LB_GETCARETINDEX, 0, 0);
|
||||
ok(ret == 1, "Unexpected caret index %d.\n", ret);
|
||||
|
||||
DestroyWindow(list);
|
||||
}
|
||||
@@ -721,70 +785,70 @@ static void test_changing_selection_styles(void)
|
||||
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"x");
|
||||
ok(ret == k, "%u: Unexpected return value %d, expected %d.\n", j, ret, k);
|
||||
ok(ret == k, "%u: Unexpected return value %ld, expected %d.\n", j, ret, k);
|
||||
}
|
||||
ret = SendMessageA(listbox, LB_GETCOUNT, 0, 0);
|
||||
ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %d.\n", j, ret);
|
||||
ok(ret == ARRAY_SIZE(selexpect_multi), "%u: Unexpected count %ld.\n", j, ret);
|
||||
|
||||
/* Select items with different methods */
|
||||
ret = SendMessageA(listbox, LB_SETCURSEL, 2, 0);
|
||||
ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(0, 0));
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(2, 2));
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
|
||||
/* Verify that the proper items are selected */
|
||||
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
|
||||
j, ret, selexpect[k]);
|
||||
}
|
||||
|
||||
/* Now change the selection style */
|
||||
style = GetWindowLongA(listbox, GWL_STYLE);
|
||||
ok((style & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) == selstyles[j],
|
||||
"%u: unexpected window styles %#x.\n", j, style);
|
||||
"%u: unexpected window styles %#lx.\n", j, style);
|
||||
if (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
|
||||
style &= ~selstyles[j];
|
||||
else
|
||||
style |= LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
|
||||
SetWindowLongA(listbox, GWL_STYLE, style);
|
||||
style = GetWindowLongA(listbox, GWL_STYLE);
|
||||
ok(!(style & selstyles[j]), "%u: unexpected window styles %#x.\n", j, style);
|
||||
ok(!(style & selstyles[j]), "%u: unexpected window styles %#lx.\n", j, style);
|
||||
|
||||
/* Verify that the same items are selected */
|
||||
ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
|
||||
ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
|
||||
ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
|
||||
j, getselcount_expect, ret);
|
||||
|
||||
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
|
||||
j, ret, selexpect[k]);
|
||||
}
|
||||
|
||||
/* Lastly see if we can still change the selection as before with old style */
|
||||
if (setcursel_expect != LB_ERR) setcursel_expect = 0;
|
||||
ret = SendMessageA(listbox, LB_SETCURSEL, 0, 0);
|
||||
ok(ret == setcursel_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == setcursel_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
ret = SendMessageA(listbox, LB_SELITEMRANGE, TRUE, MAKELPARAM(1, 1));
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
ret = SendMessageA(listbox, LB_SELITEMRANGE, FALSE, MAKELPARAM(2, 2));
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %d.\n", j, ret);
|
||||
ok(ret == selitemrange_expect, "%u: Unexpected return value %ld.\n", j, ret);
|
||||
|
||||
/* And verify the selections */
|
||||
selexpect = (selstyles[j] & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) ? selexpect_multi2 : selexpect_single2;
|
||||
ret = SendMessageA(listbox, LB_GETSELCOUNT, 0, 0);
|
||||
ok(ret == getselcount_expect, "%u: expected %d from LB_GETSELCOUNT, got %d\n",
|
||||
ok(ret == getselcount_expect, "%u: expected %ld from LB_GETSELCOUNT, got %ld\n",
|
||||
j, getselcount_expect, ret);
|
||||
|
||||
for (k = 0; k < ARRAY_SIZE(selexpect_multi); k++)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_GETSEL, k, 0);
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %d, expected %d.\n",
|
||||
ok(ret == selexpect[k], "%u: Unexpected selection state %ld, expected %ld.\n",
|
||||
j, ret, selexpect[k]);
|
||||
}
|
||||
|
||||
@@ -808,13 +872,13 @@ static void test_itemfrompoint(void)
|
||||
|
||||
/* For an empty listbox win2k returns 0x1ffff, win98 returns 0x10000, nt4 returns 0xffffffff */
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 700, 30 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( 30, 300 ));
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %x\n", r );
|
||||
ok( r == 0x1ffff || r == 0x10000 || r == 0xffffffff, "ret %lx\n", r );
|
||||
|
||||
id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi");
|
||||
ok( id == 0, "item id wrong\n");
|
||||
@@ -822,17 +886,17 @@ static void test_itemfrompoint(void)
|
||||
ok( id == 1, "item id wrong\n");
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 30 ));
|
||||
ok( r == 0x1, "ret %x\n", r );
|
||||
ok( r == 0x1, "ret %lx\n", r );
|
||||
|
||||
r = SendMessageA(hList, LB_ITEMFROMPOINT, 0, MAKELPARAM( /* x */ 30, /* y */ 601 ));
|
||||
ok( r == 0x10001 || broken(r == 1), /* nt4 */
|
||||
"ret %x\n", r );
|
||||
"ret %lx\n", r );
|
||||
|
||||
/* Resize control so that below assertions about sizes are valid */
|
||||
r = SendMessageA( hList, LB_GETITEMRECT, 0, (LPARAM)&rc);
|
||||
ok( r == 1, "ret %x\n", r);
|
||||
ok( r == 1, "ret %lx\n", r);
|
||||
r = MoveWindow(hList, 1, 1, 600, (rc.bottom - rc.top + 1) * 9 / 2, TRUE);
|
||||
ok( r != 0, "ret %x\n", r);
|
||||
ok( r != 0, "ret %lx\n", r);
|
||||
|
||||
id = SendMessageA( hList, LB_ADDSTRING, 0, (LPARAM) "hi2");
|
||||
ok( id == 2, "item id wrong\n");
|
||||
@@ -852,31 +916,31 @@ static void test_itemfrompoint(void)
|
||||
|
||||
SendMessageA( hList, LB_SETTOPINDEX, 1, 0);
|
||||
r = SendMessageA( hList, LB_GETTOPINDEX, 0, 0);
|
||||
ok( r == 1, "top %d\n", r);
|
||||
ok( r == 1, "top %ld\n", r);
|
||||
|
||||
r = SendMessageA( hList, LB_GETITEMRECT, 5, (LPARAM)&rc);
|
||||
ok( r == 1, "ret %x\n", r);
|
||||
ok( r == 1, "ret %lx\n", r);
|
||||
r = SendMessageA( hList, LB_GETITEMRECT, 6, (LPARAM)&rc);
|
||||
ok( r == 0, "ret %x\n", r);
|
||||
ok( r == 0, "ret %lx\n", r);
|
||||
|
||||
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(/* x */ 10, /* y */ 10) );
|
||||
ok( r == 1, "ret %x\n", r);
|
||||
ok( r == 1, "ret %lx\n", r);
|
||||
|
||||
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(1000, 10) );
|
||||
ok( r == 0x10001 || broken(r == 1), /* nt4 */
|
||||
"ret %x\n", r );
|
||||
"ret %lx\n", r );
|
||||
|
||||
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, -10) );
|
||||
ok( r == 0x10001 || broken(r == 1), /* nt4 */
|
||||
"ret %x\n", r );
|
||||
"ret %lx\n", r );
|
||||
|
||||
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 100) );
|
||||
ok( r == 0x10005 || broken(r == 5), /* nt4 */
|
||||
"item %x\n", r );
|
||||
"item %lx\n", r );
|
||||
|
||||
r = SendMessageA( hList, LB_ITEMFROMPOINT, 0, MAKELPARAM(10, 200) );
|
||||
ok( r == 0x10005 || broken(r == 5), /* nt4 */
|
||||
"item %x\n", r );
|
||||
"item %lx\n", r );
|
||||
|
||||
DestroyWindow( hList );
|
||||
}
|
||||
@@ -929,7 +993,7 @@ static void test_listbox_LB_DIR(void)
|
||||
ok(ret, "Failed to create test directory.\n");
|
||||
|
||||
file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
|
||||
CloseHandle( file );
|
||||
|
||||
/* NOTE: for this test to succeed, there must be no subdirectories
|
||||
@@ -953,7 +1017,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
|
||||
}
|
||||
ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08x\n", GetLastError());
|
||||
ok (res >= 0, "SendMessage(LB_DIR, 0, *) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox */
|
||||
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
|
||||
@@ -980,7 +1044,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, 0, (LPARAM)pathBuffer);
|
||||
ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08x\n", GetLastError());
|
||||
ok (res >= 0, "SendMessage(LB_DIR, 0, w*.c) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* Path specification does NOT converted to uppercase */
|
||||
ok (!strcmp(pathBuffer, "w*.c"),
|
||||
@@ -1008,7 +1072,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY, *) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox.
|
||||
* All files plus "[..]"
|
||||
@@ -1037,7 +1101,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY, (LPARAM)pathBuffer);
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08x\n", GetLastError());
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY, w*.c) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. Since the parent directory does not
|
||||
* fit w*.c, there should be exactly the same number of items as without DDL_DIRECTORY
|
||||
@@ -1066,7 +1130,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *) failed - 0x%08x\n", GetLastError());
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DRIVES|DDL_EXCLUSIVE, *) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be at least one element before, since the string "[-c-]" should
|
||||
@@ -1113,7 +1177,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, *) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be at least one element before, since the string "[-c-]" should
|
||||
@@ -1141,7 +1205,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DRIVES, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DRIVES, w*.c) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be at least one element before, since the string "[-c-]" should
|
||||
@@ -1176,7 +1240,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, *) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be exactly the number of plain files, plus the number of mapped drives.
|
||||
@@ -1216,7 +1280,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES, w*.c) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be exactly the number of plain files, plus the number of mapped drives.
|
||||
@@ -1250,7 +1314,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
|
||||
ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %u\n", GetLastError());
|
||||
ok (res != -1, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_EXCLUSIVE, *) failed err %lu\n", GetLastError());
|
||||
|
||||
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
|
||||
ok (itemCount == itemCount_allDirs,
|
||||
@@ -1292,7 +1356,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, wildcard);
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
|
||||
ok (res > 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be no plain files on the listbox */
|
||||
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
|
||||
@@ -1327,7 +1391,7 @@ static void test_listbox_LB_DIR(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
SendMessageA(hList, LB_RESETCONTENT, 0, 0);
|
||||
res = SendMessageA(hList, LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, (LPARAM)pathBuffer);
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08x\n", GetLastError());
|
||||
ok (res >= 0, "SendMessage(LB_DIR, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE, w*.c,) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be no plain files on the listbox, and no [..], since it does not fit w*.c */
|
||||
itemCount = SendMessageA(hList, LB_GETCOUNT, 0, 0);
|
||||
@@ -1433,7 +1497,7 @@ static void test_listbox_dlgdir(void)
|
||||
HANDLE file;
|
||||
|
||||
file = CreateFileA( "wtest1.tmp.c", GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL );
|
||||
ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %d\n", GetLastError());
|
||||
ok(file != INVALID_HANDLE_VALUE, "Error creating the test file: %ld\n", GetLastError());
|
||||
CloseHandle( file );
|
||||
|
||||
/* NOTE: for this test to succeed, there must be no subdirectories
|
||||
@@ -1460,7 +1524,7 @@ static void test_listbox_dlgdir(void)
|
||||
*/
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL, 0);
|
||||
ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08x\n", res, GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, 0) returned %d - expected 1 - 0x%08lx\n", res, GetLastError());
|
||||
|
||||
/* Path specification gets converted to uppercase */
|
||||
ok (!strcmp(pathBuffer, "W*.C"),
|
||||
@@ -1498,7 +1562,7 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DIRECTORY);
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08x\n", GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be exactly more elements than before, since the directories should
|
||||
@@ -1545,7 +1609,7 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DRIVES);
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08x\n", GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be at least one element before, since the string "[-c-]" should
|
||||
@@ -1587,7 +1651,7 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DIRECTORY|DDL_DRIVES);
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be some content in the listbox. In particular, there should
|
||||
* be exactly the number of plain files, plus the number of mapped drives,
|
||||
@@ -1634,7 +1698,7 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DIRECTORY|DDL_EXCLUSIVE);
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be exactly one element: "[..]" */
|
||||
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
|
||||
@@ -1663,7 +1727,7 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "w*.c");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE);
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08x\n", GetLastError());
|
||||
ok (res == 1, "DlgDirList(*.c, DDL_DIRECTORY|DDL_DRIVES|DDL_EXCLUSIVE) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
/* There should be no plain files on the listbox */
|
||||
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
|
||||
@@ -1698,19 +1762,19 @@ static void test_listbox_dlgdir(void)
|
||||
strcpy(pathBuffer, "*");
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, ID_TEST_LABEL,
|
||||
DDL_DIRECTORY|DDL_DRIVES);
|
||||
ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08x\n", GetLastError());
|
||||
ok (res != 0, "DlgDirList(*, DDL_DIRECTORY|DDL_DRIVES) failed - 0x%08lx\n", GetLastError());
|
||||
|
||||
SendMessageA(g_listBox, LB_SETCURSEL, -1, 0); /* Unselect any current selection */
|
||||
memset(pathBuffer, 0, MAX_PATH);
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with no selection modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
GetLastError());
|
||||
ok (res == 0, "DlgDirSelectEx() with no selection returned %d, expected 0\n", res);
|
||||
/* WinXP-SP2 leaves pathBuffer untouched, but Win98 fills it with garbage. */
|
||||
/*
|
||||
ok (strlen(pathBuffer) == 0, "DlgDirSelectEx() with no selection filled buffer with %s\n", pathBuffer);
|
||||
ok (!*pathBuffer, "DlgDirSelectEx() with no selection filled buffer with %s\n", pathBuffer);
|
||||
*/
|
||||
/* Test proper drive/dir/file recognition */
|
||||
itemCount = SendMessageA(g_listBox, LB_GETCOUNT, 0, 0);
|
||||
@@ -1720,7 +1784,6 @@ static void test_listbox_dlgdir(void)
|
||||
memset(tempBuffer, 0, MAX_PATH);
|
||||
driveletter = '\0';
|
||||
SendMessageA(g_listBox, LB_GETTEXT, i, (LPARAM)itemBuffer);
|
||||
if (!strstr(itemBuffer, ".exe")) continue; // skip downloaded/generated files from other tests
|
||||
res = SendMessageA(g_listBox, LB_SETCURSEL, i, 0);
|
||||
ok (res == i, "SendMessageA(LB_SETCURSEL, %d) failed\n", i);
|
||||
if (sscanf(itemBuffer, "[-%c-]", &driveletter) == 1) {
|
||||
@@ -1728,7 +1791,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1740,7 +1803,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1757,7 +1820,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1791,7 +1854,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1803,7 +1866,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 1, "DlgDirSelectEx() thinks %s (%s) is not a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1820,7 +1883,7 @@ static void test_listbox_dlgdir(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
res = DlgDirSelectExA(hWnd, pathBuffer, MAX_PATH, ID_TEST_LISTBOX);
|
||||
ok (GetLastError() == 0xdeadbeef,
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08x\n",
|
||||
"DlgDirSelectEx() with selection at %d modified last error code from 0xdeadbeef to 0x%08lx\n",
|
||||
i, GetLastError());
|
||||
ok(res == 0, "DlgDirSelectEx() thinks %s (%s) is a drive/directory!\n", itemBuffer, pathBuffer);
|
||||
|
||||
@@ -1852,7 +1915,7 @@ static void test_listbox_dlgdir(void)
|
||||
res = DlgDirListA(hWnd, pathBuffer, ID_TEST_LISTBOX, 0, DDL_DIRECTORY | DDL_EXCLUSIVE);
|
||||
ok(!res, "DlgDirList should have failed with 0 but %d was returned\n", res);
|
||||
ok(GetLastError() == ERROR_NO_WILDCARD_CHARACTERS,
|
||||
"GetLastError should return 0x589, got 0x%X\n",GetLastError());
|
||||
"GetLastError should return 0x589, got 0x%lX\n",GetLastError());
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
}
|
||||
@@ -1876,10 +1939,16 @@ static void test_set_count( void )
|
||||
GetUpdateRect( listbox, &r, TRUE );
|
||||
ok( IsRectEmpty( &r ), "got non-empty rect\n");
|
||||
|
||||
ret = GetWindowLongA( listbox, GWL_STYLE );
|
||||
ok((ret & (WS_VSCROLL | WS_HSCROLL)) == 0, "Listbox should not have scroll bars\n");
|
||||
|
||||
ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
|
||||
ok( ret == 0, "got %d\n", ret );
|
||||
ok( ret == 0, "got %ld\n", ret );
|
||||
ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
|
||||
ok( ret == 100, "got %d\n", ret );
|
||||
ok( ret == 100, "got %ld\n", ret );
|
||||
|
||||
ret = GetWindowLongA( listbox, GWL_STYLE );
|
||||
ok((ret & (WS_VSCROLL | WS_HSCROLL)) == WS_VSCROLL, "Listbox should have vertical scroll bar\n");
|
||||
|
||||
GetUpdateRect( listbox, &r, TRUE );
|
||||
ok( !IsRectEmpty( &r ), "got empty rect\n");
|
||||
@@ -1889,15 +1958,15 @@ static void test_set_count( void )
|
||||
ok( IsRectEmpty( &r ), "got non-empty rect\n");
|
||||
|
||||
ret = SendMessageA( listbox, LB_SETCOUNT, 99, 0 );
|
||||
ok( ret == 0, "got %d\n", ret );
|
||||
ok( ret == 0, "got %ld\n", ret );
|
||||
|
||||
GetUpdateRect( listbox, &r, TRUE );
|
||||
ok( !IsRectEmpty( &r ), "got empty rect\n");
|
||||
|
||||
ret = SendMessageA( listbox, LB_SETCOUNT, -5, 0 );
|
||||
ok( ret == 0, "got %d\n", ret );
|
||||
ok( ret == 0, "got %ld\n", ret );
|
||||
ret = SendMessageA( listbox, LB_GETCOUNT, 0, 0 );
|
||||
ok( ret == -5, "got %d\n", ret );
|
||||
ok( ret == -5, "got %ld\n", ret );
|
||||
|
||||
DestroyWindow( listbox );
|
||||
|
||||
@@ -1907,8 +1976,8 @@ static void test_set_count( void )
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = SendMessageA( listbox, LB_SETCOUNT, 100, 0 );
|
||||
ok( ret == LB_ERR, "expected %d, got %d\n", LB_ERR, ret );
|
||||
ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %d.\n", GetLastError() );
|
||||
ok( ret == LB_ERR, "expected %d, got %ld\n", LB_ERR, ret );
|
||||
ok( GetLastError() == ERROR_SETCOUNT_ON_BAD_LB, "Unexpected error %ld.\n", GetLastError() );
|
||||
|
||||
DestroyWindow( listbox );
|
||||
}
|
||||
@@ -1951,8 +2020,8 @@ static void test_GetListBoxInfo(void)
|
||||
|
||||
lb_getlistboxinfo = 0;
|
||||
ret = pGetListBoxInfo(listbox);
|
||||
ok(ret > 0, "got %d\n", ret);
|
||||
todo_wine
|
||||
ok(ret > 0, "got %ld\n", ret);
|
||||
todo_wine
|
||||
ok(lb_getlistboxinfo == 0, "got %d\n", lb_getlistboxinfo);
|
||||
|
||||
DestroyWindow(listbox);
|
||||
@@ -1977,45 +2046,45 @@ static void test_init_storage( void )
|
||||
0, 0, 100, 100, parent, (HMENU)1, NULL, 0);
|
||||
|
||||
items_size = SendMessageA(listbox, LB_INITSTORAGE, 100, 0);
|
||||
ok(items_size >= 100, "expected at least 100, got %d\n", items_size);
|
||||
ok(items_size >= 100, "expected at least 100, got %ld\n", items_size);
|
||||
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
|
||||
ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
|
||||
ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
|
||||
|
||||
/* it doesn't grow since the space was already reserved */
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, items_size, 0);
|
||||
ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
|
||||
ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
|
||||
|
||||
/* it doesn't shrink the reserved space */
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, 42, 0);
|
||||
ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
|
||||
ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
|
||||
|
||||
/* now populate almost all of it so it's not reserved anymore */
|
||||
if (styles[i] & LBS_NODATA)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_SETCOUNT, items_size - 1, 0);
|
||||
ok(ret == 0, "unexpected return value %d\n", ret);
|
||||
ok(ret == 0, "unexpected return value %ld\n", ret);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < items_size - 1; j++)
|
||||
{
|
||||
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
|
||||
ok(ret == j, "expected %d, got %d\n", j, ret);
|
||||
ok(ret == j, "expected %d, got %ld\n", j, ret);
|
||||
}
|
||||
}
|
||||
|
||||
/* we still have one more reserved slot, so it doesn't grow yet */
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
|
||||
ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
|
||||
ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
|
||||
|
||||
/* fill the slot and check again, it should grow this time */
|
||||
ret = SendMessageA(listbox, LB_INSERTSTRING, -1, (LPARAM)"");
|
||||
ok(ret == items_size - 1, "expected %d, got %d\n", items_size - 1, ret);
|
||||
ok(ret == items_size - 1, "expected %ld, got %ld\n", items_size - 1, ret);
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, 0, 0);
|
||||
ok(ret == items_size, "expected %d, got %d\n", items_size, ret);
|
||||
ok(ret == items_size, "expected %ld, got %ld\n", items_size, ret);
|
||||
ret = SendMessageA(listbox, LB_INITSTORAGE, 1, 0);
|
||||
ok(ret > items_size, "expected it to grow past %d, got %d\n", items_size, ret);
|
||||
ok(ret > items_size, "expected it to grow past %ld, got %ld\n", items_size, ret);
|
||||
|
||||
DestroyWindow(listbox);
|
||||
}
|
||||
@@ -2057,7 +2126,7 @@ static void test_extents(void)
|
||||
listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2072,7 +2141,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2087,7 +2156,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2104,7 +2173,7 @@ static void test_extents(void)
|
||||
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL, parent);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2119,7 +2188,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2134,7 +2203,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2148,7 +2217,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 0, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2165,7 +2234,7 @@ static void test_extents(void)
|
||||
listbox = create_listbox(WS_CHILD | WS_VISIBLE | WS_HSCROLL | LBS_DISABLENOSCROLL, parent);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %u\n", res);
|
||||
ok(res == 0, "Got wrong initial horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2180,7 +2249,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 64, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 64, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 64, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2195,7 +2264,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 184, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 184, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 184, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2209,7 +2278,7 @@ static void test_extents(void)
|
||||
SendMessageA(listbox, LB_SETHORIZONTALEXTENT, 0, 0);
|
||||
|
||||
res = SendMessageA(listbox, LB_GETHORIZONTALEXTENT, 0, 0);
|
||||
ok(res == 0, "Got wrong horizontal extent: %u\n", res);
|
||||
ok(res == 0, "Got wrong horizontal extent: %lu\n", res);
|
||||
|
||||
sinfo.cbSize = sizeof(sinfo);
|
||||
sinfo.fMask = SIF_RANGE;
|
||||
@@ -2234,14 +2303,14 @@ static void test_WM_MEASUREITEM(void)
|
||||
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE, parent);
|
||||
|
||||
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
|
||||
ok(data == (LRESULT)strings[0], "data = %08lx, expected %p\n", data, strings[0]);
|
||||
ok(data == (LRESULT)strings[0], "data = %08Ix, expected %p\n", data, strings[0]);
|
||||
DestroyWindow(parent);
|
||||
|
||||
parent = create_parent();
|
||||
listbox = create_listbox(WS_CHILD | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS, parent);
|
||||
|
||||
data = SendMessageA(listbox, LB_GETITEMDATA, 0, 0);
|
||||
ok(!data, "data = %08lx\n", data);
|
||||
ok(!data, "data = %08Ix\n", data);
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
@@ -2312,27 +2381,27 @@ static void test_LBS_NODATA(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 0);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_FINDSTRING, 1, 42);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 0);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_FINDSTRINGEXACT, 1, 42);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 0);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendMessageA(listbox, LB_SELECTSTRING, 1, 42);
|
||||
ok(ret == LB_ERR, "Unexpected return value %d.\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%X\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError should return 0x57, got 0x%lX\n", GetLastError());
|
||||
|
||||
DestroyWindow(listbox);
|
||||
|
||||
@@ -2349,7 +2418,7 @@ static void test_LBS_NODATA(void)
|
||||
ok(listbox != NULL, "Failed to create a listbox.\n");
|
||||
|
||||
style = GetWindowLongA(listbox, GWL_STYLE);
|
||||
ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#x.\n", i, style);
|
||||
ok((style & invalid_styles[i]) == invalid_styles[i], "%u: unexpected window styles %#lx.\n", i, style);
|
||||
ret = SendMessageA(listbox, LB_SETCOUNT, 100, 0);
|
||||
ok(ret == LB_ERR, "%u: unexpected return value %d.\n", i, ret);
|
||||
DestroyWindow(listbox);
|
||||
@@ -2358,6 +2427,83 @@ static void test_LBS_NODATA(void)
|
||||
DestroyWindow(parent);
|
||||
}
|
||||
|
||||
static void test_LB_FINDSTRING(void)
|
||||
{
|
||||
static const WCHAR *strings[] =
|
||||
{
|
||||
L"abci",
|
||||
L"AbCI",
|
||||
L"abcI",
|
||||
L"abc\xcdzz",
|
||||
L"abc\xedzz",
|
||||
L"abc\xcd",
|
||||
L"abc\xed",
|
||||
L"abcO",
|
||||
L"abc\xd8",
|
||||
L"abcP",
|
||||
};
|
||||
static const struct { const WCHAR *str; LRESULT from, res, exact, alt_res, alt_exact; } tests[] =
|
||||
{
|
||||
{ L"ab", -1, 0, -1, 0, -1 },
|
||||
{ L"abc", -1, 0, -1, 0, -1 },
|
||||
{ L"abci", -1, 0, 0, 0, 0 },
|
||||
{ L"ABCI", -1, 0, 0, 0, 0 },
|
||||
{ L"ABC\xed", -1, 3, 3, 3, 3 },
|
||||
{ L"ABC\xcd", 4, 5, 3, 5, 3 },
|
||||
{ L"abcp", -1, 9, 9, 8, 8 },
|
||||
};
|
||||
HWND listbox;
|
||||
unsigned int i;
|
||||
LRESULT ret;
|
||||
|
||||
listbox = CreateWindowW( L"listbox", L"TestList", LBS_HASSTRINGS | LBS_SORT,
|
||||
0, 0, 100, 100, NULL, NULL, NULL, 0 );
|
||||
ok( listbox != NULL, "Failed to create listbox\n" );
|
||||
SendMessageW( listbox, LB_SETLOCALE, MAKELANGID( LANG_FRENCH, SUBLANG_DEFAULT ), 0 );
|
||||
for (i = 0; i < ARRAY_SIZE(strings); i++) SendMessageW( listbox, LB_ADDSTRING, 0, (LPARAM)strings[i] );
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, tests[i].from, (LPARAM)tests[i].str );
|
||||
ok( ret == tests[i].res, "%u: wrong result %Id / %Id\n", i, ret, tests[i].res );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRINGEXACT, tests[i].from, (LPARAM)tests[i].str );
|
||||
ok( ret == tests[i].exact, "%u: wrong result %Id / %Id\n", i, ret, tests[i].exact );
|
||||
}
|
||||
|
||||
SendMessageW( listbox, LB_RESETCONTENT, 0, 0 );
|
||||
SendMessageW( listbox, LB_SETLOCALE, MAKELANGID( LANG_SWEDISH, SUBLANG_DEFAULT ), 0 );
|
||||
for (i = 0; i < ARRAY_SIZE(strings); i++) SendMessageW( listbox, LB_ADDSTRING, 0, (LPARAM)strings[i] );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, -1, (LPARAM)L"abcp" );
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, tests[i].from, (LPARAM)tests[i].str );
|
||||
ok( ret == tests[i].alt_res, "%u: wrong result %Id / %Id\n", i, ret, tests[i].alt_res );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRINGEXACT, tests[i].from, (LPARAM)tests[i].str );
|
||||
ok( ret == tests[i].alt_exact, "%u: wrong result %Id / %Id\n", i, ret, tests[i].alt_exact );
|
||||
}
|
||||
|
||||
SendMessageW( listbox, LB_RESETCONTENT, 0, 0 );
|
||||
SendMessageW( listbox, LB_ADDSTRING, 0, (LPARAM)L"abc" );
|
||||
SendMessageW( listbox, LB_ADDSTRING, 0, (LPARAM)L"[abc]" );
|
||||
SendMessageW( listbox, LB_ADDSTRING, 0, (LPARAM)L"[-abc-]" );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, -1, (LPARAM)L"abc" );
|
||||
ok( ret == 0, "wrong result %Id\n", ret );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRINGEXACT, -1, (LPARAM)L"abc" );
|
||||
todo_wine
|
||||
ok( ret == 0, "wrong result %Id\n", ret );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, 0, (LPARAM)L"abc" );
|
||||
ok( ret == 1, "wrong result %Id\n", ret );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRINGEXACT, 0, (LPARAM)L"abc" );
|
||||
todo_wine
|
||||
ok( ret == 0, "wrong result %Id\n", ret );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRING, 1, (LPARAM)L"abc" );
|
||||
ok( ret == 2, "wrong result %Id\n", ret );
|
||||
ret = SendMessageW( listbox, LB_FINDSTRINGEXACT, 1, (LPARAM)L"abc" );
|
||||
todo_wine
|
||||
ok( ret == 0, "wrong result %Id\n", ret );
|
||||
DestroyWindow( listbox );
|
||||
}
|
||||
|
||||
START_TEST(listbox)
|
||||
{
|
||||
const struct listbox_test SS =
|
||||
@@ -2457,4 +2603,5 @@ START_TEST(listbox)
|
||||
test_WM_MEASUREITEM();
|
||||
test_LB_SETSEL();
|
||||
test_LBS_NODATA();
|
||||
test_LB_FINDSTRING();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+4517
-1735
File diff suppressed because it is too large
Load Diff
@@ -1,101 +0,0 @@
|
||||
/* Unit test suite for rawinput.
|
||||
*
|
||||
* Copyright 2019 Remi Bernon for CodeWeavers
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define STRICT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
static void test_RegisterRawInputDevices(void)
|
||||
{
|
||||
HWND hwnd;
|
||||
RAWINPUTDEVICE raw_devices[1];
|
||||
BOOL res;
|
||||
|
||||
raw_devices[0].usUsagePage = 0x01;
|
||||
raw_devices[0].usUsage = 0x05;
|
||||
|
||||
hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL);
|
||||
ok(hwnd != NULL, "CreateWindowExA failed\n");
|
||||
|
||||
|
||||
res = RegisterRawInputDevices(NULL, 0, 0);
|
||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||
|
||||
|
||||
raw_devices[0].dwFlags = 0;
|
||||
raw_devices[0].hwndTarget = 0;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), 0);
|
||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
|
||||
/* RIDEV_REMOVE requires hwndTarget == NULL */
|
||||
raw_devices[0].dwFlags = RIDEV_REMOVE;
|
||||
raw_devices[0].hwndTarget = hwnd;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||
ok(res == FALSE, "RegisterRawInputDevices succeeded\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
raw_devices[0].hwndTarget = 0;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||
ok(res == TRUE, "RegisterRawInputDevices failed\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
|
||||
/* RIDEV_INPUTSINK requires hwndTarget != NULL */
|
||||
raw_devices[0].dwFlags = RIDEV_INPUTSINK;
|
||||
raw_devices[0].hwndTarget = 0;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||
todo_wine
|
||||
ok(res == FALSE, "RegisterRawInputDevices failed\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
raw_devices[0].hwndTarget = hwnd;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
res = RegisterRawInputDevices(raw_devices, ARRAY_SIZE(raw_devices), sizeof(RAWINPUTDEVICE));
|
||||
ok(res == TRUE, "RegisterRawInputDevices succeeded\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "RegisterRawInputDevices returned %08x\n", GetLastError());
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
START_TEST(rawinput)
|
||||
{
|
||||
test_RegisterRawInputDevices();
|
||||
}
|
||||
@@ -36,7 +36,27 @@ static void test_LoadStringW(void)
|
||||
HINSTANCE hInst = GetModuleHandleA(NULL);
|
||||
WCHAR copiedstringw[128], returnedstringw[128], *resourcepointer = NULL;
|
||||
char copiedstring[128], returnedstring[128];
|
||||
int length1, length2, retvalue;
|
||||
int length1, length2, retvalue, i;
|
||||
static struct
|
||||
{
|
||||
int id;
|
||||
const WCHAR *string;
|
||||
} string_table_tests[] =
|
||||
{
|
||||
{ 2, L"Error" },
|
||||
{ 13, L"&More Windows..." },
|
||||
{ 800, L"OK" },
|
||||
{ 801, L"Cancel" },
|
||||
{ 802, L"&Abort" },
|
||||
{ 803, L"&Retry" },
|
||||
{ 804, L"&Ignore" },
|
||||
{ 805, L"&Yes" },
|
||||
{ 806, L"&No" },
|
||||
{ 807, L"&Close" },
|
||||
{ 808, L"Help" },
|
||||
{ 809, L"&Try Again" },
|
||||
{ 810, L"&Continue" },
|
||||
};
|
||||
|
||||
/* Check that the string which is returned by LoadStringW matches
|
||||
the string at the pointer returned by LoadStringW when called with buflen = 0 */
|
||||
@@ -51,10 +71,10 @@ static void test_LoadStringW(void)
|
||||
return;
|
||||
}
|
||||
length2 = LoadStringW(hInst, 2, returnedstringw, ARRAY_SIZE(returnedstringw)); /* get resource string */
|
||||
ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %d\n", length2, GetLastError());
|
||||
ok(length2 > 0, "LoadStringW failed to load resource 2, ret %d, err %ld\n", length2, GetLastError());
|
||||
ok(length1 == length2, "LoadStringW returned different values dependent on buflen. ret1 %d, ret2 %d\n",
|
||||
length1, length2);
|
||||
ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %d\n",
|
||||
ok(length1 > 0 && resourcepointer != NULL, "LoadStringW failed to get pointer to resource 2, ret %d, err %ld\n",
|
||||
length1, GetLastError());
|
||||
|
||||
/* Copy the resource since it is not '\0' terminated, and add '\0' to the end */
|
||||
@@ -75,10 +95,78 @@ static void test_LoadStringW(void)
|
||||
/* check again, with a different buflen value, that calling LoadStringW with buffer = NULL returns zero */
|
||||
retvalue = LoadStringW(hInst, 2, NULL, 128);
|
||||
ok(!retvalue, "LoadStringW returned a non-zero value when called with buffer = NULL, retvalue = %d\n", retvalue);
|
||||
|
||||
/* Test builtin string table in user32. */
|
||||
if ((PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())) != LANG_ENGLISH)
|
||||
|| (PRIMARYLANGID(LANGIDFROMLCID(GetThreadLocale())) != LANG_ENGLISH))
|
||||
{
|
||||
skip("Skip for Non-English system.\n");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
hInst = GetModuleHandleW(L"user32.dll");
|
||||
ok(!!hInst, "Can't get module %#lx.\n", GetLastError());
|
||||
|
||||
for (i = 0; i < ARRAYSIZE(string_table_tests); i++)
|
||||
{
|
||||
winetest_push_context("Test %u", i);
|
||||
|
||||
length1 = LoadStringW(hInst, string_table_tests[i].id, returnedstringw, ARRAY_SIZE(returnedstringw));
|
||||
ok(length1 == wcslen(string_table_tests[i].string), "Got wrong length %d.\n", length1);
|
||||
ok(!wcscmp(returnedstringw, string_table_tests[i].string), "Got wrong string %s.\n",
|
||||
debugstr_w(returnedstringw));
|
||||
|
||||
winetest_pop_context();
|
||||
}
|
||||
}
|
||||
|
||||
/* Test missing resource. */
|
||||
SetLastError(0xdeadbeef);
|
||||
memset(returnedstringw, 0xcc, sizeof(returnedstringw));
|
||||
length1 = LoadStringW(hInst, 0xdeadbeef, returnedstringw, ARRAY_SIZE(returnedstringw));
|
||||
ok(!length1, "got %d.\n", length1);
|
||||
ok(GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND || broken(GetLastError() == ERROR_MUI_FILE_NOT_FOUND) /* Win7 */,
|
||||
"got %lu.\n", GetLastError());
|
||||
ok(!returnedstringw[0], "got %#x.\n", returnedstringw[0]);
|
||||
ok(returnedstringw[1] == 0xcccc, "got %#x.\n", returnedstringw[1]);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
memset(returnedstringw, 0xcc, sizeof(returnedstringw));
|
||||
length1 = LoadStringW(hInst, 0xdeadbeef, returnedstringw, 0);
|
||||
ok(!length1, "got %d.\n", length1);
|
||||
ok(GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND || broken(GetLastError() == ERROR_MUI_FILE_NOT_LOADED) /* Win7 */,
|
||||
"got %lu.\n", GetLastError());
|
||||
ok(returnedstringw[0] == 0xcccc, "got %#x.\n", returnedstringw[1]);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
memset(returnedstringw, 0xcc, sizeof(returnedstringw));
|
||||
length1 = LoadStringW(hInst, 0xdeadbeef, returnedstringw, 1);
|
||||
ok(!length1, "got %d.\n", length1);
|
||||
ok(GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND || broken(GetLastError() == ERROR_MUI_FILE_NOT_LOADED) /* Win7 */,
|
||||
"got %lu.\n", GetLastError());
|
||||
ok(!returnedstringw[0], "got %#x.\n", returnedstringw[0]);
|
||||
ok(returnedstringw[1] == 0xcccc, "got %#x.\n", returnedstringw[1]);
|
||||
|
||||
/* Test short buffer */
|
||||
SetLastError(0xdeadbeef);
|
||||
memset(returnedstringw, 0xcc, sizeof(returnedstringw));
|
||||
length1 = LoadStringW(hInst, 2, returnedstringw, 1); /* get resource string */
|
||||
ok(!length1, "got %d.\n", length1);
|
||||
ok(GetLastError() == 0xdeadbeef, "got %lu.\n", GetLastError());
|
||||
#ifdef __REACTOS__
|
||||
ok(!returnedstringw[0] || broken(returnedstringw[0] == 0xcccc) /* WS03 */, "got %#x.\n", returnedstringw[0]);
|
||||
#else
|
||||
ok(!returnedstringw[0], "got %#x.\n", returnedstringw[0]);
|
||||
#endif
|
||||
ok(returnedstringw[1] == 0xcccc, "got %#x.\n", returnedstringw[1]);
|
||||
}
|
||||
|
||||
static void test_LoadStringA (void)
|
||||
{
|
||||
#if defined(__REACTOS__) && defined(_M_AMD64)
|
||||
skip("LoadStringA test broken on amd64!\n");
|
||||
#else
|
||||
HINSTANCE hInst = GetModuleHandleA(NULL);
|
||||
static const char str[] = "String resource"; /* same in resource.rc */
|
||||
char buf[128];
|
||||
@@ -109,22 +197,22 @@ static void test_LoadStringA (void)
|
||||
}
|
||||
|
||||
ret = LoadStringA(hInst, 1, buf, sizeof(buf) );
|
||||
ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
ret2 = LoadStringA( hInst, MAKELONG( 1, 0x8000 ), buf, sizeof(buf));
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
ret2 = LoadStringA( hInst, MAKELONG( 1, 0xffff ), buf, sizeof(buf));
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
|
||||
ret = LoadStringA(hInst, 65534, buf, sizeof(buf) );
|
||||
ok( ret > 0, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret > 0, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
ret2 = LoadStringA( hInst, MAKELONG( 65534, 0x8000 ), buf, sizeof(buf));
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
ret2 = LoadStringA( hInst, MAKELONG( 65534, 0xffff ), buf, sizeof(buf));
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %d\n", ret, GetLastError());
|
||||
ok( ret2 == ret, "LoadString failed: ret %d err %ld\n", ret, GetLastError());
|
||||
|
||||
ret = LoadStringA(hInst, 0, buf, 0);
|
||||
ok( ret == -1 || broken(ret == 0),
|
||||
"LoadStringA did not return -1 when called with buflen = 0, got %d, err %d\n",
|
||||
"LoadStringA did not return -1 when called with buflen = 0, got %d, err %ld\n",
|
||||
ret, GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -132,7 +220,8 @@ static void test_LoadStringA (void)
|
||||
ret = LoadStringA(hInst, 1, buf, 1);
|
||||
ok( !ret, "LoadString returned %d\n", ret);
|
||||
ok( buf[0] == 0, "buf[0] = %c (%x)\n", buf[0], buf[0]);
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %d\n", GetLastError());
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %ld\n", GetLastError());
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_accel1(void)
|
||||
@@ -172,11 +261,11 @@ static void test_accel1(void)
|
||||
ac[n++].fVirt = (SHORT) 0xffff;
|
||||
|
||||
ac[n].cmd = 0xfff0;
|
||||
ac[n].key = 0xffff;
|
||||
ac[n].key = 'B';
|
||||
ac[n++].fVirt = (SHORT) 0xfff0;
|
||||
|
||||
ac[n].cmd = 0xfff0;
|
||||
ac[n].key = 0xffff;
|
||||
ac[n].key = 'C';
|
||||
ac[n++].fVirt = 0x0000;
|
||||
|
||||
ac[n].cmd = 0xfff0;
|
||||
@@ -204,12 +293,12 @@ static void test_accel1(void)
|
||||
|
||||
if (++n == r) goto done;
|
||||
ok( ac[n].cmd == 0xfff0, "cmd 2 not preserved got %x\n", ac[n].cmd);
|
||||
ok( (ac[n].key & 0xff) == 0xff, "key 2 not preserved got %x\n", ac[n].key);
|
||||
ok( ac[n].key == 'B', "key 2 not preserved got %x\n", ac[n].key);
|
||||
ok( ac[n].fVirt == 0x0070, "fVirt 2 wrong got %x\n", ac[n].fVirt);
|
||||
|
||||
if (++n == r) goto done;
|
||||
ok( ac[n].cmd == 0xfff0, "cmd 3 not preserved got %x\n", ac[n].cmd);
|
||||
ok( (ac[n].key & 0xff) == 0xff, "key 3 not preserved got %x\n", ac[n].key);
|
||||
ok( ac[n].key == 'C', "key 3 not preserved got %x\n", ac[n].key);
|
||||
ok( ac[n].fVirt == 0x0000, "fVirt 3 wrong got %x\n", ac[n].fVirt);
|
||||
|
||||
if (++n == r) goto done;
|
||||
@@ -348,7 +437,8 @@ static void test_PrivateExtractIcons(void) {
|
||||
ok(cIcons == ~0u, "got %u\n", cIcons);
|
||||
|
||||
cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0);
|
||||
ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
|
||||
ok(cIcons == 1 || broken(cIcons == 4) /* win11 */ ||
|
||||
broken(cIcons == 2) /* win2k */, "got %u\n", cIcons);
|
||||
|
||||
ahIcon[0] = (HICON)0xdeadbeef;
|
||||
cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0);
|
||||
|
||||
@@ -249,6 +249,9 @@ FONT 8, "MS Shell Dlg"
|
||||
/* @makedep: test_mono.bmp */
|
||||
100 BITMAP test_mono.bmp
|
||||
|
||||
/* @makedep: bmp1x1_32bpp.bmp */
|
||||
101 BITMAP bmp1x1_32bpp.bmp
|
||||
|
||||
1 MENU
|
||||
{
|
||||
POPUP "&File"
|
||||
@@ -273,3 +276,13 @@ FONT 8, "MS Shell Dlg"
|
||||
}
|
||||
MENUITEM "&Quit", 300
|
||||
}
|
||||
|
||||
IDD_SS_ICON_DIALOG DIALOG 0, 0, 186, 95
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
CONTROL 0x6100, 1003, "STATIC", SS_ICON | WS_CHILD | WS_VISIBLE, 7, 57, 21, 20
|
||||
DEFPUSHBUTTON "OK",IDOK,129,7,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14
|
||||
END
|
||||
|
||||
@@ -120,7 +120,7 @@ static void test_EnableScrollBar(void)
|
||||
todo_wine
|
||||
ok( GetLastError() == ERROR_INVALID_PARAMETER
|
||||
|| broken(GetLastError() == 0xdeadbeef), /* winxp */
|
||||
"GetLastError() = %u\n", GetLastError() );
|
||||
"GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
/* disable window, try to re-enable */
|
||||
ret = EnableWindow( hScroll, FALSE );
|
||||
@@ -181,12 +181,12 @@ static void test_SetScrollPos(void)
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = SetScrollPos( mainwnd, SB_CTL, 30, TRUE );
|
||||
ok( !ret, "The position should not be set.\n" );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ret = GetScrollPos( mainwnd, SB_CTL );
|
||||
ok( !ret, "The position should be equal to zero\n");
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %u\n", GetLastError() );
|
||||
ok( GetLastError() == 0xdeadbeef, "GetLastError() = %lu\n", GetLastError() );
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
@@ -242,7 +242,7 @@ static void test_GetScrollBarInfo(void)
|
||||
GetWindowRect( hScroll, &rect );
|
||||
ok( ret, "The GetWindowRect() call should not fail.\n" );
|
||||
ok( !(sbi.rgstate[0] & (STATE_SYSTEM_INVISIBLE|STATE_SYSTEM_OFFSCREEN)),
|
||||
"unexpected rgstate(0x%x)\n", sbi.rgstate[0]);
|
||||
"unexpected rgstate(0x%lx)\n", sbi.rgstate[0]);
|
||||
ok(EqualRect(&rect, &sbi.rcScrollBar), "WindowRect %s != rcScrollBar %s\n",
|
||||
wine_dbgstr_rect(&rect), wine_dbgstr_rect(&sbi.rcScrollBar));
|
||||
|
||||
@@ -301,40 +301,40 @@ static void scrollbar_test_default( DWORD style)
|
||||
/* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( min == 0 && max == 0,
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
|
||||
else
|
||||
ok(( min == 0 && max == 100) ||
|
||||
broken( min == 0 && max == 0), /* Win 9x/ME */
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
ret = GetScrollRange( hwnd, SB_HORZ, &min, &max);
|
||||
ok( ret ||
|
||||
broken( !ret) /* Win 9x/ME */ , "GetScrollRange failed.\n");
|
||||
/* range is 0,0 if there are no H or V scroll bars. 0,100 otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( min == 0 && max == 0,
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,0. Style %08lx\n", min, max, style);
|
||||
else
|
||||
ok(( min == 0 && max == 100) ||
|
||||
broken( min == 0 && max == 0), /* Win 9x/ME */
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* test GetScrollInfo, vist for vertical SB */
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should fail if no H or V scroll bar styles are present. Succeed otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
else
|
||||
ok( ret ||
|
||||
broken( !ret), /* Win 9x/ME */
|
||||
"GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
"GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* Same for Horizontal SB */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should fail if no H or V scroll bar styles are present. Succeed otherwise */
|
||||
if( !( style & ( WS_VSCROLL | WS_HSCROLL)))
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
else
|
||||
ok( ret ||
|
||||
broken( !ret), /* Win 9x/ME */
|
||||
"GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
"GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* now set the Vertical Scroll range to something that could be the default value it
|
||||
* already has */;
|
||||
ret = SetScrollRange( hwnd, SB_VERT, 0, 100, FALSE);
|
||||
@@ -344,26 +344,26 @@ static void scrollbar_test_default( DWORD style)
|
||||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* report the windows style */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
/* WS_VSCROLL added to the window style */
|
||||
if( !(style & WS_VSCROLL))
|
||||
{
|
||||
if (bThemeActive || style != WS_HSCROLL)
|
||||
todo_wine
|
||||
todo_wine
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_VSCROLL),
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
else
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
}
|
||||
/* do the test again with H and V reversed.
|
||||
* Start with a clean window */
|
||||
@@ -380,26 +380,26 @@ todo_wine
|
||||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* report the windows style */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
/* WS_HSCROLL added to the window style */
|
||||
if( !(style & WS_HSCROLL))
|
||||
{
|
||||
if (bThemeActive || style != WS_VSCROLL)
|
||||
todo_wine
|
||||
todo_wine
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == ( style | WS_HSCROLL),
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
else
|
||||
ok( (winstyle & (WS_HSCROLL|WS_VSCROLL)) == style,
|
||||
"unexpected style change %08x/%08x\n", winstyle, style);
|
||||
"unexpected style change %08lx/%08lx\n", winstyle, style);
|
||||
}
|
||||
/* Slightly change the test to use SetScrollInfo
|
||||
* Start with a clean window */
|
||||
@@ -413,20 +413,20 @@ todo_wine
|
||||
si.nMax = 22;
|
||||
si.fMask |= SIF_RANGE;
|
||||
ret = SetScrollInfo( hwnd, SB_HORZ, &si, FALSE);
|
||||
ok( ret, "SetScrollInfo failed. Style is %08x\n", style);
|
||||
ok( ret, "SetScrollInfo failed. Style is %08lx\n", style);
|
||||
/* and request the Vertical range */
|
||||
ret = GetScrollRange( hwnd, SB_VERT, &min, &max);
|
||||
ok( ret, "GetScrollRange failed.\n");
|
||||
/* now the range should be 0,100 in ALL cases */
|
||||
ok( min == 0 && max == 100,
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08x\n", min, max, style);
|
||||
"Scroll bar range is %d,%d. Expected 0,100. Style %08lx\n", min, max, style);
|
||||
/* See what is different now for GetScrollRange */
|
||||
ret = GetScrollInfo( hwnd, SB_HORZ, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should succeed in ALL cases */
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08x\n", style);
|
||||
ok( ret, "GetScrollInfo failed unexpectedly. Style is %08lx\n", style);
|
||||
/* also test if the window scroll bars are enabled */
|
||||
ret = EnableScrollBar( hwnd, SB_VERT, ESB_ENABLE_BOTH);
|
||||
ok( !ret, "Vertical window scroll bar was not enabled\n");
|
||||
@@ -443,13 +443,13 @@ todo_wine
|
||||
assert( hwnd != 0);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should fail */
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
/* add scroll styles */
|
||||
winstyle = GetWindowLongA( hwnd, GWL_STYLE );
|
||||
SetWindowLongW( hwnd, GWL_STYLE, winstyle | WS_VSCROLL | WS_HSCROLL);
|
||||
ret = GetScrollInfo( hwnd, SB_VERT, &si);
|
||||
/* should still fail */
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08x\n", style);
|
||||
ok( !ret, "GetScrollInfo succeeded unexpectedly. Style is %08lx\n", style);
|
||||
/* clean up */
|
||||
DestroyWindow( hwnd);
|
||||
}
|
||||
@@ -561,6 +561,8 @@ static void test_SetScrollInfo(void)
|
||||
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "scroll bar enabled\n");
|
||||
ret = IsWindowVisible(hScroll);
|
||||
ok(!ret, "Unexpected visible state.\n");
|
||||
|
||||
memset(&si, 0, sizeof(si));
|
||||
si.cbSize = sizeof(si);
|
||||
@@ -581,6 +583,8 @@ static void test_SetScrollInfo(void)
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "scroll bar enabled\n");
|
||||
ret = IsWindowVisible(hScroll);
|
||||
ok(!ret, "Unexpected visible state.\n");
|
||||
|
||||
si.fMask = 0xf;
|
||||
ret = GetScrollInfo(hScroll, SB_CTL, &si);
|
||||
@@ -588,6 +592,8 @@ static void test_SetScrollInfo(void)
|
||||
|
||||
EnableScrollBar(hScroll, SB_CTL, ESB_ENABLE_BOTH);
|
||||
ok(IsWindowEnabled(hScroll), "expected enabled scrollbar\n");
|
||||
ret = IsWindowVisible(hScroll);
|
||||
ok(!ret, "Unexpected visible state.\n");
|
||||
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 10;
|
||||
@@ -597,6 +603,86 @@ static void test_SetScrollInfo(void)
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(ret, "scroll bar disabled\n");
|
||||
ret = IsWindowVisible(hScroll);
|
||||
ok(!ret, "Unexpected visible state.\n");
|
||||
|
||||
/* With visible window. */
|
||||
ShowWindow(mainwnd, SW_SHOW);
|
||||
|
||||
ret = IsWindowVisible(hScroll);
|
||||
ok(ret, "Unexpected visible state.\n");
|
||||
|
||||
EnableScrollBar(hScroll, SB_CTL, ESB_DISABLE_BOTH);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "Unexpected enabled state.\n");
|
||||
|
||||
/* Enabled state is changed only for visible windows, and only with redraw flag. */
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 100;
|
||||
si.nMin = 10;
|
||||
si.nPos = 0;
|
||||
si.nPage = 50;
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, FALSE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "Unexpected enabled state.\n");
|
||||
|
||||
/* State changes when called with same arguments too. */
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 100;
|
||||
si.nMin = 10;
|
||||
si.nPos = 0;
|
||||
si.nPage = 50;
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(ret, "Unexpected enabled state.\n");
|
||||
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 100;
|
||||
si.nMin = 10;
|
||||
si.nPos = 0;
|
||||
si.nPage = 100;
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "Unexpected enabled state.\n");
|
||||
|
||||
EnableScrollBar(hScroll, SB_CTL, ESB_ENABLE_BOTH);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(ret, "Unexpected enabled state.\n");
|
||||
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 100;
|
||||
si.nMin = 10;
|
||||
si.nPos = 0;
|
||||
si.nPage = 100;
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "Unexpected enabled state.\n");
|
||||
|
||||
EnableScrollBar(hScroll, SB_CTL, ESB_DISABLE_BOTH);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(!ret, "Unexpected enabled state.\n");
|
||||
|
||||
si.fMask = SIF_POS|SIF_RANGE|SIF_PAGE|SIF_DISABLENOSCROLL;
|
||||
si.nMax = 41;
|
||||
si.nMin = 0;
|
||||
si.nPos = 0;
|
||||
si.nPage = 41;
|
||||
SetScrollInfo(hScroll, SB_CTL, &si, TRUE);
|
||||
ret = IsWindowEnabled(hScroll);
|
||||
ok(ret, "Unexpected enabled state.\n");
|
||||
|
||||
EnableScrollBar(mainwnd, SB_CTL, ESB_ENABLE_BOTH);
|
||||
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = 3;
|
||||
ret = SetScrollInfo(mainwnd, SB_HORZ, &si, FALSE);
|
||||
ok(ret == 3, "SetScrollInfo returned %d\n", ret);
|
||||
|
||||
/* undocumented flag making SetScrollInfo return previous position */
|
||||
si.fMask = SIF_POS | 0x1000;
|
||||
si.nPos = 4;
|
||||
ret = SetScrollInfo(mainwnd, SB_HORZ, &si, FALSE);
|
||||
ok(ret == 3, "SetScrollInfo returned %d\n", ret);
|
||||
|
||||
DestroyWindow(hScroll);
|
||||
DestroyWindow(mainwnd);
|
||||
@@ -627,7 +713,7 @@ static void test_subclass(void)
|
||||
BOOL r;
|
||||
|
||||
r = GetClassInfoExA(GetModuleHandleA(NULL), "SCROLLBAR", &class_info);
|
||||
ok(r, "GetClassInfoEx failed: %u\n", GetLastError());
|
||||
ok(r, "GetClassInfoEx failed: %lu\n", GetLastError());
|
||||
scrollbar_wndproc = class_info.lpfnWndProc;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
@@ -636,42 +722,41 @@ static void test_subclass(void)
|
||||
wc.lpszClassName = "MyTestSubclass";
|
||||
wc.lpfnWndProc = subclass_proc;
|
||||
r = RegisterClassA(&wc);
|
||||
ok(r, "RegisterClass failed: %u\n", GetLastError());
|
||||
ok(r, "RegisterClass failed: %lu\n", GetLastError());
|
||||
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
r = SetScrollRange(hwnd, SB_CTL, 0, 100, TRUE);
|
||||
ok(r, "SetScrollRange failed: %u\n", GetLastError());
|
||||
ok(r, "SetScrollRange failed: %lu\n", GetLastError());
|
||||
|
||||
res = SetScrollPos(hwnd, SB_CTL, 2, FALSE);
|
||||
ok(!res, "SetScrollPos returned %lu\n", res);
|
||||
ok(!res, "SetScrollPos returned %Iu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 2, "SetScrollPos returned %lu\n", res);
|
||||
ok(res == 2, "SetScrollPos returned %Iu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(res == 1, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(res == 1, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
/* if we skip calling wndproc for WM_CREATE, window is not considered a scrollbar */
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), (void *)1 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
@@ -679,34 +764,274 @@ static void test_subclass(void)
|
||||
wc.cbWndExtra = class_info.cbWndExtra - 1;
|
||||
wc.lpszClassName = "MyTestSubclass2";
|
||||
r = RegisterClassA(&wc);
|
||||
ok(r, "RegisterClass failed: %u\n", GetLastError());
|
||||
ok(r, "RegisterClass failed: %lu\n", GetLastError());
|
||||
|
||||
hwnd = CreateWindowExA( 0, "MyTestSubclass2", "Scroll", WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, GetModuleHandleA(NULL), 0 );
|
||||
ok(hwnd != NULL, "Failed to create window: %u\n", GetLastError());
|
||||
ok(hwnd != NULL, "Failed to create window: %lu\n", GetLastError());
|
||||
|
||||
memset(&scroll_info, 0xcc, sizeof(scroll_info));
|
||||
scroll_info.cbSize = sizeof(scroll_info);
|
||||
res = SendMessageA(hwnd, SBM_GETSCROLLBARINFO, 0, (LPARAM)&scroll_info);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %lu\n", res);
|
||||
ok(!res, "SBM_GETSCROLLBARINFO returned %Iu\n", res);
|
||||
|
||||
memset(&set_scrollinfo, 0xcc, sizeof(set_scrollinfo));
|
||||
res = SetScrollPos(hwnd, SB_CTL, 1, FALSE);
|
||||
ok(res == 0, "SetScrollPos returned %lu\n", res);
|
||||
ok(res == 0, "SetScrollPos returned %Iu\n", res);
|
||||
ok(set_scrollinfo.cbSize == sizeof(SCROLLINFO), "cbSize = %u\n", set_scrollinfo.cbSize);
|
||||
todo_wine
|
||||
ok(set_scrollinfo.fMask == (0x1000 | SIF_POS), "fMask = %x\n", set_scrollinfo.fMask);
|
||||
ok(set_scrollinfo.nPos == 1, "nPos = %x\n", set_scrollinfo.nPos);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void read_process(HWND hMainWnd)
|
||||
{
|
||||
SCROLLBARINFO sbi = {0};
|
||||
SCROLLINFO si;
|
||||
BOOL ret;
|
||||
RECT rect, intersection;
|
||||
BOOL (WINAPI *pGetScrollBarInfo)(HWND, LONG, LPSCROLLBARINFO);
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_PAGE|SIF_POS|SIF_RANGE;
|
||||
si.nMin = si.nMax = si.nPos = (int)0xdeadbeef;
|
||||
si.nPage = 0xdeadbeef;
|
||||
ret = GetScrollInfo( hMainWnd, SB_HORZ, &si );
|
||||
todo_wine ok( ret, "GetScrollInfo should succeed\n" );
|
||||
|
||||
todo_wine ok( si.nMin == 1, "unexpected nMin %i\n", si.nMin );
|
||||
todo_wine ok( si.nMax == 10, "unexpected nMax %i\n", si.nMax );
|
||||
todo_wine ok( si.nPage == 3, "unexpected nPage %u\n", si.nPage );
|
||||
todo_wine ok( si.nPos == 4, "unexpected nPos %i\n", si.nPos );
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_PAGE|SIF_POS|SIF_RANGE;
|
||||
si.nMin = si.nMax = si.nPos = (int)0xdeadbeef;
|
||||
si.nPage = 0xdeadbeef;
|
||||
ret = GetScrollInfo( hMainWnd, SB_VERT, &si );
|
||||
todo_wine ok( ret, "GetScrollInfo should succeed\n" );
|
||||
|
||||
todo_wine ok( si.nMin == 201, "unexpected nMin %i\n", si.nMin );
|
||||
todo_wine ok( si.nMax == 210, "unexpected nMax %i\n", si.nMax );
|
||||
todo_wine ok( si.nPage == 2, "unexpected nPage %u\n", si.nPage );
|
||||
todo_wine ok( si.nPos == 204, "unexpected nPos %i\n", si.nPos );
|
||||
|
||||
pGetScrollBarInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetScrollBarInfo");
|
||||
if (!pGetScrollBarInfo)
|
||||
{
|
||||
win_skip("GetScrollBarInfo is not available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = GetWindowRect( hMainWnd, &rect );
|
||||
ok( ret, "The GetWindowRect() call should not fail.\n" );
|
||||
|
||||
sbi.cbSize = sizeof(sbi);
|
||||
sbi.rgstate[0] = 0xdeadbeef;
|
||||
ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi );
|
||||
todo_wine ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
|
||||
|
||||
if (ret)
|
||||
{
|
||||
IntersectRect( &intersection, &sbi.rcScrollBar, &rect );
|
||||
ok( EqualRect( &intersection, &sbi.rcScrollBar ), "hscroll rect %s outside window rect %s\n",
|
||||
wine_dbgstr_rect( &sbi.rcScrollBar ), wine_dbgstr_rect( &rect ));
|
||||
ok( sbi.rcScrollBar.right - sbi.rcScrollBar.left > sbi.rcScrollBar.bottom - sbi.rcScrollBar.top,
|
||||
"hscroll rect %s should have width > height\n", wine_dbgstr_rect( &rect ));
|
||||
ok( sbi.rgstate[0] == 0, "unexpected hscroll state %#lx\n", sbi.rgstate[0] );
|
||||
}
|
||||
|
||||
sbi.cbSize = sizeof(sbi);
|
||||
sbi.rgstate[0] = 0xdeadbeef;
|
||||
ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi );
|
||||
todo_wine ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
|
||||
|
||||
if (ret)
|
||||
{
|
||||
IntersectRect( &intersection, &sbi.rcScrollBar, &rect );
|
||||
ok( EqualRect( &intersection, &sbi.rcScrollBar ), "vscroll rect %s outside window rect %s\n",
|
||||
wine_dbgstr_rect( &sbi.rcScrollBar ), wine_dbgstr_rect( &rect ));
|
||||
ok( sbi.rcScrollBar.right - sbi.rcScrollBar.left < sbi.rcScrollBar.bottom - sbi.rcScrollBar.top,
|
||||
"vscroll rect %s should have width < height\n", wine_dbgstr_rect( &rect ));
|
||||
ok( sbi.rgstate[0] == 0, "unexpected vscroll state %#lx\n", sbi.rgstate[0] );
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD WINAPI write_process(HWND hMainWnd)
|
||||
{
|
||||
SCROLLBARINFO sbi;
|
||||
SCROLLINFO si;
|
||||
BOOL ret;
|
||||
BOOL (WINAPI *pGetScrollBarInfo)(HWND, LONG, LPSCROLLBARINFO);
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_POS;
|
||||
si.nPos = 6;
|
||||
ret = SetScrollInfo( hMainWnd, SB_HORZ, &si, FALSE );
|
||||
todo_wine ok( ret, "SetScrollInfo should succeed\n" );
|
||||
|
||||
si.nPos = 206;
|
||||
ret = SetScrollInfo( hMainWnd, SB_VERT, &si, FALSE );
|
||||
todo_wine ok( ret, "SetScrollInfo should succeed\n" );
|
||||
|
||||
si.nPos = 0xdeadbeef;
|
||||
ret = GetScrollInfo( hMainWnd, SB_HORZ, &si );
|
||||
todo_wine ok( ret, "GetScrollInfo should succeed\n" );
|
||||
todo_wine ok( si.nPos == 6, "unexpected nPos %i\n", si.nPos );
|
||||
|
||||
si.nPos = 0xdeadbeef;
|
||||
ret = GetScrollInfo( hMainWnd, SB_VERT, &si );
|
||||
todo_wine ok( ret, "GetScrollInfo should succeed\n" );
|
||||
todo_wine ok( si.nPos == 206, "unexpected nPos %i\n", si.nPos );
|
||||
|
||||
pGetScrollBarInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetScrollBarInfo");
|
||||
if (!pGetScrollBarInfo)
|
||||
{
|
||||
win_skip("GetScrollBarInfo is not available\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = EnableScrollBar( hMainWnd, SB_HORZ, ESB_DISABLE_BOTH );
|
||||
todo_wine ok( ret, "EnableScrollBar should succeed\n" );
|
||||
|
||||
ret = ShowScrollBar( hMainWnd, SB_VERT, FALSE );
|
||||
ok( ret, "ShowScrollBar should succeed\n" );
|
||||
|
||||
sbi.cbSize = sizeof(sbi);
|
||||
sbi.rgstate[0] = 0xdeadbeef;
|
||||
ret = pGetScrollBarInfo( hMainWnd, OBJID_HSCROLL, &sbi );
|
||||
todo_wine ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
|
||||
todo_wine ok( sbi.rgstate[0] == STATE_SYSTEM_UNAVAILABLE, "unexpected hscroll state %#lx\n", sbi.rgstate[0] );
|
||||
|
||||
sbi.cbSize = sizeof(sbi);
|
||||
sbi.rgstate[0] = 0xdeadbeef;
|
||||
ret = pGetScrollBarInfo( hMainWnd, OBJID_VSCROLL, &sbi );
|
||||
todo_wine ok( ret, "The GetScrollBarInfo() call should not fail.\n" );
|
||||
todo_wine ok( sbi.rgstate[0] == STATE_SYSTEM_INVISIBLE, "unexpected vscroll state %#lx\n", sbi.rgstate[0] );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_cross_process(const char* argv0)
|
||||
{
|
||||
HWND hMainWnd;
|
||||
BOOL ret;
|
||||
SCROLLINFO si;
|
||||
STARTUPINFOA startup_info = {0};
|
||||
PROCESS_INFORMATION process_info;
|
||||
char path[MAX_PATH];
|
||||
|
||||
hMainWnd = create_main_test_wnd();
|
||||
|
||||
si.cbSize = sizeof(si);
|
||||
si.fMask = SIF_PAGE|SIF_POS|SIF_RANGE;
|
||||
si.nMin = 1;
|
||||
si.nMax = 10;
|
||||
si.nPage = 3;
|
||||
si.nPos = 4;
|
||||
SetScrollInfo( hMainWnd, SB_HORZ, &si, FALSE );
|
||||
|
||||
si.nMin = 201;
|
||||
si.nMax = 210;
|
||||
si.nPage = 2;
|
||||
si.nPos = 204;
|
||||
SetScrollInfo( hMainWnd, SB_VERT, &si, FALSE );
|
||||
|
||||
startup_info.cb = sizeof(startup_info);
|
||||
sprintf( path, "%s scroll read_process %p", argv0, hMainWnd );
|
||||
ret = CreateProcessA( NULL, path, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info );
|
||||
ok(ret, "CreateProcess \"%s\" failed err %lu.\n", path, GetLastError());
|
||||
|
||||
/* Messages do not need to be processed to read info. */
|
||||
winetest_wait_child_process(process_info.hProcess);
|
||||
CloseHandle(process_info.hProcess);
|
||||
CloseHandle(process_info.hThread);
|
||||
|
||||
sprintf( path, "%s scroll write_process %p", argv0, hMainWnd );
|
||||
ret = CreateProcessA( NULL, path, NULL, NULL, FALSE, 0, NULL, NULL, &startup_info, &process_info );
|
||||
ok(ret, "CreateProcess \"%s\" failed err %lu.\n", path, GetLastError());
|
||||
|
||||
/* Modifying info requires a message loop. */
|
||||
while (MsgWaitForMultipleObjects( 1, &process_info.hProcess, FALSE, 5000, QS_SENDMESSAGE ) == 1)
|
||||
{
|
||||
MSG msg;
|
||||
while (PeekMessageA( &msg, NULL, 0, 0, PM_REMOVE ))
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
DispatchMessageA( &msg );
|
||||
}
|
||||
}
|
||||
|
||||
winetest_wait_child_process(process_info.hProcess);
|
||||
CloseHandle(process_info.hProcess);
|
||||
CloseHandle(process_info.hThread);
|
||||
|
||||
DestroyWindow( hScroll );
|
||||
DestroyWindow( hMainWnd );
|
||||
}
|
||||
|
||||
static void test_visual(void)
|
||||
{
|
||||
static const int color_indices[] = {COLOR_SCROLLBAR, COLOR_BTNFACE};
|
||||
static const DWORD styles[] = {SBS_SIZEBOX, SBS_SIZEGRIP};
|
||||
COLORREF old_colors[2], colors[2], color;
|
||||
HWND hwnd;
|
||||
BOOL ret;
|
||||
HDC hdc;
|
||||
int i;
|
||||
|
||||
old_colors[0] = GetSysColor(color_indices[0]);
|
||||
old_colors[1] = GetSysColor(color_indices[1]);
|
||||
colors[0] = RGB(0x11, 0x22, 0x33);
|
||||
colors[1] = RGB(0xaa, 0xbb, 0xcc);
|
||||
ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, colors);
|
||||
ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(styles); ++i)
|
||||
{
|
||||
winetest_push_context("style %#lx", styles[i]);
|
||||
|
||||
hwnd = CreateWindowA("ScrollBar", "", WS_POPUP | WS_VISIBLE | styles[i], 0, 0, 20, 20, 0, 0,
|
||||
0, 0);
|
||||
ok(hwnd != NULL, "CreateWindowA failed, error %lu.\n", GetLastError());
|
||||
RedrawWindow(hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ERASENOW | RDW_FRAME);
|
||||
|
||||
hdc = GetDC(hwnd);
|
||||
color = GetPixel(hdc, 5, 5);
|
||||
ok(color == colors[1], "Expected color %#lx, got %#lx.\n", colors[1], color);
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
DestroyWindow(hwnd);
|
||||
winetest_pop_context();
|
||||
}
|
||||
|
||||
ret = SetSysColors(ARRAY_SIZE(color_indices), color_indices, old_colors);
|
||||
ok(ret, "SetSysColors failed, error %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
START_TEST ( scroll )
|
||||
{
|
||||
char **argv;
|
||||
int argc;
|
||||
WNDCLASSA wc;
|
||||
HMODULE hUxtheme;
|
||||
BOOL (WINAPI * pIsThemeActive)(VOID);
|
||||
|
||||
argc = winetest_get_mainargs(&argv);
|
||||
if (argc >= 4 && (!strcmp( argv[2], "read_process" ) || !strcmp( argv[2], "write_process" )))
|
||||
{
|
||||
long wnd_long = strtol( argv[3], NULL, 16 );
|
||||
HWND wnd = (HWND)(INT_PTR)wnd_long;
|
||||
|
||||
if (!strcmp( argv[2], "read_process" ))
|
||||
read_process( wnd );
|
||||
else
|
||||
write_process( wnd );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
@@ -726,6 +1051,7 @@ START_TEST ( scroll )
|
||||
scrollbar_test_track();
|
||||
test_SetScrollInfo();
|
||||
test_subclass();
|
||||
test_cross_process( argv[0] );
|
||||
|
||||
/* Some test results vary depending of theming being active or not */
|
||||
hUxtheme = LoadLibraryA("uxtheme.dll");
|
||||
@@ -737,6 +1063,8 @@ START_TEST ( scroll )
|
||||
FreeLibrary(hUxtheme);
|
||||
}
|
||||
|
||||
test_visual();
|
||||
|
||||
scrollbar_test_default( 0);
|
||||
scrollbar_test_default( WS_HSCROLL);
|
||||
scrollbar_test_default( WS_VSCROLL);
|
||||
|
||||
@@ -20,20 +20,17 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define STRICT
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#define OEMRESOURCE
|
||||
#include "winuser.h"
|
||||
|
||||
#include "wine/test.h"
|
||||
|
||||
#define TODO_COUNT 1
|
||||
|
||||
#define CTRL_ID 1995
|
||||
|
||||
static HWND hMainWnd;
|
||||
|
||||
#define expect_eq(expr, value, type, fmt) { type val = expr; ok(val == (value), #expr " expected " fmt " got " fmt "\n", (value), val); }
|
||||
|
||||
static int g_nReceivedColorStatic = 0;
|
||||
|
||||
/* try to make sure pending X events have been processed before continuing */
|
||||
@@ -76,14 +73,32 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
|
||||
return DefWindowProcA(hwnd, msg, wparam, lparam);
|
||||
}
|
||||
|
||||
static void test_updates(int style, int flags)
|
||||
static void test_updates(int style)
|
||||
{
|
||||
RECT r1 = {20, 20, 30, 30};
|
||||
RECT r1 = {5, 5, 30, 30}, rcClient;
|
||||
HWND hStatic = build_static(style);
|
||||
int exp;
|
||||
LONG exstyle;
|
||||
|
||||
flush_events();
|
||||
trace("Testing style 0x%x\n", style);
|
||||
|
||||
exstyle = GetWindowLongW(hStatic, GWL_EXSTYLE);
|
||||
if (style == SS_ETCHEDHORZ || style == SS_ETCHEDVERT || style == SS_SUNKEN)
|
||||
ok(exstyle == WS_EX_STATICEDGE, "expected WS_EX_STATICEDGE, got %ld\n", exstyle);
|
||||
else
|
||||
ok(exstyle == 0, "expected 0, got %ld\n", exstyle);
|
||||
|
||||
GetClientRect(hStatic, &rcClient);
|
||||
if (style == SS_ETCHEDVERT)
|
||||
ok(rcClient.right == 0, "expected zero width, got %ld\n", rcClient.right);
|
||||
else
|
||||
ok(rcClient.right > 0, "expected non-zero width, got %ld\n", rcClient.right);
|
||||
if (style == SS_ETCHEDHORZ)
|
||||
ok(rcClient.bottom == 0, "expected zero height, got %ld\n", rcClient.bottom);
|
||||
else
|
||||
ok(rcClient.bottom > 0, "expected non-zero height, got %ld\n", rcClient.bottom);
|
||||
|
||||
g_nReceivedColorStatic = 0;
|
||||
/* during each update parent WndProc will test the WM_CTLCOLORSTATIC message */
|
||||
InvalidateRect(hMainWnd, NULL, FALSE);
|
||||
@@ -104,14 +119,9 @@ static void test_updates(int style, int flags)
|
||||
if (style != SS_ETCHEDHORZ && style != SS_ETCHEDVERT)
|
||||
exp = 4;
|
||||
else
|
||||
exp = 1; /* SS_ETCHED* seems to send WM_CTLCOLORSTATIC only sometimes */
|
||||
exp = 2; /* SS_ETCHEDHORZ/SS_ETCHEDVERT have empty client rect so WM_CTLCOLORSTATIC is sent only when parent window is invalidated */
|
||||
|
||||
if (flags & TODO_COUNT)
|
||||
todo_wine { expect_eq(g_nReceivedColorStatic, exp, int, "%d"); }
|
||||
else if ((style & SS_TYPEMASK) == SS_ICON || (style & SS_TYPEMASK) == SS_BITMAP)
|
||||
ok( g_nReceivedColorStatic == exp, "expected %u got %u\n", exp, g_nReceivedColorStatic );
|
||||
else
|
||||
expect_eq(g_nReceivedColorStatic, exp, int, "%d");
|
||||
ok( g_nReceivedColorStatic == exp, "expected %u, got %u\n", exp, g_nReceivedColorStatic );
|
||||
DestroyWindow(hStatic);
|
||||
}
|
||||
|
||||
@@ -130,6 +140,211 @@ static void test_set_text(void)
|
||||
DestroyWindow(hStatic);
|
||||
}
|
||||
|
||||
static void test_image(HBITMAP image)
|
||||
{
|
||||
BITMAP bm;
|
||||
HDC hdc;
|
||||
BITMAPINFO info;
|
||||
BYTE bits[4];
|
||||
#ifdef __REACTOS__
|
||||
UINT display_bpp;
|
||||
|
||||
hdc = GetDC(0);
|
||||
display_bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
ReleaseDC(0, hdc);
|
||||
#endif
|
||||
|
||||
GetObjectW(image, sizeof(bm), &bm);
|
||||
ok(bm.bmWidth == 1, "got %d\n", bm.bmWidth);
|
||||
ok(bm.bmHeight == 1, "got %d\n", bm.bmHeight);
|
||||
#ifdef __REACTOS__
|
||||
ok(bm.bmBitsPixel == display_bpp, "got %d\n", bm.bmBitsPixel);
|
||||
#else
|
||||
ok(bm.bmBitsPixel == 32, "got %d\n", bm.bmBitsPixel);
|
||||
#endif
|
||||
ok(bm.bmBits == NULL, "bmBits is not NULL\n");
|
||||
|
||||
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
info.bmiHeader.biWidth = bm.bmWidth;
|
||||
info.bmiHeader.biHeight = bm.bmHeight;
|
||||
info.bmiHeader.biPlanes = 1;
|
||||
info.bmiHeader.biBitCount = 32;
|
||||
info.bmiHeader.biCompression = BI_RGB;
|
||||
info.bmiHeader.biSizeImage = 4;
|
||||
info.bmiHeader.biXPelsPerMeter = 0;
|
||||
info.bmiHeader.biYPelsPerMeter = 0;
|
||||
info.bmiHeader.biClrUsed = 0;
|
||||
info.bmiHeader.biClrImportant = 0;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
GetDIBits(hdc, image, 0, bm.bmHeight, bits, &info, DIB_RGB_COLORS);
|
||||
DeleteDC(hdc);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
ok(bits[0] == 0x11 && bits[1] == 0x22 && bits[2] == 0x33 && (display_bpp == 32 ? bits[3] == 0x44 : bits[3] == 0x00),
|
||||
"bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
|
||||
#else
|
||||
ok(bits[0] == 0x11 && bits[1] == 0x22 && bits[2] == 0x33 && bits[3] == 0x44,
|
||||
"bits: %02x %02x %02x %02x\n", bits[0], bits[1], bits[2], bits[3]);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void test_set_image(void)
|
||||
{
|
||||
HWND hwnd = build_static(SS_BITMAP);
|
||||
HBITMAP bmp, image;
|
||||
|
||||
image = LoadImageW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(101), IMAGE_BITMAP, 0, 0, 0);
|
||||
ok(image != NULL, "LoadImage failed\n");
|
||||
|
||||
test_image(image);
|
||||
|
||||
bmp = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image);
|
||||
ok(bmp == NULL, "got not NULL\n");
|
||||
|
||||
bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
|
||||
ok(bmp != NULL, "got NULL\n");
|
||||
ok(bmp == image, "bmp != image\n");
|
||||
|
||||
bmp = (HBITMAP)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)image);
|
||||
ok(bmp != NULL, "got NULL\n");
|
||||
ok(bmp == image, "bmp != image\n");
|
||||
test_image(image);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
DeleteObject(image);
|
||||
|
||||
hwnd = CreateWindowW(L"static", L"\uffff\x65", WS_VISIBLE|WS_CHILD|SS_BITMAP, 5, 5, 100, 100,
|
||||
hMainWnd, (HMENU)CTRL_ID, GetModuleHandleW(NULL), 0);
|
||||
|
||||
bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
|
||||
ok(bmp != NULL, "got NULL\n");
|
||||
test_image(bmp);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
hwnd = CreateWindowA("static", "\xff\x65\0", WS_VISIBLE|WS_CHILD|SS_BITMAP, 5, 5, 100, 100,
|
||||
hMainWnd, (HMENU)CTRL_ID, GetModuleHandleW(NULL), 0);
|
||||
|
||||
bmp = (HBITMAP)SendMessageW(hwnd, STM_GETIMAGE, IMAGE_BITMAP, 0);
|
||||
ok(bmp != NULL, "got NULL\n");
|
||||
test_image(bmp);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_STM_SETIMAGE(void)
|
||||
{
|
||||
DWORD type;
|
||||
HWND hwnd;
|
||||
HICON icon, old_image;
|
||||
HBITMAP bmp;
|
||||
HENHMETAFILE emf;
|
||||
HDC dc;
|
||||
|
||||
icon = LoadIconW(0, (LPCWSTR)IDI_APPLICATION);
|
||||
bmp = LoadBitmapW(0, (LPCWSTR)OBM_CLOSE);
|
||||
dc = CreateEnhMetaFileW(0, NULL, NULL, NULL);
|
||||
LineTo(dc, 1, 1);
|
||||
emf = CloseEnhMetaFile(dc);
|
||||
DeleteDC(dc);
|
||||
|
||||
for (type = SS_LEFT; type < SS_ETCHEDFRAME; type++)
|
||||
{
|
||||
winetest_push_context("%lu", type);
|
||||
|
||||
hwnd = build_static(type);
|
||||
ok(hwnd != 0, "failed to create static type %#lx\n", type);
|
||||
|
||||
/* set icon */
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)icon);
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
if (type == SS_ICON)
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
else
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_ICON, (LPARAM)icon);
|
||||
if (type == SS_ICON)
|
||||
{
|
||||
ok(old_image != 0, "got %p\n", old_image);
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETICON, (WPARAM)icon, 0);
|
||||
if (type == SS_ICON)
|
||||
{
|
||||
ok(old_image != 0, "got %p\n", old_image);
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
|
||||
/* set bitmap */
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bmp);
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
if (type == SS_BITMAP)
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
else
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)bmp);
|
||||
if (type == SS_BITMAP)
|
||||
{
|
||||
ok(old_image != 0, "got %p\n", old_image);
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
|
||||
/* set EMF */
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)emf);
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
if (type == SS_ENHMETAFILE)
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
else
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
|
||||
g_nReceivedColorStatic = 0;
|
||||
old_image = (HICON)SendMessageW(hwnd, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)emf);
|
||||
if (type == SS_ENHMETAFILE)
|
||||
{
|
||||
ok(old_image != 0, "got %p\n", old_image);
|
||||
ok(g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(!old_image, "got %p\n", old_image);
|
||||
ok(!g_nReceivedColorStatic, "Unexpected WM_CTLCOLORSTATIC value %d\n", g_nReceivedColorStatic);
|
||||
}
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
winetest_pop_context();
|
||||
}
|
||||
|
||||
DestroyIcon(icon);
|
||||
DeleteObject(bmp);
|
||||
DeleteEnhMetaFile(emf);
|
||||
}
|
||||
|
||||
START_TEST(static)
|
||||
{
|
||||
static const char szClassName[] = "testclass";
|
||||
@@ -152,16 +367,24 @@ START_TEST(static)
|
||||
hMainWnd = CreateWindowA(szClassName, "Test", WS_OVERLAPPEDWINDOW, 0, 0, 500, 500, NULL, NULL, GetModuleHandleA(NULL), NULL);
|
||||
ShowWindow(hMainWnd, SW_SHOW);
|
||||
|
||||
test_updates(0, 0);
|
||||
test_updates(SS_SIMPLE, 0);
|
||||
test_updates(SS_ICON, 0);
|
||||
test_updates(SS_BITMAP, 0);
|
||||
test_updates(SS_BITMAP | SS_CENTERIMAGE, 0);
|
||||
test_updates(SS_BLACKRECT, TODO_COUNT);
|
||||
test_updates(SS_WHITERECT, TODO_COUNT);
|
||||
test_updates(SS_ETCHEDHORZ, TODO_COUNT);
|
||||
test_updates(SS_ETCHEDVERT, TODO_COUNT);
|
||||
test_updates(0);
|
||||
test_updates(SS_ICON);
|
||||
test_updates(SS_BLACKRECT);
|
||||
test_updates(SS_WHITERECT);
|
||||
test_updates(SS_BLACKFRAME);
|
||||
test_updates(SS_WHITEFRAME);
|
||||
test_updates(SS_USERITEM);
|
||||
test_updates(SS_SIMPLE);
|
||||
test_updates(SS_OWNERDRAW);
|
||||
test_updates(SS_BITMAP);
|
||||
test_updates(SS_BITMAP | SS_CENTERIMAGE);
|
||||
test_updates(SS_ETCHEDHORZ);
|
||||
test_updates(SS_ETCHEDVERT);
|
||||
test_updates(SS_ETCHEDFRAME);
|
||||
test_updates(SS_SUNKEN);
|
||||
test_set_text();
|
||||
test_set_image();
|
||||
test_STM_SETIMAGE();
|
||||
|
||||
DestroyWindow(hMainWnd);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2023 Zhiyi Zhang for CodeWeavers
|
||||
*
|
||||
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#pragma makedep testdll
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
|
||||
LRESULT CALLBACK dummy_hook_proc(int code, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
return CallNextHookEx(0, code, wp, lp);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
@ stdcall dummy_hook_proc(long ptr ptr)
|
||||
@@ -12,27 +12,12 @@ extern void func_dce(void);
|
||||
extern void func_dde(void);
|
||||
extern void func_dialog(void);
|
||||
extern void func_edit(void);
|
||||
//extern void func_generated(void);
|
||||
extern void func_generated(void);
|
||||
extern void func_input(void);
|
||||
extern void func_listbox(void);
|
||||
extern void func_menu(void);
|
||||
extern void func_monitor(void);
|
||||
//extern void func_msg(void);
|
||||
extern void func_msg_queue(void);
|
||||
extern void func_msg_messages(void);
|
||||
extern void func_msg_focus(void);
|
||||
extern void func_msg_winpos(void);
|
||||
extern void func_msg_paint(void);
|
||||
extern void func_msg_input(void);
|
||||
extern void func_msg_timer(void);
|
||||
extern void func_msg_hook(void);
|
||||
extern void func_msg_menu(void);
|
||||
extern void func_msg_mdi(void);
|
||||
extern void func_msg_controls(void);
|
||||
extern void func_msg_layered_window(void);
|
||||
extern void func_msg_dialog(void);
|
||||
extern void func_msg_clipboard(void);
|
||||
extern void func_rawinput(void);
|
||||
extern void func_msg(void);
|
||||
extern void func_resource(void);
|
||||
extern void func_scroll(void);
|
||||
extern void func_static(void);
|
||||
@@ -54,26 +39,12 @@ const struct test winetest_testlist[] =
|
||||
{ "dde", func_dde },
|
||||
{ "dialog", func_dialog },
|
||||
{ "edit", func_edit },
|
||||
//{ "generated", func_generated },
|
||||
{ "generated", func_generated },
|
||||
{ "input", func_input },
|
||||
{ "listbox", func_listbox },
|
||||
{ "menu", func_menu },
|
||||
{ "monitor", func_monitor },
|
||||
{ "msg_queue", func_msg_queue},
|
||||
{ "msg_messages", func_msg_messages},
|
||||
{ "msg_focus", func_msg_focus},
|
||||
{ "msg_winpos", func_msg_winpos},
|
||||
{ "msg_paint", func_msg_paint},
|
||||
{ "msg_input", func_msg_input},
|
||||
{ "msg_timer", func_msg_timer},
|
||||
{ "msg_hook", func_msg_hook},
|
||||
{ "msg_menu", func_msg_menu},
|
||||
{ "msg_mdi", func_msg_mdi},
|
||||
{ "msg_controls", func_msg_controls},
|
||||
{ "msg_layered_window", func_msg_layered_window},
|
||||
{ "msg_dialog", func_msg_dialog},
|
||||
{ "msg_clipboard", func_msg_clipboard},
|
||||
{ "rawinput", func_rawinput },
|
||||
{ "msg", func_msg },
|
||||
{ "resource", func_resource },
|
||||
{ "scroll", func_scroll },
|
||||
{ "static", func_static },
|
||||
|
||||
@@ -45,6 +45,8 @@ static void test_DrawTextCalcRect(void)
|
||||
static WCHAR emptystringW[] = { 0 };
|
||||
static CHAR wordbreak_text[] = "line1 line2";
|
||||
static WCHAR wordbreak_textW[] = {'l','i','n','e','1',' ','l','i','n','e','2',0};
|
||||
static WCHAR wordbreak_text_colonW[] = {'l','i','n','e','1',' ','l','i','n','e','2',' ',':',0};
|
||||
static WCHAR wordbreak_text_csbW[] = {'l','i','n','e','1',' ','l','i','n','e','2',' ',']',0};
|
||||
static char tabstring[] = "one\ttwo";
|
||||
INT textlen, textheight, heightcheck;
|
||||
RECT rect = { 0, 0, 100, 0 }, rect2;
|
||||
@@ -55,9 +57,9 @@ static void test_DrawTextCalcRect(void)
|
||||
/* Initialization */
|
||||
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
|
||||
0, 0, 200, 200, 0, 0, 0, NULL);
|
||||
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
|
||||
ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC error %u\n", GetLastError());
|
||||
ok(hdc != 0, "GetDC error %lu\n", GetLastError());
|
||||
trace("hdc %p\n", hdc);
|
||||
textlen = lstrlenA(text);
|
||||
|
||||
@@ -74,23 +76,23 @@ static void test_DrawTextCalcRect(void)
|
||||
SetMapMode(hdc, MM_HIENGLISH);
|
||||
lf.lfHeight = 100 * 9 / 72; /* 9 point */
|
||||
hFont = CreateFontIndirectA(&lf);
|
||||
ok(hFont != 0, "CreateFontIndirectA error %u\n",
|
||||
ok(hFont != 0, "CreateFontIndirectA error %lu\n",
|
||||
GetLastError());
|
||||
hOldFont = SelectObject(hdc, hFont);
|
||||
|
||||
textheight = DrawTextA(hdc, text, textlen, &rect, DT_CALCRECT |
|
||||
DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
|
||||
DT_NOPREFIX);
|
||||
ok( textheight, "DrawTextA error %u\n", GetLastError());
|
||||
ok( textheight, "DrawTextA error %lu\n", GetLastError());
|
||||
|
||||
trace("MM_HIENGLISH rect.bottom %d\n", rect.bottom);
|
||||
trace("MM_HIENGLISH rect.bottom %ld\n", rect.bottom);
|
||||
ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with "
|
||||
"DT_CALCRECT should return a negative rectangle bottom. "
|
||||
"(bot=%d)\n", rect.bottom);
|
||||
"(bot=%ld)\n", rect.bottom);
|
||||
|
||||
SelectObject(hdc, hOldFont);
|
||||
ret = DeleteObject(hFont);
|
||||
ok( ret, "DeleteObject error %u\n", GetLastError());
|
||||
ok( ret, "DeleteObject error %lu\n", GetLastError());
|
||||
|
||||
|
||||
/* DrawText in MM_TEXT with DT_CALCRECT */
|
||||
@@ -98,18 +100,18 @@ static void test_DrawTextCalcRect(void)
|
||||
lf.lfHeight = -MulDiv(9, GetDeviceCaps(hdc,
|
||||
LOGPIXELSY), 72); /* 9 point */
|
||||
hFont = CreateFontIndirectA(&lf);
|
||||
ok(hFont != 0, "CreateFontIndirectA error %u\n",
|
||||
ok(hFont != 0, "CreateFontIndirectA error %lu\n",
|
||||
GetLastError());
|
||||
hOldFont = SelectObject(hdc, hFont);
|
||||
|
||||
textheight = DrawTextA(hdc, text, textlen, &rect, DT_CALCRECT |
|
||||
DT_EXTERNALLEADING | DT_WORDBREAK | DT_NOCLIP | DT_LEFT |
|
||||
DT_NOPREFIX);
|
||||
ok( textheight, "DrawTextA error %u\n", GetLastError());
|
||||
ok( textheight, "DrawTextA error %lu\n", GetLastError());
|
||||
|
||||
trace("MM_TEXT rect.bottom %d\n", rect.bottom);
|
||||
trace("MM_TEXT rect.bottom %ld\n", rect.bottom);
|
||||
ok(rect.bottom > 0, "In MM_TEXT, DrawText with DT_CALCRECT "
|
||||
"should return a positive rectangle bottom. (bot=%d)\n",
|
||||
"should return a positive rectangle bottom. (bot=%ld)\n",
|
||||
rect.bottom);
|
||||
|
||||
/* empty or null text should in some cases calc an empty rectangle */
|
||||
@@ -326,12 +328,12 @@ static void test_DrawTextCalcRect(void)
|
||||
dtp.iLeftMargin = 8;
|
||||
SetRectEmpty(&rect);
|
||||
DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
|
||||
ok(rect.right==dtp.iLeftMargin+textlen ,"Incorrect left margin calculated rc(%d,%d)\n", rect.left, rect.right);
|
||||
ok(rect.right==dtp.iLeftMargin+textlen ,"Incorrect left margin calculated rc(%ld,%ld)\n", rect.left, rect.right);
|
||||
dtp.iLeftMargin = 0;
|
||||
dtp.iRightMargin = 8;
|
||||
SetRectEmpty(&rect);
|
||||
DrawTextExA(hdc, text, -1, &rect, DT_CALCRECT, &dtp);
|
||||
ok(rect.right==dtp.iRightMargin+textlen ,"Incorrect right margin calculated rc(%d,%d)\n", rect.left, rect.right);
|
||||
ok(rect.right==dtp.iRightMargin+textlen ,"Incorrect right margin calculated rc(%ld,%ld)\n", rect.left, rect.right);
|
||||
|
||||
/* Wide char versions */
|
||||
SetRect( &rect, 10,10, 100, 100);
|
||||
@@ -519,15 +521,46 @@ static void test_DrawTextCalcRect(void)
|
||||
ok(textheight==0,"Got textheight from DrawTextExW\n");
|
||||
ok(dtp.uiLengthDrawn==1337, "invalid dtp.uiLengthDrawn = %i\n",dtp.uiLengthDrawn);
|
||||
}
|
||||
|
||||
/* When passing invalid DC, other parameters must be ignored - no crashes on invalid pointers */
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (is_reactos()) {
|
||||
ok(FALSE, "FIXME: invalid pointer tests crash on ReactOS.\n");
|
||||
} else {
|
||||
#endif
|
||||
SetLastError(0xdeadbeef);
|
||||
textheight = DrawTextExW((HDC)0xdeadbeef, (LPWSTR)0xdeadbeef, 100000, &rect, 0, 0);
|
||||
ok(textheight == 0, "Got textheight from DrawTextExW\n");
|
||||
ok(GetLastError() == 0xdeadbeef,"Got error %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
textheight = DrawTextExW((HDC)0xdeadbeef, 0, -1, (LPRECT)0xdeadbeef, DT_CALCRECT, 0);
|
||||
ok(textheight == 0, "Got textheight from DrawTextExW\n");
|
||||
ok(GetLastError() == 0xdeadbeef,"Got error %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
textheight = DrawTextExA((HDC)0xdeadbeef, 0, -1, (LPRECT)0xdeadbeef, DT_CALCRECT, 0);
|
||||
ok(textheight == 0, "Got textheight from DrawTextExA\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_INVALID_HANDLE,"Got error %lu\n", GetLastError());
|
||||
#ifdef __REACTOS__
|
||||
}
|
||||
#endif
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes */
|
||||
textheight = DrawTextExA((HDC)0xdeadbeef, (LPSTR)0xdeadbeef, 100, &rect, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/* More test cases from bug 12226 */
|
||||
SetRectEmpty(&rect);
|
||||
textheight = DrawTextA(hdc, emptystring, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
|
||||
ok(textheight, "DrawTextA error %u\n", GetLastError());
|
||||
ok(0 == rect.left, "expected 0, got %d\n", rect.left);
|
||||
ok(0 == rect.right, "expected 0, got %d\n", rect.right);
|
||||
ok(0 == rect.top, "expected 0, got %d\n", rect.top);
|
||||
ok(textheight, "DrawTextA error %lu\n", GetLastError());
|
||||
ok(0 == rect.left, "expected 0, got %ld\n", rect.left);
|
||||
ok(0 == rect.right, "expected 0, got %ld\n", rect.right);
|
||||
ok(0 == rect.top, "expected 0, got %ld\n", rect.top);
|
||||
ok(rect.bottom, "rect.bottom should not be 0\n");
|
||||
|
||||
SetRectEmpty(&rect);
|
||||
@@ -538,10 +571,10 @@ static void test_DrawTextCalcRect(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(textheight, "DrawTextW error %u\n", GetLastError());
|
||||
ok(0 == rect.left, "expected 0, got %d\n", rect.left);
|
||||
ok(0 == rect.right, "expected 0, got %d\n", rect.right);
|
||||
ok(0 == rect.top, "expected 0, got %d\n", rect.top);
|
||||
ok(textheight, "DrawTextW error %lu\n", GetLastError());
|
||||
ok(0 == rect.left, "expected 0, got %ld\n", rect.left);
|
||||
ok(0 == rect.right, "expected 0, got %ld\n", rect.right);
|
||||
ok(0 == rect.top, "expected 0, got %ld\n", rect.top);
|
||||
ok(rect.bottom, "rect.bottom should not be 0\n");
|
||||
}
|
||||
|
||||
@@ -567,6 +600,36 @@ static void test_DrawTextCalcRect(void)
|
||||
ok(textheight >= heightcheck * 6, "Got unexpected textheight %d, expected at least %d.\n",
|
||||
textheight, heightcheck * 6);
|
||||
|
||||
/* Word break tests with space before punctuation */
|
||||
SetRect(&rect, 0, 0, 200, 1);
|
||||
textheight = DrawTextW(hdc, wordbreak_text_colonW, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
|
||||
ok(textheight == heightcheck, "Got unexpected textheight %d, expected %d.\n",
|
||||
textheight, heightcheck);
|
||||
|
||||
rect2 = rect;
|
||||
rect.right--;
|
||||
|
||||
textheight = DrawTextW(hdc, wordbreak_text_colonW, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
|
||||
ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n",
|
||||
textheight, heightcheck * 2);
|
||||
ok(rect.right > rect2.right - 10, "Got unexpected textwdith %ld, expected larger than %ld.\n",
|
||||
rect.right, rect2.right - 10);
|
||||
|
||||
SetRect(&rect, 0, 0, 200, 1);
|
||||
textheight = DrawTextW(hdc, wordbreak_text_csbW, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
|
||||
ok(textheight == heightcheck, "Got unexpected textheight %d, expected %d.\n",
|
||||
textheight, heightcheck);
|
||||
|
||||
rect2 = rect;
|
||||
rect.right--;
|
||||
|
||||
textheight = DrawTextW(hdc, wordbreak_text_csbW, -1, &rect, DT_CALCRECT | DT_WORDBREAK);
|
||||
ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n",
|
||||
textheight, heightcheck * 2);
|
||||
ok(rect.right > rect2.right - 10, "Got unexpected textwdith %ld, expected larger than %ld.\n",
|
||||
rect.right, rect2.right - 10);
|
||||
|
||||
|
||||
/* DT_TABSTOP | DT_EXPANDTABS tests */
|
||||
SetRect( &rect, 0,0, 10, 10);
|
||||
textheight = DrawTextA(hdc, tabstring, -1, &rect, DT_TABSTOP | DT_EXPANDTABS );
|
||||
@@ -595,22 +658,22 @@ static void test_DrawTextCalcRect(void)
|
||||
textheight = DrawTextExA(hdc, tabstring, -1, &rect, DT_CALCRECT | DT_TABSTOP | DT_EXPANDTABS, &dtp);
|
||||
ok(textheight >= heightcheck, "Got unexpected textheight %d\n", textheight);
|
||||
ok(dtp.iTabLength == 8, "invalid dtp.iTabLength = %i\n",dtp.iTabLength);
|
||||
ok(rect.left == rect2.left, "unexpected value %d, got %d\n", rect.left, rect2.left);
|
||||
ok(rect.left == rect2.left, "unexpected value %ld, got %ld\n", rect.left, rect2.left);
|
||||
/* XP, 2003 appear to not give the same values. */
|
||||
ok(rect.right == rect2.right || broken(rect.right > rect2.right), "unexpected value %d, got %d\n",rect.right, rect2.right);
|
||||
ok(rect.top == rect2.top, "unexpected value %d, got %d\n", rect.top, rect2.top);
|
||||
ok(rect.bottom == rect2.bottom , "unexpected value %d, got %d\n", rect.bottom, rect2.bottom);
|
||||
ok(rect.right == rect2.right || broken(rect.right > rect2.right), "unexpected value %ld, got %ld\n",rect.right, rect2.right);
|
||||
ok(rect.top == rect2.top, "unexpected value %ld, got %ld\n", rect.top, rect2.top);
|
||||
ok(rect.bottom == rect2.bottom , "unexpected value %ld, got %ld\n", rect.bottom, rect2.bottom);
|
||||
|
||||
|
||||
SelectObject(hdc, hOldFont);
|
||||
ret = DeleteObject(hFont);
|
||||
ok( ret, "DeleteObject error %u\n", GetLastError());
|
||||
ok( ret, "DeleteObject error %lu\n", GetLastError());
|
||||
|
||||
/* Clean up */
|
||||
ret = ReleaseDC(hwnd, hdc);
|
||||
ok( ret, "ReleaseDC error %u\n", GetLastError());
|
||||
ok( ret, "ReleaseDC error %lu\n", GetLastError());
|
||||
ret = DestroyWindow(hwnd);
|
||||
ok( ret, "DestroyWindow error %u\n", GetLastError());
|
||||
ok( ret, "DestroyWindow error %lu\n", GetLastError());
|
||||
}
|
||||
|
||||
/* replace tabs by \t */
|
||||
@@ -631,7 +694,7 @@ static void strfmt( const char *str, char *strout)
|
||||
extent = GetTabbedTextExtentA( hdc, string, strlen( string), (tabcount), tabs); \
|
||||
strfmt( string, strdisp); \
|
||||
/* trace( "Extent is %08lx\n", extent); */\
|
||||
ok( extent == _exp, "Test case \"%s\". Text extent is 0x%x, expected 0x%x tab %d tabcount %d\n", \
|
||||
ok( extent == _exp, "Test case \"%s\". Text extent is 0x%lx, expected 0x%lx tab %d tabcount %d\n", \
|
||||
strdisp, extent, _exp, tabval, tabcount); \
|
||||
} \
|
||||
|
||||
@@ -648,12 +711,12 @@ static void test_TabbedText(void)
|
||||
/* Initialization */
|
||||
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP,
|
||||
0, 0, 200, 200, 0, 0, 0, NULL);
|
||||
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
|
||||
ok(hwnd != 0, "CreateWindowExA error %lu\n", GetLastError());
|
||||
hdc = GetDC(hwnd);
|
||||
ok(hdc != 0, "GetDC error %u\n", GetLastError());
|
||||
ok(hdc != 0, "GetDC error %lu\n", GetLastError());
|
||||
|
||||
ret = GetTextMetricsA( hdc, &tm);
|
||||
ok( ret, "GetTextMetrics error %u\n", GetLastError());
|
||||
ok( ret, "GetTextMetrics error %lu\n", GetLastError());
|
||||
|
||||
extent = GetTabbedTextExtentA( hdc, "x", 0, 1, tabs);
|
||||
ok( extent == 0, "GetTabbedTextExtentA returned non-zero on nCount == 0\n");
|
||||
@@ -721,24 +784,24 @@ static void test_DrawState(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, (LPARAM)text, strlen(text),
|
||||
0, 0, 10, 10, DST_TEXT);
|
||||
ok(ret, "DrawState error %u\n", GetLastError());
|
||||
ok(ret, "DrawState error %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, (LPARAM)text, 0,
|
||||
0, 0, 10, 10, DST_TEXT);
|
||||
ok(ret, "DrawState error %u\n", GetLastError());
|
||||
ok(ret, "DrawState error %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, 0, strlen(text),
|
||||
0, 0, 10, 10, DST_TEXT);
|
||||
ok(!ret || broken(ret) /* win98 */, "DrawState succeeded\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "not expected error %u\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "not expected error %lu\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = DrawStateA(hdc, GetStockObject(DKGRAY_BRUSH), NULL, 0, 0,
|
||||
0, 0, 10, 10, DST_TEXT);
|
||||
ok(!ret || broken(ret) /* win98 */, "DrawState succeeded\n");
|
||||
ok(GetLastError() == 0xdeadbeef, "not expected error %u\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "not expected error %lu\n", GetLastError());
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
DestroyWindow(hwnd);
|
||||
|
||||
@@ -46,7 +46,7 @@ static void test_FillRect(void)
|
||||
oldhbmp = SelectObject(hdcmem, hbmp);
|
||||
ok(oldhbmp != NULL, "SelectObject returned NULL\n"); /* a memdc always has a bitmap selected */
|
||||
col = GetPixel(hdcmem, 0, 0);
|
||||
ok( col == 0xffffff, "GetPixel returned %08x, expected 0xffffff\n", col);
|
||||
ok( col == 0xffffff, "GetPixel returned %08lx, expected 0xffffff\n", col);
|
||||
|
||||
/* select black brush */
|
||||
old_brush = SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
|
||||
@@ -55,7 +55,7 @@ static void test_FillRect(void)
|
||||
SelectObject(hdcmem, old_brush);
|
||||
/* bitmap filled with last selected brush */
|
||||
col = GetPixel(hdcmem, 0, 0);
|
||||
ok(col == 0, "GetPixel returned %08x, expected 0\n", col);
|
||||
ok(col == 0, "GetPixel returned %08lx, expected 0\n", col);
|
||||
|
||||
SelectObject(hdcmem, oldhbmp);
|
||||
DeleteObject(hbmp);
|
||||
|
||||
+5508
-1338
File diff suppressed because it is too large
Load Diff
@@ -18,12 +18,18 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#define WIN32_NO_STATUS
|
||||
#include <ntndk.h>
|
||||
#endif
|
||||
#include "wine/test.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "wine/winternl.h"
|
||||
#ifndef __REACTOS__
|
||||
#include "winternl.h"
|
||||
#endif
|
||||
|
||||
static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
||||
|
||||
@@ -51,7 +57,12 @@ static void register_class(void)
|
||||
WNDCLASSA cls;
|
||||
|
||||
cls.style = CS_DBLCLKS;
|
||||
cls.lpfnWndProc = DefWindowProcA;
|
||||
/* Windows < Vista apparently checks lpfnWndProc against the address of
|
||||
* DefWindowProcA(), and for some reason fails to change the thread desktop
|
||||
* after creating and destroying a window if it doesn't match. Using an IAT
|
||||
* (as is default) or a wrapper triggers this, so use GetProcAddress() as
|
||||
* a workaround. */
|
||||
cls.lpfnWndProc = (void *)GetProcAddress(GetModuleHandleA("user32"), "DefWindowProcA");
|
||||
cls.cbClsExtra = 0;
|
||||
cls.cbWndExtra = 0;
|
||||
cls.hInstance = GetModuleHandleA(0);
|
||||
@@ -76,11 +87,11 @@ static DWORD CALLBACK thread( LPVOID arg )
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseHandle( d1 ), "CloseHandle succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %ld\n", GetLastError() );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseDesktop( d1 ), "CloseDesktop succeeded\n" );
|
||||
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
|
||||
"bad last error %d\n", GetLastError() );
|
||||
"bad last error %ld\n", GetLastError() );
|
||||
print_object( d1 );
|
||||
d2 = CreateDesktopA( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||
trace( "created desktop %p\n", d2 );
|
||||
@@ -89,7 +100,7 @@ static DWORD CALLBACK thread( LPVOID arg )
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !SetThreadDesktop( d2 ), "set thread desktop succeeded with existing window\n" );
|
||||
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
|
||||
"bad last error %d\n", GetLastError() );
|
||||
"bad last error %ld\n", GetLastError() );
|
||||
|
||||
DestroyWindow( hwnd );
|
||||
ok( SetThreadDesktop( d2 ), "set thread desktop failed\n" );
|
||||
@@ -113,9 +124,12 @@ static void test_handles(void)
|
||||
HANDLE hthread;
|
||||
DWORD id, flags, le;
|
||||
ATOM atom;
|
||||
char buffer[20];
|
||||
char buffer[29], default_name[29] = "";
|
||||
DWORD size;
|
||||
BOOL ret;
|
||||
OBJECT_BASIC_INFORMATION info;
|
||||
TOKEN_STATISTICS token_stats;
|
||||
NTSTATUS status;
|
||||
|
||||
/* win stations */
|
||||
|
||||
@@ -124,9 +138,14 @@ static void test_handles(void)
|
||||
ok( !CloseWindowStation(w1), "closing process win station succeeded\n" );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseHandle(w1), "closing process win station handle succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %ld\n", GetLastError() );
|
||||
print_object( w1 );
|
||||
|
||||
status = NtQueryObject( w1, ObjectBasicInformation, &info, sizeof(info), NULL );
|
||||
ok( !status, "NtQueryObject failed, status %#lx\n", status );
|
||||
ok( info.GrantedAccess == (STANDARD_RIGHTS_REQUIRED | WINSTA_ALL_ACCESS),
|
||||
"Got unexpected access %#lx\n", info.GrantedAccess );
|
||||
|
||||
flags = 0;
|
||||
ok( GetHandleInformation( w1, &flags ), "GetHandleInformation failed\n" );
|
||||
ok( !(flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) ||
|
||||
@@ -143,14 +162,14 @@ static void test_handles(void)
|
||||
|
||||
w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
|
||||
le = GetLastError();
|
||||
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", le );
|
||||
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%lu)\n", le );
|
||||
if (w2 != 0)
|
||||
{
|
||||
ok( w2 != w1, "CreateWindowStation returned default handle\n" );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseDesktop( (HDESK)w2 ), "CloseDesktop succeeded on win station\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */
|
||||
"bad last error %d\n", GetLastError() );
|
||||
"bad last error %ld\n", GetLastError() );
|
||||
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
|
||||
|
||||
w2 = CreateWindowStationA("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
|
||||
@@ -170,7 +189,7 @@ static void test_handles(void)
|
||||
CreateMutexA( NULL, 0, "foobar" );
|
||||
w2 = CreateWindowStationA("foobar", 0, WINSTA_ALL_ACCESS, NULL );
|
||||
le = GetLastError();
|
||||
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "create foobar station failed (%u)\n", le );
|
||||
ok( w2 != 0 || le == ERROR_ACCESS_DENIED, "create foobar station failed (%lu)\n", le );
|
||||
|
||||
if (w2 != 0)
|
||||
{
|
||||
@@ -210,36 +229,49 @@ static void test_handles(void)
|
||||
SetLastError( 0xdeadbeef );
|
||||
w2 = OpenWindowStationA( "", TRUE, WINSTA_ALL_ACCESS );
|
||||
ok( !w2, "open station succeeded\n" );
|
||||
todo_wine
|
||||
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_FILE_NOT_FOUND, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
w2 = CreateWindowStationA( "", 0, WINSTA_ALL_ACCESS, NULL );
|
||||
ok( w2 != 0, "create station failed err %u\n", GetLastError() );
|
||||
ok( w2 != 0, "create station failed err %lu\n", GetLastError() );
|
||||
|
||||
memset( buffer, 0, sizeof(buffer) );
|
||||
ret = GetUserObjectInformationA( w2, UOI_NAME, buffer, sizeof(buffer), &size );
|
||||
ok( ret, "GetUserObjectInformationA failed with error %u\n", GetLastError() );
|
||||
ok( !memcmp(buffer, "Service-0x0-", 12), "unexpected window station name '%s'\n", buffer );
|
||||
ok( buffer[strlen(buffer) - 1] == '$', "unexpected window station name '%s'\n", buffer );
|
||||
ok( ret, "GetUserObjectInformationA failed with error %lu\n", GetLastError() );
|
||||
/* Get the logon session LUID */
|
||||
ret = GetTokenInformation( GetCurrentProcessToken(), TokenStatistics, &token_stats, sizeof(token_stats), NULL );
|
||||
if (ret)
|
||||
sprintf( default_name, "Service-0x%lx-%lx$", token_stats.AuthenticationId.HighPart,
|
||||
token_stats.AuthenticationId.LowPart );
|
||||
if (*default_name)
|
||||
ok( !strcmp( buffer, default_name ), "unexpected window station name '%s' expected '%s'\n", buffer, default_name );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
w3 = OpenWindowStationA( "", TRUE, WINSTA_ALL_ACCESS );
|
||||
todo_wine
|
||||
ok( w3 != 0, "open station failed err %u\n", GetLastError() );
|
||||
ok( w3 != 0, "open station failed err %lu\n", GetLastError() );
|
||||
CloseWindowStation( w3 );
|
||||
CloseWindowStation( w2 );
|
||||
|
||||
w2 = CreateWindowStationA( NULL, 0, WINSTA_ALL_ACCESS, NULL );
|
||||
ok( w2 != 0, "create station failed err %lu\n", GetLastError() );
|
||||
|
||||
memset( buffer, 0, sizeof(buffer) );
|
||||
ret = GetUserObjectInformationA( w2, UOI_NAME, buffer, sizeof(buffer), &size );
|
||||
ok( ret, "GetUserObjectInformationA failed with error %lu\n", GetLastError() );
|
||||
if (*default_name)
|
||||
ok( !strcmp( buffer, default_name ), "unexpected window station name '%s' expected '%s'\n", buffer, default_name );
|
||||
CloseWindowStation( w2 );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
w2 = CreateWindowStationA( "foo\\bar", 0, WINSTA_ALL_ACCESS, NULL );
|
||||
ok( !w2, "create station succeeded\n" );
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND || GetLastError() == ERROR_ACCESS_DENIED,
|
||||
"wrong error %u\n", GetLastError() );
|
||||
"wrong error %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
w2 = OpenWindowStationA( "foo\\bar", TRUE, WINSTA_ALL_ACCESS );
|
||||
ok( !w2, "create station succeeded\n" );
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_PATH_NOT_FOUND, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
/* desktops */
|
||||
d1 = GetThreadDesktop(GetCurrentThreadId());
|
||||
@@ -251,10 +283,15 @@ static void test_handles(void)
|
||||
ok( GetHandleInformation( d1, &flags ), "GetHandleInformation failed\n" );
|
||||
ok( !(flags & HANDLE_FLAG_PROTECT_FROM_CLOSE), "handle %p PROTECT_FROM_CLOSE set\n", d1 );
|
||||
|
||||
status = NtQueryObject( d1, ObjectBasicInformation, &info, sizeof(info), NULL );
|
||||
ok( !status, "NtQueryObject failed, status %#lx\n", status );
|
||||
ok( info.GrantedAccess == (STANDARD_RIGHTS_REQUIRED | DESKTOP_ALL_ACCESS),
|
||||
"Got unexpected access %#lx\n", info.GrantedAccess );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseDesktop(d1), "closing thread desktop succeeded\n" );
|
||||
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
|
||||
"bad last error %d\n", GetLastError() );
|
||||
"bad last error %ld\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
if (CloseHandle( d1 )) /* succeeds on nt4 */
|
||||
@@ -262,7 +299,7 @@ static void test_handles(void)
|
||||
win_skip( "NT4 desktop handle management is completely different\n" );
|
||||
return;
|
||||
}
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %d\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %ld\n", GetLastError() );
|
||||
|
||||
ok( DuplicateHandle( GetCurrentProcess(), d1, GetCurrentProcess(), (PHANDLE)&d2, 0,
|
||||
TRUE, DUPLICATE_SAME_ACCESS ), "DuplicateHandle failed\n" );
|
||||
@@ -277,37 +314,35 @@ static void test_handles(void)
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
d2 = CreateDesktopA( "", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||
todo_wine
|
||||
ok( !d2, "create empty desktop succeeded\n" );
|
||||
todo_wine
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
d2 = OpenDesktopA( "", 0, TRUE, DESKTOP_ALL_ACCESS );
|
||||
ok( !d2, "open empty desktop succeeded\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
d2 = CreateDesktopA( "foo\\bar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||
ok( !d2, "create desktop succeeded\n" );
|
||||
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
d2 = OpenDesktopA( "foo\\bar", 0, TRUE, DESKTOP_ALL_ACCESS );
|
||||
ok( !d2, "open desktop succeeded\n" );
|
||||
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %u\n", GetLastError() );
|
||||
ok( GetLastError() == ERROR_BAD_PATHNAME, "wrong error %lu\n", GetLastError() );
|
||||
|
||||
d2 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||
ok( d2 != 0, "create foobar desktop failed\n" );
|
||||
SetLastError( 0xdeadbeef );
|
||||
ok( !CloseWindowStation( (HWINSTA)d2 ), "CloseWindowStation succeeded on desktop\n" );
|
||||
ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */
|
||||
"bad last error %d\n", GetLastError() );
|
||||
"bad last error %ld\n", GetLastError() );
|
||||
|
||||
SetLastError( 0xdeadbeef );
|
||||
d3 = CreateDesktopA( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
|
||||
ok( d3 != 0, "create foobar desktop again failed\n" );
|
||||
ok( GetLastError() == 0xdeadbeef, "bad last error %d\n", GetLastError() );
|
||||
ok( GetLastError() == 0xdeadbeef, "bad last error %ld\n", GetLastError() );
|
||||
ok( CloseDesktop( d3 ), "CloseDesktop failed\n" );
|
||||
|
||||
d3 = OpenDesktopA( "foobar", 0, TRUE, DESKTOP_ALL_ACCESS );
|
||||
@@ -366,12 +401,12 @@ static void test_enumstations(void)
|
||||
SetLastError(0xbabefeed);
|
||||
ret = EnumWindowStationsA(NULL, 0);
|
||||
ok(!ret, "EnumWindowStationsA returned successfully!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08lx\n", GetLastError());
|
||||
}
|
||||
|
||||
hwinsta = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
|
||||
ret = GetLastError();
|
||||
ok(hwinsta != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
|
||||
ok(hwinsta != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%lu)\n", ret);
|
||||
if (!hwinsta)
|
||||
{
|
||||
win_skip("Not enough privileges for CreateWindowStation\n");
|
||||
@@ -380,13 +415,13 @@ static void test_enumstations(void)
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumWindowStationsA(open_window_station_callbackA, 0x12345);
|
||||
ok(ret == 0x12345, "EnumWindowStationsA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(ret == 0x12345, "EnumWindowStationsA returned %lx\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumWindowStationsA(window_station_callbackA, 0);
|
||||
ok(!ret, "EnumWindowStationsA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(!ret, "EnumWindowStationsA returned %lx\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
}
|
||||
|
||||
static BOOL CALLBACK desktop_callbackA(LPSTR desktop, LPARAM lp)
|
||||
@@ -421,28 +456,28 @@ static void test_enumdesktops(void)
|
||||
SetLastError(0xbabefeed);
|
||||
ret = EnumDesktopsA(GetProcessWindowStation(), NULL, 0);
|
||||
ok(!ret, "EnumDesktopsA returned successfully!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08lx\n", GetLastError());
|
||||
}
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumDesktopsA(NULL, desktop_callbackA, 0x12345);
|
||||
ok(ret == 0x12345, "EnumDesktopsA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumDesktopsA(GetProcessWindowStation(), open_desktop_callbackA, 0x12345);
|
||||
ok(ret == 0x12345, "EnumDesktopsA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumDesktopsA(INVALID_HANDLE_VALUE, desktop_callbackA, 0x12345);
|
||||
ok(!ret, "EnumDesktopsA returned %x\n", ret);
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_HANDLE, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = EnumDesktopsA(GetProcessWindowStation(), desktop_callbackA, 0);
|
||||
ok(!ret, "EnumDesktopsA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
}
|
||||
|
||||
/* Miscellaneous tests */
|
||||
@@ -472,8 +507,8 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationA(desk, UOI_NAME, NULL, 0, &size);
|
||||
|
||||
ok(!ret, "GetUserObjectInformationA returned %x\n", ret);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(size == 22, "size is set to %d\n", size); /* Windows returns Unicode length (11*2) */
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08lx\n", GetLastError());
|
||||
ok(size == 22, "size is set to %ld\n", size); /* Windows returns Unicode length (11*2) */
|
||||
|
||||
/* Get string */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -481,10 +516,10 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationA(desk, UOI_NAME, buffer, sizeof(buffer), &size);
|
||||
|
||||
ok(ret, "GetUserObjectInformationA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
ok(strcmp(buffer, "foobarTest") == 0, "Buffer is set to '%s'\n", buffer);
|
||||
ok(size == 11, "size is set to %d\n", size); /* 11 bytes in 'foobarTest\0' */
|
||||
ok(size == 11, "size is set to %ld\n", size); /* 11 bytes in 'foobarTest\0' */
|
||||
|
||||
/* Get size, test size and return value/error code (Unicode) */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -492,8 +527,8 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationW(desk, UOI_NAME, NULL, 0, &size);
|
||||
|
||||
ok(!ret, "GetUserObjectInformationW returned %x\n", ret);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(size == 22, "size is set to %d\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08lx\n", GetLastError());
|
||||
ok(size == 22, "size is set to %ld\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
|
||||
|
||||
/* Get string (Unicode) */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -501,15 +536,15 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationW(desk, UOI_NAME, bufferW, sizeof(bufferW), &size);
|
||||
|
||||
ok(ret, "GetUserObjectInformationW returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
ok(lstrcmpW(bufferW, foobarTestW + 1) == 0, "Buffer is not set to 'foobarTest'\n");
|
||||
ok(size == 22, "size is set to %d\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
|
||||
ok(size == 22, "size is set to %ld\n", size); /* 22 bytes in 'foobarTest\0' in Unicode */
|
||||
|
||||
/* ObjectNameInformation does not return the full desktop name */
|
||||
name_info = (OBJECT_NAME_INFORMATION *)buffer;
|
||||
status = pNtQueryObject(desk, ObjectNameInformation, name_info, sizeof(buffer), NULL);
|
||||
ok(!status, "expected STATUS_SUCCESS, got %08x\n", status);
|
||||
ok(!status, "expected STATUS_SUCCESS, got %08lx\n", status);
|
||||
ok(lstrcmpW(name_info->Name.Buffer, foobarTestW) == 0,
|
||||
"expected '\\foobarTest', got %s\n", wine_dbgstr_w(name_info->Name.Buffer));
|
||||
|
||||
@@ -521,8 +556,8 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationA(desk, UOI_TYPE, NULL, 0, &size);
|
||||
|
||||
ok(!ret, "GetUserObjectInformationA returned %x\n", ret);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(size == 16, "size is set to %d\n", size); /* Windows returns Unicode length (8*2) */
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08lx\n", GetLastError());
|
||||
ok(size == 16, "size is set to %ld\n", size); /* Windows returns Unicode length (8*2) */
|
||||
|
||||
/* Get string */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -530,10 +565,10 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationA(desk, UOI_TYPE, buffer, sizeof(buffer), &size);
|
||||
|
||||
ok(ret, "GetUserObjectInformationA returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
ok(strcmp(buffer, "Desktop") == 0, "Buffer is set to '%s'\n", buffer);
|
||||
ok(size == 8, "size is set to %d\n", size); /* 8 bytes in 'Desktop\0' */
|
||||
ok(size == 8, "size is set to %ld\n", size); /* 8 bytes in 'Desktop\0' */
|
||||
|
||||
/* Get size, test size and return value/error code (Unicode) */
|
||||
size = 0xdeadbeef;
|
||||
@@ -541,8 +576,8 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationW(desk, UOI_TYPE, NULL, 0, &size);
|
||||
|
||||
ok(!ret, "GetUserObjectInformationW returned %x\n", ret);
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08x\n", GetLastError());
|
||||
ok(size == 16, "size is set to %d\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
|
||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LastError is set to %08lx\n", GetLastError());
|
||||
ok(size == 16, "size is set to %ld\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
|
||||
|
||||
/* Get string (Unicode) */
|
||||
SetLastError(0xdeadbeef);
|
||||
@@ -550,10 +585,10 @@ static void test_getuserobjectinformation(void)
|
||||
ret = GetUserObjectInformationW(desk, UOI_TYPE, bufferW, sizeof(bufferW), &size);
|
||||
|
||||
ok(ret, "GetUserObjectInformationW returned %x\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
|
||||
ok(GetLastError() == 0xdeadbeef, "LastError is set to %08lx\n", GetLastError());
|
||||
|
||||
ok(lstrcmpW(bufferW, DesktopW) == 0, "Buffer is not set to 'Desktop'\n");
|
||||
ok(size == 16, "size is set to %d\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
|
||||
ok(size == 16, "size is set to %ld\n", size); /* 16 bytes in 'Desktop\0' in Unicode */
|
||||
|
||||
ok(CloseDesktop(desk), "CloseDesktop failed\n");
|
||||
}
|
||||
@@ -566,9 +601,9 @@ static void test_inputdesktop(void)
|
||||
INPUT inputs[1];
|
||||
|
||||
inputs[0].type = INPUT_KEYBOARD;
|
||||
U(inputs[0]).ki.wVk = 0;
|
||||
U(inputs[0]).ki.wScan = 0x3c0;
|
||||
U(inputs[0]).ki.dwFlags = KEYEVENTF_UNICODE;
|
||||
inputs[0].ki.wVk = 0;
|
||||
inputs[0].ki.wScan = 0x3c0;
|
||||
inputs[0].ki.dwFlags = KEYEVENTF_UNICODE;
|
||||
|
||||
/* OpenInputDesktop creates new handles for each calls */
|
||||
old_input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
|
||||
@@ -591,15 +626,15 @@ static void test_inputdesktop(void)
|
||||
|
||||
/* by default, GetThreadDesktop is the input desktop, SendInput should succeed. */
|
||||
old_thread_desk = GetThreadDesktop(GetCurrentThreadId());
|
||||
ok(old_thread_desk != NULL, "GetThreadDesktop faile!\n");
|
||||
ok(old_thread_desk != NULL, "GetThreadDesktop failed!\n");
|
||||
memset(name, 0, sizeof(name));
|
||||
ret = GetUserObjectInformationA(old_thread_desk, UOI_NAME, name, 1024, NULL);
|
||||
ok(!strcmp(name, "Default"), "unexpected desktop %s\n", name);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Set thread desktop to the new desktop, SendInput should fail. */
|
||||
new_desk = CreateDesktopA("new_desk", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
|
||||
@@ -623,9 +658,8 @@ static void test_inputdesktop(void)
|
||||
win_skip("Skip tests on NT4\n");
|
||||
return;
|
||||
}
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 0 || broken(ret == 1) /* Win32 */, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Set thread desktop back to the old thread desktop, SendInput should success. */
|
||||
ret = SetThreadDesktop(old_thread_desk);
|
||||
@@ -638,8 +672,8 @@ todo_wine
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Set thread desktop to the input desktop, SendInput should success. */
|
||||
ret = SetThreadDesktop(old_input_desk);
|
||||
@@ -652,8 +686,8 @@ todo_wine
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Switch input desktop to the new desktop, SendInput should fail. */
|
||||
ret = SwitchDesktop(new_desk);
|
||||
@@ -664,16 +698,14 @@ todo_wine
|
||||
memset(name, 0, sizeof(name));
|
||||
ret = GetUserObjectInformationA(input_desk, UOI_NAME, name, 1024, NULL);
|
||||
ok(ret, "GetUserObjectInformation failed!\n");
|
||||
todo_wine
|
||||
ok(!strcmp(name, "new_desk"), "unexpected desktop %s\n", name);
|
||||
ret = CloseDesktop(input_desk);
|
||||
ok(ret, "CloseDesktop failed!\n");
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1 || broken(ret == 0) /* Win64 */, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 0 || broken(ret == 1) /* Win32 */, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Set thread desktop to the new desktop, SendInput should success. */
|
||||
ret = SetThreadDesktop(new_desk);
|
||||
@@ -686,8 +718,8 @@ todo_wine
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* Switch input desktop to the old input desktop, set thread desktop to the old
|
||||
* thread desktop, clean side effects. SendInput should success. */
|
||||
@@ -710,8 +742,8 @@ todo_wine
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SendInput(1, inputs, sizeof(INPUT));
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08x\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %d\n", ret);
|
||||
ok(GetLastError() == 0xdeadbeef, "unexpected last error %08lx\n", GetLastError());
|
||||
ok(ret == 1, "unexpected return count %ld\n", ret);
|
||||
|
||||
/* free resources */
|
||||
ret = CloseDesktop(input_desk);
|
||||
@@ -735,7 +767,7 @@ static void test_inputdesktop2(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
w2 = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL);
|
||||
ret = GetLastError();
|
||||
ok(w2 != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret);
|
||||
ok(w2 != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%lu)\n", ret);
|
||||
if (!w2)
|
||||
{
|
||||
win_skip("Not enough privileges for CreateWindowStation\n");
|
||||
@@ -763,22 +795,21 @@ static void test_inputdesktop2(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
input_desk = OpenInputDesktop(0, FALSE, DESKTOP_ALL_ACCESS);
|
||||
ok(input_desk == NULL, "OpenInputDesktop should fail on non default winstation!\n");
|
||||
ok(GetLastError() == ERROR_INVALID_FUNCTION || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
|
||||
ok(GetLastError() == ERROR_INVALID_FUNCTION || broken(GetLastError() == 0xdeadbeef), "last error %08lx\n", GetLastError());
|
||||
|
||||
hdesk = OpenDesktopA("desk_test", 0, TRUE, DESKTOP_ALL_ACCESS);
|
||||
ok(hdesk != NULL, "OpenDesktop failed!\n");
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = SwitchDesktop(hdesk);
|
||||
todo_wine
|
||||
ok(!ret, "Switch to desktop belong to non default winstation should fail!\n");
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED || broken(GetLastError() == 0xdeadbeef), "last error %08x\n", GetLastError());
|
||||
todo_wine
|
||||
ok(GetLastError() == ERROR_ACCESS_DENIED || broken(GetLastError() == 0xdeadbeef), "last error %08lx\n", GetLastError());
|
||||
ret = SetThreadDesktop(hdesk);
|
||||
ok(ret, "SetThreadDesktop failed!\n");
|
||||
|
||||
/* clean side effect */
|
||||
ret = SetThreadDesktop(thread_desk);
|
||||
todo_wine
|
||||
todo_wine
|
||||
ok(ret, "SetThreadDesktop should success even desktop is not belong to process winstation!\n");
|
||||
ret = SetProcessWindowStation(w1);
|
||||
ok(ret, "SetProcessWindowStation failed!\n");
|
||||
@@ -843,17 +874,17 @@ static DWORD set_foreground(HWND hwnd)
|
||||
GetWindowTextA(hwnd_fore, win_text, 1024);
|
||||
set_id = GetWindowThreadProcessId(hwnd, NULL);
|
||||
fore_id = GetWindowThreadProcessId(hwnd_fore, NULL);
|
||||
trace("\"%s\" %p %08x hwnd %p %08x\n", win_text, hwnd_fore, fore_id, hwnd, set_id);
|
||||
trace("\"%s\" %p %08lx hwnd %p %08lx\n", win_text, hwnd_fore, fore_id, hwnd, set_id);
|
||||
ret = AttachThreadInput(set_id, fore_id, TRUE);
|
||||
trace("AttachThreadInput returned %08x\n", ret);
|
||||
trace("AttachThreadInput returned %08lx\n", ret);
|
||||
ret = ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
trace("ShowWindow returned %08x\n", ret);
|
||||
trace("ShowWindow returned %08lx\n", ret);
|
||||
ret = SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
trace("set topmost returned %08x\n", ret);
|
||||
trace("set topmost returned %08lx\n", ret);
|
||||
ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);
|
||||
trace("set notopmost returned %08x\n", ret);
|
||||
trace("set notopmost returned %08lx\n", ret);
|
||||
ret = SetForegroundWindow(hwnd);
|
||||
trace("SetForegroundWindow returned %08x\n", ret);
|
||||
trace("SetForegroundWindow returned %08lx\n", ret);
|
||||
Sleep(250);
|
||||
AttachThreadInput(set_id, fore_id, FALSE);
|
||||
return ret;
|
||||
@@ -882,7 +913,7 @@ static void test_foregroundwindow(void)
|
||||
SetLastError(0xdeadbeef);
|
||||
hdesks[1] = CreateDesktopA("desk2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
|
||||
ret = GetLastError();
|
||||
ok(hdesks[1] != NULL || ret == ERROR_ACCESS_DENIED, "CreateDesktop failed (%u)\n", ret);
|
||||
ok(hdesks[1] != NULL || ret == ERROR_ACCESS_DENIED, "CreateDesktop failed (%lu)\n", ret);
|
||||
if(!hdesks[1])
|
||||
{
|
||||
win_skip("Not enough privileges for CreateDesktop\n");
|
||||
@@ -896,13 +927,13 @@ static void test_foregroundwindow(void)
|
||||
CloseDesktop(hdesks[1]);
|
||||
return;
|
||||
}
|
||||
trace("old timeout %d\n", timeout_old);
|
||||
trace("old timeout %ld\n", timeout_old);
|
||||
timeout = 0;
|
||||
ret = SystemParametersInfoA(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, 0, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE);
|
||||
ok(ret, "set foreground lock timeout failed!\n");
|
||||
ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
|
||||
ok(ret, "get foreground lock timeout failed!\n");
|
||||
ok(timeout == 0, "unexpected timeout %d\n", timeout);
|
||||
ok(timeout == 0, "unexpected timeout %ld\n", timeout);
|
||||
|
||||
for (thread_desk_id = 0; thread_desk_id < DESKTOPS; thread_desk_id++)
|
||||
{
|
||||
@@ -994,11 +1025,105 @@ static void test_foregroundwindow(void)
|
||||
ok(ret, "set foreground lock timeout failed!\n");
|
||||
ret = SystemParametersInfoA(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &timeout, 0);
|
||||
ok(ret, "get foreground lock timeout failed!\n");
|
||||
ok(timeout == timeout_old, "unexpected timeout %d\n", timeout);
|
||||
ok(timeout == timeout_old, "unexpected timeout %ld\n", timeout);
|
||||
}
|
||||
|
||||
static void test_invisible_winstation_child(char *expected_info)
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
HDESK desktop;
|
||||
HWND hwnd;
|
||||
int ret;
|
||||
|
||||
desktop = GetThreadDesktop(GetCurrentThreadId());
|
||||
ok(!!desktop, "GetThreadDesktop failed, error %lu.\n", GetLastError());
|
||||
|
||||
ret = GetUserObjectInformationA(desktop, UOI_NAME, &buffer, sizeof(buffer), NULL);
|
||||
ok(ret, "GetUserObjectInformationA failed, error %lu.\n", GetLastError());
|
||||
ok(!strcmp(buffer, "invisible_winstation_desktop"), "Got unexpected desktop %s.\n", buffer);
|
||||
|
||||
sprintf(buffer, "%d,%d,%d,%d,%d", GetSystemMetrics(SM_XVIRTUALSCREEN),
|
||||
GetSystemMetrics(SM_YVIRTUALSCREEN), GetSystemMetrics(SM_CXVIRTUALSCREEN),
|
||||
GetSystemMetrics(SM_CYVIRTUALSCREEN), GetSystemMetrics(SM_CMONITORS));
|
||||
ok(!strcmp(buffer, expected_info), "Expected %s, got %s.\n", expected_info, buffer);
|
||||
|
||||
hwnd = GetDesktopWindow();
|
||||
ok(!!hwnd, "GetDesktopWindow failed, error %lu.\n", GetLastError());
|
||||
|
||||
ret = SendMessageW(hwnd, WM_NCHITTEST, 0, 0);
|
||||
ok(ret == HTCLIENT, "SendMessageW failed, error %lu.\n", GetLastError());
|
||||
}
|
||||
|
||||
static void test_invisible_winstation(char **argv)
|
||||
{
|
||||
char buffer[MAX_PATH], desktop_name[MAX_PATH];
|
||||
HWINSTA old_winstation, winstation;
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
STARTUPINFOA si = {0};
|
||||
HDESK desktop;
|
||||
BOOL ret;
|
||||
|
||||
old_winstation = GetProcessWindowStation();
|
||||
ok(!!old_winstation, "GetProcessWindowStation failed, error %lu.\n", GetLastError());
|
||||
winstation = CreateWindowStationW(NULL, 0, GENERIC_READ | WINSTA_CREATEDESKTOP, NULL);
|
||||
ok(!!winstation, "CreateWindowStationW failed, error %lu.\n", GetLastError());
|
||||
ret = SetProcessWindowStation(winstation);
|
||||
ok(ret, "SetProcessWindowStation failed, error %lu.\n", GetLastError());
|
||||
desktop = CreateDesktopA("invisible_winstation_desktop", NULL, NULL, 0, DESKTOP_CREATEWINDOW, NULL);
|
||||
ok(!!desktop, "CreateDesktopA failed, error %lu.\n", GetLastError());
|
||||
|
||||
ret = GetUserObjectInformationA(winstation, UOI_NAME, buffer, sizeof(buffer), NULL);
|
||||
ok(ret, "GetUserObjectInformationA failed, error %lu.\n", GetLastError());
|
||||
strcpy(desktop_name, buffer);
|
||||
strcat(desktop_name, "\\invisible_winstation_desktop");
|
||||
|
||||
si.cb = sizeof(si);
|
||||
si.lpDesktop = desktop_name;
|
||||
|
||||
sprintf(buffer, "\"%s\" %s invisible %d,%d,%d,%d,%d", argv[0], argv[1],
|
||||
GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN),
|
||||
GetSystemMetrics(SM_CXVIRTUALSCREEN), GetSystemMetrics(SM_CYVIRTUALSCREEN),
|
||||
GetSystemMetrics(SM_CMONITORS));
|
||||
ret = CreateProcessA(argv[0], buffer, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||
ok(ret, "CreateProcessA failed, error %lu.\n", GetLastError());
|
||||
|
||||
wait_child_process(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseDesktop(desktop);
|
||||
CloseWindowStation(winstation);
|
||||
SetProcessWindowStation(old_winstation);
|
||||
}
|
||||
|
||||
static void test_get_security(void)
|
||||
{
|
||||
SECURITY_INFORMATION info = DACL_SECURITY_INFORMATION;
|
||||
HDESK desktop = GetThreadDesktop(GetCurrentThreadId());
|
||||
DWORD size, expect_size;
|
||||
char buffer[500];
|
||||
BOOL ret;
|
||||
|
||||
size = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetUserObjectSecurity( desktop, &info, NULL, 0, &size );
|
||||
ok( !ret, "got %#x\n", ret );
|
||||
ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got error %lu\n", GetLastError() );
|
||||
ok( size && size < sizeof(buffer), "got size %lu\n", size );
|
||||
expect_size = size;
|
||||
|
||||
size = 0xdeadbeef;
|
||||
SetLastError(0xdeadbeef);
|
||||
ret = GetUserObjectSecurity( desktop, &info, buffer, sizeof(buffer), &size );
|
||||
ok( ret == TRUE, "got %#x\n", ret );
|
||||
ok( GetLastError() == 0xdeadbeef, "got error %lu\n", GetLastError() );
|
||||
ok( size == expect_size, "got size %lu\n", size );
|
||||
ok( IsValidSecurityDescriptor(buffer), "expected valid SD\n" );
|
||||
}
|
||||
|
||||
START_TEST(winstation)
|
||||
{
|
||||
char **argv;
|
||||
int argc;
|
||||
HMODULE hntdll = GetModuleHandleA("ntdll.dll");
|
||||
pNtQueryObject = (void *)GetProcAddress(hntdll, "NtQueryObject");
|
||||
|
||||
@@ -1012,6 +1137,14 @@ START_TEST(winstation)
|
||||
return;
|
||||
}
|
||||
|
||||
argc = winetest_get_mainargs(&argv);
|
||||
if (argc > 2)
|
||||
{
|
||||
if (!lstrcmpA(argv[2], "invisible"))
|
||||
test_invisible_winstation_child(argv[3]);
|
||||
|
||||
return;
|
||||
}
|
||||
test_inputdesktop();
|
||||
test_inputdesktop2();
|
||||
test_enumstations();
|
||||
@@ -1019,4 +1152,6 @@ START_TEST(winstation)
|
||||
test_handles();
|
||||
test_getuserobjectinformation();
|
||||
test_foregroundwindow();
|
||||
test_invisible_winstation(argv);
|
||||
test_get_security();
|
||||
}
|
||||
|
||||
@@ -52,12 +52,34 @@ static const struct
|
||||
|
||||
static void wsprintfATest(void)
|
||||
{
|
||||
char buf[25];
|
||||
char buf[25], star[4], partial[4];
|
||||
static const WCHAR starW[] = L"\x2606";
|
||||
static const WCHAR fffeW[] = L"\xfffe";
|
||||
static const WCHAR wineW[] = L"\xd83c\xdf77"; /* U+1F377: wine glass */
|
||||
const struct {
|
||||
const void *input;
|
||||
const char *fmt;
|
||||
const char *str;
|
||||
int rc;
|
||||
}
|
||||
testcase[] = {
|
||||
{ starW, "%.1S", partial, 1 },
|
||||
{ starW, "%.2S", star, 2 },
|
||||
{ starW, "%.3S", star, 2 },
|
||||
{ fffeW, "%.1S", "?", 1 },
|
||||
{ fffeW, "%.2S", "?", 1 },
|
||||
{ wineW, "%.2S", "??", 2 },
|
||||
{ star, "%.1s", partial, 1 },
|
||||
{ (void *)0x2606, "%2C", star, 2 },
|
||||
{ (void *)0xfffd, "%C", "?", 1 },
|
||||
{ (void *)0xe199, "%2c", " \x99", 2 },
|
||||
};
|
||||
CPINFO cpinfo;
|
||||
unsigned int i;
|
||||
int rc;
|
||||
|
||||
rc=wsprintfA(buf, "%010ld", -1);
|
||||
ok(rc == 10, "wsprintfA length failure: rc=%d error=%d\n",rc,GetLastError());
|
||||
ok(rc == 10, "wsprintfA length failure: rc=%d error=%ld\n",rc,GetLastError());
|
||||
ok((lstrcmpA(buf, "-000000001") == 0),
|
||||
"wsprintfA zero padded negative value failure: buf=[%s]\n",buf);
|
||||
rc = wsprintfA(buf, "%I64X", (ULONGLONG)0);
|
||||
@@ -72,28 +94,74 @@ static void wsprintfATest(void)
|
||||
ok(rc == strlen(i64_formats[i].res), "%u: wsprintfA length failure: rc=%d\n", i, rc);
|
||||
ok(!strcmp(buf, i64_formats[i].res), "%u: wrong result [%s]\n", i, buf);
|
||||
}
|
||||
|
||||
if (!GetCPInfo(CP_ACP, &cpinfo) || cpinfo.MaxCharSize != 2)
|
||||
{
|
||||
skip("Multi-byte wsprintfA test isn't available for the current codepage\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rc = WideCharToMultiByte(CP_ACP, 0, starW, -1, star, sizeof(star), NULL, NULL);
|
||||
ok(rc == 3, "unexpected rc, got %d\n", rc);
|
||||
partial[0] = star[0];
|
||||
partial[1] = '\0';
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(testcase); i++)
|
||||
{
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
rc = wsprintfA(buf, testcase[i].fmt, testcase[i].input);
|
||||
|
||||
ok(rc == testcase[i].rc,
|
||||
"%u: expected %d, got %d\n",
|
||||
i, testcase[i].rc, rc);
|
||||
|
||||
ok(!strcmp(buf, testcase[i].str),
|
||||
"%u: expected %s, got %s\n",
|
||||
i, wine_dbgstr_a(testcase[i].str), wine_dbgstr_an(buf, rc));
|
||||
}
|
||||
}
|
||||
|
||||
static WCHAR my_btowc(BYTE c)
|
||||
{
|
||||
WCHAR wc;
|
||||
if (!IsDBCSLeadByte(c) &&
|
||||
MultiByteToWideChar(CP_ACP, 0, (const char *)&c, 1, &wc, 1) > 0)
|
||||
return wc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void wsprintfWTest(void)
|
||||
{
|
||||
static const WCHAR fmt_010ld[] = {'%','0','1','0','l','d','\0'};
|
||||
static const WCHAR res_010ld[] = {'-','0','0','0','0','0','0','0','0','1', '\0'};
|
||||
static const WCHAR fmt_I64x[] = {'%','I','6','4','x',0};
|
||||
WCHAR buf[25], fmt[25], res[25];
|
||||
static const WCHAR stars[] = L"*\x2606\x2605";
|
||||
WCHAR def_spc[] = L"*?\x2605 ";
|
||||
WCHAR buf[25], fmt[25], res[25], wcA1, wc99;
|
||||
char stars_mb[8], partial00[8], partialFF[8];
|
||||
const struct {
|
||||
const char *input;
|
||||
const WCHAR *fmt;
|
||||
const WCHAR *str;
|
||||
int rc;
|
||||
}
|
||||
testcase[] = {
|
||||
{ stars_mb, L"%.3S", stars, 3 },
|
||||
{ partial00, L"%-4S", L"*\0 ", 4 },
|
||||
{ partialFF, L"%-4S", def_spc, 4 },
|
||||
};
|
||||
CPINFOEXW cpinfoex;
|
||||
unsigned int i;
|
||||
int rc;
|
||||
|
||||
rc=wsprintfW(buf, fmt_010ld, -1);
|
||||
rc=wsprintfW(buf, L"%010ld", -1);
|
||||
if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
|
||||
{
|
||||
win_skip("wsprintfW is not implemented\n");
|
||||
return;
|
||||
}
|
||||
ok(rc == 10, "wsPrintfW length failure: rc=%d error=%d\n",rc,GetLastError());
|
||||
ok((lstrcmpW(buf, res_010ld) == 0),
|
||||
ok(rc == 10, "wsPrintfW length failure: rc=%d error=%ld\n",rc,GetLastError());
|
||||
ok((lstrcmpW(buf, L"-000000001") == 0),
|
||||
"wsprintfW zero padded negative value failure\n");
|
||||
rc = wsprintfW(buf, fmt_I64x, (ULONGLONG)0 );
|
||||
if (rc == 4 && !lstrcmpW(buf, fmt_I64x + 1))
|
||||
rc = wsprintfW(buf, L"%I64x", (ULONGLONG)0 );
|
||||
if (rc == 4 && !lstrcmpW(buf, L"I64x"))
|
||||
{
|
||||
win_skip( "I64 formats not supported\n" );
|
||||
return;
|
||||
@@ -106,6 +174,59 @@ static void wsprintfWTest(void)
|
||||
ok(rc == lstrlenW(res), "%u: wsprintfW length failure: rc=%d\n", i, rc);
|
||||
ok(!lstrcmpW(buf, res), "%u: wrong result [%s]\n", i, wine_dbgstr_w(buf));
|
||||
}
|
||||
|
||||
rc = wsprintfW(buf, L"%2c", L'*');
|
||||
ok(rc == 2, "expected 2, got %d\n", rc);
|
||||
ok(buf[0] == L' ', "expected \\x0020, got \\x%04x\n", buf[0]);
|
||||
ok(buf[1] == L'*', "expected \\x%04x, got \\x%04x\n", L'*', buf[1]);
|
||||
|
||||
rc = wsprintfW(buf, L"%c", L'\x2605');
|
||||
ok(rc == 1, "expected 1, got %d\n", rc);
|
||||
ok(buf[0] == L'\x2605', "expected \\x%04x, got \\x%04x\n", L'\x2605', buf[0]);
|
||||
|
||||
wcA1 = my_btowc(0xA1);
|
||||
rc = wsprintfW(buf, L"%C", 0xA1);
|
||||
ok(rc == 1, "expected 1, got %d\n", rc);
|
||||
ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
|
||||
|
||||
rc = wsprintfW(buf, L"%C", 0x81A1);
|
||||
ok(rc == 1, "expected 1, got %d\n", rc);
|
||||
ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
|
||||
|
||||
wc99 = my_btowc(0x99);
|
||||
rc = wsprintfW(buf, L"%2C", 0xe199);
|
||||
ok(rc == 2, "expected 1, got %d\n", rc);
|
||||
ok(buf[0] == L' ', "expected \\x0020, got \\x%04x\n", buf[0]);
|
||||
ok(buf[1] == wc99, "expected \\x%04x, got \\x%04x\n", wc99, buf[1]);
|
||||
|
||||
if (!GetCPInfoExW(CP_ACP, 0, &cpinfoex) || cpinfoex.MaxCharSize != 2)
|
||||
{
|
||||
skip("Multi-byte wsprintfW test isn't available for the current codepage\n");
|
||||
return;
|
||||
}
|
||||
def_spc[1] = cpinfoex.UnicodeDefaultChar;
|
||||
|
||||
rc = WideCharToMultiByte(CP_ACP, 0, stars, -1, stars_mb, sizeof(stars_mb), NULL, NULL);
|
||||
ok(rc == 6, "expected 6, got %d\n", rc);
|
||||
strcpy(partial00, stars_mb);
|
||||
partial00[2] = '\0';
|
||||
strcpy(partialFF, stars_mb);
|
||||
partialFF[2] = 0xff;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(testcase); i++)
|
||||
{
|
||||
memset(buf, 0x11, sizeof(buf));
|
||||
rc = wsprintfW(buf, testcase[i].fmt, testcase[i].input);
|
||||
|
||||
ok(rc == testcase[i].rc,
|
||||
"%u: expected %d, got %d\n",
|
||||
i, testcase[i].rc, rc);
|
||||
|
||||
ok(!memcmp(buf, testcase[i].str, (testcase[i].rc + 1) * sizeof(WCHAR)),
|
||||
"%u: expected %s, got %s\n", i,
|
||||
wine_dbgstr_wn(testcase[i].str, testcase[i].rc + 1),
|
||||
wine_dbgstr_wn(buf, rc + 1));
|
||||
}
|
||||
}
|
||||
|
||||
/* Test if the CharUpper / CharLower functions return true 16 bit results,
|
||||
@@ -125,7 +246,7 @@ static void CharUpperTest(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok(!failed,"CharUpper failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
|
||||
ok(!failed,"CharUpper failed - 16bit input (0x%0Ix) returned 32bit result (0x%0Ix)\n",i,out);
|
||||
}
|
||||
|
||||
static void CharLowerTest(void)
|
||||
@@ -142,7 +263,7 @@ static void CharLowerTest(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok(!failed,"CharLower failed - 16bit input (0x%0lx) returned 32bit result (0x%0lx)\n",i,out);
|
||||
ok(!failed,"CharLower failed - 16bit input (0x%0Ix) returned 32bit result (0x%0Ix)\n",i,out);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user