wiaservc/tests: Basic test for device enumerator.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-10-08 00:12:34 +03:00 committed by Alexandre Julliard
parent 4185cc7a94
commit 6fc2d3ce2e
8 changed files with 110 additions and 0 deletions

1
configure vendored
View File

@ -17872,6 +17872,7 @@ wine_fn_config_dll wer enable_wer implib
wine_fn_config_test dlls/wer/tests wer_test
wine_fn_config_dll wevtapi enable_wevtapi
wine_fn_config_dll wiaservc enable_wiaservc clean
wine_fn_config_test dlls/wiaservc/tests wiaservc_test
wine_fn_config_dll win32s16.dll16 enable_win16
wine_fn_config_dll win87em.dll16 enable_win16
wine_fn_config_dll winaspi.dll16 enable_win16

View File

@ -3385,6 +3385,7 @@ WINE_CONFIG_DLL(wer,,[implib])
WINE_CONFIG_TEST(dlls/wer/tests)
WINE_CONFIG_DLL(wevtapi)
WINE_CONFIG_DLL(wiaservc,,[clean])
WINE_CONFIG_TEST(dlls/wiaservc/tests)
WINE_CONFIG_DLL(win32s16.dll16,enable_win16)
WINE_CONFIG_DLL(win87em.dll16,enable_win16)
WINE_CONFIG_DLL(winaspi.dll16,enable_win16)

View File

@ -0,0 +1,5 @@
TESTDLL = wiaservc.dll
IMPORTS = ole32
C_SRCS = \
wia.c

76
dlls/wiaservc/tests/wia.c Normal file
View File

@ -0,0 +1,76 @@
/*
* Unit test suite for WIA system
*
* Copyright 2015 Nikolay Sivov for CodeWeavers
*
* 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 <stdio.h>
#define COBJMACROS
#include "objbase.h"
#include "initguid.h"
#include "wia_lh.h"
#include "wine/test.h"
static IWiaDevMgr *devmanager;
static void test_EnumDeviceInfo(void)
{
IEnumWIA_DEV_INFO *devenum;
HRESULT hr;
ULONG count;
hr = IWiaDevMgr_EnumDeviceInfo(devmanager, WIA_DEVINFO_ENUM_LOCAL, NULL);
ok(FAILED(hr), "got 0x%08x\n", hr);
hr = IWiaDevMgr_EnumDeviceInfo(devmanager, WIA_DEVINFO_ENUM_LOCAL, &devenum);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
if (hr == S_OK) {
hr = IEnumWIA_DEV_INFO_GetCount(devenum, NULL);
ok(FAILED(hr), "got 0x%08x\n", hr);
count = 1000;
hr = IEnumWIA_DEV_INFO_GetCount(devenum, &count);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(count != 1000, "got %u\n", count);
IEnumWIA_DEV_INFO_Release(devenum);
}
}
START_TEST(wia)
{
HRESULT hr;
CoInitialize(NULL);
hr = CoCreateInstance(&CLSID_WiaDevMgr, NULL, CLSCTX_LOCAL_SERVER, &IID_IWiaDevMgr, (void**)&devmanager);
if (FAILED(hr)) {
win_skip("Failed to create WiaDevMgr instance, 0x%08x\n", hr);
CoUninitialize();
return;
}
test_EnumDeviceInfo();
IWiaDevMgr_Release(devmanager);
CoUninitialize();
}

View File

@ -611,6 +611,7 @@ SRCDIR_INCLUDES = \
werapi.h \
wfext.h \
wia.h \
wiadef.h \
winbase.h \
wincon.h \
wincred.h \

View File

@ -20,6 +20,8 @@ import "unknwn.idl";
import "oaidl.idl";
import "propidl.idl";
cpp_quote("#include <wiadef.h>")
interface IEnumWIA_DEV_INFO;
interface IWiaPropertyStorage;
interface IWiaItem;

View File

@ -20,6 +20,8 @@ import "unknwn.idl";
import "oaidl.idl";
import "propidl.idl";
cpp_quote("#include <wiadef.h>")
interface IEnumWIA_DEV_INFO;
interface IWiaPropertyStorage;
interface IWiaItem;

22
include/wiadef.h Normal file
View File

@ -0,0 +1,22 @@
/*
* WIA constants
*
* Copyright 2015 Nikolay Sivov for CodeWeavers
*
* 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
*/
#define WIA_DEVINFO_ENUM_ALL 0x0000000f
#define WIA_DEVINFO_ENUM_LOCAL 0x00000010