localspl/tests: [2/2] Add tests for XcvDataPort_DeletePort
Detlef Riekenberg
wine.dev at web.de
Tue Mar 6 17:20:32 CST 2007
localspl/tests: Add tests for XcvDataPort_DeletePort
--
By by ... Detlef
-------------- next part --------------
>From 4d30ece69770c370150c344c06ac1b2d225e0117 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Wed, 7 Mar 2007 00:16:31 +0100
Subject: [PATCH] localspl/tests: Add tests for XcvDataPort_DeletePort
---
dlls/localspl/tests/localmon.c | 44 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index 4361e71..bce9a48 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -69,6 +69,7 @@ static BOOL (WINAPI *pDeletePortUI)(PCW
static const WCHAR cmd_ConfigureLPTPortCommandOKW[] = {'C','o','n','f','i','g','u','r','e',
'L','P','T','P','o','r','t',
'C','o','m','m','a','n','d','O','K',0};
+static WCHAR cmd_DeletePortW[] = {'D','e','l','e','t','e','P','o','r','t',0};
static WCHAR cmd_GetTransmissionRetryTimeoutW[] = {'G','e','t',
'T','r','a','n','s','m','i','s','s','i','o','n',
'R','e','t','r','y','T','i','m','e','o','u','t',0};
@@ -483,6 +484,48 @@ static void test_XcvDataPort_ConfigureLP
/* ########################### */
+static void test_XcvDataPort_DeletePort(void)
+{
+ DWORD res;
+ HANDLE hXcv;
+ DWORD needed;
+
+
+ if ((pXcvOpenPort == NULL) || (pXcvDataPort == NULL) || (pXcvClosePort == NULL)) return;
+
+ hXcv = (HANDLE) 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ res = pXcvOpenPort(emptyW, SERVER_ALL_ACCESS, &hXcv);
+ ok(res, "hXcv: %d with %u and %p (expected '!= 0')\n", res, GetLastError(), hXcv);
+ if (!res) return;
+
+ /* cleanup: just to make sure */
+ needed = (DWORD) 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, &needed);
+ ok( !res || (res == ERROR_FILE_NOT_FOUND),
+ "returned %d with %u (expected ERROR_SUCCESS or ERROR_FILE_NOT_FOUND)\n",
+ res, GetLastError());
+
+
+ /* ToDo: cmd_AddPortW for tempfileW, then cmd_DeletePortW for the existing Port */
+
+
+ /* try to delete a non-existing Port */
+ needed = (DWORD) 0xdeadbeef;
+ SetLastError(0xdeadbeef);
+ res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, &needed);
+ ok( res == ERROR_FILE_NOT_FOUND,
+ "returned %d with %u (expected ERROR_FILE_NOT_FOUND)\n", res, GetLastError());
+
+ /* emptyW as Portname: ERROR_FILE_NOT_FOUND is returned */
+ /* NULL as Portname: Native localspl.dll crashed */
+
+ pXcvClosePort(hXcv);
+}
+
+/* ########################### */
+
static void test_XcvDataPort_GetTransmissionRetryTimeout(void)
{
CHAR org_value[16];
@@ -1039,6 +1082,7 @@ START_TEST(localmon)
test_EnumPorts();
test_XcvClosePort();
test_XcvDataPort_ConfigureLPTPortCommandOK();
+ test_XcvDataPort_DeletePort();
test_XcvDataPort_GetTransmissionRetryTimeout();
test_XcvDataPort_MonitorUI();
test_XcvDataPort_PortIsValid();
--
1.4.1
More information about the wine-patches
mailing list