2 * Some unit tests for d3dxof
4 * Copyright (C) 2008 Christian Costa
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
26 static HMODULE hd3dxof;
27 static HRESULT (WINAPI *pDirectXFileCreate)(LPDIRECTXFILE*);
33 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>\n"
39 static void init_function_pointers(void)
41 /* We have to use LoadLibrary as no d3dxof functions are referenced directly */
42 hd3dxof = LoadLibraryA("d3dxof.dll");
44 pDirectXFileCreate = (void *)GetProcAddress(hd3dxof, "DirectXFileCreate");
47 static unsigned long getRefcount(IUnknown *iface)
49 IUnknown_AddRef(iface);
50 return IUnknown_Release(iface);
53 static void test_d3dxof(void)
57 LPDIRECTXFILE lpDirectXFile = NULL;
59 if (!pDirectXFileCreate)
61 win_skip("DirectXFileCreate is not available\n");
65 hr = pDirectXFileCreate(&lpDirectXFile);
66 ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr);
69 skip("Couldn't create DirectXFile interface\n");
73 ref = getRefcount( (IUnknown *) lpDirectXFile);
74 ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
76 ref = IDirectXFile_AddRef(lpDirectXFile);
77 ok(ref == 2, "Got refcount %ld, expected 1\n", ref);
79 ref = IDirectXFile_Release(lpDirectXFile);
80 ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
82 hr = IDirectXFile_RegisterTemplates(lpDirectXFile, template, strlen(template));
83 ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
85 ref = IDirectXFile_Release(lpDirectXFile);
86 ok(ref == 0, "Got refcount %ld, expected 1\n", ref);
91 init_function_pointers();