From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2 (Matteo): Test GetTechniqueDesc() with a NULL handle.
dlls/d3dx9_36/effect.c | 2 +- dlls/d3dx9_36/tests/effect.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index 710e999f27f..22afa649db3 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -3816,7 +3816,7 @@ static HRESULT WINAPI d3dx_effect_FindNextValidTechnique(ID3DXEffect *iface, D3D } }
- *next_technique = get_technique_handle(&effect->techniques[0]); + *next_technique = NULL; return S_FALSE; }
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index ae6f65d52d5..d6998284271 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -7892,9 +7892,9 @@ static void test_effect_find_next_valid_technique(void) D3DPRESENT_PARAMETERS present_parameters = {0}; IDirect3DDevice9 *device; D3DXTECHNIQUE_DESC desc; + D3DXHANDLE tech, tech2; ID3DXEffect *effect; IDirect3D9 *d3d; - D3DXHANDLE tech; ULONG refcount; HWND window; HRESULT hr; @@ -7939,9 +7939,12 @@ static void test_effect_find_next_valid_technique(void) ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
- hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); + tech2 = tech; + hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2); ok(hr == S_FALSE, "Got result %#x.\n", hr); - hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc); + ok(!tech2, "Unexpected technique handle %p.\n", tech2); + /* Test GetTechniqueDesc() with a NULL handle. */ + hr = effect->lpVtbl->GetTechniqueDesc(effect, tech2, &desc); ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
@@ -7957,9 +7960,10 @@ static void test_effect_find_next_valid_technique(void) ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
- hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); + hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2); ok(hr == S_FALSE, "Got result %#x.\n", hr); - hr = effect->lpVtbl->GetTechniqueDesc(effect, tech, &desc); + ok(!tech2, "Unexpected technique handle %p.\n", tech2); + hr = effect->lpVtbl->GetTechniqueDesc(effect, tech2, &desc); ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(!strcmp(desc.Name, "tech0"), "Got unexpected technique %s.\n", desc.Name);
@@ -7985,8 +7989,9 @@ static void test_effect_find_next_valid_technique(void) ok(hr == D3D_OK, "Got result %#x.\n", hr); ok(!strcmp(desc.Name, "tech1"), "Got unexpected technique %s.\n", desc.Name);
- hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech); + hr = effect->lpVtbl->FindNextValidTechnique(effect, tech, &tech2); ok(hr == S_FALSE, "Got result %#x.\n", hr); + ok(!tech2, "Unexpected technique handle %p.\n", tech2);
hr = effect->lpVtbl->FindNextValidTechnique(effect, "nope", &tech); ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);