comdlg32: [1/2] Add initial test
Detlef Riekenberg
wine.dev at web.de
Mon Jul 3 15:55:53 CDT 2006
Resend-reason: synced to current HEAD
The changes for "configure" are not included.
More tests will follow (need a CBT-HOOK).
Changelog:
- comdlg32: [1/2] Add initial test
--
By By ...
... Detlef
-------------- next part --------------
The changes for "configure" are not included.
More tests will follow (need a CBT-HOOK).
Changelog:
- comdlg32: [1/2] Add initial test
---
configure.ac | 1
dlls/comdlg32/Makefile.in | 2 +
dlls/comdlg32/tests/.gitignore | 3 +
dlls/comdlg32/tests/Makefile.in | 13 ++++++
dlls/comdlg32/tests/printdlg.c | 84 +++++++++++++++++++++++++++++++++++++++
5 files changed, 103 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index e69b4b5..be376f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1568,6 +1568,7 @@ dlls/comcat/Makefile
dlls/comctl32/Makefile
dlls/comctl32/tests/Makefile
dlls/comdlg32/Makefile
+dlls/comdlg32/tests/Makefile
dlls/compstui/Makefile
dlls/crtdll/Makefile
dlls/crypt32/Makefile
diff --git a/dlls/comdlg32/Makefile.in b/dlls/comdlg32/Makefile.in
index 3f1870d..58a8efd 100644
--- a/dlls/comdlg32/Makefile.in
+++ b/dlls/comdlg32/Makefile.in
@@ -44,6 +44,8 @@ RC_BINARIES = \
pd32_nocollate.ico \
pd32_portrait.ico
+SUBDIRS = tests
+
@MAKE_DLL_RULES@
### Dependencies:
diff --git a/dlls/comdlg32/tests/.gitignore b/dlls/comdlg32/tests/.gitignore
new file mode 100644
index 0000000..28d73df
--- /dev/null
+++ b/dlls/comdlg32/tests/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+printdlg.ok
+testlist.c
diff --git a/dlls/comdlg32/tests/Makefile.in b/dlls/comdlg32/tests/Makefile.in
new file mode 100644
index 0000000..1e10405
--- /dev/null
+++ b/dlls/comdlg32/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR = @srcdir@
+VPATH = @srcdir@
+TESTDLL = comdlg32.dll
+IMPORTS = comdlg32 kernel32
+
+CTESTS = \
+ printdlg.c
+
+ at MAKE_TEST_RULES@
+
+### Dependencies:
diff --git a/dlls/comdlg32/tests/printdlg.c b/dlls/comdlg32/tests/printdlg.c
new file mode 100644
index 0000000..934391a
--- /dev/null
+++ b/dlls/comdlg32/tests/printdlg.c
@@ -0,0 +1,84 @@
+/*
+ * Unit test suite for comdlg32 API functions: printer dialogs
+ *
+ * Copyright 2006 Detlef Riekenberg
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winerror.h"
+#include "wingdi.h"
+#include "wingdi.h"
+#include "winuser.h"
+
+#include "cderr.h"
+#include "commdlg.h"
+
+#include "wine/test.h"
+
+
+/* ##### */
+
+static void test_PrintDlgA(void)
+{
+ DWORD res;
+ LPPRINTDLGA pDlg;
+
+
+ pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PRINTDLGA)) * 2);
+ if (!pDlg) return;
+
+
+#if 0
+ /* will crash with unpatched wine */
+ SetLastError(0xdeadbeef);
+ res = PrintDlgA(NULL);
+ ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),
+ "returned %ld with 0x%lx and 0x%lx (expected '0' and " \
+ "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
+ }
+#endif
+
+ ZeroMemory(pDlg, sizeof(PRINTDLGA));
+ pDlg->lStructSize = sizeof(PRINTDLGA) - 1;
+ SetLastError(0xdeadbeef);
+ res = PrintDlgA(pDlg);
+ ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),
+ "returned %ld with 0x%lx and 0x%lx (expected '0' and " \
+ "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
+
+
+ ZeroMemory(pDlg, sizeof(PRINTDLGA));
+ pDlg->lStructSize = sizeof(PRINTDLGA);
+ pDlg->Flags = PD_RETURNDEFAULT;
+ SetLastError(0xdeadbeef);
+ res = PrintDlgA(pDlg);
+ ok(res, "returned %ld with 0x%lx and 0x%lx (expected '!= 0')\n", res, GetLastError(), CommDlgExtendedError());
+
+ HeapFree(GetProcessHeap(), 0, pDlg);
+
+}
+
+
+START_TEST(printdlg)
+{
+ test_PrintDlgA();
+
+}
--
1.4.0
More information about the wine-patches
mailing list