Commit 56233536 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

gdi32/tests: Don't test function directly when reporting GetLastError().

parent b49e1c29
...@@ -800,6 +800,7 @@ static void test_bitmap_font_metrics(void) ...@@ -800,6 +800,7 @@ static void test_bitmap_font_metrics(void)
{ {
DWORD fs[2]; DWORD fs[2];
CHARSETINFO csi; CHARSETINFO csi;
BOOL bRet;
fs[0] = 1L << bit; fs[0] = 1L << bit;
fs[1] = 0; fs[1] = 0;
...@@ -812,7 +813,8 @@ static void test_bitmap_font_metrics(void) ...@@ -812,7 +813,8 @@ static void test_bitmap_font_metrics(void)
hfont = create_font(lf.lfFaceName, &lf); hfont = create_font(lf.lfFaceName, &lf);
old_hfont = SelectObject(hdc, hfont); old_hfont = SelectObject(hdc, hfont);
ok(GetTextMetrics(hdc, &tm), "GetTextMetrics error %d\n", GetLastError()); bRet = GetTextMetrics(hdc, &tm);
ok(bRet, "GetTextMetrics error %d\n", GetLastError());
if(fd[i].dpi == tm.tmDigitizedAspectX) if(fd[i].dpi == tm.tmDigitizedAspectX)
{ {
trace("found font %s, height %d charset %x dpi %d\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi); trace("found font %s, height %d charset %x dpi %d\n", lf.lfFaceName, lf.lfHeight, lf.lfCharSet, fd[i].dpi);
...@@ -1166,6 +1168,7 @@ static void test_GetKerningPairs(void) ...@@ -1166,6 +1168,7 @@ static void test_GetKerningPairs(void)
for (i = 0; i < sizeof(kd)/sizeof(kd[0]); i++) for (i = 0; i < sizeof(kd)/sizeof(kd[0]); i++)
{ {
OUTLINETEXTMETRICW otm; OUTLINETEXTMETRICW otm;
UINT uiRet;
if (!is_font_installed(kd[i].face_name)) if (!is_font_installed(kd[i].face_name))
{ {
...@@ -1185,7 +1188,8 @@ static void test_GetKerningPairs(void) ...@@ -1185,7 +1188,8 @@ static void test_GetKerningPairs(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
otm.otmSize = sizeof(otm); /* just in case for Win9x compatibility */ otm.otmSize = sizeof(otm); /* just in case for Win9x compatibility */
ok(GetOutlineTextMetricsW(hdc, sizeof(otm), &otm) == sizeof(otm), "GetOutlineTextMetricsW error %d\n", GetLastError()); uiRet = GetOutlineTextMetricsW(hdc, sizeof(otm), &otm);
ok(uiRet == sizeof(otm), "GetOutlineTextMetricsW error %d\n", GetLastError());
ok(match_off_by_1(kd[i].tmHeight, otm.otmTextMetrics.tmHeight), "expected %d, got %d\n", ok(match_off_by_1(kd[i].tmHeight, otm.otmTextMetrics.tmHeight), "expected %d, got %d\n",
kd[i].tmHeight, otm.otmTextMetrics.tmHeight); kd[i].tmHeight, otm.otmTextMetrics.tmHeight);
...@@ -3197,6 +3201,7 @@ static void test_AddFontMemResource(void) ...@@ -3197,6 +3201,7 @@ static void test_AddFontMemResource(void)
void *font; void *font;
DWORD font_size, num_fonts; DWORD font_size, num_fonts;
HANDLE ret; HANDLE ret;
BOOL bRet;
if (!pAddFontMemResourceEx || !pRemoveFontMemResourceEx) if (!pAddFontMemResourceEx || !pRemoveFontMemResourceEx)
{ {
...@@ -3284,7 +3289,8 @@ static void test_AddFontMemResource(void) ...@@ -3284,7 +3289,8 @@ static void test_AddFontMemResource(void)
free_font(font); free_font(font);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ok(pRemoveFontMemResourceEx(ret), "RemoveFontMemResourceEx error %d\n", GetLastError()); bRet = pRemoveFontMemResourceEx(ret);
ok(bRet, "RemoveFontMemResourceEx error %d\n", GetLastError());
/* test invalid pointer to number of loaded fonts */ /* test invalid pointer to number of loaded fonts */
font = load_font("sserife.fon", &font_size); font = load_font("sserife.fon", &font_size);
......
...@@ -118,6 +118,7 @@ struct hgdiobj_event ...@@ -118,6 +118,7 @@ struct hgdiobj_event
static DWORD WINAPI thread_proc(void *param) static DWORD WINAPI thread_proc(void *param)
{ {
LOGPEN lp; LOGPEN lp;
DWORD status;
struct hgdiobj_event *hgdiobj_event = param; struct hgdiobj_event *hgdiobj_event = param;
hgdiobj_event->hdc = CreateDC("display", NULL, NULL, NULL); hgdiobj_event->hdc = CreateDC("display", NULL, NULL, NULL);
...@@ -130,8 +131,8 @@ static DWORD WINAPI thread_proc(void *param) ...@@ -130,8 +131,8 @@ static DWORD WINAPI thread_proc(void *param)
ok(hgdiobj_event->hgdiobj2 != 0, "Failed to create pen\n"); ok(hgdiobj_event->hgdiobj2 != 0, "Failed to create pen\n");
SetEvent(hgdiobj_event->ready_event); SetEvent(hgdiobj_event->ready_event);
ok(WaitForSingleObject(hgdiobj_event->stop_event, INFINITE) == WAIT_OBJECT_0, status = WaitForSingleObject(hgdiobj_event->stop_event, INFINITE);
"WaitForSingleObject error %u\n", GetLastError()); ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
ok(!GetObject(hgdiobj_event->hgdiobj1, sizeof(lp), &lp), "GetObject should fail\n"); ok(!GetObject(hgdiobj_event->hgdiobj1, sizeof(lp), &lp), "GetObject should fail\n");
...@@ -147,6 +148,8 @@ static void test_thread_objects(void) ...@@ -147,6 +148,8 @@ static void test_thread_objects(void)
HANDLE hthread; HANDLE hthread;
struct hgdiobj_event hgdiobj_event; struct hgdiobj_event hgdiobj_event;
INT ret; INT ret;
DWORD status;
BOOL bRet;
hgdiobj_event.stop_event = CreateEvent(NULL, 0, 0, NULL); hgdiobj_event.stop_event = CreateEvent(NULL, 0, 0, NULL);
ok(hgdiobj_event.stop_event != NULL, "CreateEvent error %u\n", GetLastError()); ok(hgdiobj_event.stop_event != NULL, "CreateEvent error %u\n", GetLastError());
...@@ -156,11 +159,11 @@ static void test_thread_objects(void) ...@@ -156,11 +159,11 @@ static void test_thread_objects(void)
hthread = CreateThread(NULL, 0, thread_proc, &hgdiobj_event, 0, &tid); hthread = CreateThread(NULL, 0, thread_proc, &hgdiobj_event, 0, &tid);
ok(hthread != NULL, "CreateThread error %u\n", GetLastError()); ok(hthread != NULL, "CreateThread error %u\n", GetLastError());
ok(WaitForSingleObject(hgdiobj_event.ready_event, INFINITE) == WAIT_OBJECT_0, status = WaitForSingleObject(hgdiobj_event.ready_event, INFINITE);
"WaitForSingleObject error %u\n", GetLastError()); ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
ok(GetObject(hgdiobj_event.hgdiobj1, sizeof(lp), &lp) == sizeof(lp), ret = GetObject(hgdiobj_event.hgdiobj1, sizeof(lp), &lp);
"GetObject error %u\n", GetLastError()); ok(ret == sizeof(lp), "GetObject error %u\n", GetLastError());
ok(lp.lopnStyle == PS_DASHDOTDOT, "wrong pen style %d\n", lp.lopnStyle); ok(lp.lopnStyle == PS_DASHDOTDOT, "wrong pen style %d\n", lp.lopnStyle);
ok(lp.lopnWidth.x == 17, "wrong pen width.y %d\n", lp.lopnWidth.x); ok(lp.lopnWidth.x == 17, "wrong pen width.y %d\n", lp.lopnWidth.x);
ok(lp.lopnWidth.y == 0, "wrong pen width.y %d\n", lp.lopnWidth.y); ok(lp.lopnWidth.y == 0, "wrong pen width.y %d\n", lp.lopnWidth.y);
...@@ -169,20 +172,23 @@ static void test_thread_objects(void) ...@@ -169,20 +172,23 @@ static void test_thread_objects(void)
ret = GetDeviceCaps(hgdiobj_event.hdc, TECHNOLOGY); ret = GetDeviceCaps(hgdiobj_event.hdc, TECHNOLOGY);
ok(ret == DT_RASDISPLAY, "GetDeviceCaps(TECHNOLOGY) should return DT_RASDISPLAY not %d\n", ret); ok(ret == DT_RASDISPLAY, "GetDeviceCaps(TECHNOLOGY) should return DT_RASDISPLAY not %d\n", ret);
ok(DeleteObject(hgdiobj_event.hgdiobj1), "DeleteObject error %u\n", GetLastError()); bRet = DeleteObject(hgdiobj_event.hgdiobj1);
ok(DeleteDC(hgdiobj_event.hdc), "DeleteDC error %u\n", GetLastError()); ok(bRet, "DeleteObject error %u\n", GetLastError());
bRet = DeleteDC(hgdiobj_event.hdc);
ok(bRet, "DeleteDC error %u\n", GetLastError());
type = GetObjectType(hgdiobj_event.hgdiobj2); type = GetObjectType(hgdiobj_event.hgdiobj2);
ok(type == OBJ_REGION, "GetObjectType returned %u\n", type); ok(type == OBJ_REGION, "GetObjectType returned %u\n", type);
SetEvent(hgdiobj_event.stop_event); SetEvent(hgdiobj_event.stop_event);
ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0, status = WaitForSingleObject(hthread, INFINITE);
"WaitForSingleObject error %u\n", GetLastError()); ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
CloseHandle(hthread); CloseHandle(hthread);
type = GetObjectType(hgdiobj_event.hgdiobj2); type = GetObjectType(hgdiobj_event.hgdiobj2);
ok(type == OBJ_REGION, "GetObjectType returned %u\n", type); ok(type == OBJ_REGION, "GetObjectType returned %u\n", type);
ok(DeleteObject(hgdiobj_event.hgdiobj2), "DeleteObject error %u\n", GetLastError()); bRet = DeleteObject(hgdiobj_event.hgdiobj2);
ok(bRet, "DeleteObject error %u\n", GetLastError());
CloseHandle(hgdiobj_event.stop_event); CloseHandle(hgdiobj_event.stop_event);
CloseHandle(hgdiobj_event.ready_event); CloseHandle(hgdiobj_event.ready_event);
......
...@@ -340,13 +340,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, ...@@ -340,13 +340,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ret = GetWorldTransform(hdc, &xform); ret = GetWorldTransform(hdc, &xform);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{ {
ok(GetWindowOrgEx(hdc, &pt), "GetWindowOrgEx error %u\n", GetLastError()); ret = GetWindowOrgEx(hdc, &pt);
ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
trace("window org (%d,%d)\n", pt.x, pt.y); trace("window org (%d,%d)\n", pt.x, pt.y);
ok(GetViewportOrgEx(hdc, &pt), "GetViewportOrgEx error %u\n", GetLastError()); ret = GetViewportOrgEx(hdc, &pt);
ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
trace("vport org (%d,%d)\n", pt.x, pt.y); trace("vport org (%d,%d)\n", pt.x, pt.y);
ok(GetWindowExtEx(hdc, &size), "GetWindowExtEx error %u\n", GetLastError()); ret = GetWindowExtEx(hdc, &size);
ok(ret, "GetWindowExtEx error %u\n", GetLastError());
trace("window ext (%d,%d)\n", size.cx, size.cy); trace("window ext (%d,%d)\n", size.cx, size.cy);
ok(GetViewportExtEx(hdc, &size), "GetViewportExtEx error %u\n", GetLastError()); ret = GetViewportExtEx(hdc, &size);
ok(ret, "GetViewportExtEx error %u\n", GetLastError());
trace("vport ext (%d,%d)\n", size.cx, size.cy); trace("vport ext (%d,%d)\n", size.cx, size.cy);
} }
else else
...@@ -458,13 +462,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table, ...@@ -458,13 +462,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ret = GetWorldTransform(hdc, &xform); ret = GetWorldTransform(hdc, &xform);
if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{ {
ok(GetWindowOrgEx(hdc, &pt), "GetWindowOrgEx error %u\n", GetLastError()); ret = GetWindowOrgEx(hdc, &pt);
ok(ret, "GetWindowOrgEx error %u\n", GetLastError());
trace("window org (%d,%d)\n", pt.x, pt.y); trace("window org (%d,%d)\n", pt.x, pt.y);
ok(GetViewportOrgEx(hdc, &pt), "GetViewportOrgEx error %u\n", GetLastError()); ret = GetViewportOrgEx(hdc, &pt);
ok(ret, "GetViewportOrgEx error %u\n", GetLastError());
trace("vport org (%d,%d)\n", pt.x, pt.y); trace("vport org (%d,%d)\n", pt.x, pt.y);
ok(GetWindowExtEx(hdc, &size), "GetWindowExtEx error %u\n", GetLastError()); ret = GetWindowExtEx(hdc, &size);
ok(ret, "GetWindowExtEx error %u\n", GetLastError());
trace("window ext (%d,%d)\n", size.cx, size.cy); trace("window ext (%d,%d)\n", size.cx, size.cy);
ok(GetViewportExtEx(hdc, &size), "GetViewportExtEx error %u\n", GetLastError()); ret = GetViewportExtEx(hdc, &size);
ok(ret, "GetViewportExtEx error %u\n", GetLastError());
trace("vport ext (%d,%d)\n", size.cx, size.cy); trace("vport ext (%d,%d)\n", size.cx, size.cy);
} }
else else
......
...@@ -475,6 +475,8 @@ static void test_ps_alternate(void) ...@@ -475,6 +475,8 @@ static void test_ps_alternate(void)
HBITMAP bmp; HBITMAP bmp;
HPEN pen; HPEN pen;
LOGBRUSH lb; LOGBRUSH lb;
INT iRet;
HGDIOBJ hRet;
lb.lbStyle = BS_SOLID; lb.lbStyle = BS_SOLID;
lb.lbColor = RGB(0xff,0xff,0xff); lb.lbColor = RGB(0xff,0xff,0xff);
...@@ -490,9 +492,12 @@ static void test_ps_alternate(void) ...@@ -490,9 +492,12 @@ static void test_ps_alternate(void)
ok(hdc != NULL, "gle=%d\n", GetLastError()); ok(hdc != NULL, "gle=%d\n", GetLastError());
bmp = CreateBitmap(8, 1, 1, 1, NULL); bmp = CreateBitmap(8, 1, 1, 1, NULL);
ok(bmp != NULL, "gle=%d\n", GetLastError()); ok(bmp != NULL, "gle=%d\n", GetLastError());
ok(SelectObject(hdc, bmp) != NULL, "gle=%d\n", GetLastError()); hRet = SelectObject(hdc, bmp);
ok(SelectObject(hdc, pen) != NULL, "gle=%d\n", GetLastError()); ok(hRet != NULL, "gle=%d\n", GetLastError());
ok(SetBkMode(hdc, TRANSPARENT), "gle=%d\n", GetLastError()); hRet = SelectObject(hdc, pen);
ok(hRet != NULL, "gle=%d\n", GetLastError());
iRet = SetBkMode(hdc, TRANSPARENT);
ok(iRet, "gle=%d\n", GetLastError());
TEST_LINE(0, 1, "10000000") TEST_LINE(0, 1, "10000000")
TEST_LINE(0, 2, "10000000") TEST_LINE(0, 2, "10000000")
......
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