localspl/tests: Add Test for ConfigurePortW

Detlef Riekenberg wine.dev at web.de
Tue Nov 14 17:20:58 CST 2006


Changelog:

localspl/tests: Add Test for ConfigurePortW

-- 
 
By by ... Detlef

-------------- next part --------------
>From aff0f0a5736a24a79840eb41274530e50feb136a Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Wed, 15 Nov 2006 00:10:41 +0100
Subject: [PATCH] localspl/tests: Add Test for ConfigurePort
---
 dlls/localspl/tests/localmon.c |   47 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 1 deletions(-)

diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
index 766b553..e8e3b08 100644
--- a/dlls/localspl/tests/localmon.c
+++ b/dlls/localspl/tests/localmon.c
@@ -67,8 +67,51 @@ static WCHAR Monitors_LocalPortW[] = { \
                                 'P','r','i','n','t','\\',
                                 'M','o','n','i','t','o','r','s','\\',
                                 'L','o','c','a','l',' ','P','o','r','t',0};
+
+static WCHAR portname_com1W[] = {'C','O','M','1',':',0};
+static WCHAR portname_fileW[] = {'F','I','L','E',':',0};
+static WCHAR portname_lpt1W[] = {'L','P','T','1',':',0};
+
+/* ########################### */
                                        
-/* ##### */
+static void test_ConfigurePort(void)
+{
+    DWORD   res;
+
+    if (!pConfigurePort) return;
+
+#if 0
+    /* NT4 crash on this test */
+    res = pConfigurePort(NULL, 0, NULL);
+#endif
+
+    /*  Testing-Results (localmon.dll from NT4.0):
+        - Case of Portname is ignored
+        - "COM1:" and "COM01:" are the same (Compared by value)
+        - Portname without ":" => Dialog "Nothing to configure" comes up; Success
+        - "LPT1:", "LPT0:" and "LPT:" are the same (Numbers in "LPT:" are ignored)
+        - Empty Servername (LPT1:) => Dialog comes up (Servername is ignored)
+        - "FILE:" => Dialog "Nothing to configure" comes up; Success
+        - Empty Portname =>  => Dialog "Nothing to configure" comes up; Success
+        - Port "does_not_exist" => Dialog "Nothing to configure" comes up; Success
+    */
+    if (winetest_interactive > 0) {
+
+        SetLastError(0xdeadbeef);
+        res = pConfigurePort(NULL, 0, portname_com1W);
+        trace("returned %d with %d\n", res, GetLastError());
+
+        SetLastError(0xdeadbeef);
+        res = pConfigurePort(NULL, 0, portname_lpt1W);
+        trace("returned %d with %d\n", res, GetLastError());
+
+        SetLastError(0xdeadbeef);
+        res = pConfigurePort(NULL, 0, portname_fileW);
+        trace("returned %d with %d\n", res, GetLastError());
+    }
+}
+
+/* ########################### */
 
 static void test_EnumPorts(void)
 {
@@ -241,5 +284,7 @@ START_TEST(localmon)
         GET_MONITOR_FUNC(XcvClosePort);
     }
     test_InitializePrintMonitor();
+
+    test_ConfigurePort();
     test_EnumPorts();
 }
-- 
1.4.1



More information about the wine-patches mailing list