diff --git a/.gitignore b/.gitignore index 90e166eb2c5..43ee7d82a12 100644 --- a/.gitignore +++ b/.gitignore @@ -94,6 +94,9 @@ dlls/d3drm/tests/d3drm_crosstest.exe dlls/d3drm/tests/testlist.c dlls/d3drm/version.res dlls/d3dx8/libd3dx8.def +dlls/d3dx8/tests/*.ok +dlls/d3dx8/tests/d3dx8_crosstest.exe +dlls/d3dx8/tests/testlist.c dlls/d3dxof/libd3dxof.def dlls/d3dxof/version.res dlls/dbghelp/libdbghelp.def @@ -687,6 +690,7 @@ programs/winetest/crypt32_test.exe programs/winetest/d3d8_test.exe programs/winetest/d3d9_test.exe programs/winetest/d3drm_test.exe +programs/winetest/d3dx8_test.exe programs/winetest/ddraw_test.exe programs/winetest/dinput_test.exe programs/winetest/dnsapi_test.exe diff --git a/Makefile.in b/Makefile.in index de3da4b1ba2..46f330c44ca 100644 --- a/Makefile.in +++ b/Makefile.in @@ -198,6 +198,7 @@ ALL_MAKEFILES = \ dlls/d3drm/Makefile \ dlls/d3drm/tests/Makefile \ dlls/d3dx8/Makefile \ + dlls/d3dx8/tests/Makefile \ dlls/d3dxof/Makefile \ dlls/dbghelp/Makefile \ dlls/dciman32/Makefile \ @@ -570,6 +571,7 @@ dlls/d3dim/Makefile: dlls/d3dim/Makefile.in dlls/Makedll.rules dlls/d3drm/Makefile: dlls/d3drm/Makefile.in dlls/Makedll.rules dlls/d3drm/tests/Makefile: dlls/d3drm/tests/Makefile.in dlls/Maketest.rules dlls/d3dx8/Makefile: dlls/d3dx8/Makefile.in dlls/Makedll.rules +dlls/d3dx8/tests/Makefile: dlls/d3dx8/tests/Makefile.in dlls/Maketest.rules dlls/d3dxof/Makefile: dlls/d3dxof/Makefile.in dlls/Makedll.rules dlls/dbghelp/Makefile: dlls/dbghelp/Makefile.in dlls/Makedll.rules dlls/dciman32/Makefile: dlls/dciman32/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 1153f746105..fe57f3c4da0 100755 --- a/configure +++ b/configure @@ -20356,6 +20356,8 @@ ac_config_files="$ac_config_files dlls/d3drm/tests/Makefile" ac_config_files="$ac_config_files dlls/d3dx8/Makefile" +ac_config_files="$ac_config_files dlls/d3dx8/tests/Makefile" + ac_config_files="$ac_config_files dlls/d3dxof/Makefile" ac_config_files="$ac_config_files dlls/dbghelp/Makefile" @@ -21596,6 +21598,7 @@ do "dlls/d3drm/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/Makefile" ;; "dlls/d3drm/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3drm/tests/Makefile" ;; "dlls/d3dx8/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx8/Makefile" ;; + "dlls/d3dx8/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx8/tests/Makefile" ;; "dlls/d3dxof/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dxof/Makefile" ;; "dlls/dbghelp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dbghelp/Makefile" ;; "dlls/dciman32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dciman32/Makefile" ;; diff --git a/configure.ac b/configure.ac index b453dc6c8a4..1550d3484b7 100644 --- a/configure.ac +++ b/configure.ac @@ -1598,6 +1598,7 @@ AC_CONFIG_FILES([dlls/d3dim/Makefile]) AC_CONFIG_FILES([dlls/d3drm/Makefile]) AC_CONFIG_FILES([dlls/d3drm/tests/Makefile]) AC_CONFIG_FILES([dlls/d3dx8/Makefile]) +AC_CONFIG_FILES([dlls/d3dx8/tests/Makefile]) AC_CONFIG_FILES([dlls/d3dxof/Makefile]) AC_CONFIG_FILES([dlls/dbghelp/Makefile]) AC_CONFIG_FILES([dlls/dciman32/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index c08e25aa26b..1672d6a5c7d 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -255,6 +255,7 @@ TESTSUBDIRS = \ d3d8/tests \ d3d9/tests \ d3drm/tests \ + d3dx8/tests \ ddraw/tests \ dinput/tests \ dnsapi/tests \ diff --git a/dlls/d3dx8/tests/Makefile.in b/dlls/d3dx8/tests/Makefile.in new file mode 100644 index 00000000000..1cf574078b4 --- /dev/null +++ b/dlls/d3dx8/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = d3dx8.dll +IMPORTS = kernel32 +EXTRALIBS = -ldxguid + +CTESTS = math.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/d3dx8/tests/math.c b/dlls/d3dx8/tests/math.c new file mode 100644 index 00000000000..e9afd60080f --- /dev/null +++ b/dlls/d3dx8/tests/math.c @@ -0,0 +1,46 @@ +/* + * Copyright 2007 David Adam + * + * 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 +#include "d3dx8math.h" +#include "d3dx8math.inl" + +#include "wine/test.h" + +#define admitted_error 0.00001f + +static void D3X8Vector2Test(void) +{ + D3DXVECTOR2 u; + FLOAT expected, got; + + u.x=3.0f; u.y=4.0f; + +/*_______________D3DXVec2Length__________________________*/ + expected = 5.0f; + got = D3DXVec2Length(&u); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); + /* Tests the case NULL */ + expected=0.0f; + got= D3DXVec2Length(NULL); + ok(fabs( got - expected ) < admitted_error, "Expected: %f, Got: %f\n", expected, got); +} +START_TEST(math) +{ + D3X8Vector2Test(); +} diff --git a/include/Makefile.in b/include/Makefile.in index 9ac664f6b16..7ae17d7fb51 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -108,6 +108,7 @@ SRCDIR_INCLUDES = \ d3dx8.h \ d3dx8core.h \ d3dx8math.h \ + d3dx8math.inl \ dbghelp.h \ dbinit.idl \ dbprop.idl \ diff --git a/include/d3dx8math.h b/include/d3dx8math.h index 71de0142fae..aa561ed4dc7 100644 --- a/include/d3dx8math.h +++ b/include/d3dx8math.h @@ -58,4 +58,6 @@ typedef struct D3DXCOLOR FLOAT r, g, b, a; } D3DXCOLOR, *LPD3DXCOLOR; +FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv); + #endif /* __D3DX8MATH_H__ */ diff --git a/include/d3dx8math.inl b/include/d3dx8math.inl new file mode 100644 index 00000000000..e9b1b6d8823 --- /dev/null +++ b/include/d3dx8math.inl @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2007 David Adam + * + * 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 __D3DX8MATH_INL__ +#define __D3DX8MATH_INL__ + +extern inline FLOAT D3DXVec2Length(CONST D3DXVECTOR2 *pv) +{ + if (!pv) return 0.0f; + return sqrt( (pv->x) * (pv->x) + (pv->y) * (pv->y) ); +} + +#endif diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index a6ac69dcafa..8858a88a014 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -31,6 +31,7 @@ TESTBINS = \ d3d8_test.exe \ d3d9_test.exe \ d3drm_test.exe \ + d3dx8_test.exe \ ddraw_test.exe \ dinput_test.exe \ dnsapi_test.exe \ @@ -111,6 +112,8 @@ d3d9_test.exe: $(DLLDIR)/d3d9/tests/d3d9_test.exe$(DLLEXT) cp $(DLLDIR)/d3d9/tests/d3d9_test.exe$(DLLEXT) $@ && $(STRIP) $@ d3drm_test.exe: $(DLLDIR)/d3drm/tests/d3drm_test.exe$(DLLEXT) cp $(DLLDIR)/d3drm/tests/d3drm_test.exe$(DLLEXT) $@ && $(STRIP) $@ +d3dx8_test.exe: $(DLLDIR)/d3dx8/tests/d3dx8_test.exe$(DLLEXT) + cp $(DLLDIR)/d3dx8/tests/d3dx8_test.exe$(DLLEXT) $@ && $(STRIP) $@ ddraw_test.exe: $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT) cp $(DLLDIR)/ddraw/tests/ddraw_test.exe$(DLLEXT) $@ && $(STRIP) $@ dinput_test.exe: $(DLLDIR)/dinput/tests/dinput_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index aee8c2a43bd..fb8cee20983 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -89,6 +89,7 @@ crypt32_test.exe TESTRES "crypt32_test.exe" d3d8_test.exe TESTRES "d3d8_test.exe" d3d9_test.exe TESTRES "d3d9_test.exe" d3drm_test.exe TESTRES "d3drm_test.exe" +d3dx8_test.exe TESTRES "d3dx8_test.exe" ddraw_test.exe TESTRES "ddraw_test.exe" dinput_test.exe TESTRES "dinput_test.exe" dnsapi_test.exe TESTRES "dnsapi_test.exe"