Commit 2b1c4ba1 authored by Alexandre Julliard's avatar Alexandre Julliard

user32/tests: Fix some test failures on win9x.

parent 13645a7b
...@@ -42,9 +42,12 @@ static void test_LoadStringW(void) ...@@ -42,9 +42,12 @@ static void test_LoadStringW(void)
the string at the pointer returned by LoadStringW when called with buflen = 0 */ the string at the pointer returned by LoadStringW when called with buflen = 0 */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
length1 = LoadStringW(hInst, 2, (WCHAR *) &resourcepointer, 0); /* get pointer to resource. */ 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; return;
} }
length2 = LoadStringW(hInst, 2, returnedstringw, sizeof(returnedstringw) /sizeof(WCHAR)); /* get resource string */ length2 = LoadStringW(hInst, 2, returnedstringw, sizeof(returnedstringw) /sizeof(WCHAR)); /* get resource string */
......
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
static HWND hMainWnd; 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 && \ #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.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); 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) static HWND build_static(DWORD style)
{ {
...@@ -63,7 +63,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara ...@@ -63,7 +63,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara
return DefWindowProc(hwnd, msg, wparam, lparam); 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}; RECT r1 = {20, 20, 30, 30};
HWND hStatic = build_static(style); HWND hStatic = build_static(style);
...@@ -89,6 +89,10 @@ void test_updates(int style, int flags) ...@@ -89,6 +89,10 @@ void test_updates(int style, int flags)
if (flags & TODO_COUNT) if (flags & TODO_COUNT)
todo_wine { expect_eq(g_nReceivedColorStatic, exp, int, "%d"); } 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 else
expect_eq(g_nReceivedColorStatic, exp, int, "%d"); expect_eq(g_nReceivedColorStatic, exp, int, "%d");
DestroyWindow(hStatic); DestroyWindow(hStatic);
......
...@@ -110,21 +110,21 @@ static void test_DrawTextCalcRect(void) ...@@ -110,21 +110,21 @@ static void test_DrawTextCalcRect(void)
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExA(hdc, text, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExA(hdc, emptystring, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
SetLastError( 0); SetLastError( 0);
textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExA(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExA(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top), 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 */ /* Wide char versions */
SetRect( &rect, 10,10, 100, 100); SetRect( &rect, 10,10, 100, 100);
...@@ -132,19 +132,23 @@ static void test_DrawTextCalcRect(void) ...@@ -132,19 +132,23 @@ static void test_DrawTextCalcRect(void)
textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExW(hdc, textW, 0, &rect, DT_CALCRECT, NULL );
if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) { if( GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) {
ok( !(rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExW(hdc, emptystringW, -1, &rect, DT_CALCRECT, NULL );
ok( (rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExW(hdc, NULL, -1, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top), 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); SetRect( &rect, 10,10, 100, 100);
textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL ); textheight = DrawTextExW(hdc, NULL, 0, &rect, DT_CALCRECT, NULL );
ok( !(rect.left == rect.right && rect.bottom == rect.top), 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 */ /* More test cases from bug 12226 */
...@@ -158,11 +162,18 @@ static void test_DrawTextCalcRect(void) ...@@ -158,11 +162,18 @@ static void test_DrawTextCalcRect(void)
SetRect(&rect, 0, 0, 0, 0); SetRect(&rect, 0, 0, 0, 0);
textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE); textheight = DrawTextW(hdc, emptystringW, -1, &rect, DT_CALCRECT | DT_LEFT | DT_SINGLELINE);
todo_wine ok(textheight, "DrawTextW error %u\n", GetLastError()); if (!textheight && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
ok(0 == rect.left, "expected 0, got %d\n", rect.left); {
ok(0 == rect.right, "expected 0, got %d\n", rect.right); win_skip( "DrawTextW not implemented\n" );
ok(0 == rect.top, "expected 0, got %d\n", rect.top); }
todo_wine ok(rect.bottom, "rect.bottom should not be 0\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); SelectObject(hdc, hOldFont);
ret = DeleteObject(hFont); ret = DeleteObject(hFont);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment