sti: Test behavior of creation with the A/W functions versus STI_VERSION_FLAG_UNICODE.

This commit is contained in:
Damjan Jovanovic 2009-09-26 17:59:54 +02:00 committed by Alexandre Julliard
parent 0342ab0df1
commit ee1dd49076
4 changed files with 179 additions and 0 deletions

9
configure vendored
View File

@ -16609,6 +16609,14 @@ ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/sti/Makefile: dlls/sti/Makefile.in dlls/Makedll.rules"
ac_config_files="$ac_config_files dlls/sti/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/sti/tests/Makefile"
test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\
sti/tests"
ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS
dlls/sti/tests/Makefile: dlls/sti/tests/Makefile.in dlls/Maketest.rules"
ac_config_files="$ac_config_files dlls/sti/tests/Makefile"
ALL_MAKEFILES="$ALL_MAKEFILES \\
dlls/storage.dll16/Makefile"
test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\
@ -19031,6 +19039,7 @@ do
"dlls/stdole2.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole2.tlb/Makefile" ;;
"dlls/stdole32.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole32.tlb/Makefile" ;;
"dlls/sti/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/Makefile" ;;
"dlls/sti/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/tests/Makefile" ;;
"dlls/storage.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/storage.dll16/Makefile" ;;
"dlls/stress.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stress.dll16/Makefile" ;;
"dlls/strmiids/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/strmiids/Makefile" ;;

View File

@ -2437,6 +2437,7 @@ WINE_CONFIG_MAKEFILE([dlls/spoolss/tests/Makefile],[dlls/Maketest.rules],[dlls],
WINE_CONFIG_MAKEFILE([dlls/stdole2.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/stdole32.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/sti/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS])
WINE_CONFIG_MAKEFILE([dlls/sti/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests])
WINE_CONFIG_MAKEFILE([dlls/storage.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
WINE_CONFIG_MAKEFILE([dlls/stress.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16])
WINE_CONFIG_MAKEFILE([dlls/strmiids/Makefile],[dlls/Makeimplib.rules],[dlls],[ALL_IMPLIB_DIRS])

View File

@ -0,0 +1,15 @@
EXTRADEFS = -DCOM_NO_WINDOWS_H
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = sti.dll
IMPORTS = ole32 kernel32
EXTRALIBS = -luuid
CTESTS = \
sti.c
@MAKE_TEST_RULES@
@DEPENDENCIES@ # everything below this line is overwritten by make depend

154
dlls/sti/tests/sti.c Normal file
View File

@ -0,0 +1,154 @@
/*
* General still image implementation
*
* Copyright 2009 Damjan Jovanovic
*
* 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 <assert.h>
#include "windef.h"
#include "winbase.h"
#define COBJMACROS
#include <initguid.h>
#include <sti.h>
#include <guiddef.h>
#include <devguid.h>
#include <stdio.h>
#include "wine/test.h"
static HMODULE sti_dll;
static HRESULT (WINAPI *pStiCreateInstance)(HINSTANCE,DWORD,PSTIW*,LPUNKNOWN);
static HRESULT (WINAPI *pStiCreateInstanceA)(HINSTANCE,DWORD,PSTIA*,LPUNKNOWN);
static HRESULT (WINAPI *pStiCreateInstanceW)(HINSTANCE,DWORD,PSTIW*,LPUNKNOWN);
static BOOL init_function_pointers(void)
{
sti_dll = LoadLibrary("sti.dll");
if (sti_dll)
{
pStiCreateInstance = (void*)
GetProcAddress(sti_dll, "StiCreateInstance");
pStiCreateInstanceA = (void*)
GetProcAddress(sti_dll, "StiCreateInstanceA");
pStiCreateInstanceW = (void*)
GetProcAddress(sti_dll, "StiCreateInstanceW");
return TRUE;
}
return FALSE;
}
void test_version_flag_versus_aw(void)
{
HRESULT hr;
/* Who wins, the STI_VERSION_FLAG_UNICODE or the A/W function? And what about the neutral StiCreateInstance function? */
if (pStiCreateInstance)
{
PSTIW pStiW;
hr = pStiCreateInstance(GetModuleHandle(NULL), STI_VERSION_REAL, &pStiW, NULL);
if (SUCCEEDED(hr))
{
IUnknown *pUnknown;
hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown);
if (SUCCEEDED(hr))
{
ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n");
IUnknown_Release(pUnknown);
}
IUnknown_Release((IUnknown*)pStiW);
}
else
todo_wine ok(0, "could not create StillImageA, hr = 0x%X\n", hr);
hr = pStiCreateInstance(GetModuleHandle(NULL), STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE, &pStiW, NULL);
if (SUCCEEDED(hr))
{
IUnknown *pUnknown;
hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown);
if (SUCCEEDED(hr))
{
ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n");
IUnknown_Release(pUnknown);
}
IUnknown_Release((IUnknown*)pStiW);
}
else
todo_wine ok(0, "could not create StillImageW, hr = 0x%X\n", hr);
}
else
skip("No StiCreateInstance function\n");
if (pStiCreateInstanceA)
{
PSTIA pStiA;
hr = pStiCreateInstanceA(GetModuleHandle(NULL), STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE, &pStiA, NULL);
if (SUCCEEDED(hr))
{
IUnknown *pUnknown;
hr = IUnknown_QueryInterface((IUnknown*)pStiA, &IID_IStillImageA, (void**)&pUnknown);
if (SUCCEEDED(hr))
{
ok(pUnknown == (IUnknown*)pStiA, "created interface was not IID_IStillImageA\n");
IUnknown_Release(pUnknown);
}
IUnknown_Release((IUnknown*)pStiA);
}
else
todo_wine ok(0, "could not create StillImageA, hr = 0x%X\n", hr);
}
else
skip("No StiCreateInstanceA function\n");
if (pStiCreateInstanceW)
{
PSTIW pStiW;
hr = pStiCreateInstanceW(GetModuleHandle(NULL), STI_VERSION_REAL, &pStiW, NULL);
if (SUCCEEDED(hr))
{
IUnknown *pUnknown;
hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown);
if (SUCCEEDED(hr))
{
ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n");
IUnknown_Release((IUnknown*)pUnknown);
}
IUnknown_Release((IUnknown*)pStiW);
}
else
todo_wine ok(0, "could not create StillImageW, hr = 0x%X\n", hr);
}
else
skip("No StiCreateInstanceW function\n");
}
START_TEST(sti)
{
if (SUCCEEDED(CoInitialize(NULL)))
{
if (init_function_pointers())
{
test_version_flag_versus_aw();
FreeLibrary(sti_dll);
}
else
skip("could not load sti.dll\n");
CoUninitialize();
}
else
skip("CoInitialize failed\n");
}