Commit 493e406b authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

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

parent 09f37192
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment