push ba446c6b1b23357887fb7e3c53313f206998858b
[wine/hacks.git] / dlls / d3dxof / tests / d3dxof.c
blob8ee58b3bcefa343a497c28e10351c564fb6ff39d
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 char template[] =
27 "xof 0302txt 0064\n"
28 "template Header\n"
29 "{\n"
30 "<3D82AB43-62DA-11CF-AB390020AF71E433>\n"
31 "WORD major ;\n"
32 "WORD minor ;\n"
33 "DWORD flags ;\n"
34 "}\n";
36 static unsigned long getRefcount(IUnknown *iface)
38 IUnknown_AddRef(iface);
39 return IUnknown_Release(iface);
42 static void test_d3dxof(void)
44 HRESULT hr;
45 unsigned long ref;
46 LPDIRECTXFILE lpDirectXFile = NULL;
47 hr = DirectXFileCreate(&lpDirectXFile);
48 ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr);
49 if(!lpDirectXFile)
51 trace("Couldn't create DirectXFile interface, skipping tests\n");
52 return;
55 ref = getRefcount( (IUnknown *) lpDirectXFile);
56 ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
58 ref = IDirectXFile_AddRef(lpDirectXFile);
59 ok(ref == 2, "Got refcount %ld, expected 1\n", ref);
61 ref = IDirectXFile_Release(lpDirectXFile);
62 ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
64 /* RegisterTemplates does not support txt format yet */
65 hr = IDirectXFile_RegisterTemplates(lpDirectXFile, template, strlen(template));
66 ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
68 ref = IDirectXFile_Release(lpDirectXFile);
69 ok(ref == 0, "Got refcount %ld, expected 1\n", ref);
72 START_TEST(d3dxof)
74 test_d3dxof();