Module: wine Branch: master Commit: 6fc2d3ce2e0e46b1c1302c7279689d843d1c40d9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6fc2d3ce2e0e46b1c1302c7279...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Oct 8 00:12:34 2015 +0300
wiaservc/tests: Basic test for device enumerator.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
configure | 1 + configure.ac | 1 + dlls/wiaservc/tests/Makefile.in | 5 +++ dlls/wiaservc/tests/wia.c | 76 +++++++++++++++++++++++++++++++++++++++++ include/Makefile.in | 1 + include/wia_lh.idl | 2 ++ include/wia_xp.idl | 2 ++ include/wiadef.h | 22 ++++++++++++ 8 files changed, 110 insertions(+)
diff --git a/configure b/configure index 8b1fb86..2ba059a 100755 --- a/configure +++ b/configure @@ -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 diff --git a/configure.ac b/configure.ac index 5e83d39..1e9bd66 100644 --- a/configure.ac +++ b/configure.ac @@ -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) diff --git a/dlls/wiaservc/tests/Makefile.in b/dlls/wiaservc/tests/Makefile.in new file mode 100644 index 0000000..594e1b2 --- /dev/null +++ b/dlls/wiaservc/tests/Makefile.in @@ -0,0 +1,5 @@ +TESTDLL = wiaservc.dll +IMPORTS = ole32 + +C_SRCS = \ + wia.c diff --git a/dlls/wiaservc/tests/wia.c b/dlls/wiaservc/tests/wia.c new file mode 100644 index 0000000..e3f4edb --- /dev/null +++ b/dlls/wiaservc/tests/wia.c @@ -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(); +} diff --git a/include/Makefile.in b/include/Makefile.in index 84a6381..3d2c97f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -611,6 +611,7 @@ SRCDIR_INCLUDES = \ werapi.h \ wfext.h \ wia.h \ + wiadef.h \ winbase.h \ wincon.h \ wincred.h \ diff --git a/include/wia_lh.idl b/include/wia_lh.idl index 7cadbc6..284528a 100644 --- a/include/wia_lh.idl +++ b/include/wia_lh.idl @@ -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; diff --git a/include/wia_xp.idl b/include/wia_xp.idl index 7cadbc6..284528a 100644 --- a/include/wia_xp.idl +++ b/include/wia_xp.idl @@ -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; diff --git a/include/wiadef.h b/include/wiadef.h new file mode 100644 index 0000000..28e43e0 --- /dev/null +++ b/include/wiadef.h @@ -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