Commit 66414c46 authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

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

parent 71986eb1
...@@ -62,6 +62,24 @@ static char object_noname[] = ...@@ -62,6 +62,24 @@ static char object_noname[] =
"1; 2; 3;\n" "1; 2; 3;\n"
"}\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) static void test_templates(void)
{ {
ID3DXFile *d3dxfile; ID3DXFile *d3dxfile;
...@@ -207,7 +225,23 @@ static void test_getname(void) ...@@ -207,7 +225,23 @@ static void test_getname(void)
data_object->lpVtbl->Release(data_object); data_object->lpVtbl->Release(data_object);
enum_object->lpVtbl->Release(enum_object); enum_object->lpVtbl->Release(enum_object);
d3dxfile->lpVtbl->Release(d3dxfile); 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) static inline void debugstr_guid(char* buf, const GUID *id)
...@@ -361,5 +395,6 @@ START_TEST(xfile) ...@@ -361,5 +395,6 @@ START_TEST(xfile)
test_templates(); test_templates();
test_lock_unlock(); test_lock_unlock();
test_getname(); test_getname();
test_type_index_color();
test_dump(); test_dump();
} }
...@@ -376,6 +376,24 @@ static char object_complex[] = ...@@ -376,6 +376,24 @@ static char object_complex[] =
"3;;;, 3;;;, 1;;;, 2;;;,\n" "3;;;, 3;;;, 1;;;, 2;;;,\n"
"}\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) static void init_function_pointers(void)
{ {
/* We have to use LoadLibrary as no d3dxof functions are referenced directly */ /* We have to use LoadLibrary as no d3dxof functions are referenced directly */
...@@ -1064,6 +1082,34 @@ static void test_standard_templates(void) ...@@ -1064,6 +1082,34 @@ static void test_standard_templates(void)
IDirectXFile_Release(dxfile); 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 /* 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. */ * only one string in a sub-object (very common). Use with care, this may lead to a crash. */
#define EXPAND_STRING 0 #define EXPAND_STRING 0
...@@ -1250,6 +1296,7 @@ START_TEST(d3dxof) ...@@ -1250,6 +1296,7 @@ START_TEST(d3dxof)
test_syntax_semicolon_comma(); test_syntax_semicolon_comma();
test_complex_object(); test_complex_object();
test_standard_templates(); test_standard_templates();
test_type_index_color();
test_dump(); test_dump();
FreeLibrary(hd3dxof); FreeLibrary(hd3dxof);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment