Nikolay Sivov : xmllite: Basic test for chunk value read vs full value read .

Alexandre Julliard julliard at winehq.org
Mon Feb 11 13:06:31 CST 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb 11 09:22:23 2013 +0400

xmllite: Basic test for chunk value read vs full value read.

---

 dlls/xmllite/tests/reader.c |   55 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c
index e61600c..65c3448 100644
--- a/dlls/xmllite/tests/reader.c
+++ b/dlls/xmllite/tests/reader.c
@@ -1263,6 +1263,60 @@ static void test_read_pending(void)
     IXmlReader_Release(reader);
 }
 
+static void test_readvaluechunk(void)
+{
+    static const char testA[] = "<!-- comment1 -->";
+    IXmlReader *reader;
+    XmlNodeType type;
+    IStream *stream;
+    const WCHAR *value;
+    WCHAR b;
+    HRESULT hr;
+    UINT c;
+
+    hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
+    ok(hr == S_OK, "S_OK, got %08x\n", hr);
+
+    stream = create_stream_on_data(testA, sizeof(testA));
+    hr = IXmlReader_SetInput(reader, (IUnknown*)stream);
+    ok(hr == S_OK, "got %08x\n", hr);
+
+    hr = IXmlReader_Read(reader, &type);
+    ok(hr == S_OK, "got %08x\n", hr);
+
+    c = 0;
+    b = 0;
+    hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
+todo_wine {
+    ok(hr == S_OK, "got %08x\n", hr);
+    ok(c == 1, "got %u\n", c);
+    ok(b == ' ', "got %x\n", b);
+}
+    /* portion read as chunk is skipped from resulting node value */
+    value = NULL;
+    hr = IXmlReader_GetValue(reader, &value, NULL);
+    ok(hr == S_OK, "got %08x\n", hr);
+todo_wine
+    ok(value[0] == 'c', "got %s\n", wine_dbgstr_w(value));
+
+    /* once value is returned/allocated it's not possible to read by chunk */
+    c = 0;
+    b = 0;
+    hr = IXmlReader_ReadValueChunk(reader, &b, 1, &c);
+todo_wine
+    ok(hr == S_FALSE, "got %08x\n", hr);
+    ok(c == 0, "got %u\n", c);
+    ok(b == 0, "got %x\n", b);
+
+    value = NULL;
+    hr = IXmlReader_GetValue(reader, &value, NULL);
+    ok(hr == S_OK, "got %08x\n", hr);
+todo_wine
+    ok(value[0] == 'c', "got %s\n", wine_dbgstr_w(value));
+
+    IXmlReader_Release(reader);
+}
+
 START_TEST(reader)
 {
     HRESULT r;
@@ -1285,6 +1339,7 @@ START_TEST(reader)
     test_read_element();
     test_read_full();
     test_read_pending();
+    test_readvaluechunk();
     test_read_xmldeclaration();
 
     CoUninitialize();




More information about the wine-cvs mailing list