2007-02-05 17:53:42 +01:00
|
|
|
/* Unit tests for autocomplete
|
|
|
|
*
|
|
|
|
* Copyright 2007 Mikolaj Zalewski
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2007-02-05 17:53:42 +01:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
2008-07-08 16:17:17 +02:00
|
|
|
#include <initguid.h>
|
2007-02-05 17:53:42 +01:00
|
|
|
#include <windows.h>
|
|
|
|
#include <shlobj.h>
|
2011-09-27 00:17:45 +02:00
|
|
|
#include <shldisp.h>
|
2007-02-05 17:53:42 +01:00
|
|
|
#include <shlwapi.h>
|
2008-09-07 10:47:55 +02:00
|
|
|
#include <shlguid.h>
|
2007-02-05 17:53:42 +01:00
|
|
|
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
|
|
|
#define ole_ok(exp) \
|
|
|
|
{ \
|
|
|
|
HRESULT res = (exp); \
|
|
|
|
if (res != S_OK) \
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(FALSE, #exp " failed: %#lx\n", res); \
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static LPWSTR strdup_AtoW(LPCSTR str)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
int size = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
2009-01-04 01:46:07 +01:00
|
|
|
LPWSTR wstr = CoTaskMemAlloc((size + 1)*sizeof(WCHAR));
|
2007-02-05 17:53:42 +01:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, str, -1, wstr, size+1);
|
|
|
|
return wstr;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
IEnumString IEnumString_iface;
|
|
|
|
IACList IACList_iface;
|
2007-02-05 17:53:42 +01:00
|
|
|
LONG ref;
|
|
|
|
HRESULT expret;
|
|
|
|
INT expcount;
|
|
|
|
INT pos;
|
|
|
|
INT limit;
|
|
|
|
const char **data;
|
|
|
|
} TestACL;
|
|
|
|
|
|
|
|
extern IEnumStringVtbl TestACLVtbl;
|
|
|
|
extern IACListVtbl TestACL_ACListVtbl;
|
|
|
|
|
2011-03-24 13:44:14 +01:00
|
|
|
static inline TestACL *impl_from_IEnumString(IEnumString *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, TestACL, IEnumString_iface);
|
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static TestACL *impl_from_IACList(IACList *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
return CONTAINING_RECORD(iface, TestACL, IACList_iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static TestACL *TestACL_Constructor(int limit, const char **strings)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
TestACL *This = CoTaskMemAlloc(sizeof(TestACL));
|
|
|
|
ZeroMemory(This, sizeof(*This));
|
2011-03-24 13:44:14 +01:00
|
|
|
This->IEnumString_iface.lpVtbl = &TestACLVtbl;
|
|
|
|
This->IACList_iface.lpVtbl = &TestACL_ACListVtbl;
|
2007-02-05 17:53:42 +01:00
|
|
|
This->ref = 1;
|
|
|
|
This->expret = S_OK;
|
|
|
|
This->limit = limit;
|
|
|
|
This->data = strings;
|
|
|
|
return This;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE TestACL_AddRef(IEnumString *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IEnumString(iface);
|
2022-02-22 09:30:46 +01:00
|
|
|
trace("ACL(%p): addref (%ld)\n", This, This->ref+1);
|
2007-02-05 17:53:42 +01:00
|
|
|
return InterlockedIncrement(&This->ref);
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE TestACL_Release(IEnumString *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IEnumString(iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
res = InterlockedDecrement(&This->ref);
|
2022-02-22 09:30:46 +01:00
|
|
|
trace("ACL(%p): release (%ld)\n", This, res);
|
2007-02-05 17:53:42 +01:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_QueryInterface(IEnumString *iface, REFIID iid, LPVOID *ppvOut)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IEnumString(iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IEnumString))
|
|
|
|
{
|
|
|
|
*ppvOut = iface;
|
|
|
|
}
|
|
|
|
else if (IsEqualGUID(iid, &IID_IACList))
|
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
*ppvOut = &This->IACList_iface;
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
2013-08-24 06:38:06 +02:00
|
|
|
IEnumString_AddRef(iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!IsEqualGUID(iid, &IID_IEnumACString))
|
|
|
|
trace("unknown interface queried\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_Next(IEnumString *iface, ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IEnumString(iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
ULONG i;
|
|
|
|
|
2022-02-22 09:30:46 +01:00
|
|
|
trace("ACL(%p): read %ld item(s)\n", This, celt);
|
2007-02-05 17:53:42 +01:00
|
|
|
for (i = 0; i < celt; i++)
|
|
|
|
{
|
|
|
|
if (This->pos >= This->limit)
|
|
|
|
break;
|
|
|
|
rgelt[i] = strdup_AtoW(This->data[This->pos]);
|
|
|
|
This->pos++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pceltFetched)
|
|
|
|
*pceltFetched = i;
|
|
|
|
if (i == celt)
|
|
|
|
return S_OK;
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_Skip(IEnumString *iface, ULONG celt)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
ok(FALSE, "Unexpected call to TestACL_Skip\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_Clone(IEnumString *iface, IEnumString **out)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
ok(FALSE, "Unexpected call to TestACL_Clone\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_Reset(IEnumString *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IEnumString(iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
trace("ACL(%p): Reset\n", This);
|
|
|
|
This->pos = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_Expand(IACList *iface, LPCOLESTR str)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
TestACL *This = impl_from_IACList(iface);
|
2011-03-24 13:44:14 +01:00
|
|
|
trace("ACL(%p): Expand\n", This);
|
2007-02-05 17:53:42 +01:00
|
|
|
This->expcount++;
|
|
|
|
return This->expret;
|
|
|
|
}
|
|
|
|
|
|
|
|
IEnumStringVtbl TestACLVtbl =
|
|
|
|
{
|
|
|
|
TestACL_QueryInterface,
|
|
|
|
TestACL_AddRef,
|
|
|
|
TestACL_Release,
|
|
|
|
|
|
|
|
TestACL_Next,
|
|
|
|
TestACL_Skip,
|
|
|
|
TestACL_Reset,
|
|
|
|
TestACL_Clone
|
|
|
|
};
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE TestACL_ACList_AddRef(IACList *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IACList(iface);
|
|
|
|
return TestACL_AddRef(&This->IEnumString_iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static ULONG STDMETHODCALLTYPE TestACL_ACList_Release(IACList *iface)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IACList(iface);
|
|
|
|
return TestACL_Release(&This->IEnumString_iface);
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2008-12-28 10:37:40 +01:00
|
|
|
static HRESULT STDMETHODCALLTYPE TestACL_ACList_QueryInterface(IACList *iface, REFIID iid, LPVOID *ppvout)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
2011-03-24 13:44:14 +01:00
|
|
|
TestACL *This = impl_from_IACList(iface);
|
|
|
|
return TestACL_QueryInterface(&This->IEnumString_iface, iid, ppvout);
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
IACListVtbl TestACL_ACListVtbl =
|
|
|
|
{
|
|
|
|
TestACL_ACList_QueryInterface,
|
|
|
|
TestACL_ACList_AddRef,
|
|
|
|
TestACL_ACList_Release,
|
|
|
|
|
|
|
|
TestACL_Expand
|
|
|
|
};
|
|
|
|
|
|
|
|
#define expect_str(obj, str) \
|
|
|
|
{ \
|
2013-08-24 06:38:06 +02:00
|
|
|
ole_ok(IEnumString_Next(obj, 1, &wstr, &i)); \
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(i == 1, "Expected i == 1, got %ld\n", i); \
|
2007-02-05 17:53:42 +01:00
|
|
|
ok(str[0] == wstr[0], "String mismatch\n"); \
|
2009-12-12 15:21:17 +01:00
|
|
|
CoTaskMemFree(wstr); \
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2007-03-12 16:50:54 +01:00
|
|
|
static void test_ACLMulti(void)
|
2007-02-05 17:53:42 +01:00
|
|
|
{
|
|
|
|
const char *strings1[] = {"a", "c", "e"};
|
|
|
|
const char *strings2[] = {"a", "b", "d"};
|
2020-09-29 23:29:35 +02:00
|
|
|
const WCHAR exp[] = L"ABC";
|
2007-02-05 17:53:42 +01:00
|
|
|
IEnumString *obj;
|
2011-09-27 00:17:45 +02:00
|
|
|
IEnumACString *unk;
|
2011-09-28 17:37:24 +02:00
|
|
|
HRESULT hr;
|
2007-02-05 17:53:42 +01:00
|
|
|
TestACL *acl1, *acl2;
|
|
|
|
IACList *acl;
|
|
|
|
IObjMgr *mgr;
|
|
|
|
LPWSTR wstr;
|
|
|
|
LPWSTR wstrtab[15];
|
2022-02-22 09:30:46 +01:00
|
|
|
ULONG ref, i;
|
2007-02-05 17:53:42 +01:00
|
|
|
LPVOID tmp;
|
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = CoCreateInstance(&CLSID_ACLMulti, NULL, CLSCTX_INPROC, &IID_IEnumString, (void**)&obj);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
if (hr != S_OK) return;
|
2011-09-27 00:17:45 +02:00
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_QueryInterface(obj, &IID_IACList, (void**)&acl);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_QueryInterface(obj, &IID_IACList2, &tmp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_NOINTERFACE, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_QueryInterface(obj, &IID_IObjMgr, (void**)&mgr);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IEnumString_QueryInterface(obj, &IID_IEnumACString, (LPVOID*)&unk);
|
2011-09-28 17:37:24 +02:00
|
|
|
if (hr == E_NOINTERFACE)
|
|
|
|
todo_wine win_skip("IEnumACString is not supported, skipping tests\n");
|
|
|
|
else
|
|
|
|
{
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2011-09-28 17:37:24 +02:00
|
|
|
if (unk != NULL)
|
2013-08-24 06:38:06 +02:00
|
|
|
IEnumACString_Release(unk);
|
2011-09-28 17:37:24 +02:00
|
|
|
}
|
2007-02-05 17:53:42 +01:00
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
i = -1;
|
|
|
|
hr = IEnumString_Next(obj, 1, (LPOLESTR *)&tmp, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
|
|
|
ok(i == 0, "Unexpected fetched value %ld\n", i);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_Next(obj, 44, (LPOLESTR *)&tmp, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_Skip(obj, 1);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_NOTIMPL, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_Clone(obj, (IEnumString **)&tmp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
|
|
|
|
acl1 = TestACL_Constructor(3, strings1);
|
|
|
|
acl2 = TestACL_Constructor(3, strings2);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IObjMgr_Append(mgr, (IUnknown *)&acl1->IACList_iface);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IObjMgr_Append(mgr, (IUnknown *)&acl2->IACList_iface);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IObjMgr_Append(mgr, NULL);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
expect_str(obj, "a");
|
|
|
|
expect_str(obj, "c");
|
|
|
|
expect_str(obj, "e");
|
|
|
|
expect_str(obj, "a");
|
|
|
|
expect_str(obj, "b");
|
|
|
|
expect_str(obj, "d");
|
2022-02-22 09:30:46 +01:00
|
|
|
hr = IEnumString_Next(obj, 1, &wstr, &i);
|
|
|
|
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_Reset(obj);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
ok(acl1->pos == 0, "acl1 not reset\n");
|
|
|
|
ok(acl2->pos == 0, "acl2 not reset\n");
|
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
ok(acl1->expcount == 1, "expcount - expected 1, got %d\n", acl1->expcount);
|
2008-02-13 18:24:19 +01:00
|
|
|
ok(acl2->expcount == 0 /* XP */ || acl2->expcount == 1 /* Vista */,
|
|
|
|
"expcount - expected 0 or 1, got %d\n", acl2->expcount);
|
2007-02-05 17:53:42 +01:00
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IEnumString_Next(obj, 15, wstrtab, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
|
|
|
ok(i == 1, "Expected i == 1, got %ld\n", i);
|
2009-12-12 15:21:17 +01:00
|
|
|
CoTaskMemFree(wstrtab[0]);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IEnumString_Next(obj, 15, wstrtab, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2009-12-12 15:21:17 +01:00
|
|
|
CoTaskMemFree(wstrtab[0]);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IEnumString_Next(obj, 15, wstrtab, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2009-12-12 15:21:17 +01:00
|
|
|
CoTaskMemFree(wstrtab[0]);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IEnumString_Next(obj, 15, wstrtab, &i);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2009-12-12 15:21:17 +01:00
|
|
|
CoTaskMemFree(wstrtab[0]);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-07 16:22:33 +01:00
|
|
|
ok(acl1->expcount == 2, "expcount - expected 1, got %d\n", acl1->expcount);
|
2008-02-13 18:24:19 +01:00
|
|
|
ok(acl2->expcount == 0 /* XP */ || acl2->expcount == 2 /* Vista */,
|
|
|
|
"expcount - expected 0 or 2, got %d\n", acl2->expcount);
|
2007-02-05 17:53:42 +01:00
|
|
|
acl1->expret = S_FALSE;
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-07 16:22:33 +01:00
|
|
|
ok(acl1->expcount == 3, "expcount - expected 1, got %d\n", acl1->expcount);
|
2008-02-13 18:24:19 +01:00
|
|
|
ok(acl2->expcount == 1 /* XP */ || acl2->expcount == 3 /* Vista */,
|
|
|
|
"expcount - expected 0 or 3, got %d\n", acl2->expcount);
|
2007-02-05 17:53:42 +01:00
|
|
|
acl1->expret = E_NOTIMPL;
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-07 16:22:33 +01:00
|
|
|
ok(acl1->expcount == 4, "expcount - expected 1, got %d\n", acl1->expcount);
|
2008-02-13 18:24:19 +01:00
|
|
|
ok(acl2->expcount == 2 /* XP */ || acl2->expcount == 4 /* Vista */,
|
|
|
|
"expcount - expected 0 or 4, got %d\n", acl2->expcount);
|
2007-02-05 17:53:42 +01:00
|
|
|
acl2->expret = E_OUTOFMEMORY;
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_OUTOFMEMORY, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
acl2->expret = E_FAIL;
|
2013-08-24 06:38:06 +02:00
|
|
|
hr = IACList_Expand(acl, exp);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == E_FAIL, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
|
|
|
|
hr = IObjMgr_Remove(mgr, (IUnknown *)&acl1->IACList_iface);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
|
|
|
|
ok(acl1->ref == 1, "acl1 not released\n");
|
2022-02-22 09:30:46 +01:00
|
|
|
hr = IEnumString_Next(obj, 1, &wstr, &i);
|
|
|
|
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
2013-08-24 06:38:06 +02:00
|
|
|
IEnumString_Reset(obj);
|
2007-02-05 17:53:42 +01:00
|
|
|
expect_str(obj, "a");
|
|
|
|
expect_str(obj, "b");
|
|
|
|
expect_str(obj, "d");
|
2022-02-22 09:30:46 +01:00
|
|
|
hr = IEnumString_Next(obj, 1, &wstr, &i);
|
|
|
|
ok(hr == S_FALSE, "Unexpected hr %#lx.\n", hr);
|
2007-02-05 17:53:42 +01:00
|
|
|
|
2013-08-24 06:38:06 +02:00
|
|
|
IEnumString_Release(obj);
|
|
|
|
IACList_Release(acl);
|
|
|
|
ref = IObjMgr_Release(mgr);
|
|
|
|
ok(ref == 0, "Unexpected references\n");
|
2007-02-05 17:53:42 +01:00
|
|
|
ok(acl1->ref == 1, "acl1 not released\n");
|
|
|
|
ok(acl2->ref == 1, "acl2 not released\n");
|
2010-01-07 03:27:01 +01:00
|
|
|
|
|
|
|
CoTaskMemFree(acl1);
|
|
|
|
CoTaskMemFree(acl2);
|
2007-02-05 17:53:42 +01:00
|
|
|
}
|
|
|
|
|
2015-06-07 01:14:11 +02:00
|
|
|
static void test_ACListISF(void)
|
|
|
|
{
|
|
|
|
IEnumString *enumstring;
|
|
|
|
IACList *list, *list2;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_ACListISF, NULL, CLSCTX_INPROC, &IID_IACList, (void**)&list);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2015-06-07 01:14:11 +02:00
|
|
|
|
|
|
|
hr = IACList_QueryInterface(list, &IID_IEnumString, (void**)&enumstring);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2015-06-07 01:14:11 +02:00
|
|
|
|
|
|
|
hr = IEnumString_QueryInterface(enumstring, &IID_IACList, (void**)&list2);
|
2022-02-22 09:30:46 +01:00
|
|
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
2015-06-07 01:14:11 +02:00
|
|
|
ok(list == list2, "got %p, %p\n", list, list2);
|
|
|
|
IACList_Release(list2);
|
|
|
|
|
|
|
|
IEnumString_Release(enumstring);
|
|
|
|
IACList_Release(list);
|
|
|
|
}
|
|
|
|
|
2007-02-05 17:53:42 +01:00
|
|
|
START_TEST(autocomplete)
|
|
|
|
{
|
|
|
|
CoInitialize(NULL);
|
2015-06-07 01:14:11 +02:00
|
|
|
|
2007-02-05 17:53:42 +01:00
|
|
|
test_ACLMulti();
|
2015-06-07 01:14:11 +02:00
|
|
|
test_ACListISF();
|
|
|
|
|
2007-02-05 17:53:42 +01:00
|
|
|
CoUninitialize();
|
|
|
|
}
|