localspl/tests: Add test for DeletePort
Detlef Riekenberg
wine.dev at web.de
Thu Nov 23 14:49:42 CST 2006
Changelog:
localspl/tests: Add test for DeletePort
For more tests, we need AddPort / AddPortEx first
-Wcast-qual tested
--
By by ... Detlef
-------------- next part --------------
>From 62c9abcf5e7b931aa6caf9b79a968a26c8f48387 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Thu, 23 Nov 2006 21:27:56 +0100
Subject: [PATCH] localspl/tests: Add test for DeletePort
---
dlls/localspl/tests/localmon.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index e8e3b08..ada1a76 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -58,6 +58,7 @@ static BOOL (WINAPI *pXcvOpenPort)(HAND
static DWORD (WINAPI *pXcvDataPort)(HANDLE, LPCWSTR, PBYTE, DWORD, PBYTE, DWORD, PDWORD);
static BOOL (WINAPI *pXcvClosePort)(HANDLE);
+static WCHAR does_not_existW[] = {'d','o','e','s','_','n','o','t','_','e','x','i','s','t',0};
static WCHAR emptyW[] = {0};
static WCHAR invalid_serverW[] = {'\\','\\','i','n','v','a','l','i','d','_','s','e','r','v','e','r',0};
static WCHAR Monitors_LocalPortW[] = { \
@@ -78,6 +79,7 @@ static void test_ConfigurePort(void)
{
DWORD res;
+ /* moved to localui.dll since w2k */
if (!pConfigurePort) return;
#if 0
@@ -113,6 +115,38 @@ #endif
/* ########################### */
+static void test_DeletePort(void)
+{
+ DWORD res;
+
+ /* moved to localui.dll since w2k */
+ if (!pDeletePort) return;
+
+#if 0
+ /* NT4 crash on this test */
+ res = pDeletePort(NULL, 0, NULL);
+#endif
+
+ /* Testing-Results (localmon.dll from NT4.0):
+ - Case of Portname is ignored (returned '1' on Success)
+ - "COM1:" and "COM01:" are different (Compared as string)
+ - server_does_not_exist (LPT1:) => Port deleted, Success (Servername is ignored)
+ - Empty Portname => => FALSE (LastError not changed)
+ - Port "does_not_exist" => FALSE (LastError not changed)
+ */
+
+ SetLastError(0xdeadbeef);
+ res = pDeletePort(NULL, 0, emptyW);
+ ok(!res, "returned %d with 0x%x (expected '0')\n", res, GetLastError());
+
+ SetLastError(0xdeadbeef);
+ res = pDeletePort(NULL, 0, does_not_existW);
+ ok(!res, "returned %d with 0x%x (expected '0')\n", res, GetLastError());
+
+}
+
+/* ########################### */
+
static void test_EnumPorts(void)
{
DWORD res;
@@ -286,5 +320,6 @@ START_TEST(localmon)
test_InitializePrintMonitor();
test_ConfigurePort();
+ test_DeletePort();
test_EnumPorts();
}
--
1.4.1
More information about the wine-patches
mailing list