user32/tests: Fix some test failures on win9x.

This commit is contained in:
Alexandre Julliard 2008-08-04 23:06:54 +02:00
parent 13645a7b30
commit 2b1c4ba138
3 changed files with 36 additions and 18 deletions

View file

@ -42,9 +42,12 @@ static void test_LoadStringW(void)
the string at the pointer returned by LoadStringW when called with buflen = 0 */
SetLastError(0xdeadbeef);
length1 = LoadStringW(hInst, 2, (WCHAR *) &resourcepointer, 0); /* get pointer to resource. */
if (!length1 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
if (!length1)
{
win_skip( "LoadStringW not implemented\n" );
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
win_skip( "LoadStringW not implemented\n" );
else
win_skip( "LoadStringW does not return a pointer to the resource\n" );
return;
}
length2 = LoadStringW(hInst, 2, returnedstringw, sizeof(returnedstringw) /sizeof(WCHAR)); /* get resource string */

View file

@ -33,12 +33,12 @@
static HWND hMainWnd;
#define expect_eq(expr, value, type, fmt) { type val = expr; ok(val == (value), #expr " expected " #fmt " got " #fmt "\n", (value), val); }
#define expect_eq(expr, value, type, fmt) { type val = expr; ok(val == (value), #expr " expected " fmt " got " fmt "\n", (value), val); }
#define expect_rect(r, _left, _top, _right, _bottom) ok(r.left == _left && r.top == _top && \
r.bottom == _bottom && r.right == _right, "Invalid rect (%d,%d) (%d,%d) vs (%d,%d) (%d,%d)\n", \
r.left, r.top, r.right, r.bottom, _left, _top, _right, _bottom);
int g_nReceivedColorStatic = 0;
static int g_nReceivedColorStatic = 0;
static HWND build_static(DWORD style)
{
@ -63,7 +63,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
return DefWindowProc(hwnd, msg, wparam, lparam);
}
void test_updates(int style, int flags)
static void test_updates(int style, int flags)
{
RECT r1 = {20, 20, 30, 30};
HWND hStatic = build_static(style);
@ -89,6 +89,10 @@ void test_updates(int style, int flags)
if (flags & TODO_COUNT)
todo_wine { expect_eq(g_nReceivedColorStatic, exp, int, "%d"); }
else if (style == SS_ICON || style == SS_BITMAP)
ok( g_nReceivedColorStatic == exp ||
broken(g_nReceivedColorStatic == 0), /* win9x */
"expected %u got %u\n", exp, g_nReceivedColorStatic );
else
expect_eq(g_nReceivedColorStatic, exp, int, "%d");
DestroyWindow(hStatic);

View file

@ -110,21 +110,21 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top),
"rectangle should NOT be empty.\n");
"rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
SetLastError( 0);
textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top),
"rectangle should be empty.\n");
"rectangle should be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
SetLastError( 0);
textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top),
"rectangle should be empty.\n");
"rectangle should be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top),
"rectangle should NOT be empty.\n");
"rectangle should NOT be empty got %d,%d-%d,%d\n", rect.left, rect.top, rect.right, rect.bottom );
/* Wide char versions */
SetRect( &rect, 10,10, 100, 100);
@ -132,19 +132,23 @@ static void test_DrawTextCalcRect(void)
textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL );
if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) {
ok( !(rect.left == rect.right && rect.bottom == rect.top),
"rectangle should NOT be empty.\n");
"rectangle should NOT be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top),
"rectangle should be empty.\n");
"rectangle should be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top),
"rectangle should NOT be empty.\n");
"rectangle should NOT be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top),
"rectangle should NOT be empty.\n");
"rectangle should NOT be empty got %d,%d-%d,%d\n",
rect.left, rect.top, rect.right, rect.bottom );
}
/* More test cases from bug 12226 */
@ -158,11 +162,18 @@ static void test_DrawTextCalcRect(void)
SetRect(&rect, 0, 0, 0, 0);
textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
todo_wine 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);
todo_wine ok(rect.bottom, "rect.bottom should not be 0\n");
if (!textheight && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
win_skip( "DrawTextW not implemented\n" );
}
else
{
todo_wine 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);
todo_wine ok(rect.bottom, "rect.bottom should not be 0\n");
}
SelectObject(hdc, hOldFont);
ret = DeleteObject(hFont);