msxml3: Implement IXMLDOMText length property.

This commit is contained in:
Alistair Leslie-Hughes 2008-02-19 08:28:38 +11:00 committed by Alexandre Julliard
parent e2ac47a4f1
commit 72e70a0122
2 changed files with 29 additions and 2 deletions

View File

@ -366,6 +366,7 @@ static void test_domdoc( void )
VARIANT var; VARIANT var;
BSTR str; BSTR str;
long code; long code;
long nLength = 0;
r = CoCreateInstance( &CLSID_DOMDocument, NULL, r = CoCreateInstance( &CLSID_DOMDocument, NULL,
CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc ); CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument, (LPVOID*)&doc );
@ -554,6 +555,14 @@ static void test_domdoc( void )
ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n"); ok( V_VT(&var) == VT_NULL, "incorrect dataType type\n");
VariantClear(&var); VariantClear(&var);
/* test length property */
r = IXMLDOMText_get_length(nodetext, NULL);
ok(r == E_INVALIDARG, "ret %08x\n", r );
r = IXMLDOMText_get_length(nodetext, &nLength);
ok(r == S_OK, "ret %08x\n", r );
ok(nLength == 4, "expected 4 got %ld\n", nLength);
/* test nodeTypeString */ /* test nodeTypeString */
r = IXMLDOMText_get_nodeTypeString(nodetext, &str); r = IXMLDOMText_get_nodeTypeString(nodetext, &str);
ok(r == S_OK, "ret %08x\n", r ); ok(r == S_OK, "ret %08x\n", r );

View File

@ -491,8 +491,26 @@ static HRESULT WINAPI domtext_get_length(
IXMLDOMText *iface, IXMLDOMText *iface,
long *len) long *len)
{ {
FIXME("\n"); domtext *This = impl_from_IXMLDOMText( iface );
return E_NOTIMPL; xmlnode *pDOMNode = impl_from_IXMLDOMNode( (IXMLDOMNode*)This->element );
xmlChar *pContent;
long nLength = 0;
TRACE("%p\n", iface);
if(!len)
return E_INVALIDARG;
pContent = xmlNodeGetContent(pDOMNode->node);
if(pContent)
{
nLength = xmlStrlen(pContent);
xmlFree(pContent);
}
*len = nLength;
return S_OK;
} }
static HRESULT WINAPI domtext_substringData( static HRESULT WINAPI domtext_substringData(