Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ba42bf38
Commit
ba42bf38
authored
Feb 12, 2009
by
Nikolay Sivov
Committed by
Alexandre Julliard
Feb 16, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus/tests: Use expectf macro for floating point tests.
parent
df9831d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
image.c
dlls/gdiplus/tests/image.c
+13
-12
No files found.
dlls/gdiplus/tests/image.c
View file @
ba42bf38
...
...
@@ -28,6 +28,7 @@
#include "wine/test.h"
#define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
static
void
expect_rawformat
(
REFGUID
expected
,
GpImage
*
img
,
int
line
,
BOOL
todo
)
{
...
...
@@ -167,8 +168,8 @@ static void test_GetImageDimension(void)
h
=
-
1
;
stat
=
GdipGetImageDimension
((
GpImage
*
)
bm
,
&
w
,
&
h
);
expect
(
Ok
,
stat
);
ok
(
fabs
(
WIDTH
-
w
)
<
0
.
0001
,
"Width wrong
\n
"
);
ok
(
fabs
(
HEIGHT
-
h
)
<
0
.
0001
,
"Height wrong
\n
"
);
expectf
(
WIDTH
,
w
);
expectf
(
HEIGHT
,
h
);
GdipDisposeImage
((
GpImage
*
)
bm
);
}
...
...
@@ -274,8 +275,8 @@ static void test_SavingImages(void)
stat
=
GdipGetImageDimension
((
GpImage
*
)
bm
,
&
w
,
&
h
);
if
(
stat
!=
Ok
)
goto
cleanup
;
ok
((
fabs
(
w
-
WIDTH
)
<
0
.
01
)
&&
(
fabs
(
h
-
HEIGHT
)
<
0
.
01
),
"Saved image dimensions are different!
\n
"
);
expectf
(
WIDTH
,
w
);
expectf
(
HEIGHT
,
h
);
cleanup:
GdipFree
(
codecs
);
...
...
@@ -471,8 +472,8 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
expect
(
Ok
,
stat
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH1
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT1
-
height
)
<
.
0001
,
"height wrong
\n
"
);
expectf
(
WIDTH1
,
width
);
expectf
(
HEIGHT1
,
height
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
GlobalFree
(
hbm
);
...
...
@@ -484,8 +485,8 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
expect_rawformat
(
&
ImageFormatMemoryBMP
,
(
GpImage
*
)
gpbm
,
__LINE__
,
TRUE
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH2
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT2
-
height
)
<
.
0001
,
"height wrong
\n
"
);
expectf
(
WIDTH2
,
width
);
expectf
(
HEIGHT2
,
height
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
GlobalFree
(
hbm
);
...
...
@@ -505,8 +506,8 @@ static void test_GdipCreateBitmapFromHBITMAP(void)
stat
=
GdipCreateBitmapFromHBITMAP
(
hbm
,
NULL
,
&
gpbm
);
expect
(
Ok
,
stat
);
expect
(
Ok
,
GdipGetImageDimension
((
GpImage
*
)
gpbm
,
&
width
,
&
height
));
ok
(
fabs
(
WIDTH1
-
width
)
<
.
0001
,
"width wrong
\n
"
);
ok
(
fabs
(
HEIGHT1
-
height
)
<
.
0001
,
"height wrong
\n
"
);
expectf
(
WIDTH1
,
width
);
expectf
(
HEIGHT1
,
height
);
if
(
stat
==
Ok
)
GdipDisposeImage
((
GpImage
*
)
gpbm
);
...
...
@@ -572,8 +573,8 @@ static void test_GdipCloneImage(void)
expect
(
Ok
,
stat
);
/* Treat FP values carefully */
ok
(
fabsf
(
rectF
.
Width
-
WIDTH
)
<
1e-5
,
"Expected: %d, got %.05f
\n
"
,
WIDTH
,
rectF
.
Width
);
ok
(
fabsf
(
rectF
.
Height
-
HEIGHT
)
<
1e-5
,
"Expected: %d, got %.05f
\n
"
,
HEIGHT
,
rectF
.
Height
);
expectf
((
REAL
)
WIDTH
,
rectF
.
Width
);
expectf
((
REAL
)
HEIGHT
,
rectF
.
Height
);
stat
=
GdipDisposeImage
(
image_dest
);
expect
(
Ok
,
stat
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment