d3dx9_36: Add stubbed interface for ID3DXEffect.
[wine/multimedia.git] / dlls / d3dx9_36 / tests / effect.c
blob40a2f181cc54d803d732c672811a32276a19fd4e
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 "wine/test.h"
20 #include "d3dx9.h"
22 static const char effect_desc[] =
23 "Technique\n"
24 "{\n"
25 "}\n";
27 static void test_create_effect(IDirect3DDevice9* device)
29 HRESULT hr;
30 ID3DXEffect* effect;
32 hr = D3DXCreateEffect(NULL, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
33 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
35 hr = D3DXCreateEffect(device, NULL, 0, NULL, NULL, 0, NULL, NULL, NULL);
36 ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
38 hr = D3DXCreateEffect(device, effect_desc, 0, NULL, NULL, 0, NULL, NULL, NULL);
39 ok(hr == E_FAIL, "Got result %x, expected %x (D3DXERR_INVALIDDATA)\n", hr, E_FAIL);
41 hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, NULL, NULL);
42 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
44 hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL);
45 ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr);
47 effect->lpVtbl->Release(effect);
50 START_TEST(effect)
52 HWND wnd;
53 IDirect3D9* d3d;
54 IDirect3DDevice9* device;
55 D3DPRESENT_PARAMETERS d3dpp;
56 HRESULT hr;
58 wnd = CreateWindow("static", "d3dx9_test", 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
59 d3d = Direct3DCreate9(D3D_SDK_VERSION);
60 if (!wnd) {
61 skip("Couldn't create application window\n");
62 return;
64 if (!d3d) {
65 skip("Couldn't create IDirect3D9 object\n");
66 DestroyWindow(wnd);
67 return;
70 ZeroMemory(&d3dpp, sizeof(d3dpp));
71 d3dpp.Windowed = TRUE;
72 d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
73 hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, wnd, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device);
74 if (FAILED(hr)) {
75 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
76 IDirect3D9_Release(d3d);
77 DestroyWindow(wnd);
78 return;
81 test_create_effect(device);
83 IDirect3DDevice9_Release(device);
84 IDirect3D9_Release(d3d);
85 DestroyWindow(wnd);