Signed-off-by: Ziqing Hui zhui@codeweavers.com ---
v2: Add case tests and min/max inputs tests.
dlls/d2d1/tests/d2d1.c | 120 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 112 insertions(+), 8 deletions(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index bc662b4f8ae..970706bc569 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -99,6 +99,17 @@ L"<?xml version='1.0'?> \ </Effect> \ ";
+static const WCHAR *effect_xml_inputs_attribute = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs min='1' max='10' deadbeef='abcdef'/> \ + </Effect> \ +"; + static const WCHAR *effect_xml_without_version = L"<Effect> \ <Property name='DisplayName' type='string'/> \ @@ -170,6 +181,90 @@ L"<?xml version='1.0'?> \ </Effect> \ ";
+static const WCHAR *effect_xml_wrong_type = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string' value='TestEffect'/> \ + <Property name='Author' type='uint32' value='32'/> \ + <Property name='Category' type='string' value='Test'/> \ + <Property name='Description' type='string' value='Test effect.'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_duplicate_property = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_lower_case_effect = +L"<?xml version='1.0'?> \ + <effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs/> \ + </effect> \ +"; + +static const WCHAR *effect_xml_lower_case_property = +L"<?xml version='1.0'?> \ + <Effect> \ + <property name='DisplayName' type='string'/> \ + <property name='Author' type='string'/> \ + <property name='Category' type='string'/> \ + <property name='Description' type='string'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_lower_case_inputs = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_min_max_inputs_a = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Property name='MinInputs' type='uint32' value='1'/> \ + <Property name='MaxInputs' type='uint32' value='2'/> \ + <Inputs/> \ + </Effect> \ +"; + +static const WCHAR *effect_xml_min_max_inputs_b = +L"<?xml version='1.0'?> \ + <Effect> \ + <Property name='DisplayName' type='string'/> \ + <Property name='Author' type='string'/> \ + <Property name='Category' type='string'/> \ + <Property name='Description' type='string'/> \ + <Inputs> \ + <Property name='Min' type='uint32' value='1'/> \ + <Property name='Max' type='uint32' value='2'/> \ + </Inputs> \ + </Effect> \ +"; + + static const DWORD test_vs[] = { #if 0 @@ -10604,10 +10699,11 @@ static void test_effect_register(BOOL d3d11) } xml_tests[] = { - {effect_xml_a, S_OK}, - {effect_xml_b, S_OK}, - {effect_xml_c, S_OK}, - {effect_xml_minimum, S_OK}, + {effect_xml_a, S_OK}, + {effect_xml_b, S_OK}, + {effect_xml_c, S_OK}, + {effect_xml_minimum, S_OK}, + {effect_xml_inputs_attribute, S_OK}, {effect_xml_without_version, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, {effect_xml_without_inputs, E_INVALIDARG}, {effect_xml_without_name, E_INVALIDARG}, @@ -10615,6 +10711,13 @@ static void test_effect_register(BOOL d3d11) {effect_xml_without_category, E_INVALIDARG}, {effect_xml_without_description, E_INVALIDARG}, {effect_xml_without_type, E_INVALIDARG}, + {effect_xml_wrong_type, E_INVALIDARG}, + {effect_xml_duplicate_property, E_INVALIDARG}, + {effect_xml_lower_case_effect, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, + {effect_xml_lower_case_property, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, + {effect_xml_lower_case_inputs, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, + {effect_xml_min_max_inputs_a, E_INVALIDARG}, + {effect_xml_min_max_inputs_b, HRESULT_FROM_WIN32(ERROR_NOT_FOUND)}, };
const D2D1_PROPERTY_BINDING binding[] = @@ -10926,10 +11029,11 @@ static void test_effect_properties(BOOL d3d11) } system_property_tests[] = { - {effect_xml_a, L"TestEffectA", effect_author, effect_category, effect_description, 1, 1}, - {effect_xml_b, L"TestEffectB", effect_author, effect_category, effect_description, 1, 1}, - {effect_xml_c, L"TestEffectC", effect_author, effect_category, effect_description, 1, 1}, - {effect_xml_minimum, L"", L"" ,L"", L"", 0, 0}, + {effect_xml_a, L"TestEffectA", effect_author, effect_category, effect_description, 1, 1}, + {effect_xml_b, L"TestEffectB", effect_author, effect_category, effect_description, 1, 1}, + {effect_xml_c, L"TestEffectC", effect_author, effect_category, effect_description, 1, 1}, + {effect_xml_minimum, L"", L"" ,L"", L"", 0, 0}, + {effect_xml_inputs_attribute, L"", L"" ,L"", L"", 0, 0}, };
if (!init_test_context(&ctx, d3d11))