localui/tests: Handle different results from XP

Detlef Riekenberg wine.dev at web.de
Sun May 27 18:05:04 CDT 2007


I tested with w2k, but XP is using a different ERROR_* - Value
Sorry.


Changelog:
localui/tests: Handle different results from XP


-- 
 
By by ... Detlef

-------------- next part --------------
>From 1eb01b8d60ffd5fdec67da8610b9db7c826bbec4 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Mon, 28 May 2007 00:57:35 +0200
Subject: [PATCH] localui/tests: Handle different results from XP
---
 dlls/localui/tests/localui.c |   72 +++++++++++++++++++++++-------------------
 1 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/dlls/localui/tests/localui.c b/dlls/localui/tests/localui.c
index 7965d3c..9b53ed8 100644
--- a/dlls/localui/tests/localui.c
+++ b/dlls/localui/tests/localui.c
@@ -123,7 +123,7 @@ static LPWSTR strdupW(LPCWSTR strW)
 }
 
 /* ########################### */
-
+                              
 static void test_AddPortUI(void)
 {
     DWORD   res;
@@ -137,21 +137,24 @@ static void test_AddPortUI(void)
 
     SetLastError(0xdeadbeef);
     res = pAddPortUI(NULL, NULL, NULL, NULL);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
     SetLastError(0xdeadbeef);
     res = pAddPortUI(NULL, NULL, emptyW, NULL);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
     SetLastError(0xdeadbeef);
     res = pAddPortUI(NULL, NULL, does_not_existW, NULL);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
     if (winetest_interactive) {
         SetLastError(0xdeadbeef);
@@ -159,9 +162,9 @@ static void test_AddPortUI(void)
         /*
          * - On MSDN, you can read, that no dialogs should be displayed, when hWnd
          *   is NULL, but native localui does not care
-         * - when the new port already exist,
+         * - when the new port already exist, 
          *   TRUE is returned, but new_portname is NULL
-         * - when the new port starts with "COM" or "LPT",
+         * - when the new port starts with "COM" or "LPT", 
          *   FALSE is returned with ERROR_NOT_SUPPORTED in windows
          */
         res = pAddPortUI(NULL, NULL, localportW, &new_portname);
@@ -191,24 +194,25 @@ static void test_ConfigurePortUI(void)
 
     SetLastError(0xdeadbeef);
     res = pConfigurePortUI(NULL, NULL, NULL);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
-
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
     SetLastError(0xdeadbeef);
     res = pConfigurePortUI(NULL, NULL, emptyW);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
 
     SetLastError(0xdeadbeef);
     res = pConfigurePortUI(NULL, NULL, does_not_existW);
-    ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-        "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-        res, GetLastError());
-
+    ok( !res &&
+        ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+        "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+        "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
 
     if (winetest_interactive && lpt_present) {
         SetLastError(0xdeadbeef);
@@ -222,9 +226,10 @@ static void test_ConfigurePortUI(void)
     if (lpt_absent) {
         SetLastError(0xdeadbeef);
         res = pConfigurePortUI(NULL, NULL, lpt_absent);
-        ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-            "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-            res, GetLastError());
+        ok( !res &&
+            ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+            "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+            "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
     }
 
     if (winetest_interactive && com_present) {
@@ -239,17 +244,20 @@ static void test_ConfigurePortUI(void)
     if (com_absent) {
         SetLastError(0xdeadbeef);
         res = pConfigurePortUI(NULL, NULL, com_absent);
-        ok( !res && (GetLastError() == ERROR_UNKNOWN_PORT),
-            "got %d with %u (expected '0' with ERROR_UNKNOWN_PORT)\n",
-            res, GetLastError());
+        ok( !res &&
+            ((GetLastError() == ERROR_UNKNOWN_PORT) || (GetLastError() == ERROR_INVALID_PRINTER_NAME)),
+            "got %d with %u (expected '0' with: ERROR_UNKNOWN_PORT or "
+            "ERROR_INVALID_PRINTER_NAME)\n", res, GetLastError());
+
     }
 
     if (winetest_interactive && file_present) {
         SetLastError(0xdeadbeef);
         res = pConfigurePortUI(NULL, NULL, portname_fileW);
-        ok( !res && (GetLastError() == ERROR_CANCELLED),
-            "got %d with %u (expected '0' with ERROR_CANCELLED)\n",
-            res, GetLastError());
+        ok( !res &&
+            ((GetLastError() == ERROR_CANCELLED) || (GetLastError() == ERROR_ACCESS_DENIED)),
+            "got %d with %u (expected '0' with: ERROR_CANCELLED or "
+            "ERROR_ACCESS_DENIED)\n", res, GetLastError());
     }
 }
 
-- 
1.4.1



More information about the wine-patches mailing list