diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index ad2544f189a..a691d0e085c 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -8358,6 +8358,121 @@ static void test_MHTMLDocument(void) release_document(doc); } +static LONG get_document_elements_count(IHTMLDocument2 *doc) +{ + LONG elements_count; + IHTMLElementCollection *elements = NULL; + + IHTMLDocument2_get_all(doc, &elements); + IHTMLElementCollection_get_length(elements, &elements_count); + + IHTMLElementCollection_Release(elements); + return elements_count; +} + +static void test_MarkupContainer(IMarkupServices *markup_services) +{ + IHTMLDOMNode *doc_node; + IHTMLDocument2 *markup_container_doc; + ITargetContainer *target_container_doc; + IInternetSecurityManager *sec_manager; + IMarkupContainer *container = NULL; + ICustomDoc *custom_doc; + IHTMLLocation *location = NULL; + IHTMLElement *body = NULL; + LONG elements_count; + HRESULT hres; + + hres = IMarkupServices_CreateMarkupContainer(markup_services, &container); + todo_wine ok(hres == S_OK, "got 0x%08lx\n", hres); + todo_wine ok(container != NULL, "MarkupContainer is null.\n"); + if (!container) return; + + hres = IMarkupContainer_QueryInterface(container, &IID_IHTMLDocument2, (void**)&markup_container_doc); + ok(hres == S_OK, "got 0x%08lx\n", hres); + + hres = IHTMLDocument2_get_location(markup_container_doc, &location); + ok(hres == E_UNEXPECTED, "expected E_UNEXPECTED, got 0x%08lx\n", hres); + ok(location == NULL, "expected null location\n"); + + hres = IHTMLDocument2_get_body(markup_container_doc, &body); + ok(hres == S_OK, "got 0x%08lx\n", hres); + ok(body == NULL, "expected null body\n"); + + elements_count = get_document_elements_count(markup_container_doc); + ok(elements_count == 0, "expected document to not have elements\n"); + + hres = IMarkupContainer_QueryInterface(container, &IID_IHTMLDOMNode, (void**)&doc_node); + todo_wine ok(hres == E_NOINTERFACE, "expected to fail with E_NOINTERFACE got 0x%08lx\n", hres); + + hres = IHTMLDocument2_QueryInterface(markup_container_doc, &IID_IInternetSecurityManager, (void**)&sec_manager); + ok(hres == E_NOINTERFACE, "expected to fail with E_NOINTERFACE got 0x%08lx\n", hres); + + hres = IHTMLDocument2_QueryInterface(markup_container_doc, &IID_ITargetContainer, (void**)&target_container_doc); + ok(hres == E_NOINTERFACE, "expected to fail with E_NOINTERFACE got 0x%08lx\n", hres); + + hres = IHTMLDocument2_QueryInterface(markup_container_doc, &IID_ICustomDoc, (void**)&custom_doc); + ok(hres == E_NOINTERFACE, "expected to fail with E_NOINTERFACE got 0x%08lx\n", hres); + + IHTMLDocument2_Release(markup_container_doc); + IMarkupContainer_Release(container); +} + +static void test_MarkupServices_ParseString(IMarkupServices *markup_services, IHTMLDocument2 *doc) +{ + HRESULT hres; + LONG document_elements_count, markup_container_elements_count; + IHTMLElement *body; + BSTR inner_text; + IHTMLDocument2 *markup_container_doc = NULL; + IMarkupContainer *markup_container = NULL; + + hres = IMarkupServices_ParseString(markup_services, (OLECHAR*)L"