From 88b11064924faa4d7a1fa4b6444b3a90d21981d6 Mon Sep 17 00:00:00 2001 From: Stefan Leichter Date: Wed, 15 Jan 2003 00:50:48 +0000 Subject: [PATCH] Added tests for GetPrinterDriverDirectoryA. --- configure | 3 +- configure.ac | 1 + dlls/winspool/Makefile.in | 2 + dlls/winspool/tests/.cvsignore | 4 ++ dlls/winspool/tests/Makefile.in | 13 ++++++ dlls/winspool/tests/info.c | 101 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 dlls/winspool/tests/.cvsignore create mode 100644 dlls/winspool/tests/Makefile.in create mode 100644 dlls/winspool/tests/info.c diff --git a/configure b/configure index 7380226026b..539e553756d 100755 --- a/configure +++ b/configure @@ -15639,7 +15639,7 @@ MAKE_TEST_RULES=dlls/Maketest.rules MAKE_PROG_RULES=programs/Makeprog.rules - ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wpp/Makefile tools/wrc/Makefile unicode/Makefile" + ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3dx8/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/icmp/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msdmo/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvideo/Makefile dlls/msvideo/msrle32/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/version/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winenas/Makefile dlls/winmm/winejack/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile include/Makefile library/Makefile miscemu/Makefile ole/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/osversioncheck/Makefile programs/progman/Makefile programs/regapi/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/regtest/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/wmc/Makefile tools/wpp/Makefile tools/wrc/Makefile unicode/Makefile" cat >confcache <<\_ACEOF @@ -16287,6 +16287,7 @@ do "dlls/winsock/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winsock/Makefile" ;; "dlls/winsock/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winsock/tests/Makefile" ;; "dlls/winspool/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winspool/Makefile" ;; + "dlls/winspool/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/winspool/tests/Makefile" ;; "dlls/wintab32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wintab32/Makefile" ;; "dlls/wintrust/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wintrust/Makefile" ;; "dlls/wow32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/wow32/Makefile" ;; diff --git a/configure.ac b/configure.ac index ed9cd300d94..884045222af 100644 --- a/configure.ac +++ b/configure.ac @@ -1493,6 +1493,7 @@ dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile +dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile diff --git a/dlls/winspool/Makefile.in b/dlls/winspool/Makefile.in index 84826c79cf4..c6e80ca8bb7 100644 --- a/dlls/winspool/Makefile.in +++ b/dlls/winspool/Makefile.in @@ -13,6 +13,8 @@ C_SRCS = \ info.c \ wspool.c +SUBDIRS = tests + @MAKE_DLL_RULES@ ### Dependencies: diff --git a/dlls/winspool/tests/.cvsignore b/dlls/winspool/tests/.cvsignore new file mode 100644 index 00000000000..c650e78037a --- /dev/null +++ b/dlls/winspool/tests/.cvsignore @@ -0,0 +1,4 @@ +Makefile +info.ok +testlist.c +winspool.drv_test.exe.spec.c diff --git a/dlls/winspool/tests/Makefile.in b/dlls/winspool/tests/Makefile.in new file mode 100644 index 00000000000..d19e35b0c70 --- /dev/null +++ b/dlls/winspool/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = winspool.drv +IMPORTS = winspool kernel32 + +CTESTS = \ + info.c + +@MAKE_TEST_RULES@ + +### Dependencies: diff --git a/dlls/winspool/tests/info.c b/dlls/winspool/tests/info.c new file mode 100644 index 00000000000..6cb875481b1 --- /dev/null +++ b/dlls/winspool/tests/info.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2003 Stefan Leichter + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "wine/test.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "winspool.h" + +static void test_printer_directory(ivoid) +{ LPBYTE buffer = NULL; + DWORD cbBuf, pcbNeeded; + BOOL res; + OSVERSIONINFOA ver; + + ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); + if(!GetVersionExA( &ver)) { + ok( 0, "GetVersionExA failed!"); + return ; + } + + (void) GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, 0, &cbBuf); + + buffer = HeapAlloc( GetProcessHeap(), 0, cbBuf*2); + + res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf, &pcbNeeded); + ok( res, "expected result != 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + + res = GetPrinterDriverDirectoryA(NULL, NULL, 1, buffer, cbBuf*2, &pcbNeeded); + ok( res, "expected result != 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf-1, &pcbNeeded); + ok( !res , "expected result == 0, got %d", res); + ok( cbBuf == pcbNeeded, "pcbNeeded set to %ld instead of %ld", + pcbNeeded, cbBuf); + ok( ERROR_INSUFFICIENT_BUFFER == GetLastError(), + "last error set to %ld instead of ERROR_INSUFFICIENT_BUFFER", + GetLastError()); + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, &pcbNeeded); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( ERROR_INVALID_USER_BUFFER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_USER_BUFFER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + ok( ERROR_INVALID_PARAMETER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_PARAMETER", + GetLastError()); + } + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, buffer, cbBuf, NULL); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( RPC_X_NULL_REF_POINTER == GetLastError(), + "last error set to %ld instead of RPC_X_NULL_REF_POINTER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + } + + res = GetPrinterDriverDirectoryA( NULL, NULL, 1, NULL, cbBuf, NULL); + if(ver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + ok( !res , "expected result == 0, got %d", res); + ok( RPC_X_NULL_REF_POINTER == GetLastError(), + "last error set to %ld instead of RPC_X_NULL_REF_POINTER", + GetLastError()); + } else { + ok( res , "expected result != 0, got %d", res); + ok( ERROR_INVALID_PARAMETER == GetLastError(), + "last error set to %ld instead of ERROR_INVALID_PARAMETER", + GetLastError()); + } + + HeapFree( GetProcessHeap(), 0, buffer); +} + +START_TEST(info) +{ + test_printer_directory(); +} -- 2.11.4.GIT