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
b42ec21d
Commit
b42ec21d
authored
Oct 20, 2011
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 21, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8/tests: Add a small test for IDirect3DDevice8::SetCursorPosition().
parent
5f6dd538
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
0 deletions
+123
-0
device.c
dlls/d3d8/tests/device.c
+123
-0
No files found.
dlls/d3d8/tests/device.c
View file @
b42ec21d
...
...
@@ -18,6 +18,7 @@
*/
#define COBJMACROS
#include <windowsx.h>
#include <initguid.h>
#include <d3d8.h>
#include "wine/test.h"
...
...
@@ -782,6 +783,127 @@ cleanup:
DestroyWindow
(
hwnd
);
}
static
const
POINT
*
expect_pos
;
static
LRESULT
CALLBACK
test_cursor_proc
(
HWND
window
,
UINT
message
,
WPARAM
wparam
,
LPARAM
lparam
)
{
if
(
message
==
WM_MOUSEMOVE
)
{
if
(
expect_pos
&&
expect_pos
->
x
&&
expect_pos
->
y
)
{
POINT
p
=
{
GET_X_LPARAM
(
lparam
),
GET_Y_LPARAM
(
lparam
)};
ClientToScreen
(
window
,
&
p
);
if
(
expect_pos
->
x
==
p
.
x
&&
expect_pos
->
y
==
p
.
y
)
++
expect_pos
;
}
}
return
DefWindowProcA
(
window
,
message
,
wparam
,
lparam
);
}
static
void
test_cursor_pos
(
void
)
{
IDirect3DSurface8
*
cursor
;
IDirect3DDevice8
*
device
;
WNDCLASSA
wc
=
{
0
};
IDirect3D8
*
d3d8
;
UINT
refcount
;
HWND
window
;
HRESULT
hr
;
BOOL
ret
;
/* Note that we don't check for movement we're not supposed to receive.
* That's because it's hard to distinguish from the user accidentally
* moving the mouse. */
static
const
POINT
points
[]
=
{
{
50
,
50
},
{
75
,
75
},
{
100
,
100
},
{
125
,
125
},
{
150
,
150
},
{
125
,
125
},
{
150
,
150
},
{
150
,
150
},
{
0
,
0
},
};
if
(
!
(
d3d8
=
pDirect3DCreate8
(
D3D_SDK_VERSION
)))
{
skip
(
"Failed to create IDirect3D8 object, skipping cursor tests.
\n
"
);
return
;
}
wc
.
lpfnWndProc
=
test_cursor_proc
;
wc
.
lpszClassName
=
"d3d8_test_cursor_wc"
;
ok
(
RegisterClassA
(
&
wc
),
"Failed to register window class.
\n
"
);
window
=
CreateWindow
(
"d3d8_test_cursor_wc"
,
"d3d8_test"
,
WS_OVERLAPPEDWINDOW
,
0
,
0
,
320
,
240
,
NULL
,
NULL
,
NULL
,
NULL
);
ShowWindow
(
window
,
SW_SHOW
);
device
=
create_device
(
d3d8
,
window
,
window
,
TRUE
);
if
(
!
device
)
{
skip
(
"Failed to create a D3D device, skipping tests.
\n
"
);
goto
done
;
}
hr
=
IDirect3DDevice8_CreateImageSurface
(
device
,
32
,
32
,
D3DFMT_A8R8G8B8
,
&
cursor
);
ok
(
SUCCEEDED
(
hr
),
"Failed to create cursor surface, hr %#x.
\n
"
,
hr
);
hr
=
IDirect3DDevice8_SetCursorProperties
(
device
,
0
,
0
,
cursor
);
ok
(
SUCCEEDED
(
hr
),
"Failed to set cursor properties, hr %#x.
\n
"
,
hr
);
IDirect3DSurface8_Release
(
cursor
);
ret
=
IDirect3DDevice8_ShowCursor
(
device
,
TRUE
);
ok
(
!
ret
,
"Failed to show cursor, hr %#x.
\n
"
,
ret
);
flush_events
();
expect_pos
=
points
;
ret
=
SetCursorPos
(
50
,
50
);
ok
(
ret
,
"Failed to set cursor position.
\n
"
);
flush_events
();
IDirect3DDevice8_SetCursorPosition
(
device
,
75
,
75
,
0
);
flush_events
();
/* SetCursorPosition() eats duplicates. */
IDirect3DDevice8_SetCursorPosition
(
device
,
75
,
75
,
0
);
flush_events
();
ret
=
SetCursorPos
(
100
,
100
);
ok
(
ret
,
"Failed to set cursor position.
\n
"
);
flush_events
();
/* Even if the position was set with SetCursorPos(). */
IDirect3DDevice8_SetCursorPosition
(
device
,
100
,
100
,
0
);
flush_events
();
IDirect3DDevice8_SetCursorPosition
(
device
,
125
,
125
,
0
);
flush_events
();
ret
=
SetCursorPos
(
150
,
150
);
ok
(
ret
,
"Failed to set cursor position.
\n
"
);
flush_events
();
IDirect3DDevice8_SetCursorPosition
(
device
,
125
,
125
,
0
);
flush_events
();
IDirect3DDevice8_SetCursorPosition
(
device
,
150
,
150
,
0
);
flush_events
();
/* SetCursorPos() doesn't. */
ret
=
SetCursorPos
(
150
,
150
);
ok
(
ret
,
"Failed to set cursor position.
\n
"
);
flush_events
();
ok
(
!
expect_pos
->
x
&&
!
expect_pos
->
y
,
"Didn't receive MOUSEMOVE %u (%d, %d).
\n
"
,
expect_pos
-
points
,
expect_pos
->
x
,
expect_pos
->
y
);
refcount
=
IDirect3DDevice8_Release
(
device
);
ok
(
!
refcount
,
"Device has %u references left.
\n
"
,
refcount
);
done:
DestroyWindow
(
window
);
UnregisterClassA
(
"d3d8_test_cursor_wc"
,
GetModuleHandleA
(
NULL
));
if
(
d3d8
)
IDirect3D8_Release
(
d3d8
);
}
static
void
test_states
(
void
)
{
HRESULT
hr
;
...
...
@@ -2829,6 +2951,7 @@ START_TEST(device)
test_refcount
();
test_mipmap_levels
();
test_cursor
();
test_cursor_pos
();
test_states
();
test_reset
();
test_scene
();
...
...
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