#include <assert.h>
#include <windows.h>
+#include <windowsx.h>
#include <commctrl.h>
#include "wine/test.h"
static LRESULT CALLBACK ET2_WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
switch (iMsg) {
- case WM_COMMAND:
- ET2_OnCommand(hwnd, LOWORD(wParam), (HWND)lParam, HIWORD(wParam));
- break;
+ HANDLE_MSG(hwnd, WM_COMMAND, ET2_OnCommand);
}
return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
ok(new_rect.right == old_rect.right, "The right border of the rectangle has changed\n");
ok(new_rect.top == old_rect.top, "The top border of the rectangle has changed\n");
ok(new_rect.bottom == old_rect.bottom, "The bottom border of the rectangle has changed\n");
-
- DestroyWindow (hwEdit);
-}
-
-static INT CALLBACK find_font_proc(const LOGFONT *elf, const TEXTMETRIC *ntm, DWORD type, LPARAM lParam)
-{
- return 0;
-}
-
-static void test_margins_font_change(void)
-{
- HWND hwEdit;
- DWORD margins, font_margins;
- LOGFONT lf;
- HFONT hfont, hfont2;
- HDC hdc = GetDC(0);
-
- if(EnumFontFamiliesA(hdc, "Arial", find_font_proc, 0))
- {
- trace("Arial not found - skipping font change margin tests\n");
- ReleaseDC(0, hdc);
- return;
- }
- ReleaseDC(0, hdc);
-
- hwEdit = create_child_editcontrol(0, 0);
-
- SetWindowPos(hwEdit, NULL, 10, 10, 1000, 100, SWP_NOZORDER | SWP_NOACTIVATE);
-
- memset(&lf, 0, sizeof(lf));
- strcpy(lf.lfFaceName, "Arial");
- lf.lfHeight = 16;
- lf.lfCharSet = DEFAULT_CHARSET;
- hfont = CreateFontIndirectA(&lf);
- lf.lfHeight = 30;
- hfont2 = CreateFontIndirectA(&lf);
-
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- font_margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(font_margins) != 0, "got %d\n", LOWORD(font_margins));
- ok(HIWORD(font_margins) != 0, "got %d\n", HIWORD(font_margins));
-
- /* With 'small' edit controls, test that the margin doesn't get set */
- SetWindowPos(hwEdit, NULL, 10, 10, 16, 100, SWP_NOZORDER | SWP_NOACTIVATE);
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(0,0));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 0, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 0, "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,0));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 0, "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,1));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 1, "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(EC_USEFONTINFO,EC_USEFONTINFO));
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 1, "got %d\n", HIWORD(margins));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont2, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == 1, "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == 1, "got %d\n", HIWORD(margins));
-
- /* Above a certain size threshold then the margin is updated */
- SetWindowPos(hwEdit, NULL, 10, 10, 1000, 100, SWP_NOZORDER | SWP_NOACTIVATE);
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,0));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(1,1));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG(EC_USEFONTINFO,EC_USEFONTINFO));
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) == LOWORD(font_margins), "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) == HIWORD(font_margins), "got %d\n", HIWORD(margins));
- SendMessageA(hwEdit, WM_SETFONT, (WPARAM)hfont2, 0);
- margins = SendMessage(hwEdit, EM_GETMARGINS, 0, 0);
- ok(LOWORD(margins) != LOWORD(font_margins), "got %d\n", LOWORD(margins));
- ok(HIWORD(margins) != HIWORD(font_margins), "got %d\n", HIWORD(margins));
-
- SendMessageA(hwEdit, WM_SETFONT, 0, 0);
- DeleteObject(hfont2);
- DeleteObject(hfont);
- destroy_child_editcontrol(hwEdit);
-
+ DestroyWindow (hwEdit);
}
#define edit_pos_ok(exp, got, txt) \
test_edit_control_4();
test_edit_control_5();
test_margins();
- test_margins_font_change();
test_text_position();
-
+
UnregisterWindowClasses();
}
trace( "obj %p type '%s'\n", obj, buffer );
}
-static void register_class(void)
-{
- WNDCLASSA cls;
-
- cls.style = CS_DBLCLKS;
- cls.lpfnWndProc = DefWindowProcA;
- cls.cbClsExtra = 0;
- cls.cbWndExtra = 0;
- cls.hInstance = GetModuleHandleA(0);
- cls.hIcon = 0;
- cls.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
- cls.hbrBackground = GetStockObject(WHITE_BRUSH);
- cls.lpszMenuName = NULL;
- cls.lpszClassName = "WinStationClass";
- RegisterClassA(&cls);
-}
-
static HDESK initial_desktop;
static DWORD CALLBACK thread( LPVOID arg )
{
HDESK d1, d2;
- HWND hwnd = CreateWindowExA(0,"WinStationClass","test",WS_POPUP,0,0,100,100,GetDesktopWindow(),0,0,0);
+ HWND hwnd = CreateWindowExA(0,"BUTTON","test",WS_POPUP,0,0,100,100,GetDesktopWindow(),0,0,0);
ok( hwnd != 0, "CreateWindow failed\n" );
d1 = GetThreadDesktop(GetCurrentThreadId());
trace( "thread %p desktop: %p\n", arg, d1 );
HDESK d1, d2, d3;
HANDLE hthread;
DWORD id, flags;
- ATOM atom;
- char buffer[20];
/* win stations */
w3 = OpenWindowStation("foobar", TRUE, WINSTA_ALL_ACCESS );
ok( !w3, "open foobar station succeeded\n" );
- w2 = CreateWindowStation("foobar1", 0, WINSTA_ALL_ACCESS, NULL );
- ok( w2 != 0, "create foobar station failed\n" );
- w3 = CreateWindowStation("foobar2", 0, WINSTA_ALL_ACCESS, NULL );
- ok( w3 != 0, "create foobar station failed\n" );
- ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" );
- ok( GetHandleInformation( w3, &flags ), "GetHandleInformation failed\n" );
-
- SetProcessWindowStation( w2 );
- register_class();
- atom = GlobalAddAtomA("foo");
- ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" );
- ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer );
-
- ok( !CloseWindowStation( w2 ), "CloseWindowStation succeeded\n" );
- ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" );
-
- SetProcessWindowStation( w3 );
- ok( GetHandleInformation( w2, &flags ), "GetHandleInformation failed\n" );
- ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
- ok( GlobalGetAtomNameA( atom, buffer, sizeof(buffer) ) == 3, "GlobalGetAtomName failed\n" );
- ok( !lstrcmpiA( buffer, "foo" ), "bad atom value %s\n", buffer );
-
/* desktops */
d1 = GetThreadDesktop(GetCurrentThreadId());
initial_desktop = d1;