d3dxof: Fix guid syntax.
[wine/wine-kai.git] / dlls / d3dxof / tests / d3dxof.c
blobbdc1431034e55b4f752cae439477d2d3eb710335
1 /*
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
20 #define COBJMACROS
22 #include <assert.h>
23 #include "wine/test.h"
24 #include "dxfile.h"
26 static HMODULE hd3dxof;
27 static HRESULT (WINAPI *pDirectXFileCreate)(LPDIRECTXFILE*);
29 char template[] =
30 "xof 0302txt 0064\n"
31 "template Header\n"
32 "{\n"
33 "<3D82AB43-62DA-11CF-AB39-0020AF71E433>\n"
34 "WORD major;\n"
35 "WORD minor;\n"
36 "DWORD flags;\n"
37 "}\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)
55 HRESULT hr;
56 unsigned long ref;
57 LPDIRECTXFILE lpDirectXFile = NULL;
59 if (!pDirectXFileCreate)
61 win_skip("DirectXFileCreate is not available\n");
62 return;
65 hr = pDirectXFileCreate(&lpDirectXFile);
66 ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr);
67 if(!lpDirectXFile)
69 skip("Couldn't create DirectXFile interface\n");
70 return;
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);
89 START_TEST(d3dxof)
91 init_function_pointers();
93 test_d3dxof();
95 FreeLibrary(hd3dxof);