Ziqing Hui : d3dx10/tests: Add tests for D3DX10CreateTextureFromResource{A, W}.

Alexandre Julliard julliard at winehq.org
Wed Oct 27 16:26:01 CDT 2021


Module: wine
Branch: master
Commit: 1a35f589c33b367f55af32eaa6e8b37eff8a4d8c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1a35f589c33b367f55af32eaa6e8b37eff8a4d8c

Author: Ziqing Hui <zhui at codeweavers.com>
Date:   Tue Oct 26 23:15:54 2021 +0200

d3dx10/tests: Add tests for D3DX10CreateTextureFromResource{A, W}.

Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dx10_43/tests/d3dx10.c | 49 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/dlls/d3dx10_43/tests/d3dx10.c b/dlls/d3dx10_43/tests/d3dx10.c
index 87c06f97780..13f70f34f96 100644
--- a/dlls/d3dx10_43/tests/d3dx10.c
+++ b/dlls/d3dx10_43/tests/d3dx10.c
@@ -1974,8 +1974,10 @@ static void test_get_image_info(void)
 
 static void test_create_texture(void)
 {
+    static const WCHAR test_resource_name[] = L"resource.data";
     static const WCHAR test_filename[] = L"image.data";
     ID3D10Resource *resource;
+    HMODULE resource_module;
     ID3D10Device *device;
     WCHAR path[MAX_PATH];
     unsigned int i;
@@ -2075,6 +2077,53 @@ static void test_create_texture(void)
         winetest_pop_context();
     }
 
+    /* D3DX10CreateTextureFromResource tests */
+
+    todo_wine
+    {
+    hr = D3DX10CreateTextureFromResourceW(device, NULL, NULL, NULL, NULL, &resource, NULL);
+    ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
+    hr = D3DX10CreateTextureFromResourceW(device, NULL, L"deadbeef", NULL, NULL, &resource, NULL);
+    ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
+    hr = D3DX10CreateTextureFromResourceA(device, NULL, NULL, NULL, NULL, &resource, NULL);
+    ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
+    hr = D3DX10CreateTextureFromResourceA(device, NULL, "deadbeef", NULL, NULL, &resource, NULL);
+    ok(hr == D3DX10_ERR_INVALID_DATA, "Got unexpected hr %#x.\n", hr);
+    }
+
+    for (i = 0; i < ARRAY_SIZE(test_image); ++i)
+    {
+        winetest_push_context("Test %u", i);
+        resource_module = create_resource_module(test_resource_name, test_image[i].data, test_image[i].size);
+
+        hr = D3DX10CreateTextureFromResourceW(device, resource_module,
+                test_resource_name, NULL, NULL, &resource, NULL);
+        todo_wine
+        ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP),
+                "Got unexpected hr %#x.\n", hr);
+        if (hr == S_OK)
+        {
+            check_resource_info(resource, test_image + i, __LINE__);
+            check_resource_data(resource, test_image + i, __LINE__);
+            ID3D10Resource_Release(resource);
+        }
+
+        hr = D3DX10CreateTextureFromResourceA(device, resource_module,
+                get_str_a(test_resource_name), NULL, NULL, &resource, NULL);
+        todo_wine
+        ok(hr == S_OK || broken(hr == E_FAIL && test_image[i].expected_info.ImageFileFormat == D3DX10_IFF_WMP),
+                "Got unexpected hr %#x.\n", hr);
+        if (hr == S_OK)
+        {
+            check_resource_info(resource, test_image + i, __LINE__);
+            check_resource_data(resource, test_image + i, __LINE__);
+            ID3D10Resource_Release(resource);
+        }
+
+        delete_resource_module(test_resource_name, resource_module);
+        winetest_pop_context();
+    }
+
     CoUninitialize();
 
     ID3D10Device_Release(device);




More information about the wine-cvs mailing list