Christian Costa : d3dxof: Add some template tests.

Alexandre Julliard julliard at winehq.org
Mon Apr 29 13:55:24 CDT 2013


Module: wine
Branch: master
Commit: 692783a9340d5c3f75e42b127319b50a4ca751e3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=692783a9340d5c3f75e42b127319b50a4ca751e3

Author: Christian Costa <titan.costa at gmail.com>
Date:   Sun Apr 28 22:45:51 2013 +0200

d3dxof: Add some template tests.

---

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

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-cvs mailing list