[PATCH 0/1] MR8388: wintypes/tests: Add tests for IApiInformationStatics_IsApiContractPresentByMajorAndMinor.
Signed-off-by: chenjiangyi <chenjiangyi(a)uniontech.com> -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8388
From: chenjiangyi <chenjiangyi(a)uniontech.com> Signed-off-by: chenjiangyi <chenjiangyi(a)uniontech.com> --- dlls/wintypes/tests/wintypes.c | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/dlls/wintypes/tests/wintypes.c b/dlls/wintypes/tests/wintypes.c index 1ab3f4b9af8..a65482f6a01 100644 --- a/dlls/wintypes/tests/wintypes.c +++ b/dlls/wintypes/tests/wintypes.c @@ -691,6 +691,87 @@ static void test_IApiInformationStatics(void) WindowsDeleteString(str); + hr = WindowsCreateString(L"Windows.Networking.Connectivity.WwanContract", + wcslen(L"Windows.Networking.Connectivity.WwanContract"), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + if (0) /* Crash on Windows */ + { + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 1, 0, NULL); + ok(hr == E_INVALIDARG, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + } + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 2, 0, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE, "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 1, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE || broken(ret == FALSE) , "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = TRUE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 999, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == FALSE, "IsApiContractPresentByMajorAndMinor returned TRUE.\n"); + + WindowsDeleteString(str); + + hr = WindowsCreateString(L"Windows.Services.Store.StoreContract", + wcslen(L"Windows.Services.Store.StoreContract"), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + if (0) /* Crash on Windows */ + { + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 1, 0, NULL); + ok(hr == E_INVALIDARG, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + } + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 4, 0, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE, "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 3, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE || broken(ret == FALSE) , "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = TRUE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 999, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == FALSE, "IsApiContractPresentByMajorAndMinor returned TRUE.\n"); + + WindowsDeleteString(str); + + hr = WindowsCreateString(L"Windows.System.SystemManagementContract", + wcslen(L"Windows.System.SystemManagementContract"), &str); + ok(hr == S_OK, "WindowsCreateString failed, hr %#lx.\n", hr); + + if (0) /* Crash on Windows */ + { + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 1, 0, NULL); + ok(hr == E_INVALIDARG, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + } + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 7, 0, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE, "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = FALSE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 6, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == TRUE || broken(ret == FALSE) , "IsApiContractPresentByMajorAndMinor returned FALSE.\n"); + + ret = TRUE; + hr = IApiInformationStatics_IsApiContractPresentByMajorAndMinor(statics, str, 999, 999, &ret); + ok(hr == S_OK, "IsApiContractPresentByMajorAndMinor failed, hr %#lx.\n", hr); + ok(ret == FALSE, "IsApiContractPresentByMajorAndMinor returned TRUE.\n"); + + WindowsDeleteString(str); + /* Test API contracts presence. */ for (i = 0; i < ARRAY_SIZE(present_contracts); ++i) { -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8388
Could you add a few comments about what the tests are for? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8388#note_107385
This merge request was closed by JiangYi Chen. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8388
participants (3)
-
chenjiangyi -
JiangYi Chen (@meshine) -
Zhiyi Zhang (@zhiyi)