msxml3: Implement getValue() for MXAttributes.

This commit is contained in:
Nikolay Sivov 2012-03-14 09:21:05 +03:00 committed by Alexandre Julliard
parent 99db789eda
commit 4cddf045fc
2 changed files with 51 additions and 4 deletions

View File

@ -1819,12 +1819,22 @@ static HRESULT WINAPI SAXAttributes_getTypeFromQName(ISAXAttributes *iface, cons
return E_NOTIMPL;
}
static HRESULT WINAPI SAXAttributes_getValue(ISAXAttributes *iface, int nIndex, const WCHAR ** pValue,
int * nValue)
static HRESULT WINAPI SAXAttributes_getValue(ISAXAttributes *iface, int index, const WCHAR **value,
int *len)
{
mxattributes *This = impl_from_ISAXAttributes( iface );
FIXME("(%p)->(%d %p %p): stub\n", This, nIndex, pValue, nValue);
return E_NOTIMPL;
TRACE("(%p)->(%d %p %p)\n", This, index, value, len);
if (index >= This->length) return E_INVALIDARG;
if ((!value || !len) && (This->class_version == MSXML_DEFAULT || This->class_version == MSXML3))
return E_POINTER;
*value = This->attr[index].value;
*len = SysStringLen(This->attr[index].value);
return S_OK;
}
static HRESULT WINAPI SAXAttributes_getValueFromName(ISAXAttributes *iface, const WCHAR * pUri,

View File

@ -3298,6 +3298,7 @@ static void test_mxattr_addAttribute(void)
{
ISAXAttributes *saxattr;
IMXAttributes *mxattr;
const WCHAR *value;
HRESULT hr;
int len;
@ -3328,10 +3329,46 @@ static void test_mxattr_addAttribute(void)
EXPECT_HR(hr, S_OK);
ok(len == 0, "got %d\n", len);
hr = ISAXAttributes_getValue(saxattr, 0, &value, &len);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getValue(saxattr, 0, NULL, &len);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getValue(saxattr, 0, &value, NULL);
EXPECT_HR(hr, E_INVALIDARG);
hr = ISAXAttributes_getValue(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);
if (hr == S_OK)
{
/* SAXAttributes40 and SAXAttributes60 both crash on this test */
if (IsEqualGUID(table->clsid, &CLSID_SAXAttributes) ||
IsEqualGUID(table->clsid, &CLSID_SAXAttributes30))
{
hr = ISAXAttributes_getValue(saxattr, 0, NULL, &len);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getValue(saxattr, 0, &value, NULL);
EXPECT_HR(hr, E_POINTER);
hr = ISAXAttributes_getValue(saxattr, 0, NULL, NULL);
EXPECT_HR(hr, E_POINTER);
}
len = -1;
hr = ISAXAttributes_getValue(saxattr, 0, &value, &len);
EXPECT_HR(hr, S_OK);
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;
hr = ISAXAttributes_getLength(saxattr, &len);
EXPECT_HR(hr, S_OK);