From 0fa2cf41006402018d857b039ca06b3fc3066e89 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 31 Oct 2011 12:33:28 +0100 Subject: [PATCH] msxml3/tests: Added NamespaceUri pointer test. --- dlls/msxml3/tests/saxreader.c | 43 +++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index 4ad80c629de..2ec20bfea5a 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -123,7 +123,7 @@ static const CHAR szTestXML[] = static const CHAR szTestAttributes[] = "\n" -"\n" +"\n" "" "\n"; @@ -211,10 +211,10 @@ static content_handler_test contentHandlerTestCallbackResult6[] = { static content_handler_test contentHandlerTestAttributes[] = { { CH_PUTDOCUMENTLOCATOR, 0, 0, 1, 0 }, { CH_STARTDOCUMENT, 0, 0, 1, 22 }, - { CH_STARTPREFIXMAPPING, 2, 80, 2, 79, "test", "prefix_test" }, - { CH_STARTPREFIXMAPPING, 2, 80, 2, 79, "", "prefix" }, - { CH_STARTELEMENT, 2, 80, 2, 79, "prefix", "document", "document" }, - { CH_CHARACTERS, 2, 80, 3, 1, "\n" }, + { CH_STARTPREFIXMAPPING, 2, 96, 2, 95, "test", "prefix_test" }, + { CH_STARTPREFIXMAPPING, 2, 96, 2, 95, "", "prefix" }, + { CH_STARTELEMENT, 2, 96, 2, 95, "prefix", "document", "document" }, + { CH_CHARACTERS, 2, 96, 3, 1, "\n" }, { CH_STARTPREFIXMAPPING, 3, 25, 3, 24, "p", "test" }, { CH_STARTELEMENT, 3, 25, 3, 24, "prefix", "node1", "node1" }, { CH_ENDELEMENT, 3, 25, 3, 24, "prefix", "node1", "node1" }, @@ -229,10 +229,10 @@ static content_handler_test contentHandlerTestAttributes[] = { static content_handler_test contentHandlerTestAttributes6[] = { { CH_PUTDOCUMENTLOCATOR, 0, 0, 1, 0 }, { CH_STARTDOCUMENT, 0, 0, 1, 22 }, - { CH_STARTPREFIXMAPPING, 2, 80, 2, 79, "test", "prefix_test" }, - { CH_STARTPREFIXMAPPING, 2, 80, 2, 79, "", "prefix" }, - { CH_STARTELEMENT, 2, 80, 2, 79, "prefix", "document", "document" }, - { CH_CHARACTERS, 2, 80, 3, 1, "\n" }, + { CH_STARTPREFIXMAPPING, 2, 96, 2, 95, "test", "prefix_test" }, + { CH_STARTPREFIXMAPPING, 2, 96, 2, 95, "", "prefix" }, + { CH_STARTELEMENT, 2, 96, 2, 95, "prefix", "document", "document" }, + { CH_CHARACTERS, 2, 96, 3, 1, "\n" }, { CH_STARTPREFIXMAPPING, 3, 25, 3, 24, "p", "test" }, { CH_STARTELEMENT, 3, 25, 3, 24, "prefix", "node1", "node1" }, { CH_ENDELEMENT, 3, 25, 3, 24, "prefix", "node1", "node1" }, @@ -427,11 +427,12 @@ static HRESULT WINAPI contentHandler_startElement( ok(test_attr_ptr == pAttr, "Multiple ISAXAttributes instances are used (%p %p)\n", test_attr_ptr, pAttr); if(expectCall == contentHandlerTestAttributes+4) { + const WCHAR *uri_ptr = NULL; int i; /* msxml3 returns attributes and namespaces in the input order */ hres = ISAXAttributes_getLength(pAttr, &len); ok(hres == S_OK, "getLength returned %x\n", hres); - ok(len == 4, "Incorrect number of attributes: %d\n", len); + ok(len == 5, "Incorrect number of attributes: %d\n", len); ok(msxml_version < 6, "wrong msxml_version: %d\n", msxml_version); for(i=0; i= 6, "wrong msxml_version: %d\n", msxml_version); hres = ISAXAttributes_getName(pAttr, 0, &pNamespaceUri, &nNamespaceUri, @@ -476,6 +486,7 @@ static HRESULT WINAPI contentHandler_startElement( test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "prefix_test"); test_saxstr(__LINE__, pLocalName, nLocalName, "arg1"); test_saxstr(__LINE__, pQName, nQName, "test:arg1"); + uri_ptr = pNamespaceUri; hres = ISAXAttributes_getName(pAttr, 1, &pNamespaceUri, &nNamespaceUri, &pLocalName, &nLocalName, &pQName, &nQName); @@ -487,11 +498,19 @@ static HRESULT WINAPI contentHandler_startElement( hres = ISAXAttributes_getName(pAttr, 2, &pNamespaceUri, &nNamespaceUri, &pLocalName, &nLocalName, &pQName, &nQName); ok(hres == S_OK, "getName returned %x\n", hres); + test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "prefix_test"); + test_saxstr(__LINE__, pLocalName, nLocalName, "ar3"); + test_saxstr(__LINE__, pQName, nQName, "test:ar3"); + ok(uri_ptr == pNamespaceUri, "Incorrect NamespaceUri pointer\n"); + + hres = ISAXAttributes_getName(pAttr, 3, &pNamespaceUri, &nNamespaceUri, + &pLocalName, &nLocalName, &pQName, &nQName); + ok(hres == S_OK, "getName returned %x\n", hres); test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "http://www.w3.org/2000/xmlns/"); test_saxstr(__LINE__, pLocalName, nLocalName, ""); test_saxstr(__LINE__, pQName, nQName, "xmlns:test"); - hres = ISAXAttributes_getName(pAttr, 3, &pNamespaceUri, &nNamespaceUri, + hres = ISAXAttributes_getName(pAttr, 4, &pNamespaceUri, &nNamespaceUri, &pLocalName, &nLocalName, &pQName, &nQName); ok(hres == S_OK, "getName returned %x\n", hres); test_saxstr(__LINE__, pNamespaceUri, nNamespaceUri, "http://www.w3.org/2000/xmlns/");