Ziqing Hui : d2d1/tests: Test registering effect multiple times with different binding.
Alexandre Julliard
julliard at winehq.org
Fri May 27 16:35:29 CDT 2022
Module: wine
Branch: master
Commit: 3b4e112c17a461bdf9119b4ad6d68d0d60ba1f9c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3b4e112c17a461bdf9119b4ad6d68d0d60ba1f9c
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Thu May 26 16:40:53 2022 +0800
d2d1/tests: Test registering effect multiple times with different binding.
Signed-off-by: Ziqing Hui <zhui at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d2d1/tests/d2d1.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 49 insertions(+), 2 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index 29d3780a6e7..940205989bb 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -10437,7 +10437,7 @@ static HRESULT STDMETHODCALLTYPE effect_impl_create(IUnknown **effect_impl)
object->ID2D1EffectImpl_iface.lpVtbl = &effect_impl_vtbl;
object->refcount = 1;
- object->integer = 0;
+ object->integer = 10;
object->effect_context = NULL;
*effect_impl = (IUnknown *)&object->ID2D1EffectImpl_iface;
@@ -10489,11 +10489,12 @@ static HRESULT STDMETHODCALLTYPE effect_impl_get_context(const IUnknown *iface,
static void test_effect_register(BOOL d3d11)
{
ID2D1DeviceContext *device_context;
+ ID2D1EffectContext *effect_context;
struct d2d1_test_context ctx;
+ unsigned int i, integer;
ID2D1Factory1 *factory;
WCHAR display_name[64];
ID2D1Effect *effect;
- unsigned int i;
HRESULT hr;
const D2D1_PROPERTY_BINDING binding[] =
@@ -10613,6 +10614,52 @@ static void test_effect_register(BOOL d3d11)
winetest_pop_context();
}
+ /* Register effect multiple times with different binding */
+ hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
+ effect_xml_c, binding, 1, effect_impl_create);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ if (hr == S_OK)
+ {
+ integer = 0xdeadbeef;
+ effect_context = (ID2D1EffectContext *)0xdeadbeef;
+ hr = ID2D1Effect_GetValueByName(effect, L"Integer",
+ D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1Effect_GetValueByName(effect, L"Context",
+ D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(integer == 10, "Got unexpected integer %u.\n", integer);
+ ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
+ ID2D1Effect_Release(effect);
+ }
+
+ hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
+ effect_xml_c, binding + 1, 1, effect_impl_create);
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1DeviceContext_CreateEffect(device_context, &CLSID_TestEffect, &effect);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ if (hr == S_OK)
+ {
+ integer = 0xdeadbeef;
+ effect_context = (ID2D1EffectContext *)0xdeadbeef;
+ hr = ID2D1Effect_GetValueByName(effect, L"Integer",
+ D2D1_PROPERTY_TYPE_UINT32, (BYTE *)&integer, sizeof(integer));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1Effect_GetValueByName(effect, L"Context",
+ D2D1_PROPERTY_TYPE_IUNKNOWN, (BYTE *)&effect_context, sizeof(effect_context));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(integer == 10, "Got unexpected integer %u.\n", integer);
+ ok(effect_context == NULL, "Got unexpected effect context %p.\n", effect_context);
+ ID2D1Effect_Release(effect);
+ }
+
+ hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_TestEffect);
+ todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+
/* Unregister builtin effect */
hr = ID2D1Factory1_UnregisterEffect(factory, &CLSID_D2D1Composite);
todo_wine ok(hr == D2DERR_EFFECT_IS_NOT_REGISTERED, "Got unexpected hr %#lx.\n", hr);
More information about the wine-cvs
mailing list