dwrite: Added parameter check for registering/unregistering collection loaders.
This commit is contained in:
parent
4aea5ca72b
commit
28e9b3f421
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue