comdlg32/tests: Add simple tests for PrintDlgA

Detlef Riekenberg wine.dev at web.de
Thu Aug 9 12:21:49 CDT 2007


Tests for the Previous Patch
Fogot to mention, that the previous Pach shoud fix the Bug 8033


Changelog:
comdlg32/tests: Add simple tests for PageSetupDlgA

-- 
 
By by ... Detlef

-------------- next part --------------
>From 72971636a8255727b68fc588c6893a4a5c0ef6e3 Mon Sep 17 00:00:00 2001
From: Detlef Riekenberg <wine.dev at web.de>
Date: Thu, 9 Aug 2007 19:11:20 +0200
Subject: [PATCH] comdlg32/tests: Add simple tests for PrintDlgA
---
 dlls/comdlg32/tests/printdlg.c |   46 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/dlls/comdlg32/tests/printdlg.c b/dlls/comdlg32/tests/printdlg.c
index 227c61f..27b0390 100644
--- a/dlls/comdlg32/tests/printdlg.c
+++ b/dlls/comdlg32/tests/printdlg.c
@@ -34,6 +34,51 @@ #include "commdlg.h"
 #include "wine/test.h"
 
 
+/* ######## */
+
+static void test_PageSetupDlgA(void)
+{
+    LPPAGESETUPDLGA pDlg;
+    DWORD res;
+
+    pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PAGESETUPDLGA)) * 2);
+    if (!pDlg) return;
+
+    SetLastError(0xdeadbeef);
+    res = PageSetupDlgA(NULL);
+    ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),
+        "returned %u with %u and 0x%x (expected '0' and "
+        "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
+
+    ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));
+    pDlg->lStructSize = sizeof(PAGESETUPDLGA) -1;
+    SetLastError(0xdeadbeef);
+    res = PageSetupDlgA(pDlg);
+    ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),
+        "returned %u with %u and 0x%x (expected '0' and "
+        "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
+
+
+    ZeroMemory(pDlg, sizeof(PAGESETUPDLGA));
+    pDlg->lStructSize = sizeof(PAGESETUPDLGA);
+    pDlg->Flags = PSD_RETURNDEFAULT;
+    SetLastError(0xdeadbeef);
+    res = PageSetupDlgA(pDlg);
+    ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN),
+        "returned %u with %u and 0x%x (expected '!= 0' or '0' and "
+        "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());
+
+    ok( pDlg->hDevMode && pDlg->hDevNames,
+        "got %p and %p (expected '!= NULL' for both)\n",
+        pDlg->hDevMode, pDlg->hDevNames);
+
+    GlobalFree(pDlg->hDevMode);
+    GlobalFree(pDlg->hDevNames);
+
+    HeapFree(GetProcessHeap(), 0, pDlg);
+
+}
+
 /* ##### */
 
 static void test_PrintDlgA(void)
@@ -78,6 +123,7 @@ static void test_PrintDlgA(void)
 
 START_TEST(printdlg)
 {
+    test_PageSetupDlgA();
     test_PrintDlgA();
 
 }
-- 
1.4.1



More information about the wine-patches mailing list