msxml3: Implement getType() for MXAttributes.

oldstable
Nikolay Sivov 2012-03-14 11:44:34 +03:00 committed by Alexandre Julliard
parent 4cddf045fc
commit 69bc096645
2 changed files with 53 additions and 5 deletions

View File

@ -1612,7 +1612,7 @@ static HRESULT WINAPI MXAttributes_addAttribute(IMXAttributes *iface,
attr->qname = SysAllocString(QName);
attr->local = SysAllocString(localName);
attr->uri = SysAllocString(uri);
attr->type = SysAllocString(type);
attr->type = SysAllocString(type ? type : emptyW);
attr->value = SysAllocString(value);
This->length++;
@ -1794,12 +1794,22 @@ static HRESULT WINAPI SAXAttributes_getIndexFromQName(ISAXAttributes *iface, con
return E_NOTIMPL;
}
static HRESULT WINAPI SAXAttributes_getType(ISAXAttributes *iface, int nIndex, const WCHAR ** pType,
int * pTypeLength)
static HRESULT WINAPI SAXAttributes_getType(ISAXAttributes *iface, int index, const WCHAR **type,
int *len)
{
mxattributes *This = impl_from_ISAXAttributes( iface );
FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, pType, pTypeLength);
return E_NOTIMPL;
TRACE("(%p)->(%d %p %p)\n", This, index, type, len);
if (index >= This->length) return E_INVALIDARG;
if ((!type || !len) && (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3))
return E_POINTER;
*type = This->attr[index].type;
*len = SysStringLen(This->attr[index].type);
return S_OK;
}
static HRESULT WINAPI SAXAttributes_getTypeFromName(ISAXAttributes *iface, const WCHAR * pUri, int nUri,

View File

@ -3341,6 +3341,18 @@ static void test_mxattr_addAttribute(void)
hr = ISAXAttributes_getValue(saxattr, 0, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getType(saxattr, 0, &value, &len);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getType(saxattr, 0, NULL, &len);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getType(saxattr, 0, &value, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getType(saxattr, 0, NULL, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = IMXAttributes_addAttribute(mxattr, _bstr_(table->uri), _bstr_(table->local),
_bstr_(table->qname), _bstr_(table->type), _bstr_(table->value));
ok(hr == table->hr, "%d: got 0x%08x, expected 0x%08x\n", i, hr, table->hr);
@ -3359,6 +3371,15 @@ static void test_mxattr_addAttribute(void)
hr = ISAXAttributes_getValue(saxattr, 0, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getType(saxattr, 0, NULL, &len);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getType(saxattr, 0, &value, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getType(saxattr, 0, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
}
len = -1;
@ -3367,6 +3388,23 @@ static void test_mxattr_addAttribute(void)
ok(!lstrcmpW(_bstr_(table->value), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
table->value);
ok(lstrlenW(value) == len, "%d: got wrong value length %d\n", i, len);
len = -1;
value = (void*)0xdeadbeef;
hr = ISAXAttributes_getType(saxattr, 0, &value, &len);
EXPECT_HR(hr, S_OK);
if (table->type)
{
ok(!lstrcmpW(_bstr_(table->type), value), "%d: got %s, expected %s\n", i, wine_dbgstr_w(value),
table->type);
ok(lstrlenW(value) == len, "%d: got wrong type value length %d\n", i, len);
}
else
{
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);
}
}
len = -1;