From: Dan Kegel Subject: openal32: test whether alGetError() returns AL_NO_ERROR when called out of context, with fix. Message-Id: Date: Sat, 18 Jun 2011 20:32:31 -0700 Matches native behavior. Makes at least one app happier; see bug 27532. From 3e4e33425fbdcaac400e4ef3df36cb48b32a8b98 Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Sat, 18 Jun 2011 20:24:10 -0700 Subject: [PATCH] openal32: test whether alGetError() returns AL_NO_ERROR when called out of context, with fix. Matches native behavior. Makes at least one app happier; see bug 27532. --- configure.ac | 1 + dlls/openal32/Makefile.in | 1 + dlls/openal32/openal.c | 5 ++++ dlls/openal32/tests/Makefile.in | 7 ++++++ dlls/openal32/tests/openal.c | 42 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 0 deletions(-) create mode 100644 dlls/openal32/tests/Makefile.in create mode 100644 dlls/openal32/tests/openal.c diff --git a/configure.ac b/configure.ac index 683bae9..3469f3a 100644 --- a/configure.ac +++ b/configure.ac @@ -2738,6 +2738,7 @@ WINE_CONFIG_DLL(olesvr.dll16,enable_win16) WINE_CONFIG_DLL(olesvr32,,[implib]) WINE_CONFIG_DLL(olethk32) WINE_CONFIG_DLL(openal32) +WINE_CONFIG_TEST(dlls/openal32/tests) WINE_CONFIG_DLL(opencl) WINE_CONFIG_DLL(opengl32,,[implib]) WINE_CONFIG_TEST(dlls/opengl32/tests) diff --git a/dlls/openal32/Makefile.in b/dlls/openal32/Makefile.in index 34d43dc..5600ca1 100644 --- a/dlls/openal32/Makefile.in +++ b/dlls/openal32/Makefile.in @@ -1,4 +1,5 @@ MODULE = openal32.dll +IMPORTLIB = openal32 EXTRALIBS = @LIBOPENAL@ @FRAMEWORK_OPENAL@ C_SRCS = \ diff --git a/dlls/openal32/openal.c b/dlls/openal32/openal.c index 15206f3..f614ddb 100644 --- a/dlls/openal32/openal.c +++ b/dlls/openal32/openal.c @@ -336,6 +336,11 @@ ALdouble CDECL wine_alGetDouble(ALenum param) ALenum CDECL wine_alGetError(ALvoid) { + /* Native alGetError() returns AL_NO_ERROR here. + * At least one app relies on this. + */ + if (alcGetThreadContext() == NULL) + return AL_NO_ERROR; return alGetError(); } diff --git a/dlls/openal32/tests/Makefile.in b/dlls/openal32/tests/Makefile.in new file mode 100644 index 0000000..8d404c7 --- /dev/null +++ b/dlls/openal32/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = openal32.dll +IMPORTS = openal32 + +C_SRCS = \ + openal.c + +@MAKE_TEST_RULES@ diff --git a/dlls/openal32/tests/openal.c b/dlls/openal32/tests/openal.c new file mode 100644 index 0000000..0fa9789 --- /dev/null +++ b/dlls/openal32/tests/openal.c @@ -0,0 +1,42 @@ +/* + * OpenAL tests + * + * Copyright 2011 (C) Dan Kegel + * + * 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 "windef.h" +#include "wine/test.h" + +/* Wine does not provide al.h headers, so fake them here */ +/* #include */ +typedef int ALenum; +#define AL_APIENTRY CDECL +#define AL_API __declspec(dllimport) +#define AL_NO_ERROR 0 + +AL_API ALenum AL_APIENTRY alGetError( void ); + +static void test_init() +{ + ALenum e = alGetError(); + ok(e == AL_NO_ERROR, "alGetError() at start of program reports failure\n"); +} + +START_TEST(openal) +{ + test_init(); +} -- 1.7.4.1