https://git.reactos.org/?p=reactos.git;a=commitdiff;h=92a9a445ddf2a43e69fd5…
commit 92a9a445ddf2a43e69fd5db1322d674b8203a892
Author: Serge Gautherie <reactos-git_serge_171003(a)gautherie.fr>
AuthorDate: Fri Sep 21 00:58:14 2018 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sun Jun 2 19:10:30 2019 +0200
[WIN32KNT_APITEST:NTDD] Improve failure handling
And remove comments about ReactX.
ROSTESTS-315
---
.../win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c | 31 +++++++++++++++-----
.../win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c | 33 ++++++++++++++++------
.../win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c | 26 ++++++++---------
3 files changed, 62 insertions(+), 28 deletions(-)
diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c
b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c
index eb07b83d64b..4e0f5c8ec4f 100644
--- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c
+++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdCreateDirectDrawObject.c
@@ -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");
}
diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c
b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c
index 00ee1f57c52..78d1af7a325 100644
--- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c
+++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdDeleteDirectDrawObject.c
@@ -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");
}
diff --git a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c
b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c
index ab3fb14b59b..e682b7d25fe 100644
--- a/modules/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c
+++ b/modules/rostests/apitests/win32nt/ntdd/NtGdiDdQueryDirectDrawObject.c
@@ -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");
}