msxml3: Implement getIndexFromQName() for MXAttributes.
This commit is contained in:
parent
69bc096645
commit
c685b92b3d
|
@ -1786,12 +1786,29 @@ static HRESULT WINAPI SAXAttributes_getIndexFromName(ISAXAttributes *iface, cons
|
|||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SAXAttributes_getIndexFromQName(ISAXAttributes *iface, const WCHAR * pQName,
|
||||
int nQNameLength, int * index)
|
||||
static HRESULT WINAPI SAXAttributes_getIndexFromQName(ISAXAttributes *iface, const WCHAR *qname,
|
||||
int len, int *index)
|
||||
{
|
||||
mxattributes *This = impl_from_ISAXAttributes( iface );
|
||||
FIXME("(%p)->(%s:%d %p): stub\n", This, debugstr_wn(pQName, nQNameLength), nQNameLength, index);
|
||||
return E_NOTIMPL;
|
||||
int i;
|
||||
|
||||
TRACE("(%p)->(%s:%d %p)\n", This, debugstr_wn(qname, len), len, index);
|
||||
|
||||
if (!index && (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3))
|
||||
return E_POINTER;
|
||||
|
||||
if (!qname || !index || !len) return E_INVALIDARG;
|
||||
|
||||
for (i = 0; i < This->length; i++)
|
||||
{
|
||||
if (len != SysStringLen(This->attr[i].qname)) continue;
|
||||
if (strncmpW(qname, This->attr[i].qname, len)) continue;
|
||||
|
||||
*index = i;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SAXAttributes_getType(ISAXAttributes *iface, int index, const WCHAR **type,
|
||||
|
|
|
@ -3299,8 +3299,8 @@ static void test_mxattr_addAttribute(void)
|
|||
ISAXAttributes *saxattr;
|
||||
IMXAttributes *mxattr;
|
||||
const WCHAR *value;
|
||||
int len, index;
|
||||
HRESULT hr;
|
||||
int len;
|
||||
|
||||
if (!is_clsid_supported(table->clsid, mxattributes_support_data))
|
||||
{
|
||||
|
@ -3405,6 +3405,38 @@ static void test_mxattr_addAttribute(void)
|
|||
ok(*value == 0, "%d: got type value %s\n", i, wine_dbgstr_w(value));
|
||||
ok(len == 0, "%d: got wrong type value length %d\n", i, len);
|
||||
}
|
||||
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, NULL, 0, NULL);
|
||||
if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
|
||||
IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
|
||||
{
|
||||
EXPECT_HR(hr, E_POINTER);
|
||||
}
|
||||
else
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, NULL, 0, &index);
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
|
||||
index = -1;
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_("nonexistent"), 11, &index);
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
ok(index == -1, "%d: got wrong index %d\n", i, index);
|
||||
|
||||
index = -1;
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), 0, &index);
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
ok(index == -1, "%d: got wrong index %d\n", i, index);
|
||||
|
||||
index = -1;
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname), &index);
|
||||
EXPECT_HR(hr, S_OK);
|
||||
ok(index == 0, "%d: got wrong index %d\n", i, index);
|
||||
|
||||
index = -1;
|
||||
hr = ISAXAttributes_getIndexFromQName(saxattr, _bstr_(table->qname), strlen(table->qname)-1, &index);
|
||||
EXPECT_HR(hr, E_INVALIDARG);
|
||||
ok(index == -1, "%d: got wrong index %d\n", i, index);
|
||||
}
|
||||
|
||||
len = -1;
|
||||
|
|
Loading…
Reference in New Issue