ntprint/tests: Add initial test.

This commit is contained in:
Detlef Riekenberg 2007-06-21 06:07:10 +02:00 committed by Alexandre Julliard
parent f7bd46a49d
commit a114483e49
9 changed files with 157 additions and 0 deletions

4
.gitignore vendored
View File

@ -384,6 +384,9 @@ dlls/ntdll/version.res
dlls/ntdsapi/libntdsapi.def dlls/ntdsapi/libntdsapi.def
dlls/ntoskrnl.exe/libntoskrnl.exe.def dlls/ntoskrnl.exe/libntoskrnl.exe.def
dlls/ntprint/ntprint.res dlls/ntprint/ntprint.res
dlls/ntprint/tests/*.ok
dlls/ntprint/tests/ntprint_crosstest.exe
dlls/ntprint/tests/testlist.c
dlls/objsel/objsel.res dlls/objsel/objsel.res
dlls/odbc32/libodbc32.def dlls/odbc32/libodbc32.def
dlls/odbccp32/libodbccp32.def dlls/odbccp32/libodbccp32.def
@ -874,6 +877,7 @@ programs/winetest/msvcrtd_test.exe
programs/winetest/msxml3_test.exe programs/winetest/msxml3_test.exe
programs/winetest/netapi32_test.exe programs/winetest/netapi32_test.exe
programs/winetest/ntdll_test.exe programs/winetest/ntdll_test.exe
programs/winetest/ntprint_test.exe
programs/winetest/odbccp32_test.exe programs/winetest/odbccp32_test.exe
programs/winetest/ole32_test.exe programs/winetest/ole32_test.exe
programs/winetest/oleaut32_test.exe programs/winetest/oleaut32_test.exe

View File

@ -315,6 +315,7 @@ ALL_MAKEFILES = \
dlls/ntdsapi/Makefile \ dlls/ntdsapi/Makefile \
dlls/ntoskrnl.exe/Makefile \ dlls/ntoskrnl.exe/Makefile \
dlls/ntprint/Makefile \ dlls/ntprint/Makefile \
dlls/ntprint/tests/Makefile \
dlls/objsel/Makefile \ dlls/objsel/Makefile \
dlls/odbc32/Makefile \ dlls/odbc32/Makefile \
dlls/odbccp32/Makefile \ dlls/odbccp32/Makefile \
@ -671,6 +672,7 @@ dlls/ntdll/tests/Makefile: dlls/ntdll/tests/Makefile.in dlls/Maketest.rules
dlls/ntdsapi/Makefile: dlls/ntdsapi/Makefile.in dlls/Makedll.rules dlls/ntdsapi/Makefile: dlls/ntdsapi/Makefile.in dlls/Makedll.rules
dlls/ntoskrnl.exe/Makefile: dlls/ntoskrnl.exe/Makefile.in dlls/Makedll.rules dlls/ntoskrnl.exe/Makefile: dlls/ntoskrnl.exe/Makefile.in dlls/Makedll.rules
dlls/ntprint/Makefile: dlls/ntprint/Makefile.in dlls/Makedll.rules dlls/ntprint/Makefile: dlls/ntprint/Makefile.in dlls/Makedll.rules
dlls/ntprint/tests/Makefile: dlls/ntprint/tests/Makefile.in dlls/Maketest.rules
dlls/objsel/Makefile: dlls/objsel/Makefile.in dlls/Makedll.rules dlls/objsel/Makefile: dlls/objsel/Makefile.in dlls/Makedll.rules
dlls/odbc32/Makefile: dlls/odbc32/Makefile.in dlls/Makedll.rules dlls/odbc32/Makefile: dlls/odbc32/Makefile.in dlls/Makedll.rules
dlls/odbccp32/Makefile: dlls/odbccp32/Makefile.in dlls/Makedll.rules dlls/odbccp32/Makefile: dlls/odbccp32/Makefile.in dlls/Makedll.rules

3
configure vendored
View File

@ -20700,6 +20700,8 @@ ac_config_files="$ac_config_files dlls/ntoskrnl.exe/Makefile"
ac_config_files="$ac_config_files dlls/ntprint/Makefile" ac_config_files="$ac_config_files dlls/ntprint/Makefile"
ac_config_files="$ac_config_files dlls/ntprint/tests/Makefile"
ac_config_files="$ac_config_files dlls/objsel/Makefile" ac_config_files="$ac_config_files dlls/objsel/Makefile"
ac_config_files="$ac_config_files dlls/odbc32/Makefile" ac_config_files="$ac_config_files dlls/odbc32/Makefile"
@ -21791,6 +21793,7 @@ do
"dlls/ntdsapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntdsapi/Makefile" ;; "dlls/ntdsapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntdsapi/Makefile" ;;
"dlls/ntoskrnl.exe/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntoskrnl.exe/Makefile" ;; "dlls/ntoskrnl.exe/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntoskrnl.exe/Makefile" ;;
"dlls/ntprint/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntprint/Makefile" ;; "dlls/ntprint/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntprint/Makefile" ;;
"dlls/ntprint/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ntprint/tests/Makefile" ;;
"dlls/objsel/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/objsel/Makefile" ;; "dlls/objsel/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/objsel/Makefile" ;;
"dlls/odbc32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/odbc32/Makefile" ;; "dlls/odbc32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/odbc32/Makefile" ;;
"dlls/odbccp32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/odbccp32/Makefile" ;; "dlls/odbccp32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/odbccp32/Makefile" ;;

View File

@ -1602,6 +1602,7 @@ AC_CONFIG_FILES([dlls/ntdll/tests/Makefile])
AC_CONFIG_FILES([dlls/ntdsapi/Makefile]) AC_CONFIG_FILES([dlls/ntdsapi/Makefile])
AC_CONFIG_FILES([dlls/ntoskrnl.exe/Makefile]) AC_CONFIG_FILES([dlls/ntoskrnl.exe/Makefile])
AC_CONFIG_FILES([dlls/ntprint/Makefile]) AC_CONFIG_FILES([dlls/ntprint/Makefile])
AC_CONFIG_FILES([dlls/ntprint/tests/Makefile])
AC_CONFIG_FILES([dlls/objsel/Makefile]) AC_CONFIG_FILES([dlls/objsel/Makefile])
AC_CONFIG_FILES([dlls/odbc32/Makefile]) AC_CONFIG_FILES([dlls/odbc32/Makefile])
AC_CONFIG_FILES([dlls/odbccp32/Makefile]) AC_CONFIG_FILES([dlls/odbccp32/Makefile])

View File

@ -269,6 +269,7 @@ TESTSUBDIRS = \
msxml3/tests \ msxml3/tests \
netapi32/tests \ netapi32/tests \
ntdll/tests \ ntdll/tests \
ntprint/tests \
odbccp32/tests \ odbccp32/tests \
ole32/tests \ ole32/tests \
oleaut32/tests \ oleaut32/tests \

View File

@ -0,0 +1,13 @@
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = ntprint.dll
IMPORTS = kernel32
CTESTS = \
ntprint.c
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -0,0 +1,129 @@
/*
* Unit test suite for the Spooler Setup API (Printing)
*
* Copyright 2007 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 <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "wine/test.h"
/* ##### */
static HMODULE hdll;
static HANDLE (WINAPI *pPSetupCreateMonitorInfo)(LPVOID, LPVOID, LPVOID);
static VOID (WINAPI *pPSetupDestroyMonitorInfo)(HANDLE);
/* ########################### */
static LPCSTR load_functions(void)
{
LPCSTR ptr;
ptr = "ntprint.dll";
hdll = LoadLibraryA(ptr);
if (!hdll) return ptr;
ptr = "PSetupCreateMonitorInfo";
pPSetupCreateMonitorInfo = (VOID *) GetProcAddress(hdll, ptr);
if (!pPSetupCreateMonitorInfo) return ptr;
ptr = "PSetupDestroyMonitorInfo";
pPSetupDestroyMonitorInfo = (VOID *) GetProcAddress(hdll, ptr);
if (!pPSetupDestroyMonitorInfo) return ptr;
return NULL;
}
/* ########################### */
static void test_PSetupCreateMonitorInfo(VOID)
{
HANDLE mi;
BYTE buffer[1024] ;
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL);
ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError());
if (mi) pPSetupDestroyMonitorInfo(mi);
memset(buffer, 0, sizeof(buffer));
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(buffer, NULL, NULL);
ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError());
if (mi) pPSetupDestroyMonitorInfo(mi);
}
/* ########################### */
static void test_PSetupDestroyMonitorInfo(VOID)
{
HANDLE mi;
SetLastError(0xdeadbeef);
pPSetupDestroyMonitorInfo(NULL);
/* lasterror is returned */
trace("returned with %u\n", GetLastError());
SetLastError(0xdeadbeef);
mi = pPSetupCreateMonitorInfo(NULL, NULL, NULL);
ok( mi != NULL, "got %p with %u (expected '!= NULL')\n", mi, GetLastError());
if (!mi) return;
SetLastError(0xdeadbeef);
pPSetupDestroyMonitorInfo(mi);
/* lasterror is returned */
trace("returned with %u\n", GetLastError());
/* Try to destroy the handle twice crash with native ntprint.dll */
if (0) {
SetLastError(0xdeadbeef);
pPSetupDestroyMonitorInfo(mi);
trace(" with %u\n", GetLastError());
}
}
/* ########################### */
START_TEST(ntprint)
{
LPCSTR ptr;
/* ntprint.dll does not exist on win9x */
ptr = load_functions();
if (ptr) {
skip("%s not found\n", ptr);
return;
}
test_PSetupCreateMonitorInfo();
test_PSetupDestroyMonitorInfo();
}

View File

@ -60,6 +60,7 @@ TESTBINS = \
msxml3_test.exe \ msxml3_test.exe \
netapi32_test.exe \ netapi32_test.exe \
ntdll_test.exe \ ntdll_test.exe \
ntprint_test.exe \
odbccp32_test.exe \ odbccp32_test.exe \
ole32_test.exe \ ole32_test.exe \
oleaut32_test.exe \ oleaut32_test.exe \
@ -162,6 +163,8 @@ netapi32_test.exe: $(DLLDIR)/netapi32/tests/netapi32_test.exe$(DLLEXT)
cp $(DLLDIR)/netapi32/tests/netapi32_test.exe$(DLLEXT) $@ && $(STRIP) $@ cp $(DLLDIR)/netapi32/tests/netapi32_test.exe$(DLLEXT) $@ && $(STRIP) $@
ntdll_test.exe: $(DLLDIR)/ntdll/tests/ntdll_test.exe$(DLLEXT) ntdll_test.exe: $(DLLDIR)/ntdll/tests/ntdll_test.exe$(DLLEXT)
cp $(DLLDIR)/ntdll/tests/ntdll_test.exe$(DLLEXT) $@ && $(STRIP) $@ cp $(DLLDIR)/ntdll/tests/ntdll_test.exe$(DLLEXT) $@ && $(STRIP) $@
ntprint_test.exe: $(DLLDIR)/ntprint/tests/ntprint_test.exe$(DLLEXT)
cp $(DLLDIR)/ntprint/tests/ntprint_test.exe$(DLLEXT) $@ && $(STRIP) $@
odbccp32_test.exe: $(DLLDIR)/odbccp32/tests/odbccp32_test.exe$(DLLEXT) odbccp32_test.exe: $(DLLDIR)/odbccp32/tests/odbccp32_test.exe$(DLLEXT)
cp $(DLLDIR)/odbccp32/tests/odbccp32_test.exe$(DLLEXT) $@ && $(STRIP) $@ cp $(DLLDIR)/odbccp32/tests/odbccp32_test.exe$(DLLEXT) $@ && $(STRIP) $@
ole32_test.exe: $(DLLDIR)/ole32/tests/ole32_test.exe$(DLLEXT) ole32_test.exe: $(DLLDIR)/ole32/tests/ole32_test.exe$(DLLEXT)

View File

@ -183,6 +183,7 @@ msvcrtd_test.exe TESTRES "msvcrtd_test.exe"
msxml3_test.exe TESTRES "msxml3_test.exe" msxml3_test.exe TESTRES "msxml3_test.exe"
netapi32_test.exe TESTRES "netapi32_test.exe" netapi32_test.exe TESTRES "netapi32_test.exe"
ntdll_test.exe TESTRES "ntdll_test.exe" ntdll_test.exe TESTRES "ntdll_test.exe"
ntprint_test.exe TESTRES "ntprint_test.exe"
odbccp32_test.exe TESTRES "odbccp32_test.exe" odbccp32_test.exe TESTRES "odbccp32_test.exe"
ole32_test.exe TESTRES "ole32_test.exe" ole32_test.exe TESTRES "ole32_test.exe"
oleaut32_test.exe TESTRES "oleaut32_test.exe" oleaut32_test.exe TESTRES "oleaut32_test.exe"