ChangeLog:
- Test cases for the direct3d7 light api.
Index: dlls/ddraw/tests/.cvsignore
===
RCS file: /home/wine/wine/dlls/ddraw/tests/.cvsignore,v
retrieving revision 1.3
diff -u -p -r1.3 .cvsignore
--- dlls/ddraw/tests/.cvsignore 30 May 2005 11:11:34 - 1.3
+++ dlls/ddraw/tests/.cvsignore 6 Jun 2005 18:13:18 -
@@ -1,4 +1,5 @@
Makefile
ddrawmodes.ok
dsurface.ok
+d3d7light.ok
testlist.c
Index: dlls/ddraw/tests/Makefile.in
===
RCS file: /home/wine/wine/dlls/ddraw/tests/Makefile.in,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile.in
--- dlls/ddraw/tests/Makefile.in30 May 2005 11:11:34 - 1.4
+++ dlls/ddraw/tests/Makefile.in6 Jun 2005 18:13:18 -
@@ -3,11 +3,12 @@ TOPOBJDIR = ../../..
SRCDIR= @srcdir@
VPATH = @srcdir@
TESTDLL = ddraw.dll
-IMPORTS = ddraw user32 gdi32 kernel32
+IMPORTS = ddraw dxguid user32 gdi32 kernel32
CTESTS = \
ddrawmodes.c \
- dsurface.c
+ dsurface.c \
+ d3d7light.c
@MAKE_TEST_RULES@
--- /dev/null 1970-01-01 01:00:00.0 +0100
+++ dlls/ddraw/tests/d3d7light.c2005-06-06 20:10:12.998103616 +0200
@@ -0,0 +1,185 @@
+/*
+ * Some unit tests for direct3d7 light functions
+ *
+ * Copyright (C) 2005 Antoine Chavasse ([EMAIL PROTECTED])
+ *
+ * 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
+#include "wine/test.h"
+#include "ddraw.h"
+#include "d3d.h"
+
+static LPDIRECTDRAW7lpDD = NULL;
+static LPDIRECT3D7 lpD3D = NULL;
+static LPDIRECTDRAWSURFACE7 lpDDS = NULL;
+static LPDIRECT3DDEVICE7lpD3DDevice = 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;
+light.dcvDiffuse.r = 0.5f;
+light.dcvDiffuse.g = 0.6f;
+light.dcvDiffuse.b = 0.7f;
+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_I