[PATCH 2/2] gdi32/tests: Fix test failures on Win10 1909+.
Zhiyi Zhang
zzhang at codeweavers.com
Mon Dec 14 01:12:21 CST 2020
Memory DC, metafile DC and enhanced metafile DC support gamma ramp on Win10 1909+.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
Fix test failures like in https://test.winehq.org/data/3acb0b3326c4120ea0c4c6076bd03c9cfe82c744/win10_fgtb-w10pro64-32/gdi32:dc.html
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 );
--
2.27.0
More information about the wine-devel
mailing list