wininet: Support the Cache-Control max-age directive for setting url cache entry...
[wine/testsucceed.git] / dlls / d3drm / tests / d3drm.c
blob1af90bc0413644576162c177ae0fbafb7e7477e4
1 /*
2 * Copyright 2010 Christian Costa
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "d3drm.h"
21 #include "wine/test.h"
23 static HMODULE d3drm_handle = 0;
25 static HRESULT (WINAPI * pDirect3DRMCreate)(LPDIRECT3DRM* ppDirect3DRM);
27 #define D3DRM_GET_PROC(func) \
28 p ## func = (void*)GetProcAddress(d3drm_handle, #func); \
29 if(!p ## func) { \
30 trace("GetProcAddress(%s) failed\n", #func); \
31 FreeLibrary(d3drm_handle); \
32 return FALSE; \
35 static BOOL InitFunctionPtrs(void)
37 d3drm_handle = LoadLibraryA("d3drm.dll");
39 if(!d3drm_handle)
41 skip("Could not load d3drm.dll\n");
42 return FALSE;
45 D3DRM_GET_PROC(Direct3DRMCreate)
47 return TRUE;
50 static char data_bad_version[] =
51 "xof 0302txt 0064\n"
52 "Header Object\n"
53 "{\n"
54 "1; 2; 3;\n"
55 "}\n";
57 static char data_no_mesh[] =
58 "xof 0302txt 0064\n"
59 "Header Object\n"
60 "{\n"
61 "1; 0; 1;\n"
62 "}\n";
64 static char data_ok[] =
65 "xof 0302txt 0064\n"
66 "Header Object\n"
67 "{\n"
68 "1; 0; 1;\n"
69 "}\n"
70 "Mesh Object\n"
71 "{\n"
72 "4;\n"
73 "1.0; 0.0; 0.0;,\n"
74 "0.0; 1.0; 0.0;,\n"
75 "0.0; 0.0; 1.0;,\n"
76 "1.0; 1.0; 1.0;;\n"
77 "3;\n"
78 "3; 0, 1, 2;,\n"
79 "3; 1, 2, 3;,\n"
80 "3; 3, 1, 2;;\n"
81 "}\n";
83 static void MeshBuilderTest(void)
85 HRESULT hr;
86 LPDIRECT3DRM pD3DRM;
87 LPDIRECT3DRMMESHBUILDER pMeshBuilder;
88 D3DRMLOADMEMORY info;
89 int val;
90 DWORD val1, val2, val3;
92 hr = pDirect3DRMCreate(&pD3DRM);
93 ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr);
95 hr = IDirect3DRM_CreateMeshBuilder(pD3DRM, &pMeshBuilder);
96 ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder interface (hr = %x)\n", hr);
98 info.lpMemory = data_bad_version;
99 info.dSize = strlen(data_bad_version);
100 hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL);
101 ok(hr == D3DRMERR_BADFILE, "Sould have returned D3DRMERR_BADFILE (hr = %x)\n", hr);
103 info.lpMemory = data_no_mesh;
104 info.dSize = strlen(data_no_mesh);
105 hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL);
106 ok(hr == D3DRMERR_NOTFOUND, "Sould have returned D3DRMERR_NOTFOUND (hr = %x)\n", hr);
108 info.lpMemory = data_ok;
109 info.dSize = strlen(data_ok);
110 hr = IDirect3DRMMeshBuilder_Load(pMeshBuilder, &info, NULL, D3DRMLOAD_FROMMEMORY, NULL, NULL);
111 ok(hr == D3DRM_OK, "Cannot load mesh data (hr = %x)\n", hr);
113 val = IDirect3DRMMeshBuilder_GetVertexCount(pMeshBuilder);
114 ok(val == 4, "Wrong number of vertices %d (must be 4)\n", val);
116 val = IDirect3DRMMeshBuilder_GetFaceCount(pMeshBuilder);
117 ok(val == 3, "Wrong number of faces %d (must be 3)\n", val);
119 hr = IDirect3DRMMeshBuilder_GetVertices(pMeshBuilder, &val1, NULL, &val2, NULL, &val3, NULL);
120 ok(hr == D3DRM_OK, "Cannot get vertices information (hr = %x)\n", hr);
121 ok(val1 == 4, "Wrong number of vertices %d (must be 4)\n", val1);
122 todo_wine ok(val2 == 4, "Wrong number of normals %d (must be 4)\n", val2);
123 todo_wine ok(val3 == 22, "Wrong number of face data bytes %d (must be 22)\n", val3);
125 IDirect3DRMMeshBuilder_Release(pMeshBuilder);
127 IDirect3DRM_Release(pD3DRM);
130 START_TEST(d3drm)
132 if (!InitFunctionPtrs())
133 return;
135 MeshBuilderTest();
137 FreeLibrary(d3drm_handle);