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
e6ece9ee
Commit
e6ece9ee
authored
Jun 04, 2009
by
Tony Wasserka
Committed by
Alexandre Julliard
Jun 05, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx9: Test return codes of the D3DXGetImageInfo functions.
parent
4af750a5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
245 additions
and
1 deletion
+245
-1
Makefile.in
dlls/d3dx9_36/tests/Makefile.in
+4
-1
bmp1x1.bmp
dlls/d3dx9_36/tests/bmp1x1.bmp
+0
-0
resources.h
dlls/d3dx9_36/tests/resources.h
+26
-0
rsrc.rc
dlls/d3dx9_36/tests/rsrc.rc
+28
-0
texture.c
dlls/d3dx9_36/tests/texture.c
+187
-0
No files found.
dlls/d3dx9_36/tests/Makefile.in
View file @
e6ece9ee
...
...
@@ -8,7 +8,10 @@ IMPORTS = d3dx9 d3d9 user32 kernel32
CTESTS
=
\
core.c
\
math.c
\
shader.c
shader.c
\
texture.c
RC_SRCS
=
rsrc.rc
@MAKE_TEST_RULES@
...
...
dlls/d3dx9_36/tests/bmp1x1.bmp
0 → 100644
View file @
e6ece9ee
58 Bytes
dlls/d3dx9_36/tests/resources.h
0 → 100644
View file @
e6ece9ee
/*
* Copyright 2009 Tony Wasserka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_D3DX9_36_TEST_RESOURCES_H
#define __WINE_D3DX9_36_TEST_RESOURCES_H
#define IDB_BITMAP_1x1 10
#define IDD_BITMAPDATA_1x1 11
#define IDS_STRING 12
#endif
/* __WINE_D3DX9_36_TEST_RESOURCES_H */
dlls/d3dx9_36/tests/rsrc.rc
0 → 100644
View file @
e6ece9ee
/*
* Copyright 2009 Tony Wasserka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "resources.h"
STRINGTABLE
{
IDS_STRING "nobitmap"
}
/* @makedep: bmp1x1.bmp */
IDB_BITMAP_1x1 BITMAP bmp1x1.bmp
IDD_BITMAPDATA_1x1 RCDATA bmp1x1.bmp
dlls/d3dx9_36/tests/texture.c
0 → 100644
View file @
e6ece9ee
/*
* Tests for the D3DX9 texture functions
*
* Copyright 2009 Tony Wasserka
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/test.h"
#include "d3dx9tex.h"
#include "resources.h"
/* 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
,
0x00
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x01
,
0x00
,
0x01
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
,
0x04
,
0x00
,
0x00
,
0x00
,
0x12
,
0x0b
,
0x00
,
0x00
,
0x12
,
0x0b
,
0x00
,
0x00
,
0x02
,
0x00
,
0x00
,
0x00
,
0x02
,
0x00
,
0x00
,
0x00
,
0xff
,
0xff
,
0xff
,
0x00
,
0xff
,
0xff
,
0xff
,
0x00
,
0x00
,
0x00
,
0x00
,
0x00
};
/* invalid image file */
static
const
unsigned
char
noimage
[
4
]
=
{
0x11
,
0x22
,
0x33
,
0x44
};
static
HRESULT
create_file
(
const
char
*
filename
,
const
unsigned
char
*
data
,
const
unsigned
int
size
)
{
HANDLE
hfile
;
hfile
=
CreateFileA
(
filename
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
NULL
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
WriteFile
(
hfile
,
data
,
size
,
NULL
,
NULL
);
CloseHandle
(
hfile
);
return
D3D_OK
;
}
static
void
test_D3DXGetImageInfo
()
{
HRESULT
hr
;
D3DXIMAGE_INFO
info
;
BOOL
testdummy_ok
,
testbitmap_ok
;
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
);
/* D3DXGetImageInfoFromFile */
if
(
testbitmap_ok
)
{
todo_wine
{
hr
=
D3DXGetImageInfoFromFileA
(
"testbitmap.bmp"
,
&
info
);
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
}
hr
=
D3DXGetImageInfoFromFileA
(
"testbitmap.bmp"
,
NULL
);
/* valid image, second parameter is NULL */
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
}
else
skip
(
"Couldn't create
\"
testbitmap.bmp
\"\n
"
);
if
(
testdummy_ok
)
{
hr
=
D3DXGetImageInfoFromFileA
(
"testdummy.bmp"
,
NULL
);
/* invalid image, second parameter is NULL */
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
todo_wine
{
hr
=
D3DXGetImageInfoFromFileA
(
"testdummy.bmp"
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
}
}
else
skip
(
"Couldn't create
\"
testdummy.bmp
\"\n
"
);
hr
=
D3DXGetImageInfoFromFileA
(
"filedoesnotexist.bmp"
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromFileA
(
"filedoesnotexist.bmp"
,
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromFileA
(
""
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromFileA
(
NULL
,
&
info
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileA
(
NULL
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFile returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* D3DXGetImageInfoFromResource */
todo_wine
{
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
MAKEINTRESOURCEA
(
IDB_BITMAP_1x1
),
&
info
);
/* RT_BITMAP */
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
MAKEINTRESOURCEA
(
IDB_BITMAP_1x1
),
NULL
);
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
MAKEINTRESOURCEA
(
IDD_BITMAPDATA_1x1
),
&
info
);
/* RT_RCDATA */
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
}
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
MAKEINTRESOURCEA
(
IDS_STRING
),
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
MAKEINTRESOURCEA
(
IDS_STRING
),
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
"resourcedoesnotexist"
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
"resourcedoesnotexist"
,
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromResourceA
(
NULL
,
NULL
,
NULL
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
/* D3DXGetImageInfoFromFileInMemory */
todo_wine
{
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
sizeof
(
bmp01
),
&
info
);
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
sizeof
(
bmp01
)
+
5
,
&
info
);
/* too large size */
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
}
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
sizeof
(
bmp01
),
NULL
);
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
noimage
,
sizeof
(
noimage
),
NULL
);
ok
(
hr
==
D3D_OK
,
"D3DXGetImageInfoFromResource returned %#x, expected %#x
\n
"
,
hr
,
D3D_OK
);
todo_wine
{
hr
=
D3DXGetImageInfoFromFileInMemory
(
noimage
,
sizeof
(
noimage
),
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
sizeof
(
bmp01
)
-
1
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
+
1
,
sizeof
(
bmp01
)
-
1
,
&
info
);
ok
(
hr
==
D3DXERR_INVALIDDATA
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DXERR_INVALIDDATA
);
}
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
0
,
&
info
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
bmp01
,
0
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
noimage
,
0
,
&
info
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
noimage
,
0
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
NULL
,
0
,
&
info
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
NULL
,
4
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
NULL
,
4
,
&
info
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
hr
=
D3DXGetImageInfoFromFileInMemory
(
NULL
,
0
,
NULL
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x
\n
"
,
hr
,
D3DERR_INVALIDCALL
);
/* cleanup */
if
(
testdummy_ok
)
DeleteFileA
(
"testdummy.bmp"
);
if
(
testbitmap_ok
)
DeleteFileA
(
"testbitmap.bmp"
);
}
START_TEST
(
texture
)
{
test_D3DXGetImageInfo
();
}
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