[WIN32KNT_APITEST:NTDD] Improve failure handling

And remove comments about ReactX.

ROSTESTS-315
This commit is contained in:
Serge Gautherie 2018-09-21 00:58:14 +02:00 committed by Timo Kreuzer
parent ba884619b0
commit 92a9a445dd
3 changed files with 62 additions and 28 deletions

View file

@ -11,13 +11,30 @@ START_TEST(NtGdiDdCreateDirectDrawObject)
{
HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
ok(hdc != NULL, "\n");
ok(hdc != NULL, "CreateDCW() failed\n");
/* Test ReactX */
ok(NtGdiDdCreateDirectDrawObject(NULL) == NULL, "\n");
ok((hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
hDirectDraw = NtGdiDdCreateDirectDrawObject(NULL);
ok(hDirectDraw == NULL,
"NtGdiDdCreateDirectDrawObject() succeeded on NULL device context\n");
if (hDirectDraw != NULL)
{
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE,
"NtGdiDdDeleteDirectDrawObject() failed on unwanted object\n");
}
/* Cleanup ReactX setup */
DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
if (hdc == NULL)
{
skip("No DC\n");
return;
}
hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc);
ok(hDirectDraw != NULL, "NtGdiDdCreateDirectDrawObject() failed\n");
if (hDirectDraw != NULL)
{
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE,
"NtGdiDdDeleteDirectDrawObject() failed\n");
}
ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
}

View file

@ -11,14 +11,31 @@ START_TEST(NtGdiDdDeleteDirectDrawObject)
{
HANDLE hDirectDraw;
HDC hdc = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
ok(hdc != NULL, "\n");
ok(hdc != NULL, "CreateDCW() failed\n");
/* Test ReactX */
ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE, "\n");
ok((hDirectDraw=NtGdiDdCreateDirectDrawObject(hdc)) != NULL, "\n");
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE, "\n");
ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE,
"NtGdiDdDeleteDirectDrawObject() succeeded on NULL object\n");
/* Cleanup ReactX setup */
DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
if (hdc == NULL)
{
skip("No DC\n");
return;
}
hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc);
ok(hDirectDraw != NULL, "NtGdiDdCreateDirectDrawObject() failed\n");
if (hDirectDraw == NULL)
{
skip("No DirectDrawObject\n");
ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
return;
}
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE,
"NtGdiDdDeleteDirectDrawObject() failed on existing object\n");
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == FALSE,
"NtGdiDdDeleteDirectDrawObject() succeeded on deleted object\n");
ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
}

View file

@ -15,7 +15,7 @@
*/
START_TEST(NtGdiDdQueryDirectDrawObject)
{
HANDLE hDirectDraw = NULL;
HANDLE hDirectDraw;
DD_HALINFO *pHalInfo = NULL;
DWORD *pCallBackFlags = NULL;
LPD3DNTHAL_CALLBACKS puD3dCallbacks = NULL;
@ -68,16 +68,8 @@ START_TEST(NtGdiDdQueryDirectDrawObject)
ASSERT(hdc != NULL);
/* Create ReactX handle */
hDirectDraw = (HANDLE) NtGdiDdCreateDirectDrawObject(hdc);
hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc);
RTEST(hDirectDraw != NULL);
if (hDirectDraw == NULL)
{
DeleteDC(hdc);
return;
}
/* Start Test ReactX NtGdiDdQueryDirectDrawObject function */
/* testing OsThunkDdQueryDirectDrawObject( NULL, .... */
RTEST(NtGdiDdQueryDirectDrawObject( NULL, pHalInfo,
@ -98,6 +90,13 @@ START_TEST(NtGdiDdQueryDirectDrawObject)
RTEST(puNumHeaps == NULL);
RTEST(puvmList == NULL);
if (hDirectDraw == NULL)
{
skip("No DirectDrawObject\n");
ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
return;
}
/* testing NtGdiDdQueryDirectDrawObject( hDirectDrawLocal, NULL, .... */
RTEST(NtGdiDdQueryDirectDrawObject( hDirectDraw, pHalInfo,
pCallBackFlags, puD3dCallbacks,
@ -797,7 +796,8 @@ START_TEST(NtGdiDdQueryDirectDrawObject)
* puFourCC
*/
/* Cleanup ReactX setup */
DeleteDC(hdc);
NtGdiDdDeleteDirectDrawObject(hDirectDraw);
ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE,
"NtGdiDdDeleteDirectDrawObject() failed\n");
ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
}