msxml3: Implement schema_cache_addCollection().
This commit is contained in:
parent
eac6ed018c
commit
491ec41f5a
|
@ -474,10 +474,31 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection *ifa
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void cache_copy(void* data, void* dest, xmlChar* name)
|
||||||
|
{
|
||||||
|
schema_cache* This = (schema_cache*) dest;
|
||||||
|
cache_entry* entry = (cache_entry*) data;
|
||||||
|
|
||||||
|
if (xmlHashLookup(This->cache, name) == NULL)
|
||||||
|
{
|
||||||
|
cache_entry_add_ref(entry);
|
||||||
|
xmlHashAddEntry(This->cache, name, entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI schema_cache_addCollection(IXMLDOMSchemaCollection *iface, IXMLDOMSchemaCollection *otherCollection)
|
static HRESULT WINAPI schema_cache_addCollection(IXMLDOMSchemaCollection *iface, IXMLDOMSchemaCollection *otherCollection)
|
||||||
{
|
{
|
||||||
FIXME("stub\n");
|
schema_cache* This = impl_from_IXMLDOMSchemaCollection(iface);
|
||||||
return E_NOTIMPL;
|
schema_cache* That = impl_from_IXMLDOMSchemaCollection(otherCollection);
|
||||||
|
TRACE("(%p)->(%p)\n", This, That);
|
||||||
|
|
||||||
|
if (!otherCollection)
|
||||||
|
return E_POINTER;
|
||||||
|
|
||||||
|
/* TODO: detect errors while copying & return E_FAIL */
|
||||||
|
xmlHashScan(That->cache, cache_copy, This);
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI schema_cache_get__newEnum(IXMLDOMSchemaCollection *iface, IUnknown **ppUnk)
|
static HRESULT WINAPI schema_cache_get__newEnum(IXMLDOMSchemaCollection *iface, IUnknown **ppUnk)
|
||||||
|
|
|
@ -324,6 +324,7 @@ static void test_collection_refs(void)
|
||||||
IXMLDOMDocument2 *schema1, *schema2, *schema3;
|
IXMLDOMDocument2 *schema1, *schema2, *schema3;
|
||||||
IXMLDOMSchemaCollection *cache1, *cache2, *cache3;
|
IXMLDOMSchemaCollection *cache1, *cache2, *cache3;
|
||||||
VARIANT_BOOL b;
|
VARIANT_BOOL b;
|
||||||
|
LONG length;
|
||||||
|
|
||||||
schema1 = create_document(&IID_IXMLDOMDocument2);
|
schema1 = create_document(&IID_IXMLDOMDocument2);
|
||||||
schema2 = create_document(&IID_IXMLDOMDocument2);
|
schema2 = create_document(&IID_IXMLDOMDocument2);
|
||||||
|
@ -376,8 +377,22 @@ static void test_collection_refs(void)
|
||||||
if (schema2) todo_wine check_refs(IXMLDOMDocument2, schema2, 1);
|
if (schema2) todo_wine check_refs(IXMLDOMDocument2, schema2, 1);
|
||||||
if (schema3) todo_wine check_refs(IXMLDOMDocument2, schema3, 1);
|
if (schema3) todo_wine check_refs(IXMLDOMDocument2, schema3, 1);
|
||||||
|
|
||||||
todo_wine ole_check(IXMLDOMSchemaCollection_addCollection(cache2, cache1));
|
ole_expect(IXMLDOMSchemaCollection_addCollection(cache1, NULL), E_POINTER);
|
||||||
todo_wine ole_check(IXMLDOMSchemaCollection_addCollection(cache3, cache2));
|
ole_check(IXMLDOMSchemaCollection_addCollection(cache2, cache1));
|
||||||
|
ole_check(IXMLDOMSchemaCollection_addCollection(cache3, cache2));
|
||||||
|
|
||||||
|
length = -1;
|
||||||
|
ole_check(IXMLDOMSchemaCollection_get_length(cache1, &length));
|
||||||
|
ok(length == 1, "expected length 1, got %i", length);
|
||||||
|
|
||||||
|
length = -1;
|
||||||
|
ole_check(IXMLDOMSchemaCollection_get_length(cache2, &length));
|
||||||
|
ok(length == 2, "expected length 2, got %i", length);
|
||||||
|
|
||||||
|
length = -1;
|
||||||
|
ole_check(IXMLDOMSchemaCollection_get_length(cache3, &length));
|
||||||
|
ok(length == 3, "expected length 3, got %i", length);
|
||||||
|
|
||||||
|
|
||||||
/* merging collections does not affect the ref count */
|
/* merging collections does not affect the ref count */
|
||||||
check_refs(IXMLDOMSchemaCollection, cache1, 1);
|
check_refs(IXMLDOMSchemaCollection, cache1, 1);
|
||||||
|
|
Loading…
Reference in New Issue