mirror of
https://github.com/reactos/reactos.git
synced 2024-10-04 16:36:11 +00:00
[XMLLITE_WINETEST]
- Sync to Wine 1.3.37 svn path=/trunk/; revision=56190
This commit is contained in:
parent
8de2ad3d83
commit
551ab97f99
|
@ -1,12 +1,13 @@
|
||||||
|
|
||||||
add_definitions(-D__ROS_LONG64__)
|
add_definitions(-D__ROS_LONG64__)
|
||||||
|
|
||||||
add_executable(xmllite_winetest reader.c testlist.c)
|
list(APPEND SOURCE
|
||||||
target_link_libraries(xmllite_winetest wine)
|
reader.c
|
||||||
|
writer.c
|
||||||
|
testlist.c)
|
||||||
|
|
||||||
if(MSVC)
|
add_executable(xmllite_winetest ${SOURCE})
|
||||||
target_link_libraries(xmllite_winetest uuid)
|
target_link_libraries(xmllite_winetest wine uuid)
|
||||||
endif()
|
|
||||||
|
|
||||||
set_module_type(xmllite_winetest win32cui)
|
set_module_type(xmllite_winetest win32cui)
|
||||||
add_importlibs(xmllite_winetest xmllite ole32 msvcrt kernel32 ntdll)
|
add_importlibs(xmllite_winetest xmllite ole32 msvcrt kernel32 ntdll)
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
|
#define CONST_VTABLE
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -32,8 +33,8 @@
|
||||||
|
|
||||||
DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
|
DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
|
||||||
|
|
||||||
HRESULT (WINAPI *pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
|
static HRESULT WINAPI (*pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
|
||||||
HRESULT (WINAPI *pCreateXmlReaderInputWithEncodingName)(IUnknown *stream,
|
static HRESULT WINAPI (*pCreateXmlReaderInputWithEncodingName)(IUnknown *stream,
|
||||||
IMalloc *pMalloc,
|
IMalloc *pMalloc,
|
||||||
LPCWSTR encoding,
|
LPCWSTR encoding,
|
||||||
BOOL hint,
|
BOOL hint,
|
||||||
|
@ -258,13 +259,13 @@ static void test_read_state_(IXmlReader *reader, XmlReadState expected,
|
||||||
|
|
||||||
typedef struct _testinput
|
typedef struct _testinput
|
||||||
{
|
{
|
||||||
const IUnknownVtbl *lpVtbl;
|
IUnknown IUnknown_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
} testinput;
|
} testinput;
|
||||||
|
|
||||||
static inline testinput *impl_from_IUnknown(IUnknown *iface)
|
static inline testinput *impl_from_IUnknown(IUnknown *iface)
|
||||||
{
|
{
|
||||||
return (testinput *)((char*)iface - FIELD_OFFSET(testinput, lpVtbl));
|
return CONTAINING_RECORD(iface, testinput, IUnknown_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI testinput_QueryInterface(IUnknown *iface, REFIID riid, void** ppvObj)
|
static HRESULT WINAPI testinput_QueryInterface(IUnknown *iface, REFIID riid, void** ppvObj)
|
||||||
|
@ -317,10 +318,10 @@ static HRESULT testinput_createinstance(void **ppObj)
|
||||||
input = HeapAlloc(GetProcessHeap(), 0, sizeof (*input));
|
input = HeapAlloc(GetProcessHeap(), 0, sizeof (*input));
|
||||||
if(!input) return E_OUTOFMEMORY;
|
if(!input) return E_OUTOFMEMORY;
|
||||||
|
|
||||||
input->lpVtbl = &testinput_vtbl;
|
input->IUnknown_iface.lpVtbl = &testinput_vtbl;
|
||||||
input->ref = 1;
|
input->ref = 1;
|
||||||
|
|
||||||
*ppObj = &input->lpVtbl;
|
*ppObj = &input->IUnknown_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -353,8 +354,8 @@ static void test_reader_create(void)
|
||||||
/* crashes native */
|
/* crashes native */
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
hr = pCreateXmlReader(&IID_IXmlReader, NULL, NULL);
|
pCreateXmlReader(&IID_IXmlReader, NULL, NULL);
|
||||||
hr = pCreateXmlReader(NULL, (LPVOID*)&reader, NULL);
|
pCreateXmlReader(NULL, (LPVOID*)&reader, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
|
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL);
|
||||||
|
@ -372,13 +373,14 @@ static void test_reader_create(void)
|
||||||
hr = testinput_createinstance((void**)&input);
|
hr = testinput_createinstance((void**)&input);
|
||||||
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
|
||||||
input_iids.count = 0;
|
if (hr == S_OK)
|
||||||
hr = IXmlReader_SetInput(reader, input);
|
{
|
||||||
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
|
input_iids.count = 0;
|
||||||
ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE);
|
hr = IXmlReader_SetInput(reader, input);
|
||||||
|
ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr);
|
||||||
IUnknown_Release(input);
|
ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE);
|
||||||
|
IUnknown_Release(input);
|
||||||
|
}
|
||||||
IXmlReader_Release(reader);
|
IXmlReader_Release(reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +576,7 @@ todo_wine {
|
||||||
ok(type == XmlNodeType_XmlDeclaration,
|
ok(type == XmlNodeType_XmlDeclaration,
|
||||||
"Expected XmlNodeType_XmlDeclaration, got %s\n", type_to_str(type));
|
"Expected XmlNodeType_XmlDeclaration, got %s\n", type_to_str(type));
|
||||||
}
|
}
|
||||||
/* new version 1.2.x and 1.3.x properly update postition for <?xml ?> */
|
/* new version 1.2.x and 1.3.x properly update position for <?xml ?> */
|
||||||
ok_pos(reader, 1, 3, -1, 55, TRUE);
|
ok_pos(reader, 1, 3, -1, 55, TRUE);
|
||||||
|
|
||||||
/* check attributes */
|
/* check attributes */
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
#include "wine/test.h"
|
#include "wine/test.h"
|
||||||
|
|
||||||
extern void func_reader(void);
|
extern void func_reader(void);
|
||||||
|
extern void func_writer(void);
|
||||||
|
|
||||||
const struct test winetest_testlist[] =
|
const struct test winetest_testlist[] =
|
||||||
{
|
{
|
||||||
{ "reader", func_reader },
|
{ "reader", func_reader },
|
||||||
|
{ "writer", func_writer },
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
87
rostests/winetests/xmllite/writer.c
Normal file
87
rostests/winetests/xmllite/writer.c
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*
|
||||||
|
* XMLLite IXmlWriter tests
|
||||||
|
*
|
||||||
|
* Copyright 2011 (C) Alistair Leslie-Hughes
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "ole2.h"
|
||||||
|
#include "xmllite.h"
|
||||||
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
static HRESULT WINAPI (*pCreateXmlWriter)(REFIID riid, void **ppvObject, IMalloc *pMalloc);
|
||||||
|
|
||||||
|
static void test_writer_create(void)
|
||||||
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
IXmlWriter *writer;
|
||||||
|
|
||||||
|
/* crashes native */
|
||||||
|
if (0)
|
||||||
|
{
|
||||||
|
pCreateXmlWriter(&IID_IXmlWriter, NULL, NULL);
|
||||||
|
pCreateXmlWriter(NULL, (LPVOID*)&writer, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
hr = pCreateXmlWriter(&IID_IXmlWriter, (LPVOID*)&writer, NULL);
|
||||||
|
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
|
||||||
|
if(hr == S_OK)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
#undef MAKEFUNC
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
START_TEST(writer)
|
||||||
|
{
|
||||||
|
HRESULT r;
|
||||||
|
|
||||||
|
r = CoInitialize( NULL );
|
||||||
|
ok( r == S_OK, "failed to init com\n");
|
||||||
|
|
||||||
|
if (!init_pointers())
|
||||||
|
{
|
||||||
|
CoUninitialize();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
test_writer_create();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
|
}
|
Loading…
Reference in a new issue