[PATCH 1/4] d3dxof: Add some template tests.

Christian Costa titan.costa at gmail.com
Sun Apr 28 15:45:51 CDT 2013


---
 dlls/d3dxof/tests/d3dxof.c |   54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c
index e25b4ab..43a7fde 100644
--- a/dlls/d3dxof/tests/d3dxof.c
+++ b/dlls/d3dxof/tests/d3dxof.c
@@ -140,6 +140,22 @@ static char object_syntax_string_with_separator[] =
 "\"foo;bar\";\n"
 "}\n";
 
+static char templates_bad_file_type1[] =
+"xOf 0302txt 0064\n";
+
+static char templates_bad_file_version[] =
+"xof 0102txt 0064\n";
+
+static char templates_bad_file_type2[] =
+"xof 0302foo 0064\n";
+
+static char templates_bad_file_float_size[] =
+"xof 0302txt 0050\n";
+
+static char templates_parse_error[] =
+"xof 0302txt 0064"
+"foobar;\n";
+
 static void init_function_pointers(void)
 {
     /* We have to use LoadLibrary as no d3dxof functions are referenced directly */
@@ -379,6 +395,43 @@ static void test_file_types(void)
     IDirectXFile_Release(dxfile);
 }
 
+static void test_templates(void)
+{
+    HRESULT ret;
+    IDirectXFile *dxfile = NULL;
+
+    if (!pDirectXFileCreate)
+    {
+        win_skip("DirectXFileCreate is not available\n");
+        return;
+    }
+
+    ret = pDirectXFileCreate(&dxfile);
+    ok(ret == DXFILE_OK, "DirectXFileCreate: %x\n", ret);
+    if (!dxfile)
+    {
+        skip("Couldn't create DirectXFile interface\n");
+        return;
+    }
+
+    ret = IDirectXFile_RegisterTemplates(dxfile, templates_bad_file_type1, sizeof(templates_bad_file_type1) - 1);
+    ok(ret == DXFILEERR_BADFILETYPE, "RegisterTemplates returned %#x, expected %#x\n", ret, DXFILEERR_BADFILETYPE);
+
+    ret = IDirectXFile_RegisterTemplates(dxfile, templates_bad_file_version, sizeof(templates_bad_file_version) - 1);
+    ok(ret == DXFILEERR_BADFILEVERSION, "RegisterTemplates returned %#x, expected %#x\n", ret, DXFILEERR_BADFILEVERSION);
+
+    ret = IDirectXFile_RegisterTemplates(dxfile, templates_bad_file_type2, sizeof(templates_bad_file_type2) - 1);
+    ok(ret == DXFILEERR_BADFILETYPE, "RegisterTemplates returned %#x, expected %#x\n", ret, DXFILEERR_BADFILETYPE);
+
+    ret = IDirectXFile_RegisterTemplates(dxfile, templates_bad_file_float_size, sizeof(templates_bad_file_float_size) - 1);
+    ok(ret == DXFILEERR_BADFILEFLOATSIZE, "RegisterTemplates returned %#x, expected %#x\n", ret, DXFILEERR_BADFILEFLOATSIZE);
+
+    ret = IDirectXFile_RegisterTemplates(dxfile, templates_parse_error, sizeof(templates_parse_error) - 1);
+    todo_wine ok(ret == DXFILEERR_PARSEERROR, "RegisterTemplates returned %#x, expected %#x\n", ret, DXFILEERR_PARSEERROR);
+
+    IDirectXFile_Release(dxfile);
+}
+
 static void test_compressed_files(void)
 {
     HRESULT hr;
@@ -788,6 +841,7 @@ START_TEST(d3dxof)
     test_refcount();
     test_CreateEnumObject();
     test_file_types();
+    test_templates();
     test_compressed_files();
     test_getname();
     test_syntax();




More information about the wine-patches mailing list