Dmitry Timoshkov : xmllite/tests: Add a test for names and values parsed from an XML declaration.

Alexandre Julliard julliard at winehq.org
Fri Feb 14 15:02:11 CST 2014


Module: wine
Branch: master
Commit: 493e406bbca13d4d59e2b56eb821f95ddb173196
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=493e406bbca13d4d59e2b56eb821f95ddb173196

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Wed Feb 12 16:57:00 2014 +0900

xmllite/tests: Add a test for names and values parsed from an XML declaration.

---

 dlls/xmllite/tests/reader.c |   34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c
index 9faf243..ad9b3a2 100644
--- a/dlls/xmllite/tests/reader.c
+++ b/dlls/xmllite/tests/reader.c
@@ -644,11 +644,21 @@ if (0)
 
 static void test_read_xmldeclaration(void)
 {
+    static const struct
+    {
+        WCHAR name[12];
+        WCHAR val[12];
+    } name_val[] =
+    {
+        { {'v','e','r','s','i','o','n',0}, {'1','.','0',0} },
+        { {'e','n','c','o','d','i','n','g',0}, {'U','T','F','-','8',0} },
+        { {'s','t','a','n','d','a','l','o','n','e',0}, {'y','e','s',0} }
+    };
     IXmlReader *reader;
     IStream *stream;
     HRESULT hr;
     XmlNodeType type;
-    UINT count = 0;
+    UINT count = 0, len, i;
     const WCHAR *val;
 
     hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
@@ -730,6 +740,28 @@ static void test_read_xmldeclaration(void)
     ok(hr == S_OK, "got %08x\n", hr);
     ok(count == 3, "Expected 3, got %d\n", count);
 
+    for (i = 0; i < count; i++)
+    {
+        len = 0;
+        hr = IXmlReader_GetLocalName(reader, &val, &len);
+        ok(hr == S_OK, "got %08x\n", hr);
+        ok(len == lstrlenW(name_val[i].name), "expected %u, got %u\n", lstrlenW(name_val[i].name), len);
+        ok(!lstrcmpW(name_val[i].name, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].name), wine_dbgstr_w(val));
+
+        len = 0;
+        hr = IXmlReader_GetValue(reader, &val, &len);
+        ok(hr == S_OK, "got %08x\n", hr);
+        ok(len == lstrlenW(name_val[i].val), "expected %u, got %u\n", lstrlenW(name_val[i].val), len);
+        if (i == 1)
+todo_wine
+        ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
+        else
+        ok(!lstrcmpW(name_val[i].val, val), "expected %s, got %s\n", wine_dbgstr_w(name_val[i].val), wine_dbgstr_w(val));
+
+        hr = IXmlReader_MoveToNextAttribute(reader);
+        ok(hr == (i < count - 1) ? S_OK : S_FALSE, "got %08x\n", hr);
+    }
+
     hr = IXmlReader_GetDepth(reader, &count);
     ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
     ok(count == 1, "Expected 1, got %d\n", count);




More information about the wine-cvs mailing list