Christian Costa : d3dxof: Fix tzip and bzip files tests on all windows platform.

Alexandre Julliard julliard at winehq.org
Mon Mar 15 12:19:29 CDT 2010


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

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Mon Mar  8 08:55:52 2010 +0100

d3dxof: Fix tzip and bzip files tests on all windows platform.

---

 dlls/d3dxof/tests/d3dxof.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c
index 1198229..b630ae4 100644
--- a/dlls/d3dxof/tests/d3dxof.c
+++ b/dlls/d3dxof/tests/d3dxof.c
@@ -55,8 +55,15 @@ char object[] =
 
 char empty_txt_file[]  = "xof 0302txt 0064";
 char empty_bin_file[]  = "xof 0302bin 0064";
-char empty_tzip_file[] = "xof 0302tzip0064";
-char empty_bzip_file[] = "xof 0302bzip0064";
+/* MSZip data is generated with the command "MAKECAB.EXE /D Compress=ON /D CompressionType=MSZip file packed"
+ * Data in cab is after the filename (null terminated) and the 32-bit checksum:
+ * size (16-bit), packed_size (16-bit) and compressed data (with leading 16-bit CK signature)
+ * Data in x files is preceding by 2 16-bit words: size with xof header (16 bytes) and a 0 value
+ * It does not seem possible to generate a MSZip data with no byte, so put just 1 byte here */
+/* "\n" packed with MSZip => not text */
+char empty_tzip_file[] = "xof 0302tzip0064\x11\x00\x00\x00\x01\x00\x05\x00\x43\x4b\xe3\x02\x00";
+/* "\n" packed with MSZip => not token (token are 16-bit and there is only 1 byte) */
+char empty_bzip_file[] = "xof 0302bzip0064\x11\x00\x00\x00\x01\x00\x05\x00\x43\x4b\xe3\x02\x00";
 char empty_cmp_file[]  = "xof 0302cmp 0064";
 char empty_xxxx_file[] = "xof 0302xxxx0064";
 
@@ -224,11 +231,11 @@ static void test_file_types(void)
     hr = IDirectXFile_RegisterTemplates(dxfile, empty_bin_file, strlen(empty_bin_file));
     ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
 
-    hr = IDirectXFile_RegisterTemplates(dxfile, empty_tzip_file, strlen(empty_tzip_file));
-    ok(hr == DXFILEERR_BADALLOC, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
+    hr = IDirectXFile_RegisterTemplates(dxfile, empty_tzip_file, sizeof(empty_tzip_file) - 1);
+    todo_wine ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
 
-    hr = IDirectXFile_RegisterTemplates(dxfile, empty_bzip_file, strlen(empty_bzip_file));
-    ok(hr == DXFILEERR_BADALLOC, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
+    hr = IDirectXFile_RegisterTemplates(dxfile, empty_bzip_file, sizeof(empty_bzip_file) - 1);
+    todo_wine ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
 
     hr = IDirectXFile_RegisterTemplates(dxfile, empty_cmp_file, strlen(empty_cmp_file));
     ok(hr == DXFILEERR_BADFILETYPE, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
@@ -249,14 +256,16 @@ static void test_file_types(void)
     if (hr == DXFILE_OK) IDirectXFileEnumObject_Release(enum_object);
 
     lminfo.lpMemory = empty_tzip_file;
-    lminfo.dSize = strlen(empty_tzip_file);
+    lminfo.dSize = sizeof(empty_tzip_file) - 1;
     hr = IDirectXFile_CreateEnumObject(dxfile, &lminfo, DXFILELOAD_FROMMEMORY, &enum_object);
-    ok(hr == DXFILEERR_BADALLOC, "IDirectXFile_CreateEnumObject: %x\n", hr);
+    todo_wine ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr);
+    if (hr == DXFILE_OK) IDirectXFileEnumObject_Release(enum_object);
 
     lminfo.lpMemory = empty_bzip_file;
-    lminfo.dSize = strlen(empty_bzip_file);
+    lminfo.dSize = sizeof(empty_bzip_file) - 1;
     hr = IDirectXFile_CreateEnumObject(dxfile, &lminfo, DXFILELOAD_FROMMEMORY, &enum_object);
-    ok(hr == DXFILEERR_BADALLOC, "IDirectXFile_CreateEnumObject: %x\n", hr);
+    todo_wine ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr);
+    if (hr == DXFILE_OK) IDirectXFileEnumObject_Release(enum_object);
 
     lminfo.lpMemory = empty_cmp_file;
     lminfo.dSize = strlen(empty_cmp_file);




More information about the wine-cvs mailing list