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
926e3553
Commit
926e3553
authored
Jun 07, 2005
by
Antoine Chavasse
Committed by
Alexandre Julliard
Jun 07, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test cases for the direct3d7 light api.
parent
b65e790b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
199 additions
and
0 deletions
+199
-0
.cvsignore
dlls/ddraw/tests/.cvsignore
+1
-0
Makefile.in
dlls/ddraw/tests/Makefile.in
+2
-0
d3d.c
dlls/ddraw/tests/d3d.c
+196
-0
No files found.
dlls/ddraw/tests/.cvsignore
View file @
926e3553
Makefile
d3d.ok
ddrawmodes.ok
dsurface.ok
testlist.c
dlls/ddraw/tests/Makefile.in
View file @
926e3553
...
...
@@ -4,8 +4,10 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
TESTDLL
=
ddraw.dll
IMPORTS
=
ddraw user32 gdi32 kernel32
EXTRALIBS
=
-ldxguid
CTESTS
=
\
d3d.c
\
ddrawmodes.c
\
dsurface.c
...
...
dlls/ddraw/tests/d3d.c
0 → 100644
View file @
926e3553
/*
* Some unit tests for d3d functions
*
* Copyright (C) 2005 Antoine Chavasse
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include "wine/test.h"
#include "ddraw.h"
#include "d3d.h"
#ifdef NONAMELESSUNION
# define U(x) (x).u
# define U1(x) (x).u1
# define U2(x) (x).u2
# define U3(x) (x).u3
#else
# define U(x) (x)
# define U1(x) (x)
# define U2(x) (x)
# define U3(x) (x)
#endif
static
LPDIRECTDRAW7
lpDD
=
NULL
;
static
LPDIRECT3D7
lpD3D
=
NULL
;
static
LPDIRECTDRAWSURFACE7
lpDDS
=
NULL
;
static
LPDIRECT3DDEVICE7
lpD3DDevice
=
NULL
;
static
void
CreateDirect3D
()
{
HRESULT
rc
;
DDSURFACEDESC2
ddsd
;
rc
=
DirectDrawCreateEx
(
NULL
,
(
void
**
)
&
lpDD
,
&
IID_IDirectDraw7
,
NULL
);
ok
(
rc
==
DD_OK
,
"DirectDrawCreateEx returned: %lx
\n
"
,
rc
);
rc
=
IDirectDraw_SetCooperativeLevel
(
lpDD
,
NULL
,
DDSCL_NORMAL
);
ok
(
rc
==
DD_OK
,
"SetCooperativeLevel returned: %lx
\n
"
,
rc
);
rc
=
IDirectDraw7_QueryInterface
(
lpDD
,
&
IID_IDirect3D7
,
(
void
**
)
&
lpD3D
);
ok
(
rc
==
DD_OK
,
"QueryInterface returned: %lx
\n
"
,
rc
);
memset
(
&
ddsd
,
0
,
sizeof
(
ddsd
));
ddsd
.
dwSize
=
sizeof
(
ddsd
);
ddsd
.
dwFlags
=
DDSD_CAPS
|
DDSD_WIDTH
|
DDSD_HEIGHT
;
ddsd
.
ddsCaps
.
dwCaps
=
DDSCAPS_OFFSCREENPLAIN
|
DDSCAPS_3DDEVICE
;
ddsd
.
dwWidth
=
256
;
ddsd
.
dwHeight
=
256
;
rc
=
IDirectDraw7_CreateSurface
(
lpDD
,
&
ddsd
,
&
lpDDS
,
NULL
);
ok
(
rc
==
DD_OK
,
"CreateSurface returned: %lx
\n
"
,
rc
);
rc
=
IDirect3D7_CreateDevice
(
lpD3D
,
&
IID_IDirect3DTnLHalDevice
,
lpDDS
,
&
lpD3DDevice
);
ok
(
rc
==
D3D_OK
,
"CreateDevice returned: %lx
\n
"
,
rc
);
}
static
void
ReleaseDirect3D
()
{
if
(
lpD3DDevice
!=
NULL
)
{
IDirect3DDevice7_Release
(
lpD3DDevice
);
lpD3DDevice
=
NULL
;
}
if
(
lpDDS
!=
NULL
)
{
IDirectDrawSurface_Release
(
lpDDS
);
lpDDS
=
NULL
;
}
if
(
lpD3D
!=
NULL
)
{
IDirect3D7_Release
(
lpD3D
);
lpD3D
=
NULL
;
}
if
(
lpDD
!=
NULL
)
{
IDirectDraw_Release
(
lpDD
);
lpDD
=
NULL
;
}
}
static
void
LightTest
()
{
HRESULT
rc
;
D3DLIGHT7
light
;
D3DLIGHT7
defaultlight
;
BOOL
bEnabled
=
FALSE
;
/* Set a few lights with funky indices. */
memset
(
&
light
,
0
,
sizeof
(
light
));
light
.
dltType
=
D3DLIGHT_DIRECTIONAL
;
U1
(
light
.
dcvDiffuse
).
r
=
0
.
5
f
;
U2
(
light
.
dcvDiffuse
).
g
=
0
.
6
f
;
U3
(
light
.
dcvDiffuse
).
b
=
0
.
7
f
;
U2
(
light
.
dvDirection
).
y
=
1
.
f
;
rc
=
IDirect3DDevice7_SetLight
(
lpD3DDevice
,
5
,
&
light
);
ok
(
rc
==
D3D_OK
,
"SetLight returned: %lx
\n
"
,
rc
);
rc
=
IDirect3DDevice7_SetLight
(
lpD3DDevice
,
10
,
&
light
);
ok
(
rc
==
D3D_OK
,
"SetLight returned: %lx
\n
"
,
rc
);
rc
=
IDirect3DDevice7_SetLight
(
lpD3DDevice
,
45
,
&
light
);
ok
(
rc
==
D3D_OK
,
"SetLight returned: %lx
\n
"
,
rc
);
/* Try to retrieve a light beyond the indices of the lights that have
been set. */
rc
=
IDirect3DDevice7_GetLight
(
lpD3DDevice
,
50
,
&
light
);
ok
(
rc
==
DDERR_INVALIDPARAMS
,
"GetLight returned: %lx
\n
"
,
rc
);
rc
=
IDirect3DDevice7_GetLight
(
lpD3DDevice
,
2
,
&
light
);
ok
(
rc
==
DDERR_INVALIDPARAMS
,
"GetLight returned: %lx
\n
"
,
rc
);
/* Try to retrieve one of the lights that have been set */
rc
=
IDirect3DDevice7_GetLight
(
lpD3DDevice
,
10
,
&
light
);
ok
(
rc
==
D3D_OK
,
"GetLight returned: %lx
\n
"
,
rc
);
/* Enable a light that have been previously set. */
rc
=
IDirect3DDevice7_LightEnable
(
lpD3DDevice
,
10
,
TRUE
);
ok
(
rc
==
D3D_OK
,
"LightEnable returned: %lx
\n
"
,
rc
);
/* Enable some lights that have not been previously set, and verify that
they have been initialized with proper default values. */
memset
(
&
defaultlight
,
0
,
sizeof
(
D3DLIGHT7
));
defaultlight
.
dltType
=
D3DLIGHT_DIRECTIONAL
;
U1
(
defaultlight
.
dcvDiffuse
).
r
=
1
.
f
;
U2
(
defaultlight
.
dcvDiffuse
).
g
=
1
.
f
;
U3
(
defaultlight
.
dcvDiffuse
).
b
=
1
.
f
;
U3
(
defaultlight
.
dvDirection
).
z
=
1
.
f
;
rc
=
IDirect3DDevice7_LightEnable
(
lpD3DDevice
,
20
,
TRUE
);
ok
(
rc
==
D3D_OK
,
"LightEnable returned: %lx
\n
"
,
rc
);
memset
(
&
light
,
0
,
sizeof
(
D3DLIGHT7
));
rc
=
IDirect3DDevice7_GetLight
(
lpD3DDevice
,
20
,
&
light
);
ok
(
rc
==
D3D_OK
,
"GetLight returned: %lx
\n
"
,
rc
);
ok
(
!
memcmp
(
&
light
,
&
defaultlight
,
sizeof
(
D3DLIGHT7
)),
"light data doesn't match expected default values
\n
"
);
rc
=
IDirect3DDevice7_LightEnable
(
lpD3DDevice
,
50
,
TRUE
);
ok
(
rc
==
D3D_OK
,
"LightEnable returned: %lx
\n
"
,
rc
);
memset
(
&
light
,
0
,
sizeof
(
D3DLIGHT7
));
rc
=
IDirect3DDevice7_GetLight
(
lpD3DDevice
,
50
,
&
light
);
ok
(
rc
==
D3D_OK
,
"GetLight returned: %lx
\n
"
,
rc
);
ok
(
!
memcmp
(
&
light
,
&
defaultlight
,
sizeof
(
D3DLIGHT7
)),
"light data doesn't match expected default values
\n
"
);
/* Disable one of the light that have been previously enabled. */
rc
=
IDirect3DDevice7_LightEnable
(
lpD3DDevice
,
20
,
FALSE
);
ok
(
rc
==
D3D_OK
,
"LightEnable returned: %lx
\n
"
,
rc
);
/* Try to retrieve the enable status of some lights */
/* Light 20 is supposed to be disabled */
rc
=
IDirect3DDevice7_GetLightEnable
(
lpD3DDevice
,
20
,
&
bEnabled
);
ok
(
rc
==
D3D_OK
,
"GetLightEnable returned: %lx
\n
"
,
rc
);
ok
(
!
bEnabled
,
"GetLightEnable says the light is enabled
\n
"
);
/* Light 10 is supposed to be enabled */
bEnabled
=
FALSE
;
rc
=
IDirect3DDevice7_GetLightEnable
(
lpD3DDevice
,
10
,
&
bEnabled
);
ok
(
rc
==
D3D_OK
,
"GetLightEnable returned: %lx
\n
"
,
rc
);
ok
(
bEnabled
,
"GetLightEnable says the light is disabled
\n
"
);
/* Light 80 has not been set */
rc
=
IDirect3DDevice7_GetLightEnable
(
lpD3DDevice
,
80
,
&
bEnabled
);
ok
(
rc
==
DDERR_INVALIDPARAMS
,
"GetLightEnable returned: %lx
\n
"
,
rc
);
/* Light 23 has not been set */
rc
=
IDirect3DDevice7_GetLightEnable
(
lpD3DDevice
,
23
,
&
bEnabled
);
ok
(
rc
==
DDERR_INVALIDPARAMS
,
"GetLightEnable returned: %lx
\n
"
,
rc
);
}
START_TEST
(
d3d
)
{
CreateDirect3D
();
LightTest
();
ReleaseDirect3D
();
}
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