Author: rharabien Date: Mon Mar 19 15:18:56 2012 New Revision: 56190
URL: http://svn.reactos.org/svn/reactos?rev=56190&view=rev Log: [XMLLITE_WINETEST] - Sync to Wine 1.3.37
Added: trunk/rostests/winetests/xmllite/writer.c (with props) Modified: trunk/rostests/winetests/xmllite/CMakeLists.txt trunk/rostests/winetests/xmllite/reader.c trunk/rostests/winetests/xmllite/testlist.c
Modified: trunk/rostests/winetests/xmllite/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xmllite/CMakeLis... ============================================================================== --- trunk/rostests/winetests/xmllite/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/winetests/xmllite/CMakeLists.txt [iso-8859-1] Mon Mar 19 15:18:56 2012 @@ -1,12 +1,13 @@
add_definitions(-D__ROS_LONG64__)
-add_executable(xmllite_winetest reader.c testlist.c) -target_link_libraries(xmllite_winetest wine) +list(APPEND SOURCE + reader.c + writer.c + testlist.c)
-if(MSVC) - target_link_libraries(xmllite_winetest uuid) -endif() +add_executable(xmllite_winetest ${SOURCE}) +target_link_libraries(xmllite_winetest wine uuid)
set_module_type(xmllite_winetest win32cui) add_importlibs(xmllite_winetest xmllite ole32 msvcrt kernel32 ntdll)
Modified: trunk/rostests/winetests/xmllite/reader.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xmllite/reader.c... ============================================================================== --- trunk/rostests/winetests/xmllite/reader.c [iso-8859-1] (original) +++ trunk/rostests/winetests/xmllite/reader.c [iso-8859-1] Mon Mar 19 15:18:56 2012 @@ -19,6 +19,7 @@ */
#define COBJMACROS +#define CONST_VTABLE
#include <stdarg.h> #include <stdio.h> @@ -32,8 +33,8 @@
DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda);
-HRESULT (WINAPI *pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc); -HRESULT (WINAPI *pCreateXmlReaderInputWithEncodingName)(IUnknown *stream, +static HRESULT WINAPI (*pCreateXmlReader)(REFIID riid, void **ppvObject, IMalloc *pMalloc); +static HRESULT WINAPI (*pCreateXmlReaderInputWithEncodingName)(IUnknown *stream, IMalloc *pMalloc, LPCWSTR encoding, BOOL hint, @@ -258,13 +259,13 @@
typedef struct _testinput { - const IUnknownVtbl *lpVtbl; + IUnknown IUnknown_iface; LONG ref; } testinput;
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) @@ -317,10 +318,10 @@ input = HeapAlloc(GetProcessHeap(), 0, sizeof (*input)); if(!input) return E_OUTOFMEMORY;
- input->lpVtbl = &testinput_vtbl; + input->IUnknown_iface.lpVtbl = &testinput_vtbl; input->ref = 1;
- *ppObj = &input->lpVtbl; + *ppObj = &input->IUnknown_iface;
return S_OK; } @@ -353,8 +354,8 @@ /* crashes native */ if (0) { - hr = pCreateXmlReader(&IID_IXmlReader, NULL, NULL); - hr = pCreateXmlReader(NULL, (LPVOID*)&reader, NULL); + pCreateXmlReader(&IID_IXmlReader, NULL, NULL); + pCreateXmlReader(NULL, (LPVOID*)&reader, NULL); }
hr = pCreateXmlReader(&IID_IXmlReader, (LPVOID*)&reader, NULL); @@ -372,13 +373,14 @@ hr = testinput_createinstance((void**)&input); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
- input_iids.count = 0; - hr = IXmlReader_SetInput(reader, input); - ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); - ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE); - - IUnknown_Release(input); - + if (hr == S_OK) + { + input_iids.count = 0; + hr = IXmlReader_SetInput(reader, input); + ok(hr == E_NOINTERFACE, "Expected E_NOINTERFACE, got %08x\n", hr); + ok_iids(&input_iids, setinput_full, setinput_full_old, FALSE); + IUnknown_Release(input); + } IXmlReader_Release(reader); }
@@ -574,7 +576,7 @@ ok(type == XmlNodeType_XmlDeclaration, "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);
/* check attributes */
Modified: trunk/rostests/winetests/xmllite/testlist.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xmllite/testlist... ============================================================================== --- trunk/rostests/winetests/xmllite/testlist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/xmllite/testlist.c [iso-8859-1] Mon Mar 19 15:18:56 2012 @@ -7,9 +7,11 @@ #include "wine/test.h"
extern void func_reader(void); +extern void func_writer(void);
const struct test winetest_testlist[] = { { "reader", func_reader }, + { "writer", func_writer }, { 0, 0 } };
Added: trunk/rostests/winetests/xmllite/writer.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/xmllite/writer.c... ============================================================================== --- trunk/rostests/winetests/xmllite/writer.c (added) +++ trunk/rostests/winetests/xmllite/writer.c [iso-8859-1] Mon Mar 19 15:18:56 2012 @@ -1,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(); +}
Propchange: trunk/rostests/winetests/xmllite/writer.c ------------------------------------------------------------------------------ svn:eol-style = native