localspl/tests: Add initial Test (dynamic loading)

Detlef Riekenberg wine.dev at web.de
Thu Sep 28 04:47:52 CDT 2006


Changelog:
localspl/tests: Add initial Test

needs "make_makefiles" and "autoconf" after the Patch


As requested by Alexandre, LoadLibrary / GetProcAddress
is now used.


This Patch runs without failure, when my prev. Patch
"Start implementing InitializePrintMonitor" is applied.



-- 
 
By by ... Detlef

-------------- next part --------------
Subject: [PATCH] localspl/tests: Add initial Test (updated)

---

 dlls/localspl/tests/Makefile.in |   13 +++++++
 dlls/localspl/tests/localmon.c  |   72 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 85 insertions(+), 0 deletions(-)
 create mode 100644 dlls/localspl/tests/Makefile.in
 create mode 100644 dlls/localspl/tests/localmon.c

18cc40d84d4ad7e8a3e6abe17178b2be0469c9f2
diff --git a/dlls/localspl/tests/Makefile.in b/dlls/localspl/tests/Makefile.in
new file mode 100644
index 0000000..2d70a62
--- /dev/null
+++ b/dlls/localspl/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = localspl.dll
+IMPORTS   = kernel32
+
+CTESTS = \
+	localmon.c
+
+ at MAKE_TEST_RULES@
+
+ at DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c
new file mode 100644
index 0000000..9b8fd0e
--- /dev/null
+++ b/dlls/localspl/tests/localmon.c
@@ -0,0 +1,72 @@
+/* 
+ * Unit test suite for localspl API functions: local print monitor
+ *
+ * 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 "winreg.h"
+
+#include "winspool.h"
+#include "ddk/winsplp.h"
+
+#include "wine/test.h"
+
+
+/* ##### */
+
+static HANDLE  hdll;
+static LPMONITOREX (WINAPI *pInitializePrintMonitor)(LPWSTR);
+
+static const WCHAR emptyW[] =    {0};
+
+/* ##### */
+
+static void test_InitializePrintMonitor(void)
+{
+    LPMONITOREX res;
+
+    if (!pInitializePrintMonitor) return;
+
+    SetLastError(0xdeadbeef);
+    res = pInitializePrintMonitor(NULL);
+    ok( (res == NULL) && (GetLastError() == ERROR_INVALID_PARAMETER),
+        "returned %p with %ld\n (expected NULL with " \
+        "ERROR_INVALID_PARAMETER)\n", res, GetLastError());
+
+    SetLastError(0xdeadbeef);
+    res = pInitializePrintMonitor((LPWSTR) emptyW);
+    ok( (res == NULL) && (GetLastError() == ERROR_INVALID_PARAMETER),
+        "returned %p with %ld\n (expected NULL with " \
+        "ERROR_INVALID_PARAMETER)\n", res, GetLastError());
+}
+
+
+START_TEST(localmon)
+{
+    hdll = LoadLibraryA("localspl.dll");
+    if (!hdll) return;
+
+    pInitializePrintMonitor = (void *) GetProcAddress(hdll, "InitializePrintMonitor");
+    test_InitializePrintMonitor();
+}
-- 
1.1.3


More information about the wine-patches mailing list