From: Matteo Bruni mbruni@codeweavers.com
It wasn't actually a test, but rather a misplaced tool that could be used to compare .x file parsing between builtin and native d3dxof. --- dlls/d3dxof/tests/d3dxof.c | 165 ------------------------------------- 1 file changed, 165 deletions(-)
diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c index e798940e576..b7b1b1cc502 100644 --- a/dlls/d3dxof/tests/d3dxof.c +++ b/dlls/d3dxof/tests/d3dxof.c @@ -1048,170 +1048,6 @@ static void test_type_index_color(void) 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 - -static void process_data(LPDIRECTXFILEDATA lpDirectXFileData, int level) -{ - HRESULT hr; - char name[100]; - GUID clsid; - const GUID *clsid_type = NULL; - DWORD len = 100; - LPDIRECTXFILEOBJECT pChildObj; - int i; - int j = 0; - LPBYTE pData; - DWORD k, size; - - hr = IDirectXFileData_GetId(lpDirectXFileData, &clsid); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - hr = IDirectXFileData_GetName(lpDirectXFileData, name, &len); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - hr = IDirectXFileData_GetType(lpDirectXFileData, &clsid_type); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - hr = IDirectXFileData_GetData(lpDirectXFileData, NULL, &size, (void**)&pData); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - for (i = 0; i < level; i++) - printf(" "); - printf("Found object '%s' - %s - %s - %ld\n", - len ? name : "", wine_dbgstr_guid(&clsid), wine_dbgstr_guid(clsid_type), size); - - if (EXPAND_STRING && size == 4) - { - char * str = *(char**)pData; - printf("string %s\n", str); - } - else if (size) - { - for (k = 0; k < size; k++) - { - if (k && !(k%16)) - printf("\n"); - printf("%02x ", pData[k]); - } - printf("\n"); - } - - level++; - - while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(lpDirectXFileData, &pChildObj))) - { - LPDIRECTXFILEDATA p1; - LPDIRECTXFILEDATAREFERENCE p2; - LPDIRECTXFILEBINARY p3; - j++; - - hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileData, (void **) &p1); - if (SUCCEEDED(hr)) - { - for (i = 0; i < level; i++) - printf(" "); - printf("Found Data (%d)\n", j); - process_data(p1, level); - IDirectXFileData_Release(p1); - } - hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileDataReference, (void **) &p2); - if (SUCCEEDED(hr)) - { - LPDIRECTXFILEDATA pfdo; - for (i = 0; i < level; i++) - printf(" "); - printf("Found Data Reference (%d)\n", j); -if (0) -{ - hr = IDirectXFileDataReference_GetId(lpDirectXFileData, &clsid); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - hr = IDirectXFileDataReference_GetName(lpDirectXFileData, name, &len); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); -} - IDirectXFileDataReference_Resolve(p2, &pfdo); - process_data(pfdo, level); - IDirectXFileData_Release(pfdo); - IDirectXFileDataReference_Release(p2); - } - hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileBinary, (void **) &p3); - if (SUCCEEDED(hr)) - { - for (i = 0; i < level; i++) - printf(" "); - printf("Found Binary (%d)\n", j); - IDirectXFileBinary_Release(p3); - } - IDirectXFileObject_Release(pChildObj); - } - - ok(hr == DXFILE_OK || hr == DXFILEERR_NOMOREOBJECTS, "Unexpected hr %#lx.\n", hr); -} - -/* Dump an X file 'objects.x' and its related templates file 'templates.x' if they are both presents - * Useful for debug by comparing outputs from native and builtin dlls */ -static void test_dump(void) -{ - HRESULT hr; - ULONG ref; - LPDIRECTXFILE lpDirectXFile = NULL; - LPDIRECTXFILEENUMOBJECT lpDirectXFileEnumObject = NULL; - LPDIRECTXFILEDATA lpDirectXFileData = NULL; - HANDLE hFile; - LPVOID pvData = NULL; - DWORD cbSize; - - if (!pDirectXFileCreate) - { - win_skip("DirectXFileCreate is not available\n"); - return; - } - - /* Dump data only if there is an object and a template */ - hFile = CreateFileA("objects.x", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - if (hFile == INVALID_HANDLE_VALUE) - return; - CloseHandle(hFile); - - hFile = CreateFileA("templates.x", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - if (hFile == INVALID_HANDLE_VALUE) - return; - - pvData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 10000); - - if (!ReadFile(hFile, pvData, 10000, &cbSize, NULL)) - { - skip("Templates file is too big\n"); - goto exit; - } - - printf("Load templates file (%ld bytes)\n", cbSize); - - hr = pDirectXFileCreate(&lpDirectXFile); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - - hr = IDirectXFile_RegisterTemplates(lpDirectXFile, pvData, cbSize); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - - hr = IDirectXFile_CreateEnumObject(lpDirectXFile, (LPVOID)"objects.x", DXFILELOAD_FROMFILE, &lpDirectXFileEnumObject); - ok(hr == DXFILE_OK, "Unexpected hr %#lx.\n", hr); - - while (SUCCEEDED(hr = IDirectXFileEnumObject_GetNextDataObject(lpDirectXFileEnumObject, &lpDirectXFileData))) - { - printf("\n"); - process_data(lpDirectXFileData, 0); - IDirectXFileData_Release(lpDirectXFileData); - } - ok(hr == DXFILE_OK || hr == DXFILEERR_NOMOREOBJECTS, "Unexpected hr %#lx.\n", hr); - - ref = IDirectXFile_Release(lpDirectXFileEnumObject); - ok(!ref, "Unexpected refcount %lu.\n", ref); - - ref = IDirectXFile_Release(lpDirectXFile); - ok(!ref, "Unexpected refcount %lu.\n", ref); - -exit: - HeapFree(GetProcessHeap(), 0, pvData); - CloseHandle(hFile); -} - START_TEST(d3dxof) { init_function_pointers(); @@ -1227,7 +1063,6 @@ START_TEST(d3dxof) test_complex_object(); test_standard_templates(); test_type_index_color(); - test_dump();
FreeLibrary(hd3dxof); }