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
a612af77
Commit
a612af77
authored
Jan 22, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jan 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1/tests: A test for DrawTextLayout() with drawing effect.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c78f7a96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
0 deletions
+100
-0
d2d1.c
dlls/d2d1/tests/d2d1.c
+100
-0
No files found.
dlls/d2d1/tests/d2d1.c
View file @
a612af77
...
...
@@ -2527,6 +2527,105 @@ static void test_create_target(void)
DestroyWindow
(
window
);
}
static
void
test_draw_text_layout
(
void
)
{
static
const
WCHAR
tahomaW
[]
=
{
'T'
,
'a'
,
'h'
,
'o'
,
'm'
,
'a'
,
0
};
static
const
WCHAR
textW
[]
=
{
't'
,
'e'
,
'x'
,
't'
,
0
};
static
const
WCHAR
emptyW
[]
=
{
0
};
D2D1_RENDER_TARGET_PROPERTIES
desc
;
IDXGISwapChain
*
swapchain
;
ID2D1Factory
*
factory
,
*
factory2
;
ID2D1RenderTarget
*
rt
,
*
rt2
;
ID3D10Device1
*
device
;
IDXGISurface
*
surface
;
HWND
window
;
HRESULT
hr
;
IDWriteFactory
*
dwrite_factory
;
IDWriteTextFormat
*
text_format
;
IDWriteTextLayout
*
text_layout
;
D2D1_POINT_2F
origin
;
DWRITE_TEXT_RANGE
range
;
D2D1_COLOR_F
color
;
ID2D1SolidColorBrush
*
brush
,
*
brush2
;
if
(
!
(
device
=
create_device
()))
{
skip
(
"Failed to create device, skipping tests.
\n
"
);
return
;
}
window
=
CreateWindowA
(
"static"
,
"d2d1_test"
,
WS_OVERLAPPEDWINDOW
|
WS_VISIBLE
,
0
,
0
,
640
,
480
,
NULL
,
NULL
,
NULL
,
NULL
);
swapchain
=
create_swapchain
(
device
,
window
,
TRUE
);
hr
=
IDXGISwapChain_GetBuffer
(
swapchain
,
0
,
&
IID_IDXGISurface
,
(
void
**
)
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get buffer, hr %#x.
\n
"
,
hr
);
hr
=
D2D1CreateFactory
(
D2D1_FACTORY_TYPE_SINGLE_THREADED
,
&
IID_ID2D1Factory
,
NULL
,
(
void
**
)
&
factory
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create factory, hr %#x.
\n
"
,
hr
);
hr
=
D2D1CreateFactory
(
D2D1_FACTORY_TYPE_SINGLE_THREADED
,
&
IID_ID2D1Factory
,
NULL
,
(
void
**
)
&
factory2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create factory, hr %#x.
\n
"
,
hr
);
ok
(
factory
!=
factory2
,
"got same factory
\n
"
);
desc
.
type
=
D2D1_RENDER_TARGET_TYPE_DEFAULT
;
desc
.
pixelFormat
.
format
=
DXGI_FORMAT_UNKNOWN
;
desc
.
pixelFormat
.
alphaMode
=
D2D1_ALPHA_MODE_PREMULTIPLIED
;
desc
.
dpiX
=
0
.
0
f
;
desc
.
dpiY
=
0
.
0
f
;
desc
.
usage
=
D2D1_RENDER_TARGET_USAGE_NONE
;
desc
.
minLevel
=
D2D1_FEATURE_LEVEL_DEFAULT
;
hr
=
ID2D1Factory_CreateDxgiSurfaceRenderTarget
(
factory
,
surface
,
&
desc
,
&
rt
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a target, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1Factory_CreateDxgiSurfaceRenderTarget
(
factory2
,
surface
,
&
desc
,
&
rt2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create a target, hr %#x.
\n
"
,
hr
);
hr
=
DWriteCreateFactory
(
DWRITE_FACTORY_TYPE_SHARED
,
&
IID_IDWriteFactory
,
(
IUnknown
**
)
&
dwrite_factory
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create factory, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextFormat
(
dwrite_factory
,
tahomaW
,
NULL
,
DWRITE_FONT_WEIGHT_NORMAL
,
DWRITE_FONT_STYLE_NORMAL
,
DWRITE_FONT_STRETCH_NORMAL
,
10
.
0
f
,
emptyW
,
&
text_format
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create text format, hr %#x.
\n
"
,
hr
);
hr
=
IDWriteFactory_CreateTextLayout
(
dwrite_factory
,
textW
,
4
,
text_format
,
100
.
0
f
,
100
.
0
f
,
&
text_layout
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create text layout, hr %#x.
\n
"
,
hr
);
set_color
(
&
color
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
);
hr
=
ID2D1RenderTarget_CreateSolidColorBrush
(
rt
,
&
color
,
NULL
,
&
brush
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create brush, hr %#x.
\n
"
,
hr
);
hr
=
ID2D1RenderTarget_CreateSolidColorBrush
(
rt2
,
&
color
,
NULL
,
&
brush2
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create brush, hr %#x.
\n
"
,
hr
);
/* effect brush is created from different factory */
range
.
startPosition
=
0
;
range
.
length
=
4
;
hr
=
IDWriteTextLayout_SetDrawingEffect
(
text_layout
,
(
IUnknown
*
)
brush2
,
range
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set drawing effect, hr %#x.
\n
"
,
hr
);
ID2D1RenderTarget_BeginDraw
(
rt
);
origin
.
x
=
origin
.
y
=
0
.
0
f
;
ID2D1RenderTarget_DrawTextLayout
(
rt
,
origin
,
text_layout
,
(
ID2D1Brush
*
)
brush
,
D2D1_DRAW_TEXT_OPTIONS_NONE
);
hr
=
ID2D1RenderTarget_EndDraw
(
rt
,
NULL
,
NULL
);
todo_wine
ok
(
hr
==
D2DERR_WRONG_FACTORY
,
"EndDraw failure expected, hr %#x.
\n
"
,
hr
);
IDWriteTextFormat_Release
(
text_format
);
IDWriteTextLayout_Release
(
text_layout
);
IDWriteFactory_Release
(
dwrite_factory
);
ID2D1RenderTarget_Release
(
rt
);
ID2D1RenderTarget_Release
(
rt2
);
ID2D1Factory_Release
(
factory
);
ID2D1Factory_Release
(
factory2
);
IDXGISurface_Release
(
surface
);
IDXGISwapChain_Release
(
swapchain
);
ID3D10Device1_Release
(
device
);
DestroyWindow
(
window
);
}
START_TEST
(
d2d1
)
{
test_clip
();
...
...
@@ -2540,4 +2639,5 @@ START_TEST(d2d1)
test_bitmap_updates
();
test_opacity_brush
();
test_create_target
();
test_draw_text_layout
();
}
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