[winetests]

- Sync gdi32 and user32 winetests to Wine-1.1.36.

svn path=/trunk/; revision=45081
This commit is contained in:
Aleksey Bragin 2010-01-14 22:35:53 +00:00
parent cd4b708596
commit 44648580d7
13 changed files with 618 additions and 67 deletions

View file

@ -2848,6 +2848,29 @@ static void test_orientation(void)
DeleteDC(hdc);
}
static void test_oemcharset(void)
{
HDC hdc;
LOGFONTA lf;
HFONT hfont, old_hfont;
int charset;
hdc = CreateCompatibleDC(0);
ZeroMemory(&lf, sizeof(lf));
lf.lfHeight = 12;
lf.lfCharSet = OEM_CHARSET;
lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
lstrcpyA(lf.lfFaceName, "Terminal");
hfont = CreateFontIndirectA(&lf);
old_hfont = SelectObject(hdc, hfont);
charset = GetTextCharset(hdc);
todo_wine
ok(charset == OEM_CHARSET, "expected %d charset, got %d\n", OEM_CHARSET, charset);
SelectObject(hdc, old_hfont);
DeleteObject(hfont);
DeleteDC(hdc);
}
static void test_GetGlyphOutline(void)
{
MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
@ -2980,6 +3003,39 @@ static void test_GetTextMetrics2(const char *fontname, int font_height)
ok(ratio >= 90 && ratio <= 110, "expected width/height ratio 90-110, got %d\n", ratio);
}
static void test_CreateFontIndirect(void)
{
LOGFONTA lf, getobj_lf;
int ret, i;
HFONT hfont;
char TestName[][16] = {"Arial", "Arial Bold", "Arial Italic", "Arial Baltic"};
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = ANSI_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfHeight = 16;
lf.lfWidth = 16;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfItalic = FALSE;
lf.lfWeight = FW_DONTCARE;
for (i = 0; i < sizeof(TestName)/sizeof(TestName[0]); i++)
{
lstrcpyA(lf.lfFaceName, TestName[i]);
hfont = CreateFontIndirectA(&lf);
ok(hfont != 0, "CreateFontIndirectA failed\n");
ret = GetObject(hfont, sizeof(getobj_lf), &getobj_lf);
ok(lf.lfItalic == getobj_lf.lfItalic, "lfItalic: expect %02x got %02x\n", lf.lfItalic, getobj_lf.lfItalic);
ok(lf.lfWeight == getobj_lf.lfWeight ||
broken((SHORT)lf.lfWeight == getobj_lf.lfWeight), /* win9x */
"lfWeight: expect %08x got %08x\n", lf.lfWeight, getobj_lf.lfWeight);
ok(!lstrcmpA(lf.lfFaceName, getobj_lf.lfFaceName) ||
broken(!memcmp(lf.lfFaceName, getobj_lf.lfFaceName, LF_FACESIZE-1)), /* win9x doesn't ensure '\0' termination */
"font names don't match: %s != %s\n", lf.lfFaceName, getobj_lf.lfFaceName);
DeleteObject(hfont);
}
}
START_TEST(font)
{
init();
@ -3023,4 +3079,6 @@ START_TEST(font)
test_GetTextMetrics2("Arial", -11);
test_GetTextMetrics2("Arial", -55);
test_GetTextMetrics2("Arial", -110);
test_CreateFontIndirect();
test_oemcharset();
}

View file

@ -1030,6 +1030,63 @@ static const unsigned char EMF_LINETO_MM_TEXT_BITS[] = {
0x14, 0x00, 0x00, 0x00
};
static const unsigned char EMF_BITBLT[] =
{
0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x6a, 0x00, 0x00, 0x00, 0x6a, 0x00, 0x00, 0x00,
0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00,
0xa0, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x23, 0x04, 0x00, 0x00, 0x3b, 0x02, 0x00, 0x00,
0x75, 0x01, 0x00, 0x00, 0xc9, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0xb1, 0x05, 0x00,
0x28, 0x11, 0x03, 0x00, 0x4c, 0x00, 0x00, 0x00,
0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0xcc, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x64, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x4c, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x62, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00
};
/* For debugging or dumping the raw metafiles produced by
* new test functions.
*/
@ -1382,6 +1439,70 @@ static int compare_emf_bits(const HENHMETAFILE mf, const unsigned char *bits,
return 0;
}
/* tests blitting to an EMF */
static void test_emf_BitBlt(void)
{
HDC hdcDisplay, hdcMetafile, hdcBitmap;
HBITMAP hBitmap, hOldBitmap;
HENHMETAFILE hMetafile;
#define BMP_DIM 4
BITMAPINFOHEADER bmih =
{
sizeof(BITMAPINFOHEADER),
BMP_DIM,/* biWidth */
BMP_DIM,/* biHeight */
1, /* biPlanes */
24, /* biBitCount */
BI_RGB, /* biCompression */
0, /* biXPelsPerMeter */
0, /* biYPelsPerMeter */
0, /* biClrUsed */
0, /* biClrImportant */
};
void *bits;
BOOL ret;
hdcDisplay = CreateDCA("DISPLAY", NULL, NULL, NULL);
ok( hdcDisplay != 0, "CreateDCA error %d\n", GetLastError() );
hdcBitmap = CreateCompatibleDC(hdcDisplay);
ok( hdcBitmap != 0, "CreateCompatibleDC failed\n" );
bmih.biXPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSX), 100, 3937);
bmih.biYPelsPerMeter = MulDiv(GetDeviceCaps(hdcDisplay, LOGPIXELSY), 100, 3937);
hBitmap = CreateDIBSection(hdcDisplay, (const BITMAPINFO *)&bmih,
DIB_RGB_COLORS, &bits, NULL, 0);
hOldBitmap = SelectObject(hdcBitmap, hBitmap);
hdcMetafile = CreateEnhMetaFileA(hdcBitmap, NULL, NULL, NULL);
ok( hdcMetafile != 0, "CreateEnhMetaFileA failed\n" );
/* First fill the bitmap DC with something recognizable, like BLACKNESS */
ret = BitBlt(hdcBitmap, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, BLACKNESS);
ok( ret, "BitBlt(BLACKNESS) failed\n" );
ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, hdcBitmap, 0, 0, SRCCOPY);
ok( ret, "BitBlt(SRCCOPY) failed\n" );
ret = BitBlt(hdcMetafile, 0, 0, BMP_DIM, BMP_DIM, 0, 0, 0, WHITENESS);
ok( ret, "BitBlt(WHITENESS) failed\n" );
hMetafile = CloseEnhMetaFile(hdcMetafile);
ok( hMetafile != 0, "CloseEnhMetaFile failed\n" );
if(compare_emf_bits(hMetafile, EMF_BITBLT, sizeof(EMF_BITBLT),
"emf_BitBlt", FALSE) != 0)
{
dump_emf_bits(hMetafile, "emf_BitBlt");
dump_emf_records(hMetafile, "emf_BitBlt");
}
SelectObject(hdcBitmap, hOldBitmap);
DeleteObject(hBitmap);
DeleteDC(hdcBitmap);
DeleteDC(hdcDisplay);
#undef BMP_DIM
}
/* Test a blank metafile. May be used as a template for new tests. */
static void test_mf_Blank(void)
@ -1953,8 +2074,11 @@ static void test_emf_clipping(void)
SetRect(&rc_sclip, 100, 100, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
hrgn = CreateRectRgn(rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom);
SelectClipRgn(hdc, hrgn);
GetClipBox(hdc, &rc_res);
todo_wine ok(EqualRect(&rc_res, &rc_sclip),
ret = GetClipBox(hdc, &rc_res);
todo_wine
ok(ret == SIMPLEREGION, "got %d\n", ret);
if(ret == SIMPLEREGION)
ok(EqualRect(&rc_res, &rc_sclip),
"expected rc_res (%d, %d) - (%d, %d), got (%d, %d) - (%d, %d)\n",
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
@ -2625,6 +2749,7 @@ START_TEST(metafile)
/* For enhanced metafiles (enhmfdrv) */
test_ExtTextOut();
test_SaveDC();
test_emf_BitBlt();
/* For win-format metafiles (mfdrv) */
test_mf_SaveDC();

View file

@ -56,7 +56,8 @@ static void test_ClipboardOwner(void)
SetLastError(0xdeadbeef);
ok(!CloseClipboard(), "CloseClipboard should fail if clipboard wasn't open\n");
test_last_error(ERROR_CLIPBOARD_NOT_OPEN);
ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"wrong error %u\n", GetLastError());
ok(OpenClipboard(0), "OpenClipboard failed\n");
ok(!GetClipboardOwner(), "clipboard should still be not owned\n");
@ -188,7 +189,8 @@ todo_wine
SetLastError(0xdeadbeef);
ok(!EmptyClipboard(), "EmptyClipboard should fail if clipboard wasn't open\n");
test_last_error(ERROR_CLIPBOARD_NOT_OPEN);
ok(GetLastError() == ERROR_CLIPBOARD_NOT_OPEN || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"Wrong error %u\n", GetLastError());
}
static HGLOBAL create_text(void)

View file

@ -464,7 +464,6 @@ static BOOL OnTestDlgCreate (HWND hwnd, LPCREATESTRUCT lpcs)
static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
LPARAM lParam)
{
LRESULT result;
switch (uiMsg)
{
/* Add blank case statements for these to ensure we don't use them
@ -485,20 +484,19 @@ static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
break;
}
result=DefWindowProcA (hwnd, uiMsg, wParam, lParam);
return result;
return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
}
static LRESULT CALLBACK disabled_test_proc (HWND hwnd, UINT uiMsg,
WPARAM wParam, LPARAM lParam)
{
LRESULT result;
DWORD dw;
HWND hwndOk;
switch (uiMsg)
{
case WM_INITDIALOG:
{
DWORD dw;
HWND hwndOk;
dw = SendMessage(hwnd, DM_GETDEFID, 0, 0);
assert(DC_HASDEFID == HIWORD(dw));
hwndOk = GetDlgItem(hwnd, LOWORD(dw));
@ -508,6 +506,7 @@ static LRESULT CALLBACK disabled_test_proc (HWND hwnd, UINT uiMsg,
PostMessage(hwnd, WM_KEYDOWN, VK_RETURN, 0);
PostMessage(hwnd, WM_COMMAND, IDCANCEL, 0);
break;
}
case WM_COMMAND:
if (wParam == IDOK)
{
@ -523,14 +522,12 @@ static LRESULT CALLBACK disabled_test_proc (HWND hwnd, UINT uiMsg,
break;
}
result=DefWindowProcA (hwnd, uiMsg, wParam, lParam);
return result;
return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
}
static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam,
LPARAM lParam)
{
LRESULT result;
switch (uiMsg)
{
/* Add blank case statements for these to ensure we don't use them
@ -544,8 +541,7 @@ static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam,
(LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
}
result=DefWindowProcA (hwnd, uiMsg, wParam, lParam);
return result;
return DefDlgProcA (hwnd, uiMsg, wParam, lParam);
}
static BOOL RegisterWindowClasses (void)

View file

@ -1070,11 +1070,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(0 == ret, "expected 0 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1088,11 +1088,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(0 == ret, "expected 0 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1106,11 +1106,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(0 == ret, "expected 0 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1124,11 +1124,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2 +1;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1142,11 +1142,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2 +1;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1160,11 +1160,11 @@ static void test_edit_control_4(void)
mid = lo + (hi - lo) / 2 +1;
for (i = lo; i < mid; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok((0 == ret || 1 == ret /* Vista */), "expected 0 or 1 got %d\n", ret);
}
for (i = mid; i <= hi; i++) {
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, (LPARAM) i));
ret = LOWORD(SendMessage(hwEdit, EM_CHARFROMPOS, 0, i));
ok(1 == ret, "expected 1 got %d\n", ret);
}
ret = SendMessage(hwEdit, EM_POSFROMCHAR, 2, 0);
@ -1524,7 +1524,7 @@ static void test_text_position_style(DWORD style)
/* Edit controls that are in a parent window */
hwEdit = create_child_editcontrol(style | WS_VISIBLE, 0);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 0);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 0);
@ -1534,7 +1534,7 @@ static void test_text_position_style(DWORD style)
destroy_child_editcontrol(hwEdit);
hwEdit = create_child_editcontrol(style | WS_BORDER | WS_VISIBLE, 0);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, b);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , b);
@ -1545,7 +1545,7 @@ static void test_text_position_style(DWORD style)
destroy_child_editcontrol(hwEdit);
hwEdit = create_child_editcontrol(style | WS_VISIBLE, WS_EX_CLIENTEDGE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
@ -1555,7 +1555,7 @@ static void test_text_position_style(DWORD style)
destroy_child_editcontrol(hwEdit);
hwEdit = create_child_editcontrol(style | WS_BORDER | WS_VISIBLE, WS_EX_CLIENTEDGE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
@ -1568,7 +1568,7 @@ static void test_text_position_style(DWORD style)
/* Edit controls that are popup windows */
hwEdit = create_editcontrol(style | WS_POPUP, 0);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 0);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 0);
@ -1578,7 +1578,7 @@ static void test_text_position_style(DWORD style)
DestroyWindow(hwEdit);
hwEdit = create_editcontrol(style | WS_POPUP | WS_BORDER, 0);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, b);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , b);
@ -1589,7 +1589,7 @@ static void test_text_position_style(DWORD style)
DestroyWindow(hwEdit);
hwEdit = create_editcontrol(style | WS_POPUP, WS_EX_CLIENTEDGE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
@ -1599,7 +1599,7 @@ static void test_text_position_style(DWORD style)
DestroyWindow(hwEdit);
hwEdit = create_editcontrol(style | WS_POPUP | WS_BORDER, WS_EX_CLIENTEDGE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, (LPARAM) FALSE);
SendMessage(hwEdit, WM_SETFONT, (WPARAM) font, FALSE);
if (single_line)
check_pos(hwEdit, metrics.tmHeight - 1, 0, metrics.tmHeight - 1, 1);
check_pos(hwEdit, metrics.tmHeight , 0, metrics.tmHeight , 1);
@ -2179,7 +2179,7 @@ static void test_dialogmode(void)
len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
ok(11 == len, "expected 11, got %d\n", len);
r = SendMessage(hwEdit, WM_GETDLGCODE, (WPARAM)NULL, (LPARAM)NULL);
r = SendMessage(hwEdit, WM_GETDLGCODE, 0, 0);
ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
@ -2187,7 +2187,7 @@ static void test_dialogmode(void)
len = SendMessage(hwEdit, WM_GETTEXTLENGTH, 0, 0);
ok(13 == len, "expected 13, got %d\n", len);
r = SendMessage(hwEdit, WM_GETDLGCODE, (WPARAM)NULL, (LPARAM)&msg);
r = SendMessage(hwEdit, WM_GETDLGCODE, 0, (LPARAM)&msg);
ok(0x8d == r, "expected 0x8d, got 0x%x\n", r);
r = SendMessage(hwEdit, WM_CHAR, VK_RETURN, 0x1c0001);
ok(1 == r, "expected 1, got %d\n", r);

View file

@ -146,7 +146,7 @@ check (const struct listbox_test test)
listbox_query (hLB, &answer);
listbox_ok (test, init, answer);
SendMessage (hLB, LB_GETITEMRECT, (WPARAM) 1, (LPARAM) &second_item);
SendMessage (hLB, LB_GETITEMRECT, 1, (LPARAM) &second_item);
buttonpress(hLB, (WORD)second_item.left, (WORD)second_item.top);
listbox_query (hLB, &answer);
@ -354,7 +354,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_1, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -363,7 +363,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_3, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -372,7 +372,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -381,7 +381,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_1, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -390,7 +390,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -399,7 +399,7 @@ static void test_selection(void)
listbox_query(hLB, &answer);
listbox_test_query(test_2, answer);
SendMessage(hLB, LB_SETSEL, FALSE, (LPARAM)-1);
SendMessage(hLB, LB_SETSEL, FALSE, -1);
listbox_query(hLB, &answer);
listbox_test_query(test_nosel, answer);
@ -1112,7 +1112,7 @@ static void test_listbox_dlgdir(void)
"expected conversion to uppercase, got %s\n", pathBuffer);
/* Loaded path should have overwritten the label text */
SendMessage(g_label, WM_GETTEXT, (WPARAM)MAX_PATH, (LPARAM)pathBuffer);
SendMessage(g_label, WM_GETTEXT, MAX_PATH, (LPARAM)pathBuffer);
trace("Static control after DlgDirList: %s\n", pathBuffer);
ok (strcmp("default contents", pathBuffer), "DlgDirList() did not modify static control!\n");

View file

@ -390,8 +390,9 @@ static void test_subpopup_locked_by_menu(void)
ok( ret == itemid , "TrackPopupMenu returned %d error is %d\n", ret, gle);
}
ok( gle == 0 ||
broken( gle == ERROR_INVALID_PARAMETER), /* win2k0 */
"Last error is %d\n", gle);
broken(gle == 0xdeadbeef) || /* wow64 */
broken(gle == ERROR_INVALID_PARAMETER), /* win2k0 */
"Last error is %d\n", gle);
}
/* clean up */
DestroyMenu( hmenu);

View file

@ -161,7 +161,7 @@ static const struct message WmSWP_ShowOverlappedSeq[] = {
{ WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, /* Win9x: SWP_NOSENDCHANGING */
{ WM_ACTIVATEAPP, sent|wparam, 1 },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_NCACTIVATE, sent },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent|wparam, 1 },
{ HCBT_SETFOCUS, hook },
@ -268,7 +268,7 @@ static const struct message WmSWP_ResizeNoZOrder[] = {
{ WM_NCPAINT, sent|optional },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ERASEBKGND, sent|optional },
{ WM_WINDOWPOSCHANGED, sent|wparam, /*SWP_NOZORDER|*/SWP_NOACTIVATE, 0,
{ WM_WINDOWPOSCHANGED, sent|wparam|optional, /*SWP_NOZORDER|*/SWP_NOACTIVATE, 0,
SWP_NOMOVE|SWP_NOCLIENTMOVE|SWP_NOSIZE|SWP_NOCLIENTSIZE },
{ WM_MOVE, sent|defwinproc|optional },
{ WM_SIZE, sent|defwinproc|optional },
@ -631,9 +631,10 @@ static const struct message WmHideOverlappedSeq[] = {
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_SIZE, sent|optional }, /* XP doesn't send it */
{ WM_MOVE, sent|optional }, /* XP doesn't send it */
{ WM_NCACTIVATE, sent|wparam, 0 },
{ WM_ACTIVATE, sent|wparam, 0 },
{ WM_ACTIVATEAPP, sent|wparam, 0 },
{ WM_NCACTIVATE, sent|wparam|optional, 0 },
{ WM_ACTIVATE, sent|wparam|optional, 0 },
{ WM_ACTIVATEAPP, sent|wparam|optional, 0 },
{ HCBT_SETFOCUS, hook|optional },
{ WM_KILLFOCUS, sent|wparam, 0 },
{ WM_IME_SETCONTEXT, sent|wparam|optional, 0 },
{ WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 },
@ -1776,7 +1777,8 @@ static BOOL ignore_message( UINT message )
message == WM_GETOBJECT ||
message == WM_TIMECHANGE ||
message == WM_DISPLAYCHANGE ||
message == WM_DEVICECHANGE);
message == WM_DEVICECHANGE ||
message == WM_DWMNCRENDERINGCHANGED);
}
@ -5384,6 +5386,7 @@ static void test_button_messages(void)
UpdateWindow(hwnd);
SetFocus(0);
flush_events();
SetFocus(0);
flush_sequence();
log_all_parent_messages++;
@ -6866,8 +6869,8 @@ static const struct message WmVkAppsSeq[] = {
{ HCBT_KEYSKIPPED, hook|wparam|lparam|optional, VK_APPS, 0xc0000001 }, /* XP */
{ WM_KEYUP, wparam|lparam, VK_APPS, 0xc0000001 },
{ WM_KEYUP, sent|wparam|lparam, VK_APPS, 0xc0000001 },
{ WM_CONTEXTMENU, lparam, /*hwnd*/0, (LPARAM)-1 },
{ WM_CONTEXTMENU, sent|lparam, /*hwnd*/0, (LPARAM)-1 },
{ WM_CONTEXTMENU, lparam, /*hwnd*/0, -1 },
{ WM_CONTEXTMENU, sent|lparam, /*hwnd*/0, -1 },
{ 0 }
};
static const struct message WmVkF10Seq[] = {
@ -9324,17 +9327,21 @@ static void test_PeekMessage(void)
skip( "queuing key events not supported\n" );
goto done;
}
ok(qstatus == MAKELONG(QS_KEY, QS_KEY),
ok(qstatus == MAKELONG(QS_KEY, QS_KEY) ||
/* keybd_event seems to trigger a sent message on NT4 */
qstatus == MAKELONG(QS_KEY|QS_SENDMESSAGE, QS_KEY|QS_SENDMESSAGE),
"wrong qstatus %08x\n", qstatus);
PostMessageA(info.hwnd, WM_CHAR, 'z', 0);
qstatus = GetQueueStatus(qs_all_input);
ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY),
ok(qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY) ||
qstatus == MAKELONG(QS_POSTMESSAGE, QS_POSTMESSAGE|QS_KEY|QS_SENDMESSAGE),
"wrong qstatus %08x\n", qstatus);
InvalidateRect(info.hwnd, NULL, FALSE);
qstatus = GetQueueStatus(qs_all_input);
ok(qstatus == MAKELONG(QS_PAINT, QS_PAINT|QS_POSTMESSAGE|QS_KEY),
ok(qstatus == MAKELONG(QS_PAINT, QS_PAINT|QS_POSTMESSAGE|QS_KEY) ||
qstatus == MAKELONG(QS_PAINT, QS_PAINT|QS_POSTMESSAGE|QS_KEY|QS_SENDMESSAGE),
"wrong qstatus %08x\n", qstatus);
trace("signalling to send message\n");
@ -9896,7 +9903,7 @@ static void pump_msg_loop_timeout(DWORD timeout, BOOL inject_mouse_move)
/* Timer proc messages are not dispatched to the window proc,
* and therefore not logged.
*/
if (msg.message == WM_TIMER || msg.message == WM_SYSTIMER)
if ((msg.message == WM_TIMER || msg.message == WM_SYSTIMER) && msg.hwnd)
{
struct recvd_message s_msg;
@ -10291,8 +10298,8 @@ static const struct message WmRestore_5[] = {
};
static const struct message WmHide_1[] = {
{ WM_SHOWWINDOW, sent|wparam, 0 },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE, 0, SWP_NOACTIVATE },
{ WM_WINDOWPOSCHANGED, sent|wparam, SWP_HIDEWINDOW|SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE, 0, SWP_NOACTIVATE },
{ HCBT_ACTIVATE, hook|optional },
{ HCBT_SETFOCUS, hook|optional }, /* win2000 sends it */
{ 0 }
@ -10840,6 +10847,7 @@ static const struct message SetActiveWindowSeq4[] =
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE },
{ WM_WINDOWPOSCHANGING, sent|wparam, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE },
{ WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOREDRAW|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE },
{ WM_NCACTIVATE, sent|wparam, 1 },
{ WM_GETTEXT, sent|defwinproc|optional },
{ WM_ACTIVATE, sent|wparam, 1 },
@ -12014,11 +12022,272 @@ static void test_PostMessage(void)
flush_events();
}
static const struct
{
DWORD exp, broken;
BOOL todo;
} wait_idle_expect[] =
{
/* 0 */ { WAIT_TIMEOUT, WAIT_TIMEOUT, FALSE },
{ WAIT_TIMEOUT, 0, FALSE },
{ WAIT_TIMEOUT, 0, FALSE },
{ WAIT_TIMEOUT, WAIT_TIMEOUT, FALSE },
{ WAIT_TIMEOUT, WAIT_TIMEOUT, FALSE },
/* 5 */ { WAIT_TIMEOUT, 0, FALSE },
{ WAIT_TIMEOUT, 0, FALSE },
{ WAIT_TIMEOUT, WAIT_TIMEOUT, FALSE },
{ 0, 0, FALSE },
{ 0, 0, FALSE },
/* 10 */ { 0, 0, FALSE },
{ 0, 0, FALSE },
{ 0, WAIT_TIMEOUT, FALSE },
{ 0, 0, FALSE },
};
static DWORD CALLBACK do_wait_idle_child_thread( void *arg )
{
MSG msg;
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
return 0;
}
static void do_wait_idle_child( int arg )
{
WNDCLASS cls;
MSG msg;
HWND hwnd = 0;
HANDLE thread;
DWORD id;
HANDLE start_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_start" );
HANDLE end_event = OpenEventA( EVENT_ALL_ACCESS, FALSE, "test_WaitForInputIdle_end" );
memset( &cls, 0, sizeof(cls) );
cls.lpfnWndProc = DefWindowProc;
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
cls.hCursor = LoadCursor(0, IDC_ARROW);
cls.lpszClassName = "TestClass";
RegisterClass( &cls );
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ); /* create the msg queue */
ok( start_event != 0, "failed to create start event, error %u\n", GetLastError() );
ok( end_event != 0, "failed to create end event, error %u\n", GetLastError() );
switch (arg)
{
case 0:
SetEvent( start_event );
break;
case 1:
SetEvent( start_event );
Sleep( 200 );
PeekMessage( &msg, 0, 0, 0, PM_REMOVE );
break;
case 2:
SetEvent( start_event );
Sleep( 200 );
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
PostThreadMessage( GetCurrentThreadId(), WM_COMMAND, 0x1234, 0xabcd );
PeekMessage( &msg, 0, 0, 0, PM_REMOVE );
break;
case 3:
SetEvent( start_event );
Sleep( 200 );
SendMessage( HWND_BROADCAST, WM_WININICHANGE, 0, 0 );
break;
case 4:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessage( &msg );
break;
case 5:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
break;
case 6:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
while (PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE ))
{
GetMessage( &msg, 0, 0, 0 );
DispatchMessage( &msg );
}
break;
case 7:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
SetTimer( hwnd, 3, 1, NULL );
Sleep( 200 );
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE|PM_NOYIELD )) DispatchMessage( &msg );
break;
case 8:
SetEvent( start_event );
Sleep( 200 );
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
break;
case 9:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
for (;;) GetMessage( &msg, 0, 0, 0 );
break;
case 10:
SetEvent( start_event );
Sleep( 200 );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP|WS_VISIBLE, 0, 0, 10, 10, 0, 0, 0, NULL);
SetTimer( hwnd, 3, 1, NULL );
Sleep( 200 );
while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessage( &msg );
break;
case 11:
SetEvent( start_event );
Sleep( 200 );
return; /* exiting the process makes WaitForInputIdle return success too */
case 12:
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
MsgWaitForMultipleObjects( 0, NULL, FALSE, 100, QS_ALLINPUT );
SetEvent( start_event );
break;
case 13:
SetEvent( start_event );
PeekMessage( &msg, 0, 0, 0, PM_NOREMOVE );
Sleep( 200 );
thread = CreateThread( NULL, 0, do_wait_idle_child_thread, NULL, 0, &id );
WaitForSingleObject( thread, 10000 );
CloseHandle( thread );
break;
}
WaitForSingleObject( end_event, 2000 );
CloseHandle( start_event );
CloseHandle( end_event );
if (hwnd) DestroyWindow( hwnd );
}
static LRESULT CALLBACK wait_idle_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
{
if (msg == WM_WININICHANGE) Sleep( 200 ); /* make sure the child waits */
return DefWindowProcA( hwnd, msg, wp, lp );
}
static DWORD CALLBACK wait_idle_thread( void *arg )
{
WNDCLASS cls;
MSG msg;
HWND hwnd;
memset( &cls, 0, sizeof(cls) );
cls.lpfnWndProc = wait_idle_proc;
cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
cls.hCursor = LoadCursor(0, IDC_ARROW);
cls.lpszClassName = "TestClass";
RegisterClass( &cls );
hwnd = CreateWindowExA(0, "TestClass", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
while (GetMessage( &msg, 0, 0, 0 )) DispatchMessage( &msg );
return 0;
}
static void test_WaitForInputIdle( char *argv0 )
{
char path[MAX_PATH];
PROCESS_INFORMATION pi;
STARTUPINFOA startup;
BOOL ret;
HANDLE start_event, end_event, thread;
unsigned int i;
DWORD id;
const IMAGE_DOS_HEADER *dos = (const IMAGE_DOS_HEADER *)GetModuleHandleA(0);
const IMAGE_NT_HEADERS *nt = (const IMAGE_NT_HEADERS *)((const char *)dos + dos->e_lfanew);
BOOL console_app = (nt->OptionalHeader.Subsystem != IMAGE_SUBSYSTEM_WINDOWS_GUI);
if (console_app) /* build the test with -mwindows for better coverage */
trace( "not built as a GUI app, WaitForInputIdle may not be fully tested\n" );
start_event = CreateEventA(NULL, 0, 0, "test_WaitForInputIdle_start");
end_event = CreateEventA(NULL, 0, 0, "test_WaitForInputIdle_end");
ok(start_event != 0, "failed to create start event, error %u\n", GetLastError());
ok(end_event != 0, "failed to create end event, error %u\n", GetLastError());
memset( &startup, 0, sizeof(startup) );
startup.cb = sizeof(startup);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
thread = CreateThread( NULL, 0, wait_idle_thread, NULL, 0, &id );
for (i = 0; i < sizeof(wait_idle_expect)/sizeof(wait_idle_expect[0]); i++)
{
ResetEvent( start_event );
ResetEvent( end_event );
sprintf( path, "%s msg %u", argv0, i );
ret = CreateProcessA( NULL, path, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &pi );
ok( ret, "CreateProcess '%s' failed err %u.\n", path, GetLastError() );
if (ret)
{
ret = WaitForSingleObject( start_event, 5000 );
ok( ret == WAIT_OBJECT_0, "%u: WaitForSingleObject failed\n", i );
if (ret == WAIT_OBJECT_0)
{
ret = WaitForInputIdle( pi.hProcess, 1000 );
if (ret == WAIT_FAILED)
ok( console_app ||
ret == wait_idle_expect[i].exp ||
broken(ret == wait_idle_expect[i].broken),
"%u: WaitForInputIdle error %08x expected %08x\n",
i, ret, wait_idle_expect[i].exp );
else if (wait_idle_expect[i].todo)
todo_wine
ok( ret == wait_idle_expect[i].exp || broken(ret == wait_idle_expect[i].broken),
"%u: WaitForInputIdle error %08x expected %08x\n",
i, ret, wait_idle_expect[i].exp );
else
ok( ret == wait_idle_expect[i].exp || broken(ret == wait_idle_expect[i].broken),
"%u: WaitForInputIdle error %08x expected %08x\n",
i, ret, wait_idle_expect[i].exp );
SetEvent( end_event );
WaitForSingleObject( pi.hProcess, 1000 ); /* give it a chance to exit on its own */
}
TerminateProcess( pi.hProcess, 0 ); /* just in case */
winetest_wait_child_process( pi.hProcess );
ret = WaitForInputIdle( pi.hProcess, 100 );
ok( ret == WAIT_FAILED, "%u: WaitForInputIdle after exit error %08x\n", i, ret );
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
}
CloseHandle( start_event );
PostThreadMessage( id, WM_QUIT, 0, 0 );
WaitForSingleObject( thread, 10000 );
CloseHandle( thread );
}
START_TEST(msg)
{
char **test_argv;
BOOL ret;
BOOL (WINAPI *pIsWinEventHookInstalled)(DWORD)= 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/
int argc = winetest_get_mainargs( &test_argv );
if (argc >= 3)
{
unsigned int arg;
/* Child process. */
sscanf (test_argv[2], "%d", (unsigned int *) &arg);
do_wait_idle_child( arg );
return;
}
init_procs();
if (!RegisterWindowClasses()) assert(0);
@ -12059,6 +12328,7 @@ START_TEST(msg)
test_ShowWindow();
test_PeekMessage();
test_PeekMessage2();
test_WaitForInputIdle( test_argv[0] );
test_scrollwindowex();
test_messages();
test_setwindowpos();

View file

@ -2764,6 +2764,27 @@ static void test_EnumDisplaySettings(void)
}
}
static void test_GetSysColorBrush(void)
{
HBRUSH hbr;
SetLastError(0xdeadbeef);
hbr = GetSysColorBrush(-1);
ok(hbr == NULL, "Expected NULL brush\n");
ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
/* greater than max index */
hbr = GetSysColorBrush(COLOR_MENUBAR);
if (hbr)
{
SetLastError(0xdeadbeef);
hbr = GetSysColorBrush(COLOR_MENUBAR + 1);
ok(hbr == NULL, "Expected NULL brush\n");
ok(GetLastError() == 0xdeadbeef, "Expected last error not set, got %x\n", GetLastError());
}
else
win_skip("COLOR_MENUBAR unsupported\n");
}
START_TEST(sysparams)
{
int argc;
@ -2794,6 +2815,7 @@ START_TEST(sysparams)
test_GetSystemMetrics( );
trace("testing EnumDisplaySettings vs GetDeviceCaps\n");
test_EnumDisplaySettings( );
test_GetSysColorBrush( );
change_counter = 0;
change_last_param = 0;

View file

@ -26,6 +26,7 @@ extern void func_scroll(void);
extern void func_static(void);
extern void func_sysparams(void);
extern void func_text(void);
extern void func_uitools(void);
extern void func_win(void);
extern void func_winstation(void);
extern void func_wsprintf(void);
@ -52,6 +53,7 @@ const struct test winetest_testlist[] =
{ "static", func_static },
{ "sysparams", func_sysparams },
{ "text", func_text },
{ "uitools", func_uitools },
{ "win", func_win },
{ "winstation", func_winstation },
{ "wsprintf", func_wsprintf },

View file

@ -0,0 +1,69 @@
/* Unit test suite for user interface functions
*
* Copyright 2009 Nikolay Sivov
*
* 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 "wine/test.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
static void test_FillRect(void)
{
HDC hdc, hdcmem;
DWORD bits[64];
HBITMAP hbmp, oldhbmp;
COLORREF col;
HBRUSH old_brush;
RECT r;
/* fill bitmap data with white */
memset(bits, 0xff, sizeof(bits));
hdc = GetDC(0);
ok( hdc != NULL, "CreateDC rets %p\n", hdc);
/* create a memory dc */
hdcmem = CreateCompatibleDC(hdc);
ok(hdcmem != NULL, "CreateCompatibleDC rets %p\n", hdcmem);
/* test monochrome bitmap: should always work */
hbmp = CreateBitmap(32, 32, 1, 1, bits);
ok(hbmp != NULL, "CreateBitmap returns %p\n", hbmp);
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);
/* select black brush */
old_brush = SelectObject(hdcmem, GetStockObject(BLACK_BRUSH));
r.left = r.top = 0;
r.right = r.bottom = 5;
FillRect(hdcmem, &r, 0);
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);
SelectObject(hdcmem, oldhbmp);
DeleteObject(hbmp);
DeleteDC(hdcmem);
ReleaseDC(0, hdc);
}
START_TEST(uitools)
{
test_FillRect();
}

View file

@ -28,6 +28,7 @@
<file>static.c</file>
<file>sysparams.c</file>
<file>text.c</file>
<file>uitools.c</file>
<file>win.c</file>
<file>winstation.c</file>
<file>wsprintf.c</file>

View file

@ -76,7 +76,8 @@ static DWORD CALLBACK thread( LPVOID arg )
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %d\n", GetLastError() );
SetLastError( 0xdeadbeef );
ok( !CloseDesktop( d1 ), "CloseDesktop succeeded\n" );
ok( GetLastError() == ERROR_BUSY, "bad last error %d\n", GetLastError() );
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
print_object( d1 );
d2 = CreateDesktop( "foobar2", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );
trace( "created desktop %p\n", d2 );
@ -84,7 +85,8 @@ static DWORD CALLBACK thread( LPVOID arg )
SetLastError( 0xdeadbeef );
ok( !SetThreadDesktop( d2 ), "set thread desktop succeeded with existing window\n" );
ok( GetLastError() == ERROR_BUSY, "bad last error %d\n", GetLastError() );
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
DestroyWindow( hwnd );
ok( SetThreadDesktop( d2 ), "set thread desktop failed\n" );
@ -139,7 +141,8 @@ static void test_handles(void)
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, "bad last error %d\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
ok( CloseWindowStation( w2 ), "CloseWindowStation failed\n" );
w2 = CreateWindowStation("WinSta0", 0, WINSTA_ALL_ACCESS, NULL );
@ -200,7 +203,8 @@ static void test_handles(void)
SetLastError( 0xdeadbeef );
ok( !CloseDesktop(d1), "closing thread desktop succeeded\n" );
ok( GetLastError() == ERROR_BUSY, "bad last error %d\n", GetLastError() );
ok( GetLastError() == ERROR_BUSY || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
SetLastError( 0xdeadbeef );
if (CloseHandle( d1 )) /* succeeds on nt4 */
@ -225,7 +229,8 @@ static void test_handles(void)
ok( d2 != 0, "create foobar desktop failed\n" );
SetLastError( 0xdeadbeef );
ok( !CloseWindowStation( (HWINSTA)d2 ), "CloseWindowStation succeeded on desktop\n" );
ok( GetLastError() == ERROR_INVALID_HANDLE, "bad last error %d\n", GetLastError() );
ok( GetLastError() == ERROR_INVALID_HANDLE || broken(GetLastError() == 0xdeadbeef), /* wow64 */
"bad last error %d\n", GetLastError() );
SetLastError( 0xdeadbeef );
d3 = CreateDesktop( "foobar", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL );