gdi32/tests: Make function pointers global in the mapping test.

This commit is contained in:
Alexandre Julliard 2010-07-28 20:34:20 +02:00
parent e4b76dfd88
commit d100153e5c
1 changed files with 11 additions and 10 deletions

View File

@ -29,6 +29,11 @@
#include "winuser.h"
#include "winerror.h"
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc);
static BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *);
static DWORD (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
#define rough_match(got, expected) (abs( MulDiv( (got) - (expected), 1000, (expected) )) <= 5)
#define expect_LPtoDP(_hdc, _x, _y) \
@ -221,12 +226,8 @@ static void test_dc_layout(void)
{
INT ret, size_cx, size_cy, res_x, res_y, dpi_x, dpi_y;
SIZE size;
DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
DWORD (WINAPI *pGetLayout)(HDC hdc);
HDC hdc;
pGetLayout = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetLayout");
pSetLayout = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "SetLayout");
if (!pGetLayout || !pSetLayout)
{
win_skip( "Don't have SetLayout\n" );
@ -421,14 +422,11 @@ static void test_setvirtualresolution(void)
{
HDC hdc = CreateICA("DISPLAY", NULL, NULL, NULL);
DWORD r;
DWORD (WINAPI *pSetVirtualResolution)(HDC, DWORD, DWORD, DWORD, DWORD);
INT horz_res = GetDeviceCaps(hdc, HORZRES);
INT horz_size = GetDeviceCaps(hdc, HORZSIZE);
INT log_pixels_x = GetDeviceCaps(hdc, LOGPIXELSX);
SIZE orig_lometric_vp, orig_lometric_wnd;
pSetVirtualResolution = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "SetVirtualResolution");
if(!pSetVirtualResolution)
{
win_skip("Don't have SetVirtualResolution\n");
@ -533,13 +531,10 @@ static inline void xform_near_match(int line, XFORM *got, XFORM *expect)
static void test_gettransform(void)
{
HDC hdc = CreateICA("DISPLAY", NULL, NULL, NULL);
BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *);
XFORM xform, expect;
BOOL r;
SIZE lometric_vp, lometric_wnd;
pGetTransform = (void *)GetProcAddress(GetModuleHandleA("gdi32.dll"), "GetTransform");
if(!pGetTransform)
{
win_skip("Don't have GetTransform\n");
@ -635,6 +630,12 @@ static void test_gettransform(void)
START_TEST(mapping)
{
HMODULE mod = GetModuleHandleA("gdi32.dll");
pGetLayout = (void *)GetProcAddress( mod, "GetLayout" );
pSetLayout = (void *)GetProcAddress( mod, "SetLayout" );
pGetTransform = (void *)GetProcAddress( mod, "GetTransform" );
pSetVirtualResolution = (void *)GetProcAddress( mod, "SetVirtualResolution" );
test_modify_world_transform();
test_world_transform();
test_dc_layout();