Commit 8ab39efe authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdi32/tests: Remove workarounds for SetLayout().

parent 9db0d763
...@@ -40,7 +40,6 @@ static NTSTATUS (WINAPI *pD3DKMTCreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY * ...@@ -40,7 +40,6 @@ static NTSTATUS (WINAPI *pD3DKMTCreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *
static NTSTATUS (WINAPI *pD3DKMTDestroyDCFromMemory)( const D3DKMT_DESTROYDCFROMMEMORY *desc ); static NTSTATUS (WINAPI *pD3DKMTDestroyDCFromMemory)( const D3DKMT_DESTROYDCFROMMEMORY *desc );
static BOOL (WINAPI *pGdiAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION); static BOOL (WINAPI *pGdiAlphaBlend)(HDC,int,int,int,int,HDC,int,int,int,int,BLENDFUNCTION);
static BOOL (WINAPI *pGdiGradientFill)(HDC,TRIVERTEX*,ULONG,void*,ULONG,ULONG); static BOOL (WINAPI *pGdiGradientFill)(HDC,TRIVERTEX*,ULONG,void*,ULONG,ULONG);
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static inline int get_bitmap_stride( int width, int bpp ) static inline int get_bitmap_stride( int width, int bpp )
{ {
...@@ -4216,15 +4215,9 @@ static void test_GetSetDIBits_rtl(void) ...@@ -4216,15 +4215,9 @@ static void test_GetSetDIBits_rtl(void)
int ret; int ret;
DWORD bits_1[8 * 8], bits_2[8 * 8]; DWORD bits_1[8 * 8], bits_2[8 * 8];
if(!pSetLayout)
{
win_skip("Don't have SetLayout\n");
return;
}
hdc = GetDC( NULL ); hdc = GetDC( NULL );
hdc_mem = CreateCompatibleDC( hdc ); hdc_mem = CreateCompatibleDC( hdc );
pSetLayout( hdc_mem, LAYOUT_LTR ); SetLayout( hdc_mem, LAYOUT_LTR );
bitmap = CreateCompatibleBitmap( hdc, 8, 8 ); bitmap = CreateCompatibleBitmap( hdc, 8, 8 );
orig_bitmap = SelectObject( hdc_mem, bitmap ); orig_bitmap = SelectObject( hdc_mem, bitmap );
...@@ -4244,7 +4237,7 @@ static void test_GetSetDIBits_rtl(void) ...@@ -4244,7 +4237,7 @@ static void test_GetSetDIBits_rtl(void)
ok(ret == 8, "got %d\n", ret); ok(ret == 8, "got %d\n", ret);
ok(bits_1[56] == 0xff0000, "got %08x\n", bits_1[56]); /* check we have a red pixel */ ok(bits_1[56] == 0xff0000, "got %08x\n", bits_1[56]); /* check we have a red pixel */
pSetLayout( hdc_mem, LAYOUT_RTL ); SetLayout( hdc_mem, LAYOUT_RTL );
ret = GetDIBits( hdc_mem, bitmap, 0, 8, bits_2, &info, DIB_RGB_COLORS ); ret = GetDIBits( hdc_mem, bitmap, 0, 8, bits_2, &info, DIB_RGB_COLORS );
ok(ret == 8, "got %d\n", ret); ok(ret == 8, "got %d\n", ret);
...@@ -4254,7 +4247,7 @@ static void test_GetSetDIBits_rtl(void) ...@@ -4254,7 +4247,7 @@ static void test_GetSetDIBits_rtl(void)
/* Now to show that SetDIBits also ignores the mode, we perform a SetDIBits /* Now to show that SetDIBits also ignores the mode, we perform a SetDIBits
followed by a GetDIBits and show that the bits remain unchanged. */ followed by a GetDIBits and show that the bits remain unchanged. */
pSetLayout( hdc_mem, LAYOUT_LTR ); SetLayout( hdc_mem, LAYOUT_LTR );
ret = SetDIBits( hdc_mem, bitmap, 0, 8, bits_1, &info, DIB_RGB_COLORS ); ret = SetDIBits( hdc_mem, bitmap, 0, 8, bits_1, &info, DIB_RGB_COLORS );
ok(ret == 8, "got %d\n", ret); ok(ret == 8, "got %d\n", ret);
...@@ -4262,7 +4255,7 @@ static void test_GetSetDIBits_rtl(void) ...@@ -4262,7 +4255,7 @@ static void test_GetSetDIBits_rtl(void)
ok(ret == 8, "got %d\n", ret); ok(ret == 8, "got %d\n", ret);
ok(!memcmp( bits_1, bits_2, sizeof(bits_1) ), "bits differ\n"); ok(!memcmp( bits_1, bits_2, sizeof(bits_1) ), "bits differ\n");
pSetLayout( hdc_mem, LAYOUT_RTL ); SetLayout( hdc_mem, LAYOUT_RTL );
ret = SetDIBits( hdc_mem, bitmap, 0, 8, bits_1, &info, DIB_RGB_COLORS ); ret = SetDIBits( hdc_mem, bitmap, 0, 8, bits_1, &info, DIB_RGB_COLORS );
ok(ret == 8, "got %d\n", ret); ok(ret == 8, "got %d\n", ret);
...@@ -5165,19 +5158,16 @@ static void test_SetDIBitsToDevice(void) ...@@ -5165,19 +5158,16 @@ static void test_SetDIBitsToDevice(void)
memset( dib_bits, 0xaa, 64 * 4 ); memset( dib_bits, 0xaa, 64 * 4 );
SetMapMode( hdc, MM_TEXT ); SetMapMode( hdc, MM_TEXT );
if (pSetLayout) SetLayout( hdc, LAYOUT_RTL );
{ ret = SetDIBitsToDevice( hdc, 1, 2, 3, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS );
pSetLayout( hdc, LAYOUT_RTL ); ok( ret == 3, "got %d\n", ret );
ret = SetDIBitsToDevice( hdc, 1, 2, 3, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS ); for (i = 0; i < 64; i++)
ok( ret == 3, "got %d\n", ret ); if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46)
for (i = 0; i < 64; i++) ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] );
if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46) else
ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] ); ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
else memset( dib_bits, 0xaa, 64 * 4 );
ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] ); SetLayout( hdc, LAYOUT_LTR );
memset( dib_bits, 0xaa, 64 * 4 );
pSetLayout( hdc, LAYOUT_LTR );
}
/* t-d -> b-u */ /* t-d -> b-u */
info->bmiHeader.biHeight = -8; info->bmiHeader.biHeight = -8;
...@@ -5954,7 +5944,6 @@ START_TEST(bitmap) ...@@ -5954,7 +5944,6 @@ START_TEST(bitmap)
pD3DKMTDestroyDCFromMemory = (void *)GetProcAddress( hdll, "D3DKMTDestroyDCFromMemory" ); pD3DKMTDestroyDCFromMemory = (void *)GetProcAddress( hdll, "D3DKMTDestroyDCFromMemory" );
pGdiAlphaBlend = (void *)GetProcAddress( hdll, "GdiAlphaBlend" ); pGdiAlphaBlend = (void *)GetProcAddress( hdll, "GdiAlphaBlend" );
pGdiGradientFill = (void *)GetProcAddress( hdll, "GdiGradientFill" ); pGdiGradientFill = (void *)GetProcAddress( hdll, "GdiGradientFill" );
pSetLayout = (void *)GetProcAddress( hdll, "SetLayout" );
test_createdibitmap(); test_createdibitmap();
test_dibsections(); test_dibsections();
......
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#define LAYOUT_LTR 0 #define LAYOUT_LTR 0
#endif #endif
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static void test_dc_values(void) static void test_dc_values(void)
{ {
HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL); HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
...@@ -1002,27 +1000,24 @@ static void test_boundsrect(void) ...@@ -1002,27 +1000,24 @@ static void test_boundsrect(void)
SetRect(&expect, 40, 70, 100, 130); SetRect(&expect, 40, 70, 100, 130);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect)); ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
if (pSetLayout) SetLayout( hdc, LAYOUT_RTL );
{ ret = GetBoundsRect(hdc, &rect, 0);
pSetLayout( hdc, LAYOUT_RTL ); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
ret = GetBoundsRect(hdc, &rect, 0); SetRect(&expect, 159, 70, 99, 130);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect(&expect, 159, 70, 99, 130); SetRect(&set_rect, 50, 25, 30, 35);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect)); ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
SetRect(&set_rect, 50, 25, 30, 35); ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
ret = GetBoundsRect(hdc, &rect, 0); SetRect(&expect, 50, 25, 30, 35);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect(&expect, 50, 25, 30, 35);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
pSetLayout( hdc, LAYOUT_LTR ); SetLayout( hdc, LAYOUT_LTR );
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 149, 25, 169, 35); SetRect(&expect, 149, 25, 169, 35);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect)); ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
}
/* empty rect resets, except on nt4 */ /* empty rect resets, except on nt4 */
SetRect(&expect, 20, 20, 10, 10); SetRect(&expect, 20, 20, 10, 10);
...@@ -1642,7 +1637,6 @@ static void test_clip_box(void) ...@@ -1642,7 +1637,6 @@ static void test_clip_box(void)
START_TEST(dc) START_TEST(dc)
{ {
pSetLayout = (void *)GetProcAddress( GetModuleHandleA("gdi32.dll"), "SetLayout");
test_dc_values(); test_dc_values();
test_savedc(); test_savedc();
test_savedc_2(); test_savedc_2();
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include "winuser.h" #include "winuser.h"
#include "winerror.h" #include "winerror.h"
static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc); static DWORD (WINAPI *pGetLayout)(HDC hdc);
static INT (WINAPI *pGetRandomRgn)(HDC hDC, HRGN hRgn, INT iCode); static INT (WINAPI *pGetRandomRgn)(HDC hDC, HRGN hRgn, INT iCode);
static BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *); static BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *);
...@@ -247,9 +246,9 @@ static void test_dc_layout(void) ...@@ -247,9 +246,9 @@ static void test_dc_layout(void)
HDC hdc; HDC hdc;
HRGN hrgn; HRGN hrgn;
if (!pGetLayout || !pSetLayout) if (!pGetLayout)
{ {
win_skip( "Don't have SetLayout\n" ); win_skip( "Don't have GetLayout\n" );
return; return;
} }
...@@ -271,7 +270,7 @@ static void test_dc_layout(void) ...@@ -271,7 +270,7 @@ static void test_dc_layout(void)
expect_world_transform(hdc, 1.0, 1.0); expect_world_transform(hdc, 1.0, 1.0);
expect_LPtoDP(hdc, 1000, 1000); expect_LPtoDP(hdc, 1000, 1000);
pSetLayout( hdc, LAYOUT_RTL ); SetLayout( hdc, LAYOUT_RTL );
if (!pGetLayout( hdc )) if (!pGetLayout( hdc ))
{ {
win_skip( "SetLayout not supported\n" ); win_skip( "SetLayout not supported\n" );
...@@ -310,7 +309,7 @@ static void test_dc_layout(void) ...@@ -310,7 +309,7 @@ static void test_dc_layout(void)
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc )); ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
pSetLayout( hdc, LAYOUT_LTR ); SetLayout( hdc, LAYOUT_LTR );
SetRect( &rc, 80, 10, 90, 20 ); SetRect( &rc, 80, 10, 90, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
...@@ -318,7 +317,7 @@ static void test_dc_layout(void) ...@@ -318,7 +317,7 @@ static void test_dc_layout(void)
GetClipBox( hdc, &ret_rc ); GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc )); ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
IntersectClipRect( hdc, 80, 10, 85, 20 ); IntersectClipRect( hdc, 80, 10, 85, 20 );
pSetLayout( hdc, LAYOUT_RTL ); SetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 20, 20 ); SetRect( &rc, 15, 10, 20, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
...@@ -326,9 +325,9 @@ static void test_dc_layout(void) ...@@ -326,9 +325,9 @@ static void test_dc_layout(void)
GetClipBox( hdc, &ret_rc ); GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc )); ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
SetRectRgn( hrgn, 60, 10, 80, 20 ); SetRectRgn( hrgn, 60, 10, 80, 20 );
pSetLayout( hdc, LAYOUT_LTR ); SetLayout( hdc, LAYOUT_LTR );
ExtSelectClipRgn( hdc, hrgn, RGN_OR ); ExtSelectClipRgn( hdc, hrgn, RGN_OR );
pSetLayout( hdc, LAYOUT_RTL ); SetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 40, 20 ); SetRect( &rc, 15, 10, 40, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
...@@ -370,7 +369,7 @@ static void test_dc_layout(void) ...@@ -370,7 +369,7 @@ static void test_dc_layout(void)
SetMapMode(hdc, MM_TEXT); SetMapMode(hdc, MM_TEXT);
ret = GetMapMode( hdc ); ret = GetMapMode( hdc );
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret); ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
pSetLayout( hdc, LAYOUT_LTR ); SetLayout( hdc, LAYOUT_LTR );
ret = GetMapMode( hdc ); ret = GetMapMode( hdc );
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret); ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
SetMapMode(hdc, MM_TEXT); SetMapMode(hdc, MM_TEXT);
...@@ -715,7 +714,6 @@ START_TEST(mapping) ...@@ -715,7 +714,6 @@ START_TEST(mapping)
{ {
HMODULE mod = GetModuleHandleA("gdi32.dll"); HMODULE mod = GetModuleHandleA("gdi32.dll");
pGetLayout = (void *)GetProcAddress( mod, "GetLayout" ); pGetLayout = (void *)GetProcAddress( mod, "GetLayout" );
pSetLayout = (void *)GetProcAddress( mod, "SetLayout" );
pGetRandomRgn = (void *)GetProcAddress( mod, "GetRandomRgn" ); pGetRandomRgn = (void *)GetProcAddress( mod, "GetRandomRgn" );
pGetTransform = (void *)GetProcAddress( mod, "GetTransform" ); pGetTransform = (void *)GetProcAddress( mod, "GetTransform" );
pSetVirtualResolution = (void *)GetProcAddress( mod, "SetVirtualResolution" ); pSetVirtualResolution = (void *)GetProcAddress( mod, "SetVirtualResolution" );
......
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