Module: wine Branch: master Commit: a60204461afc907f5377d416dbbe8ca5387dc055 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a60204461afc907f5377d416db...
Author: Detlef Riekenberg wine.dev@web.de Date: Sun Jan 10 17:37:36 2010 +0100
avifil32/tests: Add initial tests.
---
configure | 9 ++++ configure.ac | 1 + dlls/avifil32/tests/Makefile.in | 13 +++++ dlls/avifil32/tests/api.c | 97 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 120 insertions(+), 0 deletions(-)
diff --git a/configure b/configure index a97fe17..b92e426 100755 --- a/configure +++ b/configure @@ -13817,6 +13817,14 @@ dlls/avifil32/Makefile: dlls/avifil32/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/avifil32/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \ + dlls/avifil32/tests/Makefile" +test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \ + avifil32/tests" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/avifil32/tests/Makefile: dlls/avifil32/tests/Makefile.in dlls/Maketest.rules" +ac_config_files="$ac_config_files dlls/avifil32/tests/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \ dlls/avifile.dll16/Makefile" test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \ avifile.dll16" @@ -18761,6 +18769,7 @@ do "dlls/authz/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/authz/Makefile" ;; "dlls/avicap32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/avicap32/Makefile" ;; "dlls/avifil32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/avifil32/Makefile" ;; + "dlls/avifil32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/avifil32/tests/Makefile" ;; "dlls/avifile.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/avifile.dll16/Makefile" ;; "dlls/avrt/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/avrt/Makefile" ;; "dlls/bcrypt/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/bcrypt/Makefile" ;; diff --git a/configure.ac b/configure.ac index 6cae9ba..943938b 100644 --- a/configure.ac +++ b/configure.ac @@ -2138,6 +2138,7 @@ WINE_CONFIG_MAKEFILE([dlls/atl/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DI WINE_CONFIG_MAKEFILE([dlls/authz/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/avicap32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/avifil32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/avifil32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/avifile.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/avrt/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/bcrypt/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) diff --git a/dlls/avifil32/tests/Makefile.in b/dlls/avifil32/tests/Makefile.in new file mode 100644 index 0000000..c43ac34 --- /dev/null +++ b/dlls/avifil32/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = avifil32.dll +IMPORTS = avifil32 kernel32 + +CTESTS = \ + api.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/avifil32/tests/api.c b/dlls/avifil32/tests/api.c new file mode 100644 index 0000000..55b194f --- /dev/null +++ b/dlls/avifil32/tests/api.c @@ -0,0 +1,97 @@ +/* + * Unit test suite for AVI Functions + * + * Copyright 2008 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 "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "vfw.h" +#include "wine/test.h" + +/* ########################### */ + +static const CHAR winetest0[] = "winetest0"; +static const CHAR winetest1[] = "winetest1"; + +/* ########################### */ + +static void test_AVISaveOptions(void) +{ + AVICOMPRESSOPTIONS options[2]; + LPAVICOMPRESSOPTIONS poptions[2]; + PAVISTREAM streams[2] = {NULL, NULL}; + HRESULT hres; + DWORD res; + LONG lres; + + poptions[0] = &options[0]; + poptions[1] = &options[1]; + ZeroMemory(options, sizeof(options)); + + SetLastError(0xdeadbeef); + hres = CreateEditableStream(&streams[0], NULL); + ok(hres == AVIERR_OK, "0: got 0x%x and %p (expected AVIERR_OK)\n", hres, streams[0]); + + SetLastError(0xdeadbeef); + hres = CreateEditableStream(&streams[1], NULL); + ok(hres == AVIERR_OK, "1: got 0x%x and %p (expected AVIERR_OK)\n", hres, streams[1]); + + SetLastError(0xdeadbeef); + hres = EditStreamSetNameA(streams[0], winetest0); + todo_wine ok(hres == AVIERR_OK, "0: got 0x%x (expected AVIERR_OK)\n", hres); + + SetLastError(0xdeadbeef); + hres = EditStreamSetNameA(streams[1], winetest1); + todo_wine ok(hres == AVIERR_OK, "1: got 0x%x (expected AVIERR_OK)\n", hres); + + if (winetest_interactive) { + SetLastError(0xdeadbeef); + res = AVISaveOptions(0, ICMF_CHOOSE_DATARATE |ICMF_CHOOSE_KEYFRAME | ICMF_CHOOSE_ALLCOMPRESSORS, + 2, streams, poptions); + trace("got %u with 0x%x/%u\n", res, GetLastError(), GetLastError()); + } + + SetLastError(0xdeadbeef); + lres = AVISaveOptionsFree(2, poptions); + ok(lres == AVIERR_OK, "got 0x%x with 0x%x/%u\n", lres, GetLastError(), GetLastError()); + + SetLastError(0xdeadbeef); + res = AVIStreamRelease(streams[0]); + ok(res == 0, "0: got refcount %u (expected 0)\n", res); + + SetLastError(0xdeadbeef); + res = AVIStreamRelease(streams[1]); + ok(res == 0, "1: got refcount %u (expected 0)\n", res); + +} + +/* ########################### */ + +START_TEST(api) +{ + + AVIFileInit(); + test_AVISaveOptions(); + AVIFileExit(); + +}