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
2c732889
Commit
2c732889
authored
May 03, 2007
by
H. Verbeet
Committed by
Alexandre Julliard
May 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d8: Add a surface locking test.
parent
1316b7f5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
76 additions
and
1 deletion
+76
-1
surface.c
dlls/d3d8/tests/surface.c
+76
-1
No files found.
dlls/d3d8/tests/surface.c
View file @
2c732889
/*
* Copyright
(C) 2006
Henri Verbeet
* Copyright
2006-2007
Henri Verbeet
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -121,6 +121,80 @@ cleanup:
if
(
surface_ptr
)
IDirect3DSurface8_Release
(
surface_ptr
);
}
static
void
test_lockrect_invalid
(
IDirect3DDevice8
*
device
)
{
IDirect3DSurface8
*
surface
=
0
;
D3DLOCKED_RECT
locked_rect
;
unsigned
int
i
;
BYTE
*
base
;
HRESULT
hr
;
const
RECT
valid
[]
=
{
{
60
,
60
,
68
,
68
},
{
120
,
60
,
128
,
68
},
{
60
,
120
,
68
,
128
},
};
const
RECT
invalid
[]
=
{
{
60
,
60
,
60
,
68
},
/* 0 height */
{
60
,
60
,
68
,
60
},
/* 0 width */
{
68
,
60
,
60
,
68
},
/* left > right */
{
60
,
68
,
68
,
60
},
/* top > bottom */
{
-
8
,
60
,
0
,
68
},
/* left < surface */
{
60
,
-
8
,
68
,
0
},
/* top < surface */
{
-
16
,
60
,
-
8
,
68
},
/* right < surface */
{
60
,
-
16
,
68
,
-
8
},
/* bottom < surface */
{
60
,
60
,
136
,
68
},
/* right > surface */
{
60
,
60
,
68
,
136
},
/* bottom > surface */
{
136
,
60
,
144
,
68
},
/* left > surface */
{
60
,
136
,
68
,
144
},
/* top > surface */
};
hr
=
IDirect3DDevice8_CreateImageSurface
(
device
,
128
,
128
,
D3DFMT_A8R8G8B8
,
&
surface
);
ok
(
SUCCEEDED
(
hr
),
"CreateImageSurface failed (0x%08x)
\n
"
,
hr
);
hr
=
IDirect3DSurface8_LockRect
(
surface
,
&
locked_rect
,
NULL
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed (0x%08x)
\n
"
,
hr
);
base
=
locked_rect
.
pBits
;
hr
=
IDirect3DSurface8_UnlockRect
(
surface
);
ok
(
SUCCEEDED
(
hr
),
"UnlockRect failed (0x%08x)
\n
"
,
hr
);
for
(
i
=
0
;
i
<
(
sizeof
(
valid
)
/
sizeof
(
*
valid
));
++
i
)
{
unsigned
int
offset
,
expected_offset
;
const
RECT
*
rect
=
&
valid
[
i
];
locked_rect
.
pBits
=
(
BYTE
*
)
0xdeadbeef
;
locked_rect
.
Pitch
=
0xdeadbeef
;
hr
=
IDirect3DSurface8_LockRect
(
surface
,
&
locked_rect
,
rect
,
0
);
ok
(
SUCCEEDED
(
hr
),
"LockRect failed (0x%08x) for rect [%d, %d]->[%d, %d]
\n
"
,
hr
,
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
);
offset
=
(
BYTE
*
)
locked_rect
.
pBits
-
base
;
expected_offset
=
rect
->
top
*
locked_rect
.
Pitch
+
rect
->
left
*
4
;
ok
(
offset
==
expected_offset
,
"Got offset %u, expected offset %u for rect [%d, %d]->[%d, %d]
\n
"
,
offset
,
expected_offset
,
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
);
hr
=
IDirect3DSurface8_UnlockRect
(
surface
);
ok
(
SUCCEEDED
(
hr
),
"UnlockRect failed (0x%08x)
\n
"
,
hr
);
}
for
(
i
=
0
;
i
<
(
sizeof
(
invalid
)
/
sizeof
(
*
invalid
));
++
i
)
{
const
RECT
*
rect
=
&
invalid
[
i
];
hr
=
IDirect3DSurface8_LockRect
(
surface
,
&
locked_rect
,
rect
,
0
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"LockRect returned 0x%08x for rect [%d, %d]->[%d, %d]"
", expected D3DERR_INVALIDCALL (0x%08x)
\n
"
,
hr
,
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
,
D3DERR_INVALIDCALL
);
}
IDirect3DSurface8_Release
(
surface
);
}
START_TEST
(
surface
)
{
HMODULE
d3d8_handle
;
...
...
@@ -137,4 +211,5 @@ START_TEST(surface)
if
(
!
device_ptr
)
return
;
test_surface_get_container
(
device_ptr
);
test_lockrect_invalid
(
device_ptr
);
}
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