Alexandre Julliard : user32/tests: Fix some test failures on win9x.
Alexandre Julliard
julliard at winehq.org
Tue Aug 5 07:26:10 CDT 2008
Module: wine
Branch: master
Commit: 2b1c4ba13896c1c882009df6e5fd1d941541943b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2b1c4ba13896c1c882009df6e5fd1d941541943b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Aug 4 23:06:54 2008 +0200
user32/tests: Fix some test failures on win9x.
---
dlls/user32/tests/resource.c | 7 +++++--
dlls/user32/tests/static.c | 10 +++++++---
dlls/user32/tests/text.c | 37 ++++++++++++++++++++++++-------------
3 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/dlls/user32/tests/resource.c b/dlls/user32/tests/resource.c
index e588524..30b3e1f 100644
--- a/dlls/user32/tests/resource.c
+++ b/dlls/user32/tests/resource.c
@@ -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 */
diff --git a/dlls/user32/tests/static.c b/dlls/user32/tests/static.c
index 7810db4..8a9366d 100644
--- a/dlls/user32/tests/static.c
+++ b/dlls/user32/tests/static.c
@@ -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);
diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c
index 1e09650..7627280 100644
--- a/dlls/user32/tests/text.c
+++ b/dlls/user32/tests/text.c
@@ -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);
More information about the wine-cvs
mailing list