-- v4: msxml3/tests: Add tests of ValidateOnParse property.
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/msxml3/domdoc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index f0420a517ea..30dd2f4743f 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -77,6 +77,7 @@ typedef struct { LONG refs; MSXML_VERSION version; VARIANT_BOOL preserving; + VARIANT_BOOL validating; IXMLDOMSchemaCollection2* schemaCache; struct list selectNsList; xmlChar const* selectNsStr; @@ -123,7 +124,6 @@ struct domdoc IConnectionPointContainer IConnectionPointContainer_iface; LONG ref; VARIANT_BOOL async; - VARIANT_BOOL validating; VARIANT_BOOL resolving; domdoc_properties* properties; HRESULT error; @@ -288,6 +288,7 @@ static domdoc_properties *create_properties(MSXML_VERSION version) properties->refs = 1; list_init(&properties->selectNsList); properties->preserving = VARIANT_FALSE; + properties->validating = VARIANT_TRUE; properties->schemaCache = NULL; properties->selectNsStr = heap_alloc_zero(sizeof(xmlChar)); properties->selectNsStr_len = 0; @@ -315,6 +316,7 @@ static domdoc_properties* copy_properties(domdoc_properties const* properties) pcopy->refs = 1; pcopy->version = properties->version; pcopy->preserving = properties->preserving; + pcopy->validating = properties->validating; pcopy->schemaCache = properties->schemaCache; if (pcopy->schemaCache) IXMLDOMSchemaCollection2_AddRef(pcopy->schemaCache); @@ -2709,8 +2711,8 @@ static HRESULT WINAPI domdoc_get_validateOnParse( VARIANT_BOOL* isValidating ) { domdoc *This = impl_from_IXMLDOMDocument3( iface ); - TRACE("(%p)->(%p: %d)\n", This, isValidating, This->validating); - *isValidating = This->validating; + TRACE("(%p)->(%p: %d)\n", This, isValidating, This->properties->validating); + *isValidating = This->properties->validating; return S_OK; }
@@ -2721,7 +2723,7 @@ static HRESULT WINAPI domdoc_put_validateOnParse( { domdoc *This = impl_from_IXMLDOMDocument3( iface ); TRACE("(%p)->(%d)\n", This, isValidating); - This->validating = isValidating; + This->properties->validating = isValidating; return S_OK; }
@@ -3740,7 +3742,6 @@ HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) doc->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl; doc->ref = 1; doc->async = VARIANT_TRUE; - doc->validating = 0; doc->resolving = 0; doc->properties = properties_add_ref(properties_from_xmlDocPtr(xmldoc)); doc->error = S_OK;
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/msxml3/domdoc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 30dd2f4743f..a8679d9b782 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -68,6 +68,7 @@ static const WCHAR PropertyResolveExternalsW[] = {'R','e','s','o','l','v','e','E static const WCHAR PropertyAllowXsltScriptW[] = {'A','l','l','o','w','X','s','l','t','S','c','r','i','p','t',0}; static const WCHAR PropertyAllowDocumentFunctionW[] = {'A','l','l','o','w','D','o','c','u','m','e','n','t','F','u','n','c','t','i','o','n',0}; static const WCHAR PropertyNormalizeAttributeValuesW[] = {'N','o','r','m','a','l','i','z','e','A','t','t','r','i','b','u','t','e','V','a','l','u','e','s',0}; +static const WCHAR PropertyValidateOnParse[] = L"ValidateOnParse";
/* Anything that passes the test_get_ownerDocument() * tests can go here (data shared between all instances). @@ -3189,6 +3190,16 @@ static HRESULT WINAPI domdoc_setProperty( VariantClear(&varStr); return hr; } + else if (lstrcmpiW(p, PropertyValidateOnParse) == 0) + { + if (This->properties->version < MSXML4) + return E_FAIL; + else + { + This->properties->validating = V_BOOL(&value); + return S_OK; + } + } else if (lstrcmpiW(p, PropertyProhibitDTDW) == 0 || lstrcmpiW(p, PropertyNewParserW) == 0 || lstrcmpiW(p, PropertyResolveExternalsW) == 0 || @@ -3260,6 +3271,17 @@ static HRESULT WINAPI domdoc_getProperty( heap_free(rebuiltStr); return S_OK; } + else if (lstrcmpiW(p, PropertyValidateOnParse) == 0) + { + if (This->properties->version < MSXML4) + return E_FAIL; + else + { + V_VT(var) = VT_BOOL; + V_BOOL(var) = This->properties->validating; + return S_OK; + } + }
FIXME("Unknown property %s\n", debugstr_w(p)); return E_FAIL;
From: Jactry Zeng jzeng@codeweavers.com
--- dlls/msxml3/tests/domdoc.c | 150 ++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index 6590a8dbad4..daf763e7481 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -13947,6 +13947,154 @@ static void test_load_with_site(void) free_bstrs(); }
+typedef struct _validate_on_parse_test_t +{ + const GUID *guid; + const char *clsid; + HRESULT hr; +} validate_on_parse_test_t; + +static const validate_on_parse_test_t validate_on_parse_tests[] = +{ + { &CLSID_DOMDocument, "CLSID_DOMDocument" , E_FAIL }, + { &CLSID_DOMDocument2, "CLSID_DOMDocument2", E_FAIL }, + { &CLSID_DOMDocument26, "CLSID_DOMDocument26", E_FAIL }, + { &CLSID_DOMDocument30, "CLSID_DOMDocument30", E_FAIL }, + { &CLSID_DOMDocument40, "CLSID_DOMDocument40", S_OK }, + { &CLSID_DOMDocument60, "CLSID_DOMDocument60", S_OK }, + { 0 } +}; + +static void test_validate_on_parse_values(void) +{ + const validate_on_parse_test_t *entry = validate_on_parse_tests; + int i = 0; + + while (entry->guid) + { + IXMLDOMDocument2 *doc, *doc_clone; + IXMLDOMNode *node_clone; + VARIANT var, var_clone; + VARIANT_BOOL b; + HRESULT hr; + + i++; + if (!is_clsid_supported(entry->guid, &IID_IXMLDOMDocument2)) + { + entry++; + continue; + } + + hr = CoCreateInstance(entry->guid, NULL, CLSCTX_INPROC_SERVER, &IID_IXMLDOMDocument2, (void **)&doc); + ok(hr == S_OK, "%d: got %#lx.\n", i, hr); + + V_VT(&var) = VT_I2; + V_I2(&var) = 0; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("ValidateOnParse"), &var); + ok(hr == entry->hr || broken(hr == E_FAIL) /* win8 */, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var) == VT_BOOL, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_TRUE, "%d: got property value %d.\n", i, V_BOOL(&var)); + } + else + { + ok(V_VT(&var) == VT_I2, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_I2(&var) == 0, "%d: got property value %d.\n", i, V_I2(&var)); + if (IsEqualCLSID(entry->guid, &CLSID_DOMDocument40)) + { + win_skip("Skip tests for CLSID_DOMDocument40 on Windows 8.\n"); + continue; + } + } + + b = VARIANT_FALSE; + hr = IXMLDOMDocument2_get_validateOnParse(doc, &b); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + ok(b == VARIANT_TRUE, "%d: got property value %d.\n", i, b); + + V_VT(&var) = VT_I2; + V_I2(&var) = 0; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("ValidateOnParse"), var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + V_VT(&var) = VT_I2; + V_I2(&var) = 10; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("ValidateOnParse"), &var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var) == VT_BOOL, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_FALSE, "%d: got property value %d.\n", i, V_BOOL(&var)); + } + + V_VT(&var) = VT_BOOL; + V_BOOL(&var) = VARIANT_TRUE; + hr = IXMLDOMDocument2_setProperty(doc, _bstr_("ValidateOnParse"), var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + b = VARIANT_FALSE; + hr = IXMLDOMDocument2_get_validateOnParse(doc, &b); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + ok(b == VARIANT_TRUE, "%d: got property value %d.\n", i, b); + + V_VT(&var) = VT_I2; + V_I2(&var) = 0; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("ValidateOnParse"), &var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var) == VT_BOOL, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_TRUE, "%d: got property value %d.\n", i, V_BOOL(&var)); + } + + b = VARIANT_FALSE; + hr = IXMLDOMDocument2_put_validateOnParse(doc, b); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + V_VT(&var) = VT_I2; + V_I2(&var) = 10; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("ValidateOnParse"), &var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var) == VT_BOOL, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_FALSE, "%d: got property value %d.\n", i, V_BOOL(&var)); + } + + /* Cloned document inherits the property. */ + hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_TRUE, &node_clone); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + ok(node_clone != NULL, "%d: got node %p.\n", i, node_clone); + hr = IXMLDOMNode_QueryInterface(node_clone, &IID_IXMLDOMDocument2, (void **)&doc_clone); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + V_VT(&var) = VT_I2; + V_I2(&var) = 10; + hr = IXMLDOMDocument2_getProperty(doc, _bstr_("ValidateOnParse"), &var); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var) == VT_BOOL, "%d: got property value type %d.\n", i, V_VT(&var)); + ok(V_BOOL(&var) == VARIANT_FALSE, "%d: got property value %d.\n", i, V_BOOL(&var)); + } + V_VT(&var_clone) = VT_I2; + V_I2(&var_clone) = 10; + hr = IXMLDOMDocument2_getProperty(doc_clone, _bstr_("ValidateOnParse"), &var_clone); + ok(hr == entry->hr, "%d: got hr %#lx.\n", i, hr); + if (SUCCEEDED(hr)) + { + ok(V_VT(&var_clone) == V_VT(&var), "%d: got property value type %d.\n", i, V_VT(&var_clone)); + ok(V_BOOL(&var_clone) == V_BOOL(&var), "%d: got property value %d.\n", i, V_BOOL(&var_clone)); + } + b = VARIANT_TRUE; + hr = IXMLDOMDocument2_get_validateOnParse(doc_clone, &b); + ok(hr == S_OK, "%d: got hr %#lx.\n", i, hr); + ok(b == VARIANT_FALSE, "%d: got property value %d.\n", i, b); + IXMLDOMNode_Release(node_clone); + IXMLDOMDocument2_Release(doc_clone); + + IXMLDOMDocument2_Release(doc); + entry++; + } +} + START_TEST(domdoc) { HRESULT hr; @@ -14033,7 +14181,7 @@ START_TEST(domdoc) test_transformNodeToObject(); test_normalize_attribute_values(); test_namespaces_as_attributes(); - + test_validate_on_parse_values(); test_xsltemplate(); test_xsltext();
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=138091
Your paranoid android.
=== w8 (32 bit report) ===
Report validation errors: msxml3:domdoc has no test summary line (early exit of the main process?) msxml3:domdoc has unaccounted for skip messages msxml3:domdoc returned a non-zero exit code despite reporting no failures
=== w8adm (32 bit report) ===
Report validation errors: msxml3:domdoc has no test summary line (early exit of the main process?) msxml3:domdoc has unaccounted for skip messages msxml3:domdoc returned a non-zero exit code despite reporting no failures
=== w864 (32 bit report) ===
Report validation errors: msxml3:domdoc has no test summary line (early exit of the main process?) msxml3:domdoc has unaccounted for skip messages msxml3:domdoc returned a non-zero exit code despite reporting no failures
=== debian11b (64 bit WoW report) ===
winhttp: notification.c:118: Test failed: 297: expected status 0x8 got 0x800 notification.c:118: Test failed: 297: expected status 0x8 got 0x800 winhttp.c:5740: Test failed: failed to send request 12002 winhttp.c:5759: Test failed: failed to send request 12002 winhttp.c:5764: Test succeeded inside todo block: unexpected success winhttp: Timeout