Nikolay Sivov : dwrite: Implement IDWriteFontList1::GetFont().
Module: wine Branch: master Commit: 51154acb6a5ad95e0b9610fb8e3069393ff17a8d URL: http://source.winehq.org/git/wine.git/?a=commit;h=51154acb6a5ad95e0b9610fb8e... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Fri May 6 00:34:01 2016 +0300 dwrite: Implement IDWriteFontList1::GetFont(). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dwrite/font.c | 12 ++++++++++-- dlls/dwrite/tests/font.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 2aad837..9c874f2 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1678,9 +1678,17 @@ static HRESULT WINAPI dwritefontlist1_GetFont(IDWriteFontList1 *iface, UINT32 in { struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - FIXME("(%p)->(%u %p): stub\n", This, index, font); + TRACE("(%p)->(%u %p)\n", This, index, font); - return E_NOTIMPL; + *font = NULL; + + if (This->font_count == 0) + return S_FALSE; + + if (index >= This->font_count) + return E_FAIL; + + return create_font(This->fonts[index], This->family, font); } static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *iface, UINT32 index, diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 5169f2a..3ffe97f 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -2945,10 +2945,18 @@ static void test_GetMatchingFonts(void) font = (void*)0xdeadbeef; hr = IDWriteFontList1_GetFont(fontlist1, ~0u, &font); - todo_wine { ok(hr == E_FAIL, "got 0x%08x\n", hr); ok(font == NULL, "got %p\n", font); - } + + font = (void*)0xdeadbeef; + hr = IDWriteFontList1_GetFont(fontlist1, IDWriteFontList1_GetFontCount(fontlist1), &font); + ok(hr == E_FAIL, "got 0x%08x\n", hr); + ok(font == NULL, "got %p\n", font); + + hr = IDWriteFontList1_GetFont(fontlist1, 0, &font); + ok(hr == S_OK, "got 0x%08x\n", hr); + IDWriteFont3_Release(font); + IDWriteFontList1_Release(fontlist1); } else
participants (1)
-
Alexandre Julliard