Beginning of CreateSurface test.
authorMaarten Bosma <maarten@bosma.de>
Sun, 13 May 2007 16:37:58 +0000 (16:37 +0000)
committerMaarten Bosma <maarten@bosma.de>
Sun, 13 May 2007 16:37:58 +0000 (16:37 +0000)
svn path=/trunk/; revision=26755

rostests/dxtest/ddraw/testlist.cpp
rostests/dxtest/ddraw/tests/CreateSurface.cpp [new file with mode: 0644]
rostests/dxtest/ddraw/tests/DisplayModes.cpp

index 1f091f7..e20d74e 100644 (file)
@@ -7,13 +7,15 @@
 /* include the tests */
 #include "tests/CreateDDraw.cpp"
 #include "tests/DisplayModes.cpp"
+#include "tests/CreateSurface.cpp"
 
 /* The List of tests */
 TEST TestList[] =
 {
        { "DirectDrawCreate(Ex)", Test_CreateDDraw },
        { "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
-       // { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes } // uncomment this test if you have enough time and patience
+       // { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience
+       { "IDirectDraw::CreateSurface", Test_CreateSurface }
 };
 
 /* The function that gives us the number of tests */
diff --git a/rostests/dxtest/ddraw/tests/CreateSurface.cpp b/rostests/dxtest/ddraw/tests/CreateSurface.cpp
new file mode 100644 (file)
index 0000000..33edbbc
--- /dev/null
@@ -0,0 +1,46 @@
+
+HWND CreateBasicWindow (VOID);
+
+BOOL Test_CreateSurface (INT* passed, INT* failed)
+{
+       LPDIRECTDRAW7 DirectDraw;
+       LPDIRECTDRAWSURFACE7 DirectDrawSurface;
+       HWND hwnd;
+
+       /* Preparations */
+       if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
+       {
+               printf("ERROR: Failed to set up ddraw\n");
+               return FALSE;
+       }
+
+       if(!( hwnd = CreateBasicWindow() ))
+       {
+               printf("ERROR: Failed to create window\n");
+               DirectDraw->Release();
+               return FALSE;
+       }
+
+       if (DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) != DD_OK)
+       {
+               printf("ERROR: you not set cooperative level\n");
+               DirectDraw->Release();
+               return 0;
+       }
+
+       /* The Test */
+
+       DDSURFACEDESC2 Desc = { 0 };
+
+       TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION );
+       TEST ( DirectDraw->CreateSurface(NULL, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
+       TEST ( DirectDraw->CreateSurface(&Desc, NULL, NULL) == DDERR_INVALIDPARAMS );
+       TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
+
+       Desc.dwSize = sizeof (DDSURFACEDESC2);
+       TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
+
+       DirectDraw->Release();
+
+       return TRUE;
+}
\ No newline at end of file
index 4592e8e..7dd9514 100644 (file)
@@ -42,6 +42,8 @@ BOOL Test_DisplayModes (INT* passed, INT* failed)
        TEST ( DirectDraw->SetDisplayMode (800, 600, 0, 0, 0) == DD_OK ); 
        TEST ( DirectDraw->SetDisplayMode (0, 0, 16, 0, 0) == DD_OK );
 
+       // does this change the display mode to DDSCL_EXCLUSIVE ?
+
        // Now try getting vaild modes from driver
        TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, NULL) == DDERR_INVALIDPARAMS);
        TEST (DirectDraw->EnumDisplayModes(0, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );