Nikolay Sivov : gdi32/tests: Remove workarounds for SetLayout().
Alexandre Julliard
julliard at winehq.org
Wed Jan 8 16:28:01 CST 2020
Module: wine
Branch: master
Commit: 8ab39efe0af13cad2c898fa68ee98c93bf3b6663
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8ab39efe0af13cad2c898fa68ee98c93bf3b6663
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed Jan 8 11:50:13 2020 +0300
gdi32/tests: Remove workarounds for SetLayout().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/tests/bitmap.c | 39 ++++++++++++++-------------------------
dlls/gdi32/tests/dc.c | 40 +++++++++++++++++-----------------------
dlls/gdi32/tests/mapping.c | 18 ++++++++----------
3 files changed, 39 insertions(+), 58 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 8f0f6601b3..fe3482671b 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -40,7 +40,6 @@ static NTSTATUS (WINAPI *pD3DKMTCreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *
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 *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 )
{
@@ -4216,15 +4215,9 @@ static void test_GetSetDIBits_rtl(void)
int ret;
DWORD bits_1[8 * 8], bits_2[8 * 8];
- if(!pSetLayout)
- {
- win_skip("Don't have SetLayout\n");
- return;
- }
-
hdc = GetDC( NULL );
hdc_mem = CreateCompatibleDC( hdc );
- pSetLayout( hdc_mem, LAYOUT_LTR );
+ SetLayout( hdc_mem, LAYOUT_LTR );
bitmap = CreateCompatibleBitmap( hdc, 8, 8 );
orig_bitmap = SelectObject( hdc_mem, bitmap );
@@ -4244,7 +4237,7 @@ static void test_GetSetDIBits_rtl(void)
ok(ret == 8, "got %d\n", ret);
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 );
ok(ret == 8, "got %d\n", ret);
@@ -4254,7 +4247,7 @@ static void test_GetSetDIBits_rtl(void)
/* Now to show that SetDIBits also ignores the mode, we perform a SetDIBits
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 );
ok(ret == 8, "got %d\n", ret);
@@ -4262,7 +4255,7 @@ static void test_GetSetDIBits_rtl(void)
ok(ret == 8, "got %d\n", ret);
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 );
ok(ret == 8, "got %d\n", ret);
@@ -5165,19 +5158,16 @@ static void test_SetDIBitsToDevice(void)
memset( dib_bits, 0xaa, 64 * 4 );
SetMapMode( hdc, MM_TEXT );
- if (pSetLayout)
- {
- pSetLayout( hdc, LAYOUT_RTL );
- ret = SetDIBitsToDevice( hdc, 1, 2, 3, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS );
- ok( ret == 3, "got %d\n", ret );
- for (i = 0; i < 64; i++)
- if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46)
- ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] );
- else
- ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
- memset( dib_bits, 0xaa, 64 * 4 );
- pSetLayout( hdc, LAYOUT_LTR );
- }
+ SetLayout( hdc, LAYOUT_RTL );
+ ret = SetDIBitsToDevice( hdc, 1, 2, 3, 2, 1, 2, 1, 5, data, info, DIB_RGB_COLORS );
+ ok( ret == 3, "got %d\n", ret );
+ for (i = 0; i < 64; i++)
+ if (i == 36 || i == 37 || i == 38 || i == 44 || i == 45 || i == 46)
+ ok( dib_bits[i] == data[i - 27], "%d: got %08x\n", i, dib_bits[i] );
+ else
+ ok( dib_bits[i] == 0xaaaaaaaa, "%d: got %08x\n", i, dib_bits[i] );
+ memset( dib_bits, 0xaa, 64 * 4 );
+ SetLayout( hdc, LAYOUT_LTR );
/* t-d -> b-u */
info->bmiHeader.biHeight = -8;
@@ -5954,7 +5944,6 @@ START_TEST(bitmap)
pD3DKMTDestroyDCFromMemory = (void *)GetProcAddress( hdll, "D3DKMTDestroyDCFromMemory" );
pGdiAlphaBlend = (void *)GetProcAddress( hdll, "GdiAlphaBlend" );
pGdiGradientFill = (void *)GetProcAddress( hdll, "GdiGradientFill" );
- pSetLayout = (void *)GetProcAddress( hdll, "SetLayout" );
test_createdibitmap();
test_dibsections();
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 4f53e433b4..c8a903e56b 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -38,8 +38,6 @@
#define LAYOUT_LTR 0
#endif
-static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
-
static void test_dc_values(void)
{
HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
@@ -1002,27 +1000,24 @@ static void test_boundsrect(void)
SetRect(&expect, 40, 70, 100, 130);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
- if (pSetLayout)
- {
- pSetLayout( hdc, LAYOUT_RTL );
- ret = GetBoundsRect(hdc, &rect, 0);
- ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
- SetRect(&expect, 159, 70, 99, 130);
- ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
- SetRect(&set_rect, 50, 25, 30, 35);
- ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
- ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
- ret = GetBoundsRect(hdc, &rect, 0);
- ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
- SetRect(&expect, 50, 25, 30, 35);
- ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
+ SetLayout( hdc, LAYOUT_RTL );
+ ret = GetBoundsRect(hdc, &rect, 0);
+ ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
+ SetRect(&expect, 159, 70, 99, 130);
+ ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
+ SetRect(&set_rect, 50, 25, 30, 35);
+ ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
+ ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
+ ret = GetBoundsRect(hdc, &rect, 0);
+ ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
+ SetRect(&expect, 50, 25, 30, 35);
+ ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
- pSetLayout( hdc, LAYOUT_LTR );
- ret = GetBoundsRect(hdc, &rect, 0);
- ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
- SetRect(&expect, 149, 25, 169, 35);
- ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
- }
+ SetLayout( hdc, LAYOUT_LTR );
+ ret = GetBoundsRect(hdc, &rect, 0);
+ ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
+ SetRect(&expect, 149, 25, 169, 35);
+ ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
/* empty rect resets, except on nt4 */
SetRect(&expect, 20, 20, 10, 10);
@@ -1642,7 +1637,6 @@ static void test_clip_box(void)
START_TEST(dc)
{
- pSetLayout = (void *)GetProcAddress( GetModuleHandleA("gdi32.dll"), "SetLayout");
test_dc_values();
test_savedc();
test_savedc_2();
diff --git a/dlls/gdi32/tests/mapping.c b/dlls/gdi32/tests/mapping.c
index 6635a72c18..ea6b7ac2cc 100644
--- a/dlls/gdi32/tests/mapping.c
+++ b/dlls/gdi32/tests/mapping.c
@@ -28,7 +28,6 @@
#include "winuser.h"
#include "winerror.h"
-static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
static DWORD (WINAPI *pGetLayout)(HDC hdc);
static INT (WINAPI *pGetRandomRgn)(HDC hDC, HRGN hRgn, INT iCode);
static BOOL (WINAPI *pGetTransform)(HDC, DWORD, XFORM *);
@@ -247,9 +246,9 @@ static void test_dc_layout(void)
HDC hdc;
HRGN hrgn;
- if (!pGetLayout || !pSetLayout)
+ if (!pGetLayout)
{
- win_skip( "Don't have SetLayout\n" );
+ win_skip( "Don't have GetLayout\n" );
return;
}
@@ -271,7 +270,7 @@ static void test_dc_layout(void)
expect_world_transform(hdc, 1.0, 1.0);
expect_LPtoDP(hdc, 1000, 1000);
- pSetLayout( hdc, LAYOUT_RTL );
+ SetLayout( hdc, LAYOUT_RTL );
if (!pGetLayout( hdc ))
{
win_skip( "SetLayout not supported\n" );
@@ -310,7 +309,7 @@ static void test_dc_layout(void)
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &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 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
@@ -318,7 +317,7 @@ static void test_dc_layout(void)
GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
IntersectClipRect( hdc, 80, 10, 85, 20 );
- pSetLayout( hdc, LAYOUT_RTL );
+ SetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 20, 20 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
@@ -326,9 +325,9 @@ static void test_dc_layout(void)
GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
SetRectRgn( hrgn, 60, 10, 80, 20 );
- pSetLayout( hdc, LAYOUT_LTR );
+ SetLayout( hdc, LAYOUT_LTR );
ExtSelectClipRgn( hdc, hrgn, RGN_OR );
- pSetLayout( hdc, LAYOUT_RTL );
+ SetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 40, 20 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
@@ -370,7 +369,7 @@ static void test_dc_layout(void)
SetMapMode(hdc, MM_TEXT);
ret = GetMapMode( hdc );
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
- pSetLayout( hdc, LAYOUT_LTR );
+ SetLayout( hdc, LAYOUT_LTR );
ret = GetMapMode( hdc );
ok(ret == MM_ANISOTROPIC, "expected MM_ANISOTROPIC, got %d\n", ret);
SetMapMode(hdc, MM_TEXT);
@@ -715,7 +714,6 @@ START_TEST(mapping)
{
HMODULE mod = GetModuleHandleA("gdi32.dll");
pGetLayout = (void *)GetProcAddress( mod, "GetLayout" );
- pSetLayout = (void *)GetProcAddress( mod, "SetLayout" );
pGetRandomRgn = (void *)GetProcAddress( mod, "GetRandomRgn" );
pGetTransform = (void *)GetProcAddress( mod, "GetTransform" );
pSetVirtualResolution = (void *)GetProcAddress( mod, "SetVirtualResolution" );
More information about the wine-cvs
mailing list