Commit b9b2dafb authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

xmllite/tests: Use static linking to xmllite.dll.

parent 41f22e4c
TESTDLL = xmllite.dll
IMPORTS = ole32
IMPORTS = xmllite ole32
C_SRCS = \
reader.c \
......
......@@ -33,14 +33,6 @@
DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
static HRESULT (WINAPI *pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
static HRESULT (WINAPI *pCreateXmlReaderInputWithEncodingName)(IUnknown *stream,
IMalloc *pMalloc,
LPCWSTR encoding,
BOOL hint,
LPCWSTR base_uri,
IXmlReaderInput **ppInput);
static WCHAR *a2w(const char *str)
{
int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
......@@ -367,25 +359,6 @@ static const ISequentialStreamVtbl teststreamvtbl =
teststream_Write
};
static BOOL init_pointers(void)
{
/* don't free module here, it's to be unloaded on exit */
HMODULE mod = LoadLibraryA("xmllite.dll");
if (!mod)
{
win_skip("xmllite library not available\n");
return FALSE;
}
#define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE;
MAKEFUNC(CreateXmlReader);
MAKEFUNC(CreateXmlReaderInputWithEncodingName);
#undef MAKEFUNC
return TRUE;
}
static HRESULT WINAPI resolver_QI(IXmlResolver *iface, REFIID riid, void **obj)
{
ok(0, "unexpected call, riid %s\n", wine_dbgstr_guid(riid));
......@@ -440,11 +413,11 @@ static void test_reader_create(void)
/* crashes native */
if (0)
{
pCreateXmlReader(&IID_IXmlReader, NULL, NULL);
pCreateXmlReader(NULL, (void**)&reader, NULL);
CreateXmlReader(&IID_IXmlReader, NULL, NULL);
CreateXmlReader(NULL, (void**)&reader, NULL);
}
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
test_read_state(reader, XmlReadState_Closed, -1, FALSE);
......@@ -517,9 +490,9 @@ static void test_readerinput(void)
HRESULT hr;
LONG ref;
hr = pCreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, NULL);
hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
hr = pCreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, &reader_input);
hr = CreateXmlReaderInputWithEncodingName(NULL, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
......@@ -528,7 +501,7 @@ static void test_readerinput(void)
ref = IStream_AddRef(stream);
ok(ref == 2, "Expected 2, got %d\n", ref);
IStream_Release(stream);
hr = pCreateXmlReaderInputWithEncodingName((IUnknown*)stream, NULL, NULL, FALSE, NULL, &reader_input);
hr = CreateXmlReaderInputWithEncodingName((IUnknown*)stream, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IUnknown_QueryInterface(reader_input, &IID_IStream, (void**)&stream2);
......@@ -543,7 +516,7 @@ static void test_readerinput(void)
IStream_Release(stream);
/* try ::SetInput() with valid IXmlReaderInput */
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ref = IUnknown_AddRef(reader_input);
......@@ -609,7 +582,7 @@ static void test_readerinput(void)
ref = IUnknown_AddRef(input);
ok(ref == 2, "Expected 2, got %d\n", ref);
IUnknown_Release(input);
hr = pCreateXmlReaderInputWithEncodingName(input, NULL, NULL, FALSE, NULL, &reader_input);
hr = CreateXmlReaderInputWithEncodingName(input, NULL, NULL, FALSE, NULL, &reader_input);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok_iids(&input_iids, empty_seq, NULL, FALSE);
/* IXmlReaderInput stores stream interface as IUnknown */
......@@ -617,7 +590,7 @@ static void test_readerinput(void)
ok(ref == 3, "Expected 3, got %d\n", ref);
IUnknown_Release(input);
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
input_iids.count = 0;
......@@ -648,7 +621,7 @@ static void test_readerinput(void)
ok_iids(&input_iids, setinput_readerinput, NULL, FALSE);
/* another reader */
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader2, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* resolving from IXmlReaderInput to IStream/ISequentialStream is done at
......@@ -671,7 +644,7 @@ static void test_reader_state(void)
XmlNodeType nodetype;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* invalid arguments */
......@@ -711,7 +684,7 @@ static void test_read_xmldeclaration(void)
BOOL ret;
const WCHAR *val;
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* position methods with Null args */
......@@ -932,7 +905,7 @@ static void test_read_comment(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1014,7 +987,7 @@ static void test_read_pi(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1130,7 +1103,7 @@ static void test_read_full(void)
HRESULT hr;
int i;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
stream = create_stream_on_data(test->xml, strlen(test->xml)+1);
......@@ -1179,7 +1152,7 @@ static void test_read_dtd(void)
UINT len, count;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
hr = IXmlReader_SetProperty(reader, XmlReaderProperty_DtdProcessing, DtdProcessing_Parse);
......@@ -1272,7 +1245,7 @@ static void test_read_element(void)
UINT depth;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1403,7 +1376,7 @@ static void test_read_pending(void)
HRESULT hr;
int c;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got 0x%08x\n", hr);
hr = IXmlReader_SetInput(reader, (IUnknown*)&teststream);
......@@ -1441,7 +1414,7 @@ static void test_readvaluechunk(void)
HRESULT hr;
UINT c;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
stream = create_stream_on_data(testA, sizeof(testA));
......@@ -1496,7 +1469,7 @@ static void test_read_cdata(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1589,7 +1562,7 @@ static void test_read_text(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1687,7 +1660,7 @@ static void test_isemptyelement(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1745,7 +1718,7 @@ static void test_read_attribute(void)
IXmlReader *reader;
HRESULT hr;
hr = pCreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
hr = CreateXmlReader(&IID_IXmlReader, (void**)&reader, NULL);
ok(hr == S_OK, "S_OK, got %08x\n", hr);
while (test->xml)
......@@ -1814,9 +1787,6 @@ static void test_read_attribute(void)
START_TEST(reader)
{
if (!init_pointers())
return;
test_reader_create();
test_readerinput();
test_reader_state();
......
......@@ -31,16 +31,6 @@
#include "initguid.h"
DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
static HRESULT (WINAPI *pCreateXmlWriter)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
static HRESULT (WINAPI *pCreateXmlWriterOutputWithEncodingName)(IUnknown *stream,
IMalloc *imalloc,
LPCWSTR encoding_name,
IXmlWriterOutput **output);
static HRESULT (WINAPI *pCreateXmlWriterOutputWithEncodingCodePage)(IUnknown *stream,
IMalloc *imalloc,
UINT codepage,
IXmlWriterOutput **output);
static HRESULT WINAPI testoutput_QueryInterface(IUnknown *iface, REFIID riid, void **obj)
{
if (IsEqualGUID(riid, &IID_IUnknown)) {
......@@ -127,11 +117,11 @@ static void test_writer_create(void)
/* crashes native */
if (0)
{
pCreateXmlWriter(&IID_IXmlWriter, NULL, NULL);
pCreateXmlWriter(NULL, (void**)&writer, NULL);
CreateXmlWriter(&IID_IXmlWriter, NULL, NULL);
CreateXmlWriter(NULL, (void**)&writer, NULL);
}
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* check default properties values */
......@@ -158,26 +148,6 @@ static void test_writer_create(void)
IXmlWriter_Release(writer);
}
static BOOL init_pointers(void)
{
/* don't free module here, it's to be unloaded on exit */
HMODULE mod = LoadLibraryA("xmllite.dll");
if (!mod)
{
win_skip("xmllite library not available\n");
return FALSE;
}
#define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE;
MAKEFUNC(CreateXmlWriter);
MAKEFUNC(CreateXmlWriterOutputWithEncodingName);
MAKEFUNC(CreateXmlWriterOutputWithEncodingCodePage);
#undef MAKEFUNC
return TRUE;
}
static void test_writeroutput(void)
{
static const WCHAR utf16W[] = {'u','t','f','-','1','6',0};
......@@ -186,11 +156,11 @@ static void test_writeroutput(void)
HRESULT hr;
output = NULL;
hr = pCreateXmlWriterOutputWithEncodingName(&testoutput, NULL, NULL, &output);
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, NULL, &output);
ok(hr == S_OK, "got %08x\n", hr);
IUnknown_Release(output);
hr = pCreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output);
hr = CreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
......@@ -200,11 +170,11 @@ static void test_writeroutput(void)
IUnknown_Release(output);
output = NULL;
hr = pCreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, ~0u, &output);
hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, ~0u, &output);
ok(hr == S_OK, "got %08x\n", hr);
IUnknown_Release(output);
hr = pCreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, CP_UTF8, &output);
hr = CreateXmlWriterOutputWithEncodingCodePage(&testoutput, NULL, CP_UTF8, &output);
ok(hr == S_OK, "got %08x\n", hr);
unk = NULL;
hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk);
......@@ -226,7 +196,7 @@ static void test_writestartdocument(void)
HRESULT hr;
char *ptr;
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
/* output not set */
......@@ -306,7 +276,7 @@ static void test_flush(void)
IXmlWriter *writer;
HRESULT hr;
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)&teststream);
......@@ -342,7 +312,7 @@ static void test_omitxmldeclaration(void)
HRESULT hr;
char *ptr;
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
......@@ -440,10 +410,10 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE);
......@@ -473,7 +443,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
......@@ -499,7 +469,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
......@@ -525,7 +495,7 @@ static void test_bom(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
hr = CreateXmlWriterOutputWithEncodingName((IUnknown*)stream, NULL, utf16W, &output);
ok(hr == S_OK, "got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, output);
......@@ -565,7 +535,7 @@ static void test_writestartelement(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_WriteStartElement(writer, NULL, aW, NULL);
......@@ -612,7 +582,7 @@ static void test_writestartelement(void)
IXmlWriter_Release(writer);
/* WriteElementString */
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
......@@ -657,7 +627,7 @@ static void test_writeendelement(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetOutput(writer, (IUnknown*)stream);
......@@ -702,7 +672,7 @@ static void test_writeenddocument(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_WriteEndDocument(writer);
......@@ -769,7 +739,7 @@ static void test_WriteComment(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE);
......@@ -829,7 +799,7 @@ static void test_WriteCData(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_SetProperty(writer, XmlWriterProperty_OmitXmlDeclaration, TRUE);
......@@ -892,7 +862,7 @@ static void test_WriteRaw(void)
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = pCreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
hr = CreateXmlWriter(&IID_IXmlWriter, (void**)&writer, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
hr = IXmlWriter_WriteRaw(writer, NULL);
......@@ -943,9 +913,6 @@ static void test_WriteRaw(void)
START_TEST(writer)
{
if (!init_pointers())
return;
test_writer_create();
test_writeroutput();
test_writestartdocument();
......
......@@ -300,3 +300,5 @@ cpp_quote("STDAPI CreateXmlWriter(REFIID riid, void **ppvObject, IMalloc *pMallo
cpp_quote("typedef IUnknown IXmlWriterOutput;")
cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,")
cpp_quote(" LPCWSTR encoding, IXmlWriterOutput **output);")
cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingCodePage(IUnknown *stream, IMalloc *pMalloc,")
cpp_quote(" UINT codepage, IXmlWriterOutput **output);")
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