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
1ac6f487
Commit
1ac6f487
authored
Nov 27, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9/tests: Test the window and backbuffer dimensions after display mode changes.
parent
bf8d9cb7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
91 additions
and
0 deletions
+91
-0
device.c
dlls/d3d9/tests/device.c
+91
-0
No files found.
dlls/d3d9/tests/device.c
View file @
1ac6f487
...
...
@@ -3248,6 +3248,96 @@ done:
IDirect3D9_Release
(
d3d9
);
}
static
void
test_mode_change
(
void
)
{
RECT
fullscreen_rect
,
focus_rect
,
r
;
IDirect3DSurface9
*
backbuffer
;
IDirect3DDevice9
*
device
;
D3DSURFACE_DESC
desc
;
IDirect3D9
*
d3d9
;
DEVMODEW
devmode
;
UINT
refcount
;
HRESULT
hr
;
DWORD
ret
;
if
(
!
(
d3d9
=
pDirect3DCreate9
(
D3D_SDK_VERSION
)))
{
skip
(
"Failed to create IDirect3D9 object, skipping mode change tests.
\n
"
);
return
;
}
focus_window
=
CreateWindowA
(
"d3d9_test_wc"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
screen_width
/
2
,
screen_height
/
2
,
0
,
0
,
0
,
0
);
device_window
=
CreateWindowA
(
"d3d9_test_wc"
,
"d3d9_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
screen_width
/
2
,
screen_height
/
2
,
0
,
0
,
0
,
0
);
SetRect
(
&
fullscreen_rect
,
0
,
0
,
screen_width
,
screen_height
);
GetWindowRect
(
focus_window
,
&
focus_rect
);
device
=
create_device
(
d3d9
,
device_window
,
focus_window
,
FALSE
);
if
(
!
device
)
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
memset
(
&
devmode
,
0
,
sizeof
(
devmode
));
devmode
.
dmSize
=
sizeof
(
devmode
);
devmode
.
dmFields
=
DM_PELSWIDTH
|
DM_PELSHEIGHT
;
devmode
.
dmPelsWidth
=
640
;
devmode
.
dmPelsHeight
=
480
;
ret
=
ChangeDisplaySettingsW
(
&
devmode
,
CDS_FULLSCREEN
);
ok
(
ret
==
DISP_CHANGE_SUCCESSFUL
,
"Failed to change display mode, ret %#x.
\n
"
,
ret
);
memset
(
&
devmode
,
0
,
sizeof
(
devmode
));
devmode
.
dmSize
=
sizeof
(
devmode
);
ret
=
EnumDisplaySettingsW
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
devmode
);
ok
(
ret
,
"Failed to get display mode.
\n
"
);
ok
(
devmode
.
dmPelsWidth
==
640
,
"Got unexpect width %u.
\n
"
,
devmode
.
dmPelsWidth
);
ok
(
devmode
.
dmPelsHeight
==
480
,
"Got unexpect height %u.
\n
"
,
devmode
.
dmPelsHeight
);
GetWindowRect
(
device_window
,
&
r
);
ok
(
EqualRect
(
&
r
,
&
fullscreen_rect
),
"Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.
\n
"
,
fullscreen_rect
.
left
,
fullscreen_rect
.
top
,
fullscreen_rect
.
right
,
fullscreen_rect
.
bottom
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
);
GetWindowRect
(
focus_window
,
&
r
);
ok
(
EqualRect
(
&
r
,
&
focus_rect
),
"Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.
\n
"
,
focus_rect
.
left
,
focus_rect
.
top
,
focus_rect
.
right
,
focus_rect
.
bottom
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
);
hr
=
IDirect3DDevice9_GetBackBuffer
(
device
,
0
,
0
,
D3DBACKBUFFER_TYPE_MONO
,
&
backbuffer
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get backbuffer, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DSurface9_GetDesc
(
backbuffer
,
&
desc
);
ok
(
SUCCEEDED
(
hr
),
"Failed to get backbuffer desc, hr %#x.
\n
"
,
hr
);
ok
(
desc
.
Width
==
screen_width
,
"Got unexpected backbuffer width %u.
\n
"
,
desc
.
Width
);
ok
(
desc
.
Height
==
screen_height
,
"Got unexpected backbuffer height %u.
\n
"
,
desc
.
Height
);
IDirect3DSurface9_Release
(
backbuffer
);
refcount
=
IDirect3DDevice9_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
memset
(
&
devmode
,
0
,
sizeof
(
devmode
));
devmode
.
dmSize
=
sizeof
(
devmode
);
ret
=
EnumDisplaySettingsW
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
devmode
);
ok
(
ret
,
"Failed to get display mode.
\n
"
);
ok
(
devmode
.
dmPelsWidth
==
screen_width
,
"Got unexpect width %u.
\n
"
,
devmode
.
dmPelsWidth
);
ok
(
devmode
.
dmPelsHeight
==
screen_height
,
"Got unexpect height %u.
\n
"
,
devmode
.
dmPelsHeight
);
done:
DestroyWindow
(
device_window
);
DestroyWindow
(
focus_window
);
if
(
d3d9
)
IDirect3D9_Release
(
d3d9
);
memset
(
&
devmode
,
0
,
sizeof
(
devmode
));
devmode
.
dmSize
=
sizeof
(
devmode
);
ret
=
EnumDisplaySettingsW
(
NULL
,
ENUM_CURRENT_SETTINGS
,
&
devmode
);
ok
(
ret
,
"Failed to get display mode.
\n
"
);
ok
(
devmode
.
dmPelsWidth
==
screen_width
,
"Got unexpect width %u.
\n
"
,
devmode
.
dmPelsWidth
);
ok
(
devmode
.
dmPelsHeight
==
screen_height
,
"Got unexpect height %u.
\n
"
,
devmode
.
dmPelsHeight
);
}
START_TEST
(
device
)
{
HMODULE
d3d9_handle
=
LoadLibraryA
(
"d3d9.dll"
);
...
...
@@ -3302,6 +3392,7 @@ START_TEST(device)
test_wndproc
();
test_wndproc_windowed
();
test_window_style
();
test_mode_change
();
}
out
:
...
...
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