From: chenjiangyi chenjiangyi@uniontech.com
Signed-off-by: chenjiangyi chenjiangyi@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) {
Could you add a few comments about what the tests are for?