From 3beee00a99e7b9145239433b49cdabc9eb64fb82 Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Fri, 24 Oct 2014 19:36:47 -0200 Subject: [PATCH] wininet: Add more tests to InternetGetConnectedStateEx. --- dlls/wininet/tests/internet.c | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 688f7862414..fc965e29fd8 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -1556,6 +1556,12 @@ todo_wine sz = strlen(buffer); ok(sz > 0, "Expected a connection name\n"); + flags = 0; + res = pInternetGetConnectedStateExA(&flags, NULL, sizeof(buffer), 0); +todo_wine + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + /* no space for complete string this time */ buffer[0] = 0; flags = 0; @@ -1564,6 +1570,13 @@ todo_wine ok(flags, "Expected at least one flag set\n"); ok(sz - 1 == strlen(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenA(buffer)); + buffer[0] = 0; + flags = 0; + res = pInternetGetConnectedStateExA(&flags, buffer, sz / 2, 0); + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + ok(sz / 2 - 1 == strlen(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1, lstrlenA(buffer)); + buffer[0] = 0; flags = 0; res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0); @@ -1571,6 +1584,22 @@ todo_wine ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer)); + + buffer[0] = 0; + flags = 0; + res = pInternetGetConnectedStateExA(&flags, buffer, 2, 0); + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + ok(strlen(buffer) == 1, "Expected 1 byte, got %u\n", lstrlenA(buffer)); + + flags = 0; + buffer[0] = 0xDE; + res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0); +todo_wine + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); +todo_wine + ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer)); } static void test_InternetGetConnectedStateExW(void) @@ -1623,6 +1652,12 @@ todo_wine sz = lstrlenW(buffer); ok(sz > 0, "Expected a connection name\n"); + flags = 0; + res = pInternetGetConnectedStateExW(&flags, NULL, sizeof(buffer) / sizeof(buffer[0]), 0); +todo_wine + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + /* no space for complete string this time */ buffer[0] = 0; flags = 0; @@ -1631,6 +1666,13 @@ todo_wine ok(flags, "Expected at least one flag set\n"); ok(sz - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz - 1, lstrlenW(buffer)); + buffer[0] = 0; + flags = 0; + res = pInternetGetConnectedStateExW(&flags, buffer, sz / 2, 0); + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + ok(sz / 2 - 1 == lstrlenW(buffer), "Expected %u bytes, got %u\n", sz / 2 - 1, lstrlenW(buffer)); + buffer[0] = 0; flags = 0; res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0); @@ -1638,6 +1680,22 @@ todo_wine ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer)); + + buffer[0] = 0; + flags = 0; + res = pInternetGetConnectedStateExW(&flags, buffer, 2, 0); + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); + ok(lstrlenW(buffer) == 1, "Expected 1 byte, got %u\n", lstrlenW(buffer)); + + buffer[0] = 0xDEAD; + flags = 0; + res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0); +todo_wine + ok(res == TRUE, "Expected TRUE, got %d\n", res); + ok(flags, "Expected at least one flag set\n"); +todo_wine + ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer)); } /* ############################### */