[PATCH] winspool/tests: Add tests for DeleteForm

Marcel Partap mpartap at gmx.net
Sat Apr 12 16:34:48 CDT 2008


---
 dlls/winspool.drv/tests/info.c |   56 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/dlls/winspool.drv/tests/info.c b/dlls/winspool.drv/tests/info.c
index be1affc..222ea46 100644
--- a/dlls/winspool.drv/tests/info.c
+++ b/dlls/winspool.drv/tests/info.c
@@ -756,6 +756,61 @@ static void test_ConfigurePort(void)
 
 /* ########################### */
 
+static void test_DeleteForm(void)
+{
+    FORM_INFO_1A fi1a;
+    HANDLE       hPrinter;
+    BOOL         res;
+
+    fi1a.pName = form_name;
+    fi1a.Flags = FORM_PRINTER;
+    fi1a.Size.cx = 1;
+    fi1a.Size.cy = 1;
+    fi1a.ImageableArea.top = 0;
+    fi1a.ImageableArea.left = 0;
+    fi1a.ImageableArea.right = 1;
+    fi1a.ImageableArea.bottom = 1;
+
+    if (default_printer)
+        OpenPrinter(default_printer, &hPrinter, NULL);
+    if (!hPrinter)
+        return;
+
+    /* Create a test form */
+    AddForm(hPrinter, 1, (LPBYTE)&fi1a);
+
+    SetLastError(MAGIC_DEAD);
+    res = DeleteForm(NULL, form_name);
+    ok( !res && (GetLastError() == ERROR_INVALID_HANDLE),
+        "returned %d with %d (expected '0' with ERROR_INVALID_HANDLE)\n",
+        res, GetLastError());
+
+    SetLastError(MAGIC_DEAD);
+    res = DeleteForm(hPrinter, NULL);
+    ok( !res && (GetLastError() == RPC_X_NULL_REF_POINTER),
+        "returned %d with %d (expected '0' with RPC_X_NULL_REF_POINTER)\n",
+        res, GetLastError());
+
+    SetLastError(MAGIC_DEAD);
+    res = DeleteForm(hPrinter, empty);
+    ok( !res && (GetLastError() == ERROR_INVALID_FORM_NAME),
+        "returned %d with %d (expected '0' with ERROR_INVALID_FORM_NAME)\n",
+        res, GetLastError());
+
+    SetLastError(MAGIC_DEAD);
+    res = DeleteForm(hPrinter, form_name);
+    ok( res, "returned %d with %d (expected '1')\n", res, GetLastError());
+
+    /* Delete the form a second time */
+    SetLastError(MAGIC_DEAD);
+    res = DeleteForm(hPrinter, form_name);
+    ok( !res && (GetLastError() == ERROR_INVALID_FORM_NAME),
+        "returned %d with %d (expected '0' with ERROR_INVALID_FORM_NAME)\n",
+        res, GetLastError());
+}
+
+/* ########################### */
+
 static void test_DeleteMonitor(void)
 {
     MONITOR_INFO_2A         mi2a;
@@ -2494,6 +2549,7 @@ START_TEST(info)
     test_AddPort();
     test_AddPortEx();
     test_ConfigurePort();
+    test_DeleteForm();
     test_DeleteMonitor();
     test_DeletePort();
     test_DeviceCapabilities();
-- 
1.5.4.5


--------------020800020708070609060703--



More information about the wine-patches mailing list