Commit 28e9b3f4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Added parameter check for registering/unregistering collection loaders.

parent 4aea5ca7
......@@ -491,11 +491,14 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory *i
static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory *iface,
IDWriteFontCollectionLoader *loader)
{
int i;
struct dwritefactory *This = impl_from_IDWriteFactory(iface);
int i;
TRACE("(%p)->(%p)\n", This, loader);
if (!loader)
return E_INVALIDARG;
for (i = 0; i < This->loader_count; i++)
if (This->loaders[i] == loader)
return DWRITE_E_ALREADYREGISTERED;
......@@ -527,11 +530,14 @@ static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory
static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory *iface,
IDWriteFontCollectionLoader *loader)
{
int i;
struct dwritefactory *This = impl_from_IDWriteFactory(iface);
int i;
TRACE("(%p)->(%p)\n", This, loader);
if (!loader)
return E_INVALIDARG;
for (i = 0; i < This->loader_count; i++)
if (This->loaders[i] == loader) break;
if (i == This->loader_count)
......
......@@ -855,6 +855,12 @@ static void test_CustomFontCollection(void)
IDWriteFontCollectionLoader collection2 = { &dwritefontcollectionloadervtbl };
HRESULT hr;
hr = IDWriteFactory_RegisterFontCollectionLoader(factory, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IDWriteFactory_UnregisterFontCollectionLoader(factory, NULL);
ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
hr = IDWriteFactory_RegisterFontCollectionLoader(factory, &collection);
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDWriteFactory_RegisterFontCollectionLoader(factory, &collection2);
......
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