avifil32/tests: Add initial tests.

This commit is contained in:
Detlef Riekenberg 2010-01-10 17:37:36 +01:00 committed by Alexandre Julliard
parent 7c3b9a1551
commit a60204461a
4 changed files with 120 additions and 0 deletions

9
configure vendored
View File

@ -13816,6 +13816,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
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 \\
@ -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" ;;

View File

@ -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])

View File

@ -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

97
dlls/avifil32/tests/api.c Normal file
View File

@ -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();
}