Commit 114ef068 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Implement GetStringLength method.

parent 98ce55c1
......@@ -271,8 +271,16 @@ static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *if
static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings *iface, UINT32 index, UINT32 *length)
{
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface);
FIXME("(%p)->(%u %p): stub\n", This, index, length);
return E_NOTIMPL;
TRACE("(%p)->(%u %p)\n", This, index, length);
if (index >= This->count) {
*length = (UINT32)-1;
return E_FAIL;
}
*length = strlenW(This->data[index].string);
return S_OK;
}
static HRESULT WINAPI localizedstrings_GetString(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size)
......
......@@ -321,6 +321,7 @@ static void test_GetFamilyNames(void)
IDWriteFont *font;
LOGFONTW logfont;
HRESULT hr;
UINT32 len;
hr = IDWriteFactory_GetGdiInterop(factory, &interop);
EXPECT_HR(hr, S_OK);
......@@ -350,9 +351,24 @@ if (0) /* crashes on native */
EXPECT_REF(names2, 1);
ok(names != names2, "got %p, was %p\n", names2, names);
IDWriteLocalizedStrings_Release(names);
IDWriteLocalizedStrings_Release(names2);
/* GetStringLength */
if (0) /* crashes on native */
hr = IDWriteLocalizedStrings_GetStringLength(names, 0, NULL);
len = 0;
hr = IDWriteLocalizedStrings_GetStringLength(names, 0, &len);
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(len > 0, "got %u\n", len);
len = 100;
hr = IDWriteLocalizedStrings_GetStringLength(names, 10, &len);
ok(hr == E_FAIL, "got 0x%08x\n", hr);
ok(len == (UINT32)-1, "got %u\n", len);
IDWriteLocalizedStrings_Release(names);
IDWriteFontFamily_Release(family);
IDWriteFont_Release(font);
IDWriteGdiInterop_Release(interop);
......
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