Commit 4bc4e431 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d8/tests: Prefer higher resolutions in test_reset().

parent bd103626
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
*/ */
#define WINVER 0x0602 /* for CURSOR_SUPPRESSED */ #define WINVER 0x0602 /* for CURSOR_SUPPRESSED */
#include <stdlib.h>
#define COBJMACROS #define COBJMACROS
#include <initguid.h> #include <initguid.h>
#include <d3d8.h> #include <d3d8.h>
...@@ -1269,6 +1270,21 @@ static void test_display_modes(void) ...@@ -1269,6 +1270,21 @@ static void test_display_modes(void)
IDirect3D8_Release(d3d); IDirect3D8_Release(d3d);
} }
struct mode
{
unsigned int w;
unsigned int h;
};
static int compare_mode(const void *a, const void *b)
{
const struct mode *mode_a = a;
const struct mode *mode_b = b;
unsigned int w = mode_a->w - mode_b->w;
unsigned int h = mode_b->h - mode_b->h;
return abs(w) >= abs(h) ? -w : -h;
}
static void test_reset(void) static void test_reset(void)
{ {
UINT width, orig_width = GetSystemMetrics(SM_CXSCREEN); UINT width, orig_width = GetSystemMetrics(SM_CXSCREEN);
...@@ -1303,11 +1319,7 @@ static void test_reset(void) ...@@ -1303,11 +1319,7 @@ static void test_reset(void)
D3DVSD_END(), D3DVSD_END(),
}; };
struct struct mode *modes = NULL;
{
UINT w;
UINT h;
} *modes = NULL;
window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW,
100, 100, 160, 160, NULL, NULL, NULL, NULL); 100, 100, 160, 160, NULL, NULL, NULL, NULL);
...@@ -1358,6 +1370,9 @@ static void test_reset(void) ...@@ -1358,6 +1370,9 @@ static void test_reset(void)
goto cleanup; goto cleanup;
} }
/* Prefer higher resolutions. */
qsort(modes, mode_count, sizeof(*modes), compare_mode);
i = 0; i = 0;
if (modes[i].w == orig_width && modes[i].h == orig_height) ++i; if (modes[i].w == orig_width && modes[i].h == orig_height) ++i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment