Module: wine Branch: master Commit: aa3e02e19399f175110ba002ad65f685229a7084 URL: https://source.winehq.org/git/wine.git/?a=commit;h=aa3e02e19399f175110ba002a...
Author: Zhiyi Zhang zzhang@codeweavers.com Date: Mon Dec 14 15:12:21 2020 +0800
gdi32/tests: Fix test failures on Win10 1909+.
Memory DC, metafile DC and enhanced metafile DC support gamma ramp on Win10 1909+.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/tests/dc.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c index 2cb8c65dd64..04703288302 100644 --- a/dlls/gdi32/tests/dc.c +++ b/dlls/gdi32/tests/dc.c @@ -346,11 +346,6 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale "wrong caps on %s for %u: %u\n", descr, caps[i], GetDeviceCaps( hdc, caps[i] ) );
- SetLastError( 0xdeadbeef ); - ret = GetDeviceGammaRamp( hdc, &ramp ); - ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr ); - ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */ - "wrong error %u on %s\n", GetLastError(), descr ); type = GetClipBox( hdc, &rect ); ok( type == ERROR, "GetClipBox returned %d on %s\n", type, descr );
@@ -393,17 +388,6 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale hdc_caps, GetDeviceCaps( ref_dc, caps[i] ), scale ); }
- SetLastError( 0xdeadbeef ); - ret = GetDeviceGammaRamp( hdc, &ramp ); - if (GetObjectType( hdc ) != OBJ_DC || GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER) - { - ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %d)\n", descr, GetObjectType( hdc ) ); - ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */ - "wrong error %u on %s\n", GetLastError(), descr ); - } - else - ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %d), error %u\n", descr, GetObjectType( hdc ), GetLastError() ); - type = GetBoundsRect( hdc, &rect, 0 ); ok( type == DCB_RESET || broken(type == DCB_SET) /* XP */, "GetBoundsRect returned type %x for %s\n", type, descr ); @@ -494,12 +478,6 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale "mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i], GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
- SetLastError( 0xdeadbeef ); - ret = GetDeviceGammaRamp( hdc, &ramp ); - ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr ); - ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */ - "wrong error %u on %s\n", GetLastError(), descr ); - type = GetClipBox( hdc, &rect ); ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr ); ok( rect.left == 0 && rect.top == 0 && rect.right == 16 && rect.bottom == 16, @@ -517,6 +495,29 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale DeleteObject( dib ); }
+ /* Memory DC, metafile DC and enhanced metafile DC support gamma ramp on Win10 1909+. Exclude + * these types from tests as they return different results depending on Windows versions */ + if (GetObjectType( hdc ) != OBJ_MEMDC + && GetObjectType( hdc ) != OBJ_METADC + && GetObjectType( hdc ) != OBJ_ENHMETADC) + { + SetLastError( 0xdeadbeef ); + ret = GetDeviceGammaRamp( hdc, &ramp ); + if (GetObjectType( hdc ) != OBJ_DC || GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER) + { + ok( !ret, "GetDeviceGammaRamp succeeded on %s (type %d)\n", descr, GetObjectType( hdc ) ); + ok( GetLastError() == ERROR_INVALID_PARAMETER + || broken(GetLastError() == 0xdeadbeef) /* nt4 */ + || broken(GetLastError() == NO_ERROR), /* Printer DC on Win10 1909+ */ + "wrong error %u on %s\n", GetLastError(), descr ); + } + else + { + ok( ret || broken(!ret) /* NT4 */, "GetDeviceGammaRamp failed on %s (type %d), error %u\n", + descr, GetObjectType( hdc ), GetLastError() ); + } + } + /* restore hdc state */ SetBoundsRect( hdc, NULL, DCB_RESET | DCB_DISABLE ); SetBoundsRect( ref_dc, NULL, DCB_RESET | DCB_DISABLE );