Author: akhaldi
Date: Sun Feb 26 18:23:11 2017
New Revision: 73961
URL:
http://svn.reactos.org/svn/reactos?rev=73961&view=rev
Log:
[MSACM32_WINETEST] Sync with Wine Staging 2.2. CORE-12823
Modified:
trunk/rostests/winetests/msacm32/CMakeLists.txt
trunk/rostests/winetests/msacm32/msacm.c
Modified: trunk/rostests/winetests/msacm32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msacm32/CMakeLi…
==============================================================================
--- trunk/rostests/winetests/msacm32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/msacm32/CMakeLists.txt [iso-8859-1] Sun Feb 26 18:23:11 2017
@@ -1,5 +1,5 @@
add_executable(msacm32_winetest msacm.c testlist.c)
set_module_type(msacm32_winetest win32cui)
-add_importlibs(msacm32_winetest msacm32 msvcrt kernel32)
+add_importlibs(msacm32_winetest msacm32 winmm msvcrt kernel32)
add_rostests_file(TARGET msacm32_winetest)
Modified: trunk/rostests/winetests/msacm32/msacm.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msacm32/msacm.c…
==============================================================================
--- trunk/rostests/winetests/msacm32/msacm.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msacm32/msacm.c [iso-8859-1] Sun Feb 26 18:23:11 2017
@@ -31,6 +31,7 @@
#define NOBITMAP
#include "mmreg.h"
#include "msacm.h"
+#include "wine/msacmdrv.h"
static BOOL CALLBACK FormatTagEnumProc(HACMDRIVERID hadid,
PACMFORMATTAGDETAILSA paftd,
@@ -829,6 +830,7 @@
ok(rc == MMSYSERR_INVALPARAM, "failed with error 0x%x\n", rc);
}
+
void test_mp3(void)
{
MPEGLAYER3WAVEFORMAT src;
@@ -899,10 +901,175 @@
ok(mr == MMSYSERR_NOERROR, "failed with error 0x%x\n", mr);
}
+static struct
+{
+ struct
+ {
+ int load, free, open, close, enable, disable, install,
+ remove, details, notify, querycfg, about;
+ } driver;
+ struct
+ {
+ int tag_details, details, suggest;
+ } format;
+ struct
+ {
+ int open, close, size, convert, prepare, unprepare, reset;
+ } stream;
+ int other;
+} driver_calls;
+
+static LRESULT CALLBACK acm_driver_func(DWORD_PTR id, HDRVR handle, UINT msg, LPARAM
param1, LPARAM param2)
+{
+ switch (msg)
+ {
+ /* Driver messages */
+ case DRV_LOAD:
+ driver_calls.driver.load++;
+ return 1;
+ case DRV_FREE:
+ driver_calls.driver.free++;
+ return 1;
+ case DRV_OPEN:
+ driver_calls.driver.open++;
+ return 1;
+ case DRV_CLOSE:
+ driver_calls.driver.close++;
+ return 1;
+ case DRV_ENABLE:
+ driver_calls.driver.enable++;
+ return 1;
+ case DRV_DISABLE:
+ driver_calls.driver.disable++;
+ return 1;
+ case DRV_QUERYCONFIGURE:
+ driver_calls.driver.querycfg++;
+ return 1;
+ case DRV_INSTALL:
+ driver_calls.driver.install++;
+ return DRVCNF_RESTART;
+ case DRV_REMOVE:
+ driver_calls.driver.remove++;
+ return DRVCNF_RESTART;
+ case ACMDM_DRIVER_ABOUT:
+ driver_calls.driver.about++;
+ return MMSYSERR_NOTSUPPORTED;
+ case ACMDM_DRIVER_DETAILS:
+ {
+ ACMDRIVERDETAILSA *ptr = (ACMDRIVERDETAILSA *)param1;
+
+ /* copied from pcmconverter.c */
+ ptr->fccType = ACMDRIVERDETAILS_FCCTYPE_AUDIOCODEC;
+ ptr->fccComp = ACMDRIVERDETAILS_FCCCOMP_UNDEFINED;
+ ptr->wMid = MM_MICROSOFT;
+ ptr->wPid = MM_MSFT_ACM_PCM;
+ ptr->vdwACM = 0x01000000;
+ ptr->vdwDriver = 0x01000000;
+ ptr->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CONVERTER;
+ ptr->cFormatTags = 1;
+ ptr->cFilterTags = 0;
+ ptr->hicon = NULL;
+ strcpy(ptr->szShortName, "TEST-CODEC");
+ strcpy(ptr->szLongName, "Wine Test Codec");
+ strcpy(ptr->szCopyright, "Brought to you by the Wine team...");
+ strcpy(ptr->szLicensing, "Refer to LICENSE file");
+ ptr->szFeatures[0] = 0;
+
+ driver_calls.driver.details++;
+ break;
+ }
+ case ACMDM_DRIVER_NOTIFY:
+ driver_calls.driver.notify++;
+ return MMSYSERR_NOTSUPPORTED;
+
+ /* Format messages */
+ case ACMDM_FORMATTAG_DETAILS:
+ driver_calls.format.tag_details++;
+ break;
+ case ACMDM_FORMAT_DETAILS:
+ driver_calls.format.details++;
+ break;
+ case ACMDM_FORMAT_SUGGEST:
+ driver_calls.format.suggest++;
+ break;
+
+ /* Stream messages */
+ case ACMDM_STREAM_OPEN:
+ driver_calls.stream.open++;
+ break;
+ case ACMDM_STREAM_CLOSE:
+ driver_calls.stream.close++;
+ break;
+ case ACMDM_STREAM_SIZE:
+ driver_calls.stream.size++;
+ break;
+ case ACMDM_STREAM_CONVERT:
+ driver_calls.stream.convert++;
+ break;
+ case ACMDM_STREAM_RESET:
+ driver_calls.stream.reset++;
+ return MMSYSERR_NOTSUPPORTED;
+ case ACMDM_STREAM_PREPARE:
+ driver_calls.stream.prepare++;
+ break;
+ case ACMDM_STREAM_UNPREPARE:
+ driver_calls.stream.unprepare++;
+ break;
+
+ default:
+ driver_calls.other++;
+ return DefDriverProc(id, handle, msg, param1, param2);
+ }
+ return MMSYSERR_NOERROR;
+}
+
+static void test_acmDriverAdd(void)
+{
+ MMRESULT res;
+ HACMDRIVERID drvid;
+ union
+ {
+ ACMDRIVERDETAILSA drv_details;
+ } acm;
+
+ /* Driver load steps:
+ * - acmDriverAdd checks the passed parameters
+ * - DRV_LOAD message is sent - required
+ * - DRV_ENABLE message is sent - required
+ * - DRV_OPEN message is sent - required
+ * - DRV_DETAILS message is sent - required
+ * - ACMDM_FORMATTAG_DETAILS message is sent - optional
+ * - DRV_QUERYCONFIGURE message is sent - optional
+ * - ACMDM_DRIVER_ABOUT message is sent - optional
+ */
+
+ res = acmDriverAddA(&drvid, GetModuleHandleA(NULL), (LPARAM)acm_driver_func, 0,
ACM_DRIVERADDF_FUNCTION);
+ ok(res == MMSYSERR_NOERROR, "Expected 0, got %d\n", res);
+todo_wine
+ ok(driver_calls.driver.open == 1, "Expected 1, got %d\n",
driver_calls.driver.open);
+ ok(driver_calls.driver.details == 1, "Expected 1, got %d\n",
driver_calls.driver.details);
+
+ memset(&acm, 0, sizeof(acm));
+ res = acmDriverDetailsA(drvid, &acm.drv_details, 0);
+ ok(res == MMSYSERR_INVALPARAM, "Expected 11, got %d\n", res);
+
+ acm.drv_details.cbStruct = sizeof(acm.drv_details);
+ res = acmDriverDetailsA(drvid, &acm.drv_details, 0);
+ ok(res == MMSYSERR_NOERROR, "Expected 0, got %d\n", res);
+todo_wine
+ ok(driver_calls.driver.open == 1, "Expected 1, got %d\n",
driver_calls.driver.open);
+ ok(driver_calls.driver.details == 2, "Expected 2, got %d\n",
driver_calls.driver.details);
+todo_wine
+ ok(driver_calls.driver.close == 0, "Expected 0, got %d\n",
driver_calls.driver.close);
+}
+
START_TEST(msacm)
{
driver_tests();
test_prepareheader();
test_acmFormatSuggest();
test_mp3();
-}
+ /* Test acmDriverAdd in the end as it may conflict
+ * with other tests due to codec lookup order */
+ test_acmDriverAdd();
+}