From c4a9d1cfa2087ba3e9139bd20abfaa003835a704 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 29 Aug 2009 15:04:27 +0200 Subject: [PATCH] msxml3: Added more IDispatchEx tests. --- dlls/msxml3/tests/domdoc.c | 90 ++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 38 deletions(-) diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 2d831dd7fb..91e34f50a3 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -323,6 +323,55 @@ static void get_str_for_type(DOMNodeType type, char *buf) } } +#define test_disp(u) _test_disp(__LINE__,u) +static void _test_disp(unsigned line, IUnknown *unk) +{ + DISPID dispid = DISPID_XMLDOM_NODELIST_RESET; + IDispatchEx *dispex; + DWORD dwProps = 0; + BSTR sName; + UINT ticnt; + IUnknown *pUnk; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IDispatchEx, (void**)&dispex); + ok_(__FILE__,line) (hres == S_OK, "Could not get IDispatch: %08x\n", hres); + if(FAILED(hres)) + return; + + ticnt = 0xdeadbeef; + hres = IDispatchEx_GetTypeInfoCount(dispex, &ticnt); + ok_(__FILE__,line) (hres == S_OK, "GetTypeInfoCount failed: %08x\n", hres); + ok_(__FILE__,line) (ticnt == 1, "ticnt=%u\n", ticnt); + + sName = SysAllocString( szstar ); + hres = IDispatchEx_DeleteMemberByName(dispex, sName, fdexNameCaseSensitive); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + SysFreeString( sName ); + + hres = IDispatchEx_DeleteMemberByDispID(dispex, dispid); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + + hres = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &dwProps); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + ok(dwProps == 0, "expected 0 got %d\n", dwProps); + + hres = IDispatchEx_GetMemberName(dispex, dispid, &sName); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + if(SUCCEEDED(hres)) + SysFreeString(sName); + + hres = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_NODELIST_RESET, &dispid); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + + hres = IDispatchEx_GetNameSpaceParent(dispex, &pUnk); + ok(hres == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", hres); + if(hres == S_OK && pUnk) + IUnknown_Release(pUnk); + + IDispatchEx_Release(dispex); +} + static int get_node_position(IXMLDOMNode *node) { HRESULT r; @@ -457,6 +506,8 @@ static void test_domdoc( void ) if( r != S_OK ) return; + test_disp((IUnknown*)doc); + /* try some stupid things */ r = IXMLDOMDocument_loadXML( doc, NULL, NULL ); ok( r == S_FALSE, "loadXML failed\n"); @@ -1660,7 +1711,6 @@ static void test_getElementsByTagName(void) VARIANT_BOOL b; IXMLDOMDocument *doc; IXMLDOMNodeList *node_list; - IDispatchEx *dispex; LONG len; r = CoCreateInstance( &CLSID_DOMDocument, NULL, @@ -1681,43 +1731,7 @@ static void test_getElementsByTagName(void) ok( r == S_OK, "ret %08x\n", r ); ok( len == 6, "len %d\n", len ); - r = IXMLDOMNodeList_QueryInterface( node_list, &IID_IDispatchEx, (void**)&dispex ); - ok( r == S_OK, "rets %08x\n", r); - if( r == S_OK ) - { - DISPID dispid = DISPID_XMLDOM_NODELIST_RESET; - DWORD dwProps = 0; - BSTR sName; - IUnknown *pUnk; - - sName = SysAllocString( szstar ); - r = IDispatchEx_DeleteMemberByName(dispex, sName, fdexNameCaseSensitive); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - SysFreeString( sName ); - - r = IDispatchEx_DeleteMemberByDispID(dispex, dispid); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - - r = IDispatchEx_GetMemberProperties(dispex, dispid, grfdexPropCanAll, &dwProps); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - ok(dwProps == 0, "expected 0 got %d\n", dwProps); - - r = IDispatchEx_GetMemberName(dispex, dispid, &sName); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - if( SUCCEEDED(r) ) - SysFreeString(sName); - - r = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_NODELIST_RESET, &dispid); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - - r = IDispatchEx_GetNameSpaceParent(dispex, &pUnk); - ok(r == E_NOTIMPL, "expected E_NOTIMPL got %08x\n", r); - if(r == S_OK) - IUnknown_Release(pUnk); - - IDispatchEx_Release( dispex ); - } - + test_disp((IUnknown*)node_list); IXMLDOMNodeList_Release( node_list ); SysFreeString( str ); -- 2.32.0.93.g670b81a890