=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: d3d11/tests: Add test for ID3D11Device: :GetImmediateContext().

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 9 09:55:21 CDT 2015


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Fri Oct  9 03:19:14 2015 +0200

d3d11/tests: Add test for ID3D11Device::GetImmediateContext().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d11/tests/d3d11.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index bcd370d..2fb1381 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -292,6 +292,43 @@ static void test_device_interfaces(void)
     }
 }
 
+static void test_get_immediate_context(void)
+{
+    ID3D11DeviceContext *immediate_context, *previous_immediate_context;
+    ULONG expected_refcount, refcount;
+    ID3D11Device *device;
+
+    if (!(device = create_device(NULL)))
+    {
+        skip("Failed to create device.\n");
+        return;
+    }
+
+    expected_refcount = get_refcount((IUnknown *)device) + 1;
+    ID3D11Device_GetImmediateContext(device, &immediate_context);
+    refcount = get_refcount((IUnknown *)device);
+    ok(refcount == expected_refcount, "Got unexpected refcount %u.\n", refcount);
+    previous_immediate_context = immediate_context;
+
+    ID3D11Device_GetImmediateContext(device, &immediate_context);
+    ok(immediate_context == previous_immediate_context, "Got different immediate device context objects.\n");
+    refcount = get_refcount((IUnknown *)device);
+    ok(refcount == expected_refcount, "Got unexpected refcount %u.\n", refcount);
+
+    refcount = ID3D11DeviceContext_Release(previous_immediate_context);
+    ok(refcount == 1, "Got unexpected refcount %u.\n", refcount);
+    refcount = ID3D11DeviceContext_Release(immediate_context);
+    ok(!refcount, "Got unexpected refcount %u.\n", refcount);
+
+    ID3D11Device_GetImmediateContext(device, &immediate_context);
+    ok(immediate_context == previous_immediate_context, "Got different immediate device context objects.\n");
+    refcount = ID3D11DeviceContext_Release(immediate_context);
+    ok(!refcount, "Got unexpected refcount %u.\n", refcount);
+
+    refcount = ID3D11Device_Release(device);
+    ok(!refcount, "Device has %u references left.\n", refcount);
+}
+
 static void test_create_texture2d(void)
 {
     ULONG refcount, expected_refcount;
@@ -2125,6 +2162,7 @@ START_TEST(d3d11)
 {
     test_create_device();
     test_device_interfaces();
+    test_get_immediate_context();
     test_create_texture2d();
     test_texture2d_interfaces();
     test_create_texture3d();




More information about the wine-cvs mailing list