msxml3: Test for attribute value normalization

Nikolay Sivov nsivov at codeweavers.com
Sat Apr 28 04:21:13 CDT 2012


Test for attribute value normalization
-------------- next part --------------
>From ff2cae79ab1e88ada5999817ac162c3009725e80 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sat, 28 Apr 2012 13:20:06 +0400
Subject: [PATCH 2/2] Test for attribute value normalization

---
 dlls/msxml3/tests/saxreader.c |   51 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c
index cb1a088..73c16b9 100644
--- a/dlls/msxml3/tests/saxreader.c
+++ b/dlls/msxml3/tests/saxreader.c
@@ -866,6 +866,34 @@ static struct call_entry xmlspaceattr_test_alternate[] = {
     { CH_ENDTEST }
 };
 
+/* attribute value normalization test */
+static const char attribute_normalize[] =
+    "<?xml version=\"1.0\" ?>\n"
+    "<a attr1=\" \r \n \tattr_value A \t \r \n\r\n \n\"/>\n";
+
+static struct attribute_entry attribute_norm_attrs[] = {
+    { "", "attr1", "attr1", "      attr_value A         " },
+    { NULL }
+};
+
+static struct call_entry attribute_norm[] = {
+    { CH_PUTDOCUMENTLOCATOR, 0, 0, S_OK },
+    { CH_STARTDOCUMENT, 0, 0, S_OK },
+    { CH_STARTELEMENT, 6, 4, S_OK, "", "a", "a", attribute_norm_attrs },
+    { CH_ENDELEMENT, 6, 4, S_OK, "", "a", "a" },
+    { CH_ENDDOCUMENT, 0, 0, S_OK },
+    { CH_ENDTEST }
+};
+
+static struct call_entry attribute_norm_alt[] = {
+    { CH_PUTDOCUMENTLOCATOR, 1, 0, S_OK },
+    { CH_STARTDOCUMENT, 1, 22, S_OK },
+    { CH_STARTELEMENT, 8, 3, S_OK, "", "a", "a", attribute_norm_attrs },
+    { CH_ENDELEMENT, 8, 3, S_OK, "", "a", "a" },
+    { CH_ENDDOCUMENT, 9, 0, S_OK },
+    { CH_ENDTEST }
+};
+
 static const char xmlspace_attr[] =
     "<?xml version=\"1.0\" encoding=\"UTF-16\"?>"
     "<a xml:space=\"preserve\"> Some text data </a>";
@@ -2170,6 +2198,29 @@ static void test_saxreader(void)
         hr = ISAXXMLReader_putFeature(reader, _bstr_("http://xml.org/sax/features/namespace-prefixes"), VARIANT_TRUE);
         EXPECT_HR(hr, S_OK);
 
+        /* attribute normalization */
+        CreateStreamOnHGlobal(NULL, TRUE, &stream);
+        size.QuadPart = strlen(attribute_normalize);
+        IStream_SetSize(stream, size);
+        IStream_Write(stream, attribute_normalize, strlen(attribute_normalize), &written);
+        pos.QuadPart = 0;
+        IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
+        V_VT(&var) = VT_UNKNOWN|VT_DISPATCH;
+        V_UNKNOWN(&var) = (IUnknown*)stream;
+
+        if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader40) ||
+            IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60))
+        {
+            test_seq = attribute_norm_alt;
+        }
+        else
+            test_seq = attribute_norm;
+
+        set_expected_seq(test_seq);
+        hr = ISAXXMLReader_parse(reader, var);
+        EXPECT_HR(hr, S_OK);
+        ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "attribute value normalization", TRUE);
+
         ISAXXMLReader_Release(reader);
         table++;
     }
-- 
1.5.6.5



More information about the wine-patches mailing list