Module: wine Branch: master Commit: 97dcf42ff2c21dd521f79916bf66900c8cc6f68d URL: http://source.winehq.org/git/wine.git/?a=commit;h=97dcf42ff2c21dd521f79916bf...
Author: Paul Gofman gofmanp@gmail.com Date: Fri May 5 14:34:31 2017 +0300
d3dx9/tests: Add tests for setting strings in effect.
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3dx9_36/tests/effect.c | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 4 deletions(-)
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index c0ff4bd..6e8024f 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -2402,12 +2402,18 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
static void test_effect_setvalue_object(IDirect3DDevice9 *device) { - ID3DXEffect *effect; - D3DXHANDLE parameter; - IDirect3DTexture9 *texture; + static const char expected_string[] = "test_string_1"; + static const char expected_string2[] = "test_longer_string_2"; + static const char *expected_string_array[] = {expected_string, expected_string2}; + const char *string_array[ARRAY_SIZE(expected_string_array)]; + const char *string, *string2; IDirect3DTexture9 *texture_set; - HRESULT hr; + IDirect3DTexture9 *texture; + D3DXHANDLE parameter; + ID3DXEffect *effect; + unsigned int i; ULONG count; + HRESULT hr;
hr = D3DXCreateEffect(device, test_effect_parameter_value_blob_object, sizeof(test_effect_parameter_value_blob_object), NULL, NULL, 0, NULL, &effect, NULL); @@ -2434,6 +2440,47 @@ static void test_effect_setvalue_object(IDirect3DDevice9 *device) count = IDirect3DTexture9_Release(texture); ok(!count, "Got reference count %u, expected 0.\n", count);
+ hr = effect->lpVtbl->SetString(effect, "s", expected_string); + todo_wine + ok(hr == D3D_OK, "Got result %#x.\n", hr); + string = NULL; + hr = effect->lpVtbl->GetString(effect, "s", &string); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + hr = effect->lpVtbl->GetString(effect, "s", &string2); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + + ok(string != expected_string, "String pointers are the same.\n"); + ok(string == string2, "String pointers differ.\n"); + todo_wine + ok(!strcmp(string, expected_string), "Unexpected string '%s'.\n", string); + + string = expected_string2; + hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) - 1); + ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr); + hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + hr = effect->lpVtbl->SetValue(effect, "s", &string, sizeof(string) * 2); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + string = NULL; + hr = effect->lpVtbl->GetValue(effect, "s", &string, sizeof(string)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + + ok(string != expected_string2, "String pointers are the same.\n"); + todo_wine + ok(!strcmp(string, expected_string2), "Unexpected string '%s'.\n", string); + + hr = effect->lpVtbl->SetValue(effect, "s_2", expected_string_array, + sizeof(expected_string_array)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + hr = effect->lpVtbl->GetValue(effect, "s_2", string_array, + sizeof(string_array)); + ok(hr == D3D_OK, "Got result %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(expected_string_array); ++i) + { + todo_wine + ok(!strcmp(string_array[i], expected_string_array[i]), "Unexpected string '%s', i %u.\n", + string_array[i], i); + } effect->lpVtbl->Release(effect); }