On 14.07.2015 16:31, Zhenbo Li wrote:
Hi Nikolay,
2015-07-14 20:17 GMT+08:00 Nikolay Sivov bunglehead@gmail.com:
In principle this is most likely fine, but I'd really prefer to have similar test for all node types that support this method, so we can move a check directly to node_get_owner_doc(). For those additional tests it would be better to add a new test function called test_get_ownerDocument(). Next step would be to make this test run on all document versions (3, 4 and 6), but that should be a separate patch, and I'm not asking you to work on it.
Thanks for your reply. I agree with you that move the check into node_get_owner_doc might be more general
Do you mean I should write a helper function like:
#define test_get_ownerDocument_call(el,doc) _test_get_ownerDocument_call(__LINE__,el,doc) static void _test_get_ownerDocument_call(unsigned line, IXMLDOMElement *element, IXMLDOMDocument *doc) { IXMLDOMDocument *owner; HRESULT r; r = IXMLDOMElement_get_ownerDocument( element, NULL ); ok( r == E_INVALIDARG, "got %08x, expected E_INVALIDARG\n", r);
owner = NULL; r = IXMLDOMElement_get_ownerDocument( element, &owner ); ok( r == S_OK, "get_ownerDocument return code\n"); ok( owner != doc, "get_ownerDocument return\n"); IXMLDOMDocument_Release(owner);
}
No, helper like that won't work, because the point is to check how all node types work, not just elements. What I meant is to have a separate test_* function in START_TEST() that will load a document with all node types you need and iterating through them call get_ownderDocument.