=?UTF-8?Q?Rico=20Sch=C3=BCller=20?=: d3dx9/tests: Add tests for ID3DXConstantTable::GetConstant/ByName/Element().
Alexandre Julliard
julliard at winehq.org
Mon Aug 27 14:35:03 CDT 2012
Module: wine
Branch: master
Commit: 68508ed5810c4f1509b24e6d1a02e84617233ecc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=68508ed5810c4f1509b24e6d1a02e84617233ecc
Author: Rico Schüller <kgbricola at web.de>
Date: Sat Aug 25 16:28:44 2012 +0200
d3dx9/tests: Add tests for ID3DXConstantTable::GetConstant/ByName/Element().
---
dlls/d3dx9_36/tests/shader.c | 71 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/dlls/d3dx9_36/tests/shader.c b/dlls/d3dx9_36/tests/shader.c
index e2496a7..9ae77b3 100644
--- a/dlls/d3dx9_36/tests/shader.c
+++ b/dlls/d3dx9_36/tests/shader.c
@@ -1731,7 +1731,7 @@ static void test_get_shader_constant_variables(void)
ULONG count;
UINT i;
UINT nr = 1;
- D3DXHANDLE constant;
+ D3DXHANDLE constant, element;
D3DXCONSTANT_DESC desc;
DWORD *ctab;
@@ -1779,6 +1779,75 @@ static void test_get_shader_constant_variables(void)
fullname, (UINT)((DWORD *)desc.DefaultValue - ctab), ctaboffset);
}
+ element = ID3DXConstantTable_GetConstantElement(ctable, NULL, 0);
+ ok(element == NULL, "GetConstantElement failed\n");
+
+ constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i");
+ ok(constant != NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "i[0]");
+ ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantElement(ctable, "i", 0);
+ ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
+
+ constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f");
+ ok(constant != NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstant(ctable, NULL, 0);
+ ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstant(ctable, "invalid", 0);
+ ok(element == NULL, "GetConstant failed\n");
+
+ element = ID3DXConstantTable_GetConstant(ctable, "f", 0);
+ ok(element == NULL, "GetConstant failed\n");
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0]");
+ ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[1]");
+ ok(NULL == element, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f[0][0]");
+ ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f.");
+ ok(element == NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstantElement(ctable, "f", 0);
+ ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantElement(ctable, "f", 1);
+ ok(element == NULL, "GetConstantElement failed\n");
+
+ constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[0]");
+ ok(constant != NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2");
+ ok(element != constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 0);
+ ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
+
+ constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "f_2[1]");
+ ok(constant != NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstantElement(ctable, "f_2", 1);
+ ok(element == constant, "GetConstantElement failed, got %p, expected %p\n", element, constant);
+
+ constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0].f");
+ ok(constant != NULL, "GetConstantByName failed\n");
+
+ element = ID3DXConstantTable_GetConstant(ctable, "s_2[0]", 0);
+ ok(element == constant, "GetConstant failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "f");
+ ok(element == constant, "GetConstantByName failed, got %p, expected %p\n", element, constant);
+
+ element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "invalid");
+ ok(element == NULL, "GetConstantByName failed\n");
+
count = ID3DXConstantTable_Release(ctable);
ok(count == 0, "Release failed, got %u, expected %u\n", count, 0);
}
More information about the wine-cvs
mailing list