Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/msxml3/tests/domdoc.c | 44 +++++++++++++++++++++-------- dlls/msxml3/tests/httpreq.c | 19 +++++++++++++ dlls/msxml3/tests/saxreader.c | 52 +++++++++++++++++------------------ dlls/msxml3/tests/schema.c | 22 ++++++++++++++- 4 files changed, 99 insertions(+), 38 deletions(-)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index a7890d56f71..d2a4d867bae 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -54,6 +54,21 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(IID_transformdest_unknown,0xf5078f3a,0xc551,0x11d3,0x89,0xb9,0x00,0x00,0xf8,0x1f,0xe2,0x21);
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static int g_unexpectedcall, g_expectedcall;
struct msxmlsupported_data_t @@ -1480,6 +1495,14 @@ static void test_domdoc( void ) doc = create_document(&IID_IXMLDOMDocument); if (!doc) return;
+ check_interface(doc, &IID_IXMLDOMDocument, TRUE); + check_interface(doc, &IID_IPersistStreamInit, TRUE); + check_interface(doc, &IID_IObjectWithSite, TRUE); + check_interface(doc, &IID_IObjectSafety, TRUE); + check_interface(doc, &IID_IConnectionPointContainer, TRUE); + check_interface(doc, &IID_IDispatch, TRUE); + check_interface(doc, &IID_IDispatchEx, TRUE); + if (0) { /* crashes on native */ @@ -2110,7 +2133,6 @@ static void test_persiststream(void) IPersistStream *stream; IXMLDOMDocument *doc; ULARGE_INTEGER size; - IPersist *persist; IStream *istream; HRESULT hr; CLSID clsid; @@ -2130,11 +2152,8 @@ static void test_persiststream(void) ok(hr == S_OK, "got 0x%08x\n", hr); ok((IUnknown *)stream == (IUnknown *)streaminit, "got %p, %p\n", stream, streaminit);
- hr = IPersistStream_QueryInterface(stream, &IID_IPersist, (void **)&persist); - ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); - - hr = IXMLDOMDocument_QueryInterface(doc, &IID_IPersist, (void **)&persist); - ok(hr == E_NOINTERFACE, "got 0x%08x\n", hr); + check_interface(stream, &IID_IPersist, FALSE); + check_interface(doc, &IID_IPersist, FALSE);
hr = IPersistStreamInit_GetClassID(streaminit, NULL); ok(hr == E_POINTER, "got 0x%08x\n", hr); @@ -9039,6 +9058,10 @@ static void test_xsltemplate(void) if (!is_clsid_supported(&CLSID_XSLTemplate, &IID_IXSLTemplate)) return; template = create_xsltemplate(&IID_IXSLTemplate);
+ check_interface(template, &IID_IXSLTemplate, TRUE); + check_interface(template, &IID_IDispatch, TRUE); + check_interface(template, &IID_IDispatchEx, TRUE); + /* works as reset */ hr = IXSLTemplate_putref_stylesheet(template, NULL); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -10790,7 +10813,6 @@ static void test_mxnamespacemanager(void) IMXNamespaceManager *nsmgr; IUnknown *unk1, *unk2; WCHAR buffW[250]; - IDispatch *disp; IUnknown *unk; HRESULT hr; INT len; @@ -10799,10 +10821,10 @@ static void test_mxnamespacemanager(void) &IID_IMXNamespaceManager, (void**)&nsmgr); EXPECT_HR(hr, S_OK);
- /* IMXNamespaceManager inherits from IUnknown */ - hr = IMXNamespaceManager_QueryInterface(nsmgr, &IID_IDispatch, (void**)&disp); - EXPECT_HR(hr, S_OK); - IDispatch_Release(disp); + check_interface(nsmgr, &IID_IDispatch, TRUE); + check_interface(nsmgr, &IID_IDispatchEx, TRUE); + check_interface(nsmgr, &IID_IMXNamespaceManager, TRUE); + check_interface(nsmgr, &IID_IVBMXNamespaceManager, TRUE);
hr = IMXNamespaceManager_QueryInterface(nsmgr, &IID_IVBMXNamespaceManager, (void**)&mgr2); EXPECT_HR(hr, S_OK); diff --git a/dlls/msxml3/tests/httpreq.c b/dlls/msxml3/tests/httpreq.c index 4a23f1d82a8..2491e499638 100644 --- a/dlls/msxml3/tests/httpreq.c +++ b/dlls/msxml3/tests/httpreq.c @@ -50,6 +50,21 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line) ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc); }
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static const char xmltestA[] = "http://test.winehq.org/tests/xmltest.xml"; static const CHAR xmltestbodyA[] = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<a>TEST</a>\n";
@@ -1457,6 +1472,10 @@ static void test_XMLHTTP(void)
xhr = create_xhr();
+ check_interface(xhr, &IID_IXMLHttpRequest, TRUE); + check_interface(xhr, &IID_IDispatch, TRUE); + check_interface(xhr, &IID_IDispatchEx, FALSE); + VariantInit(&dummy); V_VT(&dummy) = VT_ERROR; V_ERROR(&dummy) = DISP_E_MEMBERNOTFOUND; diff --git a/dlls/msxml3/tests/saxreader.c b/dlls/msxml3/tests/saxreader.c index e401aafc87d..ad093af6a12 100644 --- a/dlls/msxml3/tests/saxreader.c +++ b/dlls/msxml3/tests/saxreader.c @@ -48,6 +48,21 @@ static void _expect_ref(IUnknown* obj, ULONG ref, int line) ok_(__FILE__, line)(rc == ref, "expected refcount %d, got %d\n", ref, rc); }
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static LONG get_refcount(void *iface) { IUnknown *unk = iface; @@ -4861,6 +4876,11 @@ static void test_saxreader_dispex(void) &IID_ISAXXMLReader, (void**)&reader); EXPECT_HR(hr, S_OK);
+ check_interface(reader, &IID_ISAXXMLReader, TRUE); + check_interface(reader, &IID_IVBSAXXMLReader, TRUE); + check_interface(reader, &IID_IDispatch, TRUE); + check_interface(reader, &IID_IDispatchEx, TRUE); + hr = ISAXXMLReader_QueryInterface(reader, &IID_IUnknown, (void**)&unk); EXPECT_HR(hr, S_OK); test_obj_dispex(unk); @@ -5811,40 +5831,20 @@ static void test_mxattr_dispex(void)
static void test_mxattr_qi(void) { - IVBSAXAttributes *vbsaxattr, *vbsaxattr2; - ISAXAttributes *saxattr; IMXAttributes *mxattr; HRESULT hr;
hr = CoCreateInstance(&CLSID_SAXAttributes, NULL, CLSCTX_INPROC_SERVER, - &IID_IMXAttributes, (void**)&mxattr); + &IID_IMXAttributes, (void **)&mxattr); EXPECT_HR(hr, S_OK);
- EXPECT_REF(mxattr, 1); - hr = IMXAttributes_QueryInterface(mxattr, &IID_ISAXAttributes, (void**)&saxattr); - EXPECT_HR(hr, S_OK); - - EXPECT_REF(mxattr, 2); - EXPECT_REF(saxattr, 2); - - hr = IMXAttributes_QueryInterface(mxattr, &IID_IVBSAXAttributes, (void**)&vbsaxattr); - EXPECT_HR(hr, S_OK); - - EXPECT_REF(vbsaxattr, 3); - EXPECT_REF(mxattr, 3); - EXPECT_REF(saxattr, 3); - - hr = ISAXAttributes_QueryInterface(saxattr, &IID_IVBSAXAttributes, (void**)&vbsaxattr2); - EXPECT_HR(hr, S_OK); - - EXPECT_REF(vbsaxattr, 4); - EXPECT_REF(mxattr, 4); - EXPECT_REF(saxattr, 4); + check_interface(mxattr, &IID_IMXAttributes, TRUE); + check_interface(mxattr, &IID_ISAXAttributes, TRUE); + check_interface(mxattr, &IID_IVBSAXAttributes, TRUE); + check_interface(mxattr, &IID_IDispatch, TRUE); + check_interface(mxattr, &IID_IDispatchEx, TRUE);
IMXAttributes_Release(mxattr); - ISAXAttributes_Release(saxattr); - IVBSAXAttributes_Release(vbsaxattr); - IVBSAXAttributes_Release(vbsaxattr2); }
static struct msxmlsupported_data_t saxattr_support_data[] = diff --git a/dlls/msxml3/tests/schema.c b/dlls/msxml3/tests/schema.c index 8dc9dcd7e22..4cdfedf9c29 100644 --- a/dlls/msxml3/tests/schema.c +++ b/dlls/msxml3/tests/schema.c @@ -37,6 +37,21 @@ #define EXPECT_HR(hr,hr_exp) \ ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
+#define check_interface(a, b, c) check_interface_(__LINE__, a, b, c) +static void check_interface_(unsigned int line, void *iface_ptr, REFIID iid, BOOL supported) +{ + IUnknown *iface = iface_ptr; + HRESULT hr, expected_hr; + IUnknown *unk; + + expected_hr = supported ? S_OK : E_NOINTERFACE; + + hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); + ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x, expected %#x.\n", hr, expected_hr); + if (SUCCEEDED(hr)) + IUnknown_Release(unk); +} + static const CHAR xdr_schema1_uri[] = "x-schema:test1.xdr"; static const CHAR xdr_schema1_xml[] = "<?xml version='1.0'?>" @@ -1808,8 +1823,13 @@ static void test_ifaces(void) hr = IXMLDOMSchemaCollection2_QueryInterface(cache, &CLSID_XMLSchemaCache60, (void**)&unk); ok (hr == S_OK, "Could not get CLSID_XMLSchemaCache60 iface: %08x\n", hr); ok (unk == (IUnknown*)cache, "unk != cache\n"); - IUnknown_Release(unk); + + check_interface(cache, &IID_IXMLDOMSchemaCollection, TRUE); + check_interface(cache, &IID_IXMLDOMSchemaCollection2, TRUE); + check_interface(cache, &IID_IDispatch, TRUE); + check_interface(cache, &IID_IDispatchEx, TRUE); + IXMLDOMSchemaCollection2_Release(cache); }