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
345fc8a9
Commit
345fc8a9
authored
Jun 25, 2009
by
Tony Wasserka
Committed by
Alexandre Julliard
Jun 26, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Add tests for D3DXLoadSurfaceFromFile.
parent
9777bb1b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
0 deletions
+105
-0
texture.c
dlls/d3dx9_36/tests/texture.c
+105
-0
No files found.
dlls/d3dx9_36/tests/texture.c
View file @
345fc8a9
...
...
@@ -18,10 +18,29 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "wine/test.h"
#include "d3dx9tex.h"
#include "resources.h"
static
inline
int
get_ref
(
IUnknown
*
obj
)
{
IUnknown_AddRef
(
obj
);
return
IUnknown_Release
(
obj
);
}
static
inline
void
check_ref
(
IUnknown
*
obj
,
int
exp
)
{
int
ref
=
get_ref
(
obj
);
ok
(
exp
==
ref
,
"Invalid refcount. Expected %d, got %d
\n
"
,
exp
,
ref
);
}
static
inline
void
check_release
(
IUnknown
*
obj
,
int
exp
)
{
int
ref
=
IUnknown_Release
(
obj
);
ok
(
ref
==
exp
,
"Invalid refcount. Expected %d, got %d
\n
"
,
exp
,
ref
);
}
/* 1x1 bmp (1 bpp) */
static
const
unsigned
char
bmp01
[
66
]
=
{
0x42
,
0x4d
,
0x42
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x3e
,
0x00
,
0x00
,
0x00
,
0x28
,
0x00
,
...
...
@@ -181,7 +200,93 @@ static void test_D3DXGetImageInfo()
if
(
testbitmap_ok
)
DeleteFileA
(
"testbitmap.bmp"
);
}
static
void
test_D3DXLoadSurface
(
IDirect3DDevice9
*
device
)
{
HRESULT
hr
;
BOOL
testdummy_ok
,
testbitmap_ok
;
IDirect3DSurface9
*
surf
;
hr
=
create_file
(
"testdummy.bmp"
,
noimage
,
sizeof
(
noimage
));
/* invalid image */
testdummy_ok
=
SUCCEEDED
(
hr
);
hr
=
create_file
(
"testbitmap.bmp"
,
bmp01
,
sizeof
(
bmp01
));
/* valid image */
testbitmap_ok
=
SUCCEEDED
(
hr
);
hr
=
IDirect3DDevice9_CreateOffscreenPlainSurface
(
device
,
256
,
256
,
D3DFMT_A8R8G8B8
,
D3DPOOL_DEFAULT
,
&
surf
,
NULL
);
if
(
FAILED
(
hr
))
{
skip
(
"Failed to create a surface (%#x)
\n
"
,
hr
);
if
(
testdummy_ok
)
DeleteFileA
(
"testdummy.bmp"
);
if
(
testbitmap_ok
)
DeleteFileA
(
"testbitmap.bmp"
);
return
;
}
/* D3DXLoadSurfaceFromFile */
if
(
testbitmap_ok
)
{
todo_wine
{
hr
=
D3DXLoadSurfaceFromFileA
(
surf
,
NULL
,
NULL
,
"testbitmap.bmp"
,
NULL
,
D3DX_DEFAULT
,
0
,
NULL
);
ok
(
hr
==
D3D_OK
,
"D3DXLoadSurfaceFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
}
hr
=
D3DXLoadSurfaceFromFileA
(
NULL
,
NULL
,
NULL
,
"testbitmap.bmp"
,
NULL
,
D3DX_DEFAULT
,
0
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXLoadSurfaceFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
}
else
skip
(
"Couldn't create
\"
testbitmap.bmp
\"\n
"
);
if
(
testdummy_ok
)
{
todo_wine
{
hr
=
D3DXLoadSurfaceFromFileA
(
surf
,
NULL
,
NULL
,
"testdummy.bmp"
,
NULL
,
D3DX_DEFAULT
,
0
,
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXLoadSurfaceFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
}
}
else
skip
(
"Couldn't create
\"
testdummy.bmp
\"\n
"
);
hr
=
D3DXLoadSurfaceFromFileA
(
surf
,
NULL
,
NULL
,
NULL
,
NULL
,
D3DX_DEFAULT
,
0
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXLoadSurfaceFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXLoadSurfaceFromFileA
(
surf
,
NULL
,
NULL
,
""
,
NULL
,
D3DX_DEFAULT
,
0
,
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXLoadSurfaceFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
/* cleanup */
check_release
((
IUnknown
*
)
surf
,
0
);
if
(
testdummy_ok
)
DeleteFileA
(
"testdummy.bmp"
);
if
(
testbitmap_ok
)
DeleteFileA
(
"testbitmap.bmp"
);
}
START_TEST
(
texture
)
{
HWND
wnd
;
IDirect3D9
*
d3d
;
IDirect3DDevice9
*
device
;
D3DPRESENT_PARAMETERS
d3dpp
;
HRESULT
hr
;
wnd
=
CreateWindow
(
"static"
,
"d3dx9_test"
,
0
,
0
,
0
,
0
,
0
,
NULL
,
NULL
,
NULL
,
NULL
);
d3d
=
Direct3DCreate9
(
D3D_SDK_VERSION
);
if
(
!
wnd
)
{
skip
(
"Couldn't create application window
\n
"
);
return
;
}
if
(
!
d3d
)
{
skip
(
"Couldn't create IDirect3D9 object
\n
"
);
DestroyWindow
(
wnd
);
return
;
}
ZeroMemory
(
&
d3dpp
,
sizeof
(
d3dpp
));
d3dpp
.
Windowed
=
TRUE
;
d3dpp
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
hr
=
IDirect3D9_CreateDevice
(
d3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
wnd
,
D3DCREATE_MIXED_VERTEXPROCESSING
,
&
d3dpp
,
&
device
);
if
(
FAILED
(
hr
))
{
skip
(
"Failed to create IDirect3DDevice9 object %#x
\n
"
,
hr
);
IDirect3D9_Release
(
d3d
);
DestroyWindow
(
wnd
);
return
;
}
test_D3DXGetImageInfo
();
test_D3DXLoadSurface
(
device
);
check_release
((
IUnknown
*
)
device
,
0
);
check_release
((
IUnknown
*
)
d3d
,
0
);
if
(
wnd
)
DestroyWindow
(
wnd
);
}
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