[PATCH 4/4] ddraw/tests: Add test for checking available depth format.
Jactry Zeng
jzeng at codeweavers.com
Sun Jun 16 09:49:56 CDT 2019
Thanks Matteo and Henri!
I sent another try just now.
On 2019/6/13 下午4:56, Matteo Bruni wrote:
> Aside from what Henri already mentioned:
>
> On Wed, May 22, 2019 at 9:57 AM Jactry Zeng <jzeng at codeweavers.com> wrote:
>> Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
>> ---
>> dlls/ddraw/tests/ddraw4.c | 44 +++++++++++++++++++++++++++++++++++++++
>> dlls/ddraw/tests/ddraw7.c | 44 +++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 88 insertions(+)
>>
>> diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
>> index cb7582c1d4..db70fa2423 100644
>> --- a/dlls/ddraw/tests/ddraw4.c
>> +++ b/dlls/ddraw/tests/ddraw4.c
>> @@ -16002,6 +16002,49 @@ static void test_clipper_refcount(void)
>> DestroyWindow(window);
>> }
>>
>> +static HRESULT CALLBACK enum_available_fmt(DDPIXELFORMAT *format, void *ctx)
>> +{
>> + DDPIXELFORMAT *z_fmt = ctx;
>> +
>> + if (U1(*format).dwZBufferBitDepth > U1(*z_fmt).dwZBufferBitDepth)
>> + *z_fmt = *format;
> You don't need this part, you're not going to use it.
>
>> +
>> + ok(U3(*format).dwZBitMask != 0xffffffff, "Got unexpected depth format: %#x.\n", U3(*format).dwZBitMask);
>> +
>> + return DDENUMRET_OK;
>> +}
>> +
>> +static void test_available_fmt(void)
> Minor nitpick, but I'd spell out "formats" here and in the name of the
> callback function above.
>
>> +{
>> + DDPIXELFORMAT z_fmt;
>> + IDirectDraw4 *ddraw;
>> + IDirect3D3 *d3d3;
>> + HWND window;
>> + HRESULT hr;
>> +
>> + ddraw = create_ddraw();
>> + ok(!!ddraw, "Failed to create a ddraw object.\n");
>> +
>> + window = create_window();
>> + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
>> + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
> I'm not 100% sure but it should be possible to avoid creating a window
> and calling SetCooperativeLevel().
>
>> + hr = IDirectDraw4_QueryInterface(ddraw, &IID_IDirect3D3, (void **)&d3d3);
>> + IDirectDraw4_Release(ddraw);
>> + if (FAILED(hr))
>> + {
>> + skip("D3D interface is not available, skipping test.\n");
>> + return;
>> + }
>> +
>> + memset(&z_fmt, 0, sizeof(z_fmt));
>> + hr = IDirect3D3_EnumZBufferFormats(d3d3, &IID_IDirect3DHALDevice, enum_available_fmt, &z_fmt);
>> + if (FAILED(hr) || !z_fmt.dwSize)
>> + skip("No depth buffer formats available, skipping test.\n");
> Related to the comment for the callback, here you don't need to pass
> and then check z_fmt.
>
> Same comments for the ddraw7 test.
More information about the wine-devel
mailing list