Commit 00cd2b2e authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

Added tests for msacm32.dll.

parent 445fc35e
......@@ -20033,7 +20033,7 @@ MAKE_LIB_RULES=libs/Makelib.rules
MAKE_PROG_RULES=programs/Makeprog.rules
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/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/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/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/rsabase/Makefile dlls/secur32/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/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/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/winejack/Makefile dlls/winmm/winenas/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 libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/amstream/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3dx8/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/oleacc/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/rsabase/Makefile dlls/secur32/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/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/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/winejack/Makefile dlls/winmm/winenas/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 libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile"
cat >confcache <<\_ACEOF
......@@ -20643,6 +20643,7 @@ do
"dlls/msacm/msadp32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/msadp32/Makefile" ;;
"dlls/msacm/msg711/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/msg711/Makefile" ;;
"dlls/msacm/winemp3/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/winemp3/Makefile" ;;
"dlls/msacm/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msacm/tests/Makefile" ;;
"dlls/msdmo/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msdmo/Makefile" ;;
"dlls/mshtml/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mshtml/Makefile" ;;
"dlls/msi/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msi/Makefile" ;;
......
......@@ -1567,6 +1567,7 @@ dlls/msacm/imaadp32/Makefile
dlls/msacm/msadp32/Makefile
dlls/msacm/msg711/Makefile
dlls/msacm/winemp3/Makefile
dlls/msacm/tests/Makefile
dlls/msdmo/Makefile
dlls/mshtml/Makefile
dlls/msi/Makefile
......
......@@ -22,6 +22,8 @@ C_SRCS16 = \
RC_SRCS = msacm.rc
SUBDIRS = tests
@MAKE_DLL_RULES@
### Dependencies:
Makefile
msacm.ok
testlist.c
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = msacm32.dll
IMPORTS = msacm32
CTESTS = \
msacm.c
@MAKE_TEST_RULES@
### Dependencies:
/*
* Unit tests for msacm functions
*
* Copyright (c) 2004 Robert Reif
*
* 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 <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "msacm.h"
static BOOL CALLBACK FormatEnumProc(HACMDRIVERID hadid,
LPACMFORMATDETAILS pafd,
DWORD dwInstance,
DWORD fd)
{
trace(" 0x%04lx, %s\n", pafd->dwFormatTag, pafd->szFormat);
return TRUE;
}
static BOOL CALLBACK DriverEnumProc(HACMDRIVERID hadid,
DWORD dwInstance,
DWORD fdwSupport)
{
MMRESULT rc;
ACMDRIVERDETAILS dd;
HACMDRIVER had;
trace("id: %p\n", hadid);
trace(" Supports:\n");
if (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_ASYNC)
trace(" async conversions\n");
if (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CODEC)
trace(" different format conversions\n");
if (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_CONVERTER)
trace(" same format conversions\n");
if (fdwSupport & ACMDRIVERDETAILS_SUPPORTF_FILTER)
trace(" filtering\n");
/* try an invalid pointer */
rc = acmDriverDetails(hadid, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try an invalid structure size */
ZeroMemory(&dd, sizeof(dd));
rc = acmDriverDetails(hadid, &dd, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* MSDN says this should fail but it doesn't in practice */
dd.cbStruct = 4;
rc = acmDriverDetails(hadid, &dd, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
/* try an invalid handle */
dd.cbStruct = sizeof(dd);
rc = acmDriverDetails((HACMDRIVERID)1, &dd, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try an invalid handle and pointer */
rc = acmDriverDetails((HACMDRIVERID)1, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try invalid details */
rc = acmDriverDetails(hadid, &dd, -1);
ok(rc == MMSYSERR_INVALFLAG,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALFLAG);
/* try valid parameters */
rc = acmDriverDetails(hadid, &dd, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverDetails(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
if (rc == MMSYSERR_NOERROR) {
trace(" Short name: %s\n", dd.szShortName);
trace(" Long name: %s\n", dd.szLongName);
trace(" Copyright: %s\n", dd.szCopyright);
trace(" Licensing: %s\n", dd.szLicensing);
trace(" Features: %s\n", dd.szFeatures);
trace(" Supports %lu formats\n", dd.cFormatTags);
trace(" Supports %lu filter formats\n", dd.cFilterTags);
}
/* try invalid pointer */
rc = acmDriverOpen(0, hadid, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmDriverOpen(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try invalid handle */
rc = acmDriverOpen(&had, (HACMDRIVERID)1, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmDriverOpen(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try invalid open */
rc = acmDriverOpen(&had, hadid, -1);
ok(rc == MMSYSERR_INVALFLAG,
"acmDriverOpen(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALFLAG);
/* try valid parameters */
rc = acmDriverOpen(&had, hadid, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverOpen(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
if (rc == MMSYSERR_NOERROR) {
DWORD dwSize;
WAVEFORMATEX * pwfx;
ACMFORMATDETAILS fd;
HACMDRIVERID hid;
/* try bad pointer */
rc = acmDriverID((HACMOBJ)had, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmDriverID(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try bad handle */
rc = acmDriverID((HACMOBJ)1, &hid, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try bad handle and pointer */
rc = acmDriverID((HACMOBJ)1, 0, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try bad flag */
rc = acmDriverID((HACMOBJ)had, &hid, 1);
ok(rc == MMSYSERR_INVALFLAG,
"acmDriverID(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALFLAG);
/* try valid parameters */
rc = acmDriverID((HACMOBJ)had, &hid, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverID(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
ok(hid == hadid,
"acmDriverID() returned ID %08lx doesn't equal %08lx\n",
(DWORD)hid, (DWORD)hadid);
/* try bad pointer */
rc = acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try bad handle */
rc = acmMetrics((HACMOBJ)1, ACM_METRIC_MAX_SIZE_FORMAT, &dwSize);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try bad pointer and handle */
rc = acmMetrics((HACMOBJ)1, ACM_METRIC_MAX_SIZE_FORMAT, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try valid parameters */
rc = acmMetrics((HACMOBJ)had, ACM_METRIC_MAX_SIZE_FORMAT, &dwSize);
ok(rc == MMSYSERR_NOERROR,
"acmMetrics(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
if (rc == MMSYSERR_NOERROR) {
/* try bad pointer */
rc = acmFormatEnum(had, 0, FormatEnumProc, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmFormatEnum(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
/* try bad structure size */
ZeroMemory(&fd, sizeof(fd));
rc = acmFormatEnum(had, &fd, FormatEnumProc, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmFormatEnum(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
fd.cbStruct = sizeof(fd) - 1;
rc = acmFormatEnum(had, &fd, FormatEnumProc, 0, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmFormatEnum(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALPARAM);
if (dwSize < sizeof(WAVEFORMATEX))
dwSize = sizeof(WAVEFORMATEX);
pwfx = (WAVEFORMATEX *) malloc(dwSize);
ZeroMemory(pwfx, dwSize);
pwfx->cbSize = LOWORD(dwSize) - sizeof(WAVEFORMATEX);
pwfx->wFormatTag = WAVE_FORMAT_UNKNOWN;
fd.cbStruct = sizeof(fd);
fd.pwfx = pwfx;
fd.cbwfx = dwSize;
fd.dwFormatTag = WAVE_FORMAT_UNKNOWN;
/* try valid parameters */
rc = acmFormatEnum(had, &fd, FormatEnumProc, 0, 0);
ok(rc == MMSYSERR_NOERROR,
"acmFormatEnum(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
free(pwfx);
/* try invalid handle */
rc = acmDriverClose((HACMDRIVER)1, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmDriverClose(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
/* try invalid flag */
rc = acmDriverClose(had, 1);
ok(rc == MMSYSERR_INVALFLAG,
"acmDriverClose(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALFLAG);
/* try valid parameters */
rc = acmDriverClose(had, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverClose(): rc = %08x, should be %08x\n",
rc, MMSYSERR_NOERROR);
/* try closing again */
rc = acmDriverClose(had, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmDriverClose(): rc = %08x, should be %08x\n",
rc, MMSYSERR_INVALHANDLE);
}
}
return TRUE;
}
static const char * get_metric(UINT uMetric)
{
switch (uMetric) {
case ACM_METRIC_COUNT_CODECS:
return "ACM_METRIC_COUNT_CODECS";
case ACM_METRIC_COUNT_CONVERTERS:
return "ACM_METRIC_COUNT_CONVERTERS";
case ACM_METRIC_COUNT_DISABLED:
return "ACM_METRIC_COUNT_DISABLED";
case ACM_METRIC_COUNT_DRIVERS:
return "ACM_METRIC_COUNT_DRIVERS";
case ACM_METRIC_COUNT_FILTERS:
return "ACM_METRIC_COUNT_FILTERS";
case ACM_METRIC_COUNT_HARDWARE:
return "ACM_METRIC_COUNT_HARDWARE";
case ACM_METRIC_COUNT_LOCAL_CODECS:
return "ACM_METRIC_COUNT_LOCAL_CODECS";
case ACM_METRIC_COUNT_LOCAL_CONVERTERS:
return "ACM_METRIC_COUNT_LOCAL_CONVERTERS";
case ACM_METRIC_COUNT_LOCAL_DISABLED:
return "ACM_METRIC_COUNT_LOCAL_DISABLED";
case ACM_METRIC_COUNT_LOCAL_DRIVERS:
return "ACM_METRIC_COUNT_LOCAL_DRIVERS";
case ACM_METRIC_COUNT_LOCAL_FILTERS:
return "ACM_METRIC_COUNT_LOCAL_FILTERS";
case ACM_METRIC_DRIVER_PRIORITY:
return "ACM_METRIC_DRIVER_PRIORITY";
case ACM_METRIC_DRIVER_SUPPORT:
return "ACM_METRIC_DRIVER_SUPPORT";
case ACM_METRIC_HARDWARE_WAVE_INPUT:
return "ACM_METRIC_HARDWARE_WAVE_INPUT";
case ACM_METRIC_HARDWARE_WAVE_OUTPUT:
return "ACM_METRIC_HARDWARE_WAVE_OUTPUT";
case ACM_METRIC_MAX_SIZE_FILTER:
return "ACM_METRIC_MAX_SIZE_FILTER";
case ACM_METRIC_MAX_SIZE_FORMAT:
return "ACM_METRIC_MAX_SIZE_FORMAT";
}
return "UNKNOWN";
}
static DWORD check_count(UINT uMetric)
{
DWORD dwMetric;
MMRESULT rc;
/* try invalid result pointer */
rc = acmMetrics(NULL, uMetric, 0);
ok(rc == MMSYSERR_INVALPARAM,
"acmMetrics(NULL, %s, 0): rc = 0x%08x, should be 0x%08x\n",
get_metric(uMetric), rc, MMSYSERR_INVALPARAM);
/* try invalid handle */
rc = acmMetrics((HACMOBJ)1, uMetric, &dwMetric);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(1, %s, %p): rc = 0x%08x, should be 0x%08x\n",
get_metric(uMetric), &dwMetric, rc, MMSYSERR_INVALHANDLE);
/* try invalid result pointer and handle */
rc = acmMetrics((HACMOBJ)1, uMetric, 0);
ok(rc == MMSYSERR_INVALHANDLE,
"acmMetrics(1, %s, 0): rc = 0x%08x, should be 0x%08x\n",
get_metric(uMetric), rc, MMSYSERR_INVALHANDLE);
/* try valid parameters */
rc = acmMetrics(NULL, uMetric, &dwMetric);
ok(rc == MMSYSERR_NOERROR, "acmMetrics() failed: rc = 0x%08x\n", rc);
if (rc == MMSYSERR_NOERROR)
trace("%s: %lu\n", get_metric(uMetric), dwMetric);
return dwMetric;
}
static void msacm_tests()
{
MMRESULT rc;
DWORD dwCount;
DWORD dwACMVersion = acmGetVersion();
trace("ACM version = %u.%02u build %u%s\n",
HIWORD(dwACMVersion) >> 8,
HIWORD(dwACMVersion) & 0xff,
LOWORD(dwACMVersion),
LOWORD(dwACMVersion) == 0 ? " (Retail)" : "");
dwCount = check_count(ACM_METRIC_COUNT_CODECS);
dwCount = check_count(ACM_METRIC_COUNT_CONVERTERS);
dwCount = check_count(ACM_METRIC_COUNT_DISABLED);
dwCount = check_count(ACM_METRIC_COUNT_DRIVERS);
dwCount = check_count(ACM_METRIC_COUNT_FILTERS);
dwCount = check_count(ACM_METRIC_COUNT_HARDWARE);
dwCount = check_count(ACM_METRIC_COUNT_LOCAL_CODECS);
dwCount = check_count(ACM_METRIC_COUNT_LOCAL_CONVERTERS);
dwCount = check_count(ACM_METRIC_COUNT_LOCAL_DISABLED);
dwCount = check_count(ACM_METRIC_COUNT_LOCAL_DRIVERS);
dwCount = check_count(ACM_METRIC_COUNT_LOCAL_FILTERS);
trace("enabled drivers:\n");
rc = acmDriverEnum(DriverEnumProc, 0, 0);
ok(rc == MMSYSERR_NOERROR,
"acmDriverEnum() failed, rc=%08x, should be 0x%08x\n",
rc, MMSYSERR_NOERROR);
}
START_TEST(msacm)
{
msacm_tests();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment