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)
{
DWORD fs[2];
CHARSETINFO csi;
BOOL bRet;
fs[0] = 1L << bit;
fs[1] = 0;
......@@ -812,7 +813,8 @@ static void test_bitmap_font_metrics(void)
hfont = create_font(lf.lfFaceName, &lf);
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)
{
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)
for (i = 0; i < sizeof(kd)/sizeof(kd[0]); i++)
{
OUTLINETEXTMETRICW otm;
UINT uiRet;
if (!is_font_installed(kd[i].face_name))
{
......@@ -1185,7 +1188,8 @@ static void test_GetKerningPairs(void)
SetLastError(0xdeadbeef);
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",
kd[i].tmHeight, otm.otmTextMetrics.tmHeight);
......@@ -3197,6 +3201,7 @@ static void test_AddFontMemResource(void)
void *font;
DWORD font_size, num_fonts;
HANDLE ret;
BOOL bRet;
if (!pAddFontMemResourceEx || !pRemoveFontMemResourceEx)
{
......@@ -3284,7 +3289,8 @@ static void test_AddFontMemResource(void)
free_font(font);
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 */
font = load_font("sserife.fon", &font_size);
......
......@@ -118,6 +118,7 @@ struct hgdiobj_event
static DWORD WINAPI thread_proc(void *param)
{
LOGPEN lp;
DWORD status;
struct hgdiobj_event *hgdiobj_event = param;
hgdiobj_event->hdc = CreateDC("display", NULL, NULL, NULL);
......@@ -130,8 +131,8 @@ static DWORD WINAPI thread_proc(void *param)
ok(hgdiobj_event->hgdiobj2 != 0, "Failed to create pen\n");
SetEvent(hgdiobj_event->ready_event);
ok(WaitForSingleObject(hgdiobj_event->stop_event, INFINITE) == WAIT_OBJECT_0,
"WaitForSingleObject error %u\n", GetLastError());
status = WaitForSingleObject(hgdiobj_event->stop_event, INFINITE);
ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
ok(!GetObject(hgdiobj_event->hgdiobj1, sizeof(lp), &lp), "GetObject should fail\n");
......@@ -147,6 +148,8 @@ static void test_thread_objects(void)
HANDLE hthread;
struct hgdiobj_event hgdiobj_event;
INT ret;
DWORD status;
BOOL bRet;
hgdiobj_event.stop_event = CreateEvent(NULL, 0, 0, NULL);
ok(hgdiobj_event.stop_event != NULL, "CreateEvent error %u\n", GetLastError());
......@@ -156,11 +159,11 @@ static void test_thread_objects(void)
hthread = CreateThread(NULL, 0, thread_proc, &hgdiobj_event, 0, &tid);
ok(hthread != NULL, "CreateThread error %u\n", GetLastError());
ok(WaitForSingleObject(hgdiobj_event.ready_event, INFINITE) == WAIT_OBJECT_0,
"WaitForSingleObject error %u\n", GetLastError());
status = WaitForSingleObject(hgdiobj_event.ready_event, INFINITE);
ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
ok(GetObject(hgdiobj_event.hgdiobj1, sizeof(lp), &lp) == sizeof(lp),
"GetObject error %u\n", GetLastError());
ret = GetObject(hgdiobj_event.hgdiobj1, sizeof(lp), &lp);
ok(ret == sizeof(lp), "GetObject error %u\n", GetLastError());
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.y == 0, "wrong pen width.y %d\n", lp.lopnWidth.y);
......@@ -169,20 +172,23 @@ static void test_thread_objects(void)
ret = GetDeviceCaps(hgdiobj_event.hdc, TECHNOLOGY);
ok(ret == DT_RASDISPLAY, "GetDeviceCaps(TECHNOLOGY) should return DT_RASDISPLAY not %d\n", ret);
ok(DeleteObject(hgdiobj_event.hgdiobj1), "DeleteObject error %u\n", GetLastError());
ok(DeleteDC(hgdiobj_event.hdc), "DeleteDC error %u\n", GetLastError());
bRet = DeleteObject(hgdiobj_event.hgdiobj1);
ok(bRet, "DeleteObject error %u\n", GetLastError());
bRet = DeleteDC(hgdiobj_event.hdc);
ok(bRet, "DeleteDC error %u\n", GetLastError());
type = GetObjectType(hgdiobj_event.hgdiobj2);
ok(type == OBJ_REGION, "GetObjectType returned %u\n", type);
SetEvent(hgdiobj_event.stop_event);
ok(WaitForSingleObject(hthread, INFINITE) == WAIT_OBJECT_0,
"WaitForSingleObject error %u\n", GetLastError());
status = WaitForSingleObject(hthread, INFINITE);
ok(status == WAIT_OBJECT_0, "WaitForSingleObject error %u\n", GetLastError());
CloseHandle(hthread);
type = GetObjectType(hgdiobj_event.hgdiobj2);
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.ready_event);
......
......@@ -340,13 +340,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ret = GetWorldTransform(hdc, &xform);
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);
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);
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);
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);
}
else
......@@ -458,13 +462,17 @@ static int CALLBACK savedc_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ret = GetWorldTransform(hdc, &xform);
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);
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);
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);
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);
}
else
......
......@@ -475,6 +475,8 @@ static void test_ps_alternate(void)
HBITMAP bmp;
HPEN pen;
LOGBRUSH lb;
INT iRet;
HGDIOBJ hRet;
lb.lbStyle = BS_SOLID;
lb.lbColor = RGB(0xff,0xff,0xff);
......@@ -490,9 +492,12 @@ static void test_ps_alternate(void)
ok(hdc != NULL, "gle=%d\n", GetLastError());
bmp = CreateBitmap(8, 1, 1, 1, NULL);
ok(bmp != NULL, "gle=%d\n", GetLastError());
ok(SelectObject(hdc, bmp) != NULL, "gle=%d\n", GetLastError());
ok(SelectObject(hdc, pen) != NULL, "gle=%d\n", GetLastError());
ok(SetBkMode(hdc, TRANSPARENT), "gle=%d\n", GetLastError());
hRet = SelectObject(hdc, bmp);
ok(hRet != NULL, "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, 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