d3dxof/tests: Add test for case sensitive 'indexColor' type.

This commit is contained in:
Christian Costa 2013-06-11 22:09:07 +02:00 committed by Alexandre Julliard
parent 71986eb109
commit 66414c46c9
2 changed files with 82 additions and 0 deletions

View file

@ -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();
}

View file

@ -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);