[PATCH 4/4] d3dxof: Add test for case sensitive 'indexColor' type.
Christian Costa
titan.costa at gmail.com
Mon Jun 10 02:19:45 CDT 2013
Revealed by bug 30897.
---
dlls/d3dx9_36/tests/xfile.c | 35 ++++++++++++++++++++++++++++++++
dlls/d3dxof/tests/d3dxof.c | 47 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/dlls/d3dx9_36/tests/xfile.c b/dlls/d3dx9_36/tests/xfile.c
index 4ac521b..c47cffb 100644
--- a/dlls/d3dx9_36/tests/xfile.c
+++ b/dlls/d3dx9_36/tests/xfile.c
@@ -62,6 +62,24 @@ static char object_noname[] =
"1; 2; 3;\n"
"}\n";
+static char template_using_index_color_lower[] =
+"xof 0302txt 0064\n"
+"template MeshVertexColors\n"
+"{\n"
+"<1630B821-7842-11cf-8F52-0040333594A3>\n"
+"DWORD nVertexColors;\n"
+"array indexColor vertexColors[nVertexColors];\n"
+"}\n";
+
+static char template_using_index_color_upper[] =
+"xof 0302txt 0064\n"
+"template MeshVertexColors\n"
+"{\n"
+"<1630B821-7842-11cf-8F52-0040333594A3>\n"
+"DWORD nVertexColors;\n"
+"array IndexColor vertexColors[nVertexColors];\n"
+"}\n";
+
static void test_templates(void)
{
ID3DXFile *d3dxfile;
@@ -207,7 +225,23 @@ static void test_getname(void)
data_object->lpVtbl->Release(data_object);
enum_object->lpVtbl->Release(enum_object);
d3dxfile->lpVtbl->Release(d3dxfile);
+}
+static void test_type_index_color(void)
+{
+ ID3DXFile *d3dxfile;
+ HRESULT ret;
+
+ ret = D3DXFileCreate(&d3dxfile);
+ ok(ret == S_OK, "D3DXCreateFile failed with %#x\n", ret);
+
+ /* Test that 'indexColor' can be used (same as IndexedColor in standard templates) and is case sensitive */
+ ret = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, template_using_index_color_lower, sizeof(template_using_index_color_lower) - 1);
+ todo_wine ok(ret == S_OK, "RegisterTemplates failed with %#x\n", ret);
+ ret = d3dxfile->lpVtbl->RegisterTemplates(d3dxfile, template_using_index_color_upper, sizeof(template_using_index_color_upper) - 1);
+ ok(ret == D3DXFERR_PARSEERROR, "RegisterTemplates returned %#x instead of %#x\n", ret, D3DXFERR_PARSEERROR);
+
+ d3dxfile->lpVtbl->Release(d3dxfile);
}
static inline void debugstr_guid(char* buf, const GUID *id)
@@ -361,5 +395,6 @@ START_TEST(xfile)
test_templates();
test_lock_unlock();
test_getname();
+ test_type_index_color();
test_dump();
}
diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c
index ede23f8..d0f110d 100644
--- a/dlls/d3dxof/tests/d3dxof.c
+++ b/dlls/d3dxof/tests/d3dxof.c
@@ -376,6 +376,24 @@ static char object_complex[] =
"3;;;, 3;;;, 1;;;, 2;;;,\n"
"}\n";
+static char template_using_index_color_lower[] =
+"xof 0302txt 0064\n"
+"template MeshVertexColors\n"
+"{\n"
+"<1630B821-7842-11cf-8F52-0040333594A3>\n"
+"DWORD nVertexColors;\n"
+"array indexColor vertexColors[nVertexColors];\n"
+"}\n";
+
+static char template_using_index_color_upper[] =
+"xof 0302txt 0064\n"
+"template MeshVertexColors\n"
+"{\n"
+"<1630B821-7842-11cf-8F52-0040333594A3>\n"
+"DWORD nVertexColors;\n"
+"array IndexColor vertexColors[nVertexColors];\n"
+"}\n";
+
static void init_function_pointers(void)
{
/* We have to use LoadLibrary as no d3dxof functions are referenced directly */
@@ -1064,6 +1082,34 @@ static void test_standard_templates(void)
IDirectXFile_Release(dxfile);
}
+static void test_type_index_color(void)
+{
+ HRESULT ret;
+ IDirectXFile *dxfile = NULL;
+
+ if (!pDirectXFileCreate)
+ {
+ win_skip("DirectXFileCreate is not available\n");
+ return;
+ }
+
+ ret = pDirectXFileCreate(&dxfile);
+ ok(ret == DXFILE_OK, "DirectXFileCreate failed with %#x\n", ret);
+ if (!dxfile)
+ {
+ skip("Couldn't create DirectXFile interface\n");
+ return;
+ }
+
+ /* Test that 'indexColor' can be used (same as IndexedColor in standard templates) and is case sensitive */
+ ret = IDirectXFile_RegisterTemplates(dxfile, template_using_index_color_lower, sizeof(template_using_index_color_lower) - 1);
+ todo_wine ok(ret == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates failed with %#x\n", ret);
+ ret = IDirectXFile_RegisterTemplates(dxfile, template_using_index_color_upper, sizeof(template_using_index_color_upper) - 1);
+ ok(ret == DXFILEERR_PARSEERROR, "IDirectXFileImpl_RegisterTemplates returned %#x instead of %#x\n", ret, DXFILEERR_PARSEERROR);
+
+ IDirectXFile_Release(dxfile);
+}
+
/* Set it to 1 to expand the string when dumping the object. This is useful when there is
* only one string in a sub-object (very common). Use with care, this may lead to a crash. */
#define EXPAND_STRING 0
@@ -1250,6 +1296,7 @@ START_TEST(d3dxof)
test_syntax_semicolon_comma();
test_complex_object();
test_standard_templates();
+ test_type_index_color();
test_dump();
FreeLibrary(hd3dxof);
More information about the wine-patches
mailing list