Owen Rudge : wsdapi/tests: Add WSDCreateUdpAddress tests.

Alexandre Julliard julliard at winehq.org
Mon Jun 5 16:56:30 CDT 2017


Module: wine
Branch: master
Commit: 30b356337384ca38b00c4273d278a73054233bcb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30b356337384ca38b00c4273d278a73054233bcb

Author: Owen Rudge <orudge at codeweavers.com>
Date:   Sat Jun  3 10:34:37 2017 +0100

wsdapi/tests: Add WSDCreateUdpAddress tests.

Signed-off-by: Owen Rudge <orudge at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wsdapi/tests/Makefile.in |  1 +
 dlls/wsdapi/tests/address.c   | 82 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)

diff --git a/dlls/wsdapi/tests/Makefile.in b/dlls/wsdapi/tests/Makefile.in
index 77434cf..a4a2821 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 0000000..8b16b06
--- /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 <windows.h>
+
+#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();
+}




More information about the wine-cvs mailing list