On 25.12.2015 10:30, Zhenbo Li wrote:
> +static void test_illegal_xml(IXMLDOMDocument *xmldom)
> +{
> + IXMLDOMNode *first, *last;
> + VARIANT variant;
> + HRESULT hres;
> + BSTR bstr;
> +
> + hres = IXMLDOMDocument_get_baseName(xmldom, NULL);
> + ok(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres);
> + hres = IXMLDOMDocument_get_baseName(xmldom, &bstr);
> + ok(hres == S_FALSE, "get_baseName failed: %08x\n", hres);
> + ok(bstr == NULL, "bstr(%p): %s\n", bstr, wine_dbgstr_w(bstr));
> + SysFreeString(bstr);
> +
> + hres = IXMLDOMDocument_get_dataType(xmldom, NULL);
> + ok(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres);
> + hres = IXMLDOMDocument_get_dataType(xmldom, &variant);
> + ok(hres == S_FALSE, "get_dataType failed: %08x\n", hres);
> + ok(V_VT(&variant) == VT_NULL, "got %s\n", debugstr_variant(&variant));
> + VariantClear(&variant);
> +
> + hres = IXMLDOMDocument_get_text(xmldom, &bstr);
> + ok(!strcmp_wa(bstr, ""), "text = %s\n", wine_dbgstr_w(bstr));
> + SysFreeString(bstr);
> +
> + hres = IXMLDOMDocument_get_firstChild(xmldom, NULL);
> + ok(hres == E_INVALIDARG, "Expect E_INVALIDARG, got %08x\n", hres);
> +
> + first = (void*)0xdeadbeef;
> + hres = IXMLDOMDocument_get_firstChild(xmldom, &first);
> + ok(hres == S_FALSE, "get_firstChild failed: %08x\n", hres);
> + ok(first == NULL, "first != NULL\n");
> +
> + last = (void*)0xdeadbeef;
> + hres = IXMLDOMDocument_get_lastChild(xmldom, &last);
> + ok(hres == S_FALSE, "get_lastChild failed: %08x\n", hres);
> + ok(last == NULL, "last != NULL\n");
> +}
It makes no sense to test every method on empty tree, test for text string.
> + hres = IXMLDOMDocument_QueryInterface(xmldoc, &IID_IObjectSafety, (void**)&safety);
> + assert(SUCCEEDED(hres));
> + hres = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
> + INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER,
> + INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER);
> + assert(SUCCEEDED(hres));
> + IObjectSafety_Release(safety);
This looks weird to me, why the asserts? Did Jacek suggest that?