Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
e6c69e96
Commit
e6c69e96
authored
Jul 25, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jul 26, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Add some GdipTransformPoints tests for a device with different x/y resolutions.
parent
e536a128
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
1 deletion
+100
-1
graphics.c
dlls/gdiplus/tests/graphics.c
+100
-1
No files found.
dlls/gdiplus/tests/graphics.c
View file @
e6c69e96
...
...
@@ -26,7 +26,7 @@
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) < (precision), "Expected %f, got %f\n", (expected), (got))
#define expectf(expected, got) expectf_((expected), (got), 0.00
0
1)
#define expectf(expected, got) expectf_((expected), (got), 0.001)
#define TABLE_LEN (23)
static
HWND
hwnd
;
...
...
@@ -3398,6 +3398,104 @@ static void test_GdipMeasureString(void)
DeleteDC
(
hdc
);
}
static
GpGraphics
*
create_graphics
(
REAL
res_x
,
REAL
res_y
,
GpUnit
unit
,
REAL
scale
)
{
GpStatus
status
;
union
{
GpBitmap
*
bitmap
;
GpImage
*
image
;
}
u
;
GpGraphics
*
graphics
=
NULL
;
REAL
res
;
status
=
GdipCreateBitmapFromScan0
(
1
,
1
,
4
,
PixelFormat24bppRGB
,
NULL
,
&
u
.
bitmap
);
expect
(
Ok
,
status
);
status
=
GdipBitmapSetResolution
(
u
.
bitmap
,
res_x
,
res_y
);
expect
(
Ok
,
status
);
status
=
GdipGetImageHorizontalResolution
(
u
.
image
,
&
res
);
expect
(
Ok
,
status
);
expectf
(
res_x
,
res
);
status
=
GdipGetImageVerticalResolution
(
u
.
image
,
&
res
);
expect
(
Ok
,
status
);
expectf
(
res_y
,
res
);
status
=
GdipGetImageGraphicsContext
(
u
.
image
,
&
graphics
);
expect
(
Ok
,
status
);
status
=
GdipDisposeImage
(
u
.
image
);
expect
(
Ok
,
status
);
status
=
GdipGetDpiX
(
graphics
,
&
res
);
expect
(
Ok
,
status
);
expectf
(
res_x
,
res
);
status
=
GdipGetDpiY
(
graphics
,
&
res
);
expect
(
Ok
,
status
);
expectf
(
res_y
,
res
);
status
=
GdipSetPageUnit
(
graphics
,
unit
);
expect
(
Ok
,
status
);
status
=
GdipSetPageScale
(
graphics
,
scale
);
expect
(
Ok
,
status
);
return
graphics
;
}
static
void
test_transform
(
void
)
{
static
const
struct
test_data
{
REAL
res_x
,
res_y
,
scale
;
GpUnit
unit
;
GpPointF
in
[
2
],
out
[
2
];
}
td
[]
=
{
{
96
.
0
,
96
.
0
,
1
.
0
,
UnitPixel
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
}
},
{
96
.
0
,
96
.
0
,
1
.
0
,
UnitDisplay
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
}
},
{
96
.
0
,
96
.
0
,
1
.
0
,
UnitInch
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
9600
.
0
,
0
.
0
},
{
0
.
0
,
9600
.
0
}
}
},
{
123
.
0
,
456
.
0
,
1
.
0
,
UnitPoint
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
170
.
833313
,
0
.
0
},
{
0
.
0
,
633
.
333252
}
}
},
{
123
.
0
,
456
.
0
,
1
.
0
,
UnitDocument
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
40
.
999996
,
0
.
0
},
{
0
.
0
,
151
.
999985
}
}
},
{
123
.
0
,
456
.
0
,
2
.
0
,
UnitMillimeter
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
968
.
503845
,
0
.
0
},
{
0
.
0
,
3590
.
550781
}
}
},
{
196
.
0
,
296
.
0
,
1
.
0
,
UnitDisplay
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
}
},
{
196
.
0
,
296
.
0
,
1
.
0
,
UnitPixel
,
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
},
{
{
100
.
0
,
0
.
0
},
{
0
.
0
,
100
.
0
}
}
},
};
GpStatus
status
;
GpGraphics
*
graphics
;
GpPointF
ptf
[
2
];
UINT
i
;
for
(
i
=
0
;
i
<
sizeof
(
td
)
/
sizeof
(
td
[
0
]);
i
++
)
{
graphics
=
create_graphics
(
td
[
i
].
res_x
,
td
[
i
].
res_y
,
td
[
i
].
unit
,
td
[
i
].
scale
);
ptf
[
0
].
X
=
td
[
i
].
in
[
0
].
X
;
ptf
[
0
].
Y
=
td
[
i
].
in
[
0
].
Y
;
ptf
[
1
].
X
=
td
[
i
].
in
[
1
].
X
;
ptf
[
1
].
Y
=
td
[
i
].
in
[
1
].
Y
;
status
=
GdipTransformPoints
(
graphics
,
CoordinateSpaceDevice
,
CoordinateSpaceWorld
,
ptf
,
2
);
expect
(
Ok
,
status
);
expectf
(
td
[
i
].
out
[
0
].
X
,
ptf
[
0
].
X
);
expectf
(
td
[
i
].
out
[
0
].
Y
,
ptf
[
0
].
Y
);
expectf
(
td
[
i
].
out
[
1
].
X
,
ptf
[
1
].
X
);
expectf
(
td
[
i
].
out
[
1
].
Y
,
ptf
[
1
].
Y
);
status
=
GdipTransformPoints
(
graphics
,
CoordinateSpaceWorld
,
CoordinateSpaceDevice
,
ptf
,
2
);
expect
(
Ok
,
status
);
expectf
(
td
[
i
].
in
[
0
].
X
,
ptf
[
0
].
X
);
expectf
(
td
[
i
].
in
[
0
].
Y
,
ptf
[
0
].
Y
);
expectf
(
td
[
i
].
in
[
1
].
X
,
ptf
[
1
].
X
);
expectf
(
td
[
i
].
in
[
1
].
Y
,
ptf
[
1
].
Y
);
status
=
GdipDeleteGraphics
(
graphics
);
expect
(
Ok
,
status
);
}
}
START_TEST
(
graphics
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -3424,6 +3522,7 @@ START_TEST(graphics)
GdiplusStartup
(
&
gdiplusToken
,
&
gdiplusStartupInput
,
NULL
);
test_transform
();
test_GdipMeasureString
();
test_constructor_destructor
();
test_save_restore
();
...
...
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