1 BOOL CreateSurface(LPDIRECTDRAWSURFACE7* pSurface); 2 3 BOOL Test_Misc (INT* passed, INT* failed) 4 { 5 LPDIRECTDRAWSURFACE7 Surface; 6 if(!CreateSurface(&Surface)) 7 return FALSE; 8 9 TEST (Surface->Initialize(NULL, NULL) == DDERR_ALREADYINITIALIZED); 10 11 // GetCaps 12 DDSCAPS2 Caps; 13 TEST (Surface->GetCaps((DDSCAPS2*)0xdeadbeef) == DDERR_INVALIDPARAMS); 14 TEST (Surface->GetCaps(&Caps) == DD_OK && Caps.dwCaps == 0x10004040 15 && Caps.dwCaps2 == 0 && Caps.dwCaps3 == 0 && Caps.dwCaps4 == 0); // FIXME: Replace 0x10004040 16 17 // GetDC / ReleaseDC 18 HDC hdc; 19 TEST (Surface->GetDC((HDC*)0xdeadbeef) == DDERR_INVALIDPARAMS); 20 TEST (Surface->ReleaseDC((HDC)0xdeadbeef) == DDERR_NODC); 21 TEST (Surface->ReleaseDC(GetDC(NULL)) == DDERR_NODC); 22 23 TEST (Surface->GetDC(&hdc) == DD_OK); 24 TEST (MoveToEx(hdc, 0, 0, NULL) == TRUE); // validate hdc 25 TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_SURFACEBUSY); // check lock 26 TEST (Surface->ReleaseDC(hdc) == DD_OK); 27 28 // ChangeUniquenessValue / GetUniquenessValue 29 DWORD Value; 30 // FIXME: find out other apis which increases the uniqueness value 31 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 2); 32 TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_INVALIDPARAMS); // Even this increases the uniqueness value 33 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 3); 34 TEST (Surface->ChangeUniquenessValue() == DD_OK); 35 TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 4); 36 37 // GetPixelFormat 38 DDPIXELFORMAT PixelFormat = {0}; 39 // FIXME: Produce DDERR_INVALIDSURFACETYPE 40 TEST (Surface->GetPixelFormat((LPDDPIXELFORMAT)0xdeadbeef) == DDERR_INVALIDPARAMS); 41 TEST (Surface->GetPixelFormat(&PixelFormat)); 42 PixelFormat.dwSize = sizeof(DDPIXELFORMAT); 43 TEST (Surface->GetPixelFormat(&PixelFormat) == DD_OK && PixelFormat.dwFlags == 0x40); // FIXME: Find out what 0x40 is 44 45 // GetSurfaceDesc / SetSurfaceDesc 46 DDSURFACEDESC2 Desc = {0}; 47 // FIXME: Produce DDERR_INVALIDSURFACETYPE 48 TEST (Surface->GetSurfaceDesc((LPDDSURFACEDESC2)0xdeadbeef) == DDERR_INVALIDPARAMS); 49 TEST (Surface->GetSurfaceDesc(&Desc)); 50 Desc.dwSize = sizeof(DDSURFACEDESC2); 51 TEST (Surface->GetSurfaceDesc(&Desc) == DD_OK && Desc.dwFlags == 0x100f); // FIXME: Find out what 0x100f is 52 TEST (memcmp ((PVOID)&Desc.ddpfPixelFormat, (PVOID)&PixelFormat, sizeof(DDPIXELFORMAT)) == 0); 53 // FIXME: Test SetSurfaceDesc 54 55 // GetDDInterface 56 IUnknown* iface; 57 TEST(Surface->GetDDInterface((LPVOID*)0xdeadbeef) == DDERR_INVALIDPARAMS); 58 TEST(Surface->GetDDInterface((LPVOID*)&iface) == DD_OK && iface); 59 TEST(iface->Release() == 1); // FIXME: Test the interface further 60 61 Surface->Release(); 62 63 return TRUE; 64 } 65