[PATCH 2/5] ddraw/tests: New visual back buffer flipping tests. (try 5, resend)
Oldřich Jedlička
oldium.pro at seznam.cz
Sat Aug 21 14:25:27 CDT 2010
Hi Stefan,
On Thursday 19 August 2010 15:40:53 Stefan Dösinger wrote:
> This test contains a C++ comment, please remove it. Otherwise it looks ok,
> as does patch 1
I will start sending patches one-by-one and wait until it is applied - as you
recommended. It will not contain the [PATCH x/y] prefix, so don't be confused
:-) I will also remove the "try 5" and start from the beginning.
I will start with this patch, description is unmodified, but the C++ comment is
converted to C comment.
Oldřich.
>
> Am 18.08.2010 um 22:01 schrieb Oldřich Jedlička:
> > ---
> > dlls/ddraw/tests/visual.c | 123
> > +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 123
> > insertions(+), 0 deletions(-)
> >
> > diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c
> > index 290cb76..aecc2ab 100644
> > --- a/dlls/ddraw/tests/visual.c
> > +++ b/dlls/ddraw/tests/visual.c
> > @@ -2920,6 +2920,128 @@ static void depth_clamp_test(IDirect3DDevice7
> > *device)
> >
> > ok(SUCCEEDED(hr), "SetViewport failed, hr %#x.\n", hr);
> >
> > }
> >
> > +static void DX1_BackBufferFlipTest(void)
> > +{
> > + HRESULT hr;
> > + int ret;
> > + IDirectDraw *DirectDraw1 = NULL;
> > + IDirectDrawSurface *Primary = NULL;
> > + IDirectDrawSurface *Backbuffer = NULL;
> > + WNDCLASS wc = {0};
> > + DDSURFACEDESC ddsd;
> > + DDBLTFX ddbltfx;
> > + COLORREF color;
> > + const DWORD white = 0xffffff;
> > + const DWORD red = 0xff0000;
> > + BOOL attached = FALSE;
> > +
> > + wc.lpfnWndProc = DefWindowProc;
> > + wc.lpszClassName = "DX1_BackBufferFlipTest_wc";
> > + RegisterClass(&wc);
> > + window = CreateWindow("DX1_BackBufferFlipTest_wc",
> > "DX1_BackBufferFlipTest", + WS_MAXIMIZE |
> > WS_VISIBLE | WS_CAPTION , 0, 0, 640, 480, 0, 0, 0, 0); +
> > + hr = DirectDrawCreate( NULL, &DirectDraw1, NULL );
> > + ok(hr==DD_OK || hr==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreate
> > returned: %x\n", hr); + if(FAILED(hr)) goto out;
> > +
> > + hr = IDirectDraw_SetCooperativeLevel(DirectDraw1, window,
> > DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(hr==DD_OK,
> > "SetCooperativeLevel returned: %x\n", hr);
> > + if(FAILED(hr)) goto out;
> > +
> > + hr = IDirectDraw_SetDisplayMode(DirectDraw1, 640, 480, 32);
> > + if(FAILED(hr)) {
> > + /* 24 bit is fine too */
> > + hr = IDirectDraw_SetDisplayMode(DirectDraw1, 640, 480, 24);
> > + }
> > + ok(hr==DD_OK || hr == DDERR_UNSUPPORTED, "SetDisplayMode returned:
> > %x\n", hr); + if (FAILED(hr)) {
> > + goto out;
> > + }
> > +
> > + memset(&ddsd, 0, sizeof(DDSURFACEDESC));
> > + ddsd.dwSize = sizeof(DDSURFACEDESC);
> > + ddsd.dwFlags = DDSD_CAPS;
> > + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
> > +
> > + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &Primary, NULL);
> > + ok(hr==DD_OK, "IDirectDraw_CreateSurface returned: %08x\n", hr);
> > +
> > + memset(&ddsd, 0, sizeof(DDSURFACEDESC));
> > + ddsd.dwSize = sizeof(DDSURFACEDESC);
> > + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT |
> > DDSD_PIXELFORMAT; + ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
> > + ddsd.dwWidth = 640;
> > + ddsd.dwHeight = 480;
> > + ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
> > + ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
> > + U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32;
> > + U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
> > + U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
> > + U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
> > +
> > + hr = IDirectDraw_CreateSurface(DirectDraw1, &ddsd, &Backbuffer,
> > NULL); + todo_wine ok(hr==DD_OK, "IDirectDraw_CreateSurface returned:
> > %08x\n", hr); + if(FAILED(hr)) goto out;
> > +
> > + hr = IDirectDrawSurface_AddAttachedSurface(Primary, Backbuffer);
> > + todo_wine ok(hr == DD_OK || broken(hr == DDERR_CANNOTATTACHSURFACE),
> > + "Attaching a back buffer to a front buffer returned %08x\n", hr);
> > + if (FAILED(hr)) goto out;
> > +
> > + attached = TRUE;
> > +
> > + memset(&ddbltfx, 0, sizeof(ddbltfx));
> > + ddbltfx.dwSize = sizeof(ddbltfx);
> > + U5(ddbltfx).dwFillColor = red;
> > + hr = IDirectDrawSurface_Blt(Backbuffer, NULL, NULL, NULL,
> > DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + ok(hr == DD_OK,
> > "IDirectDrawSurface_Blt returned: %x\n", hr); +
> > + U5(ddbltfx).dwFillColor = white;
> > + hr = IDirectDrawSurface_Blt(Primary, NULL, NULL, NULL,
> > DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); + ok(hr == DD_OK,
> > "IDirectDrawSurface_Blt returned: %x\n", hr); +
> > + // Check it out
> > + color = getPixelColor_GDI(Primary, 5, 5);
> > + ok(GetRValue(color) == 0xFF && GetGValue(color) == 0xFF &&
> > GetBValue(color) == 0xFF, + "got R %02X G %02X B %02X,
> > expected R FF G FF B FF\n", + GetRValue(color),
> > GetGValue(color), GetBValue(color)); +
> > + color = getPixelColor_GDI(Backbuffer, 5, 5);
> > + ok(GetRValue(color) == 0xFF && GetGValue(color) == 0 &&
> > GetBValue(color) == 0, + "got R %02X G %02X B %02X, expected
> > R FF G 00 B 00\n", + GetRValue(color), GetGValue(color),
> > GetBValue(color)); +
> > + hr = IDirectDrawSurface_Flip(Primary, NULL, DDFLIP_WAIT);
> > + todo_wine ok(hr == DD_OK, "IDirectDrawSurface_Flip returned
> > 0x%08x\n", hr); +
> > + if (hr == DD_OK)
> > + {
> > + color = getPixelColor_GDI(Primary, 5, 5);
> > + ok(GetRValue(color) == 0xFF && GetGValue(color) == 0 &&
> > GetBValue(color) == 0, + "got R %02X G %02X B %02X,
> > expected R FF G 00 B 00\n", + GetRValue(color),
> > GetGValue(color), GetBValue(color)); +
> > + color = getPixelColor_GDI(Backbuffer, 5, 5);
> > + ok((GetRValue(color) == 0xFF && GetGValue(color) == 0xFF &&
> > GetBValue(color) == 0xFF) || + broken(GetRValue(color) == 0xFF
> > && GetGValue(color) == 0 && GetBValue(color) == 0), // broken driver +
> > "got R %02X G %02X B %02X, expected R FF G FF B FF\n", +
> > GetRValue(color), GetGValue(color), GetBValue(color)); +
> > }
> > +
> > + out:
> > +
> > + if (Backbuffer)
> > + {
> > + if (attached)
> > + IDirectDrawSurface_DeleteAttachedSurface(Primary, 0,
> > Backbuffer); + IDirectDrawSurface_Release(Backbuffer);
> > + }
> > + if (Primary) IDirectDrawSurface_Release(Primary);
> > + if (DirectDraw1) IDirectDraw_Release(DirectDraw1);
> > + if (window) DestroyWindow(window);
> > +}
> > +
> > START_TEST(visual)
> > {
> >
> > HRESULT hr;
> >
> > @@ -2983,6 +3105,7 @@ START_TEST(visual)
> >
> > D3D3_ViewportClearTest();
> > p8_primary_test();
> >
> > + DX1_BackBufferFlipTest();
> >
> > return ;
More information about the wine-devel
mailing list