From 04d72cdd6ff1ce286ea3c9bc3d5948a67f343669 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Tue, 19 Aug 2008 00:30:44 +0200 Subject: [PATCH] d3dxof: Add basic tests. --- .gitignore | 1 + Makefile.in | 2 ++ configure | 3 ++ configure.ac | 1 + dlls/Makefile.in | 1 + dlls/d3dxof/tests/Makefile.in | 13 ++++++++ dlls/d3dxof/tests/d3dxof.c | 75 +++++++++++++++++++++++++++++++++++++++++++ programs/winetest/Makefile.in | 3 ++ programs/winetest/winetest.rc | 1 + 9 files changed, 100 insertions(+) create mode 100644 dlls/d3dxof/tests/Makefile.in create mode 100644 dlls/d3dxof/tests/d3dxof.c diff --git a/.gitignore b/.gitignore index f3206c6f153..e5de4c9bc9f 100644 --- a/.gitignore +++ b/.gitignore @@ -270,6 +270,7 @@ programs/winetest/d3d9_test.exe programs/winetest/d3drm_test.exe programs/winetest/d3dx8_test.exe programs/winetest/d3dx9_36_test.exe +programs/winetest/d3dxof_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 8d197792808..fd34e31822d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -231,6 +231,7 @@ ALL_MAKEFILES = \ dlls/d3dx9_36/tests/Makefile \ dlls/d3dx9_37/Makefile \ dlls/d3dxof/Makefile \ + dlls/d3dxof/tests/Makefile \ dlls/dbghelp/Makefile \ dlls/dciman32/Makefile \ dlls/ddraw/Makefile \ @@ -666,6 +667,7 @@ dlls/d3dx9_36/Makefile: dlls/d3dx9_36/Makefile.in dlls/Makedll.rules dlls/d3dx9_36/tests/Makefile: dlls/d3dx9_36/tests/Makefile.in dlls/Maketest.rules dlls/d3dx9_37/Makefile: dlls/d3dx9_37/Makefile.in dlls/Makedll.rules dlls/d3dxof/Makefile: dlls/d3dxof/Makefile.in dlls/Makedll.rules +dlls/d3dxof/tests/Makefile: dlls/d3dxof/tests/Makefile.in dlls/Maketest.rules dlls/dbghelp/Makefile: dlls/dbghelp/Makefile.in dlls/Makedll.rules dlls/dciman32/Makefile: dlls/dciman32/Makefile.in dlls/Makedll.rules dlls/ddraw/Makefile: dlls/ddraw/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 5a191c9abaf..422f585507a 100755 --- a/configure +++ b/configure @@ -22041,6 +22041,8 @@ ac_config_files="$ac_config_files dlls/d3dx9_37/Makefile" ac_config_files="$ac_config_files dlls/d3dxof/Makefile" +ac_config_files="$ac_config_files dlls/d3dxof/tests/Makefile" + ac_config_files="$ac_config_files dlls/dbghelp/Makefile" ac_config_files="$ac_config_files dlls/dciman32/Makefile" @@ -23382,6 +23384,7 @@ do "dlls/d3dx9_36/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx9_36/tests/Makefile" ;; "dlls/d3dx9_37/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dx9_37/Makefile" ;; "dlls/d3dxof/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dxof/Makefile" ;; + "dlls/d3dxof/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3dxof/tests/Makefile" ;; "dlls/dbghelp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dbghelp/Makefile" ;; "dlls/dciman32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dciman32/Makefile" ;; "dlls/ddraw/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ddraw/Makefile" ;; diff --git a/configure.ac b/configure.ac index bc2d1184fe5..fb8de889d35 100644 --- a/configure.ac +++ b/configure.ac @@ -1783,6 +1783,7 @@ AC_CONFIG_FILES([dlls/d3dx9_36/Makefile]) AC_CONFIG_FILES([dlls/d3dx9_36/tests/Makefile]) AC_CONFIG_FILES([dlls/d3dx9_37/Makefile]) AC_CONFIG_FILES([dlls/d3dxof/Makefile]) +AC_CONFIG_FILES([dlls/d3dxof/tests/Makefile]) AC_CONFIG_FILES([dlls/dbghelp/Makefile]) AC_CONFIG_FILES([dlls/dciman32/Makefile]) AC_CONFIG_FILES([dlls/ddraw/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 581276c167e..5a50ce76a41 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -304,6 +304,7 @@ TESTSUBDIRS = \ d3drm/tests \ d3dx8/tests \ d3dx9_36/tests \ + d3dxof/tests \ ddraw/tests \ dinput/tests \ dnsapi/tests \ diff --git a/dlls/d3dxof/tests/Makefile.in b/dlls/d3dxof/tests/Makefile.in new file mode 100644 index 00000000000..91776c6f9f7 --- /dev/null +++ b/dlls/d3dxof/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = d3dxof.dll +IMPORTS = d3dxof kernel32 + +CTESTS = \ + d3dxof.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c new file mode 100644 index 00000000000..e9ee9f272c0 --- /dev/null +++ b/dlls/d3dxof/tests/d3dxof.c @@ -0,0 +1,75 @@ +/* + * Some unit tests for d3dxof + * + * Copyright (C) 2008 Christian Costa + * + * 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 + */ +#define COBJMACROS + +#include +#include "wine/test.h" +#include "dxfile.h" + +char template[] = +"xof 0302 txt 064\n" +"template Header\n" +"{\n" +"<3D82AB43-62DA-11CF-AB390020AF71E433>\n" +"WORD major ;\n" +"WORD minor ;\n" +"DWORD flags ;\n" +"}\n"; + +static unsigned long getRefcount(IUnknown *iface) +{ + IUnknown_AddRef(iface); + return IUnknown_Release(iface); +} + +static void test_d3dxof(void) +{ + HRESULT hr; + unsigned long ref; + LPDIRECTXFILE lpDirectXFile = NULL; + hr = DirectXFileCreate(&lpDirectXFile); + ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr); + if(!lpDirectXFile) + { + trace("Couldn't create DirectXFile interface, skipping tests\n"); + return; + } + + ref = getRefcount( (IUnknown *) lpDirectXFile); + ok(ref == 1, "Got refcount %ld, expected 1\n", ref); + + ref = IDirectXFile_AddRef(lpDirectXFile); + ok(ref == 2, "Got refcount %ld, expected 1\n", ref); + + ref = IDirectXFile_Release(lpDirectXFile); + ok(ref == 1, "Got refcount %ld, expected 1\n", ref); + + /* RegisterTemplates does not support txt format yet */ + hr = IDirectXFile_RegisterTemplates(lpDirectXFile, template, strlen(template)); + todo_wine ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr); + + ref = IDirectXFile_Release(lpDirectXFile); + ok(ref == 0, "Got refcount %ld, expected 1\n", ref); +} + +START_TEST(d3dxof) +{ + test_d3dxof(); +} diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 9defc7c83dc..2c06b1194eb 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -39,6 +39,7 @@ TESTBINS = \ d3drm_test.exe \ d3dx8_test.exe \ d3dx9_36_test.exe \ + d3dxof_test.exe \ ddraw_test.exe \ dinput_test.exe \ dnsapi_test.exe \ @@ -139,6 +140,8 @@ d3dx8_test.exe: $(DLLDIR)/d3dx8/tests/d3dx8_test.exe$(DLLEXT) cp $(DLLDIR)/d3dx8/tests/d3dx8_test.exe$(DLLEXT) $@ && $(STRIP) $@ d3dx9_36_test.exe: $(DLLDIR)/d3dx9_36/tests/d3dx9_36_test.exe$(DLLEXT) cp $(DLLDIR)/d3dx9_36/tests/d3dx9_36_test.exe$(DLLEXT) $@ && $(STRIP) $@ +d3dxof_test.exe: $(DLLDIR)/d3dxof/tests/d3dxof_test.exe$(DLLEXT) + cp $(DLLDIR)/d3dxof/tests/d3dxof_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 fb00c504a0c..4aaa099d684 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -100,6 +100,7 @@ d3d9_test.exe TESTRES "d3d9_test.exe" d3drm_test.exe TESTRES "d3drm_test.exe" d3dx8_test.exe TESTRES "d3dx8_test.exe" d3dx9_36_test.exe TESTRES "d3dx9_36_test.exe" +d3dxof_test.exe TESTRES "d3dxof_test.exe" ddraw_test.exe TESTRES "ddraw_test.exe" dinput_test.exe TESTRES "dinput_test.exe" dnsapi_test.exe TESTRES "dnsapi_test.exe" -- 2.11.4.GIT