From 30b356337384ca38b00c4273d278a73054233bcb Mon Sep 17 00:00:00 2001 From: Owen Rudge Date: Sat, 3 Jun 2017 10:34:37 +0100 Subject: [PATCH] wsdapi/tests: Add WSDCreateUdpAddress tests. Signed-off-by: Owen Rudge Signed-off-by: Alexandre Julliard --- dlls/wsdapi/tests/Makefile.in | 1 + dlls/wsdapi/tests/address.c | 82 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 dlls/wsdapi/tests/address.c diff --git a/dlls/wsdapi/tests/Makefile.in b/dlls/wsdapi/tests/Makefile.in index 77434cfd456..a4a2821a53a 100644 --- a/dlls/wsdapi/tests/Makefile.in +++ b/dlls/wsdapi/tests/Makefile.in @@ -2,6 +2,7 @@ TESTDLL = wsdapi.dll IMPORTS = wsdapi ole32 user32 C_SRCS = \ + address.c \ discovery.c \ memory.c \ xml.c diff --git a/dlls/wsdapi/tests/address.c b/dlls/wsdapi/tests/address.c new file mode 100644 index 00000000000..8b16b0677b2 --- /dev/null +++ b/dlls/wsdapi/tests/address.c @@ -0,0 +1,82 @@ +/* + * Web Services on Devices + * Address tests + * + * Copyright 2017 Owen Rudge for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include + +#include "wine/test.h" +#include "objbase.h" +#include "wsdapi.h" + +static void CreateUdpAddress_tests(void) +{ + IWSDUdpAddress *udpAddress = NULL, *udpAddress2 = NULL; + IWSDTransportAddress *transportAddress = NULL; + IWSDAddress *address = NULL; + IUnknown *unknown; + HRESULT rc; + ULONG ref; + + rc = WSDCreateUdpAddress(NULL); + ok((rc == E_POINTER) || (rc == E_INVALIDARG), "WSDCreateUDPAddress(NULL) failed: %08x\n", rc); + + rc = WSDCreateUdpAddress(&udpAddress); + ok(rc == S_OK, "WSDCreateUDPAddress(NULL, &udpAddress) failed: %08x\n", rc); + ok(udpAddress != NULL, "WSDCreateUDPAddress(NULL, &udpAddress) failed: udpAddress == NULL\n"); + + /* Try to query for objects */ + rc = IWSDUdpAddress_QueryInterface(udpAddress, &IID_IWSDUdpAddress, (LPVOID*)&udpAddress2); + ok(rc == S_OK, "IWSDUdpAddress_QueryInterface(IWSDUdpAddress) failed: %08x\n", rc); + + if (rc == S_OK) + IWSDUdpAddress_Release(udpAddress2); + + rc = IWSDUdpAddress_QueryInterface(udpAddress, &IID_IWSDTransportAddress, (LPVOID*)&transportAddress); + ok(rc == S_OK, "IWSDUdpAddress_QueryInterface(IID_WSDTransportAddress) failed: %08x\n", rc); + + if (rc == S_OK) + IWSDTransportAddress_Release(transportAddress); + + rc = IWSDUdpAddress_QueryInterface(udpAddress, &IID_IWSDAddress, (LPVOID*)&address); + ok(rc == S_OK, "IWSDUdpAddress_QueryInterface(IWSDAddress) failed: %08x\n", rc); + + if (rc == S_OK) + IWSDAddress_Release(address); + + rc = IWSDUdpAddress_QueryInterface(udpAddress, &IID_IUnknown, (LPVOID*)&unknown); + ok(rc == S_OK, "IWSDUdpAddress_QueryInterface(IID_IUnknown) failed: %08x\n", rc); + + if (rc == S_OK) + IUnknown_Release(unknown); + + ref = IWSDUdpAddress_Release(udpAddress); + ok(ref == 0, "IWSDUdpAddress_Release() has %d references, should have 0\n", ref); +} + +START_TEST(address) +{ + CoInitialize(NULL); + + CreateUdpAddress_tests(); + + CoUninitialize(); +} -- 2.11.4.GIT