Commit e36f326f authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32/tests: Fixed coordinates matching to use a relative error.

parent b5a5db91
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "winuser.h" #include "winuser.h"
#include "winerror.h" #include "winerror.h"
#define rough_match(got, expected) (abs((got) - (expected)) <= 5) #define rough_match(got, expected) (abs( MulDiv( (got) - (expected), 1000, (expected) )) <= 5)
#define expect_LPtoDP(_hdc, _x, _y) \ #define expect_LPtoDP(_hdc, _x, _y) \
{ \ { \
...@@ -121,11 +121,11 @@ static void test_world_transform(void) ...@@ -121,11 +121,11 @@ static void test_world_transform(void)
{ {
expect_viewport_ext(hdc, res_x, -res_y); expect_viewport_ext(hdc, res_x, -res_y);
ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" ); ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" );
ok( size.cx == size_cx * 10 || ok( rough_match( size.cx, size_cx * 10 ) ||
size.cx == MulDiv( res_x, 254, dpi_x ), /* Vista uses a more precise method */ rough_match( size.cx, MulDiv( res_x, 254, dpi_x )), /* Vista uses a more precise method */
"expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx ); "expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
ok( size.cy == size_cy * 10 || ok( rough_match( size.cy, size_cy * 10 ) ||
size.cy == MulDiv( res_y, 254, dpi_y ), /* Vista uses a more precise method */ rough_match( size.cy, MulDiv( res_y, 254, dpi_y )), /* Vista uses a more precise method */
"expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy ); "expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
} }
expect_world_trasform(hdc, 1.0, 1.0); expect_world_trasform(hdc, 1.0, 1.0);
...@@ -186,11 +186,11 @@ static void test_world_transform(void) ...@@ -186,11 +186,11 @@ static void test_world_transform(void)
expect_viewport_ext(hdc, res_x, -res_y); expect_viewport_ext(hdc, res_x, -res_y);
ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" ); ok( GetWindowExtEx( hdc, &size ), "GetWindowExtEx failed\n" );
ok( size.cx == size_cx * 10 || ok( rough_match( size.cx, size_cx * 10 ) ||
size.cx == MulDiv( res_x, 254, dpi_x ), /* Vista uses a more precise method */ rough_match( size.cx, MulDiv( res_x, 254, dpi_x )), /* Vista uses a more precise method */
"expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx ); "expected cx %d or %d, got %d\n", size_cx * 10, MulDiv( res_x, 254, dpi_x ), size.cx );
ok( size.cy == size_cy * 10 || ok( rough_match( size.cy, size_cy * 10 ) ||
size.cy == MulDiv( res_y, 254, dpi_y ), /* Vista uses a more precise method */ rough_match( size.cy, MulDiv( res_y, 254, dpi_y )), /* Vista uses a more precise method */
"expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy ); "expected cy %d or %d, got %d\n", size_cy * 10, MulDiv( res_y, 254, dpi_y ), size.cy );
expect_world_trasform(hdc, 20.0, 20.0); expect_world_trasform(hdc, 20.0, 20.0);
expect_LPtoDP(hdc, MulDiv(20000, res_x, size.cx), -MulDiv(20000, res_y, size.cy)); expect_LPtoDP(hdc, MulDiv(20000, res_x, size.cx), -MulDiv(20000, res_y, size.cy));
......
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