Ziqing Hui : d2d1/tests: Test effect property if register effect multiple times with different xml.
Alexandre Julliard
julliard at winehq.org
Fri May 27 16:35:29 CDT 2022
Module: wine
Branch: master
Commit: a95433d685b9f228948e6d1fa28bdb4879c007be
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a95433d685b9f228948e6d1fa28bdb4879c007be
Author: Ziqing Hui <zhui at codeweavers.com>
Date: Thu May 26 16:40:52 2022 +0800
d2d1/tests: Test effect property if register effect multiple times with different xml.
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 | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c
index d5adb0c749c..29d3780a6e7 100644
--- a/dlls/d2d1/tests/d2d1.c
+++ b/dlls/d2d1/tests/d2d1.c
@@ -37,7 +37,7 @@ DEFINE_GUID(GUID_TestPixelShader, 0x53015748,0xfc13,0x4168,0xbd,0x13,0x0f,0xcf,
static const WCHAR *effect_xml_a =
L"<?xml version='1.0'?> \
<Effect> \
- <Property name='DisplayName' type='string' value='TestEffect'/> \
+ <Property name='DisplayName' type='string' value='TestEffectA'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
@@ -56,7 +56,7 @@ L"<?xml version='1.0'?> \
static const WCHAR *effect_xml_b =
L"<?xml version='1.0'?> \
<Effect> \
- <Property name='DisplayName' type='string' value='TestEffect'/> \
+ <Property name='DisplayName' type='string' value='TestEffectB'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
@@ -72,7 +72,7 @@ L"<?xml version='1.0'?> \
static const WCHAR *effect_xml_c =
L"<?xml version='1.0'?> \
<Effect> \
- <Property name='DisplayName' type='string' value='TestEffect'/> \
+ <Property name='DisplayName' type='string' value='TestEffectC'/> \
<Property name='Author' type='string' value='The Wine Project'/> \
<Property name='Category' type='string' value='Test'/> \
<Property name='Description' type='string' value='Test effect.'/> \
@@ -10488,8 +10488,11 @@ static HRESULT STDMETHODCALLTYPE effect_impl_get_context(const IUnknown *iface,
static void test_effect_register(BOOL d3d11)
{
+ ID2D1DeviceContext *device_context;
struct d2d1_test_context ctx;
ID2D1Factory1 *factory;
+ WCHAR display_name[64];
+ ID2D1Effect *effect;
unsigned int i;
HRESULT hr;
@@ -10529,6 +10532,7 @@ static void test_effect_register(BOOL d3d11)
if (!init_test_context(&ctx, d3d11))
return;
+ device_context = ctx.context;
factory = ctx.factory1;
if (!factory)
{
@@ -10564,9 +10568,31 @@ static void test_effect_register(BOOL d3d11)
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
effect_xml_a, NULL, 0, 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)
+ {
+ hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
+ D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
+ ID2D1Effect_Release(effect);
+ }
+
hr = ID2D1Factory1_RegisterEffectFromString(factory, &CLSID_TestEffect,
effect_xml_b, NULL, 0, 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)
+ {
+ hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME,
+ D2D1_PROPERTY_TYPE_STRING, (BYTE *)display_name, sizeof(display_name));
+ ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ ok(!wcscmp(display_name, L"TestEffectA"), "Got unexpected display name %s.\n", debugstr_w(display_name));
+ 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);
More information about the wine-cvs
mailing list