mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-01 12:47:44 +00:00
dwrite: Implement remaining methods of IDWriteLocalizedStrings.
This commit is contained in:
parent
ad69c7bf6d
commit
e2eb760ffc
2 changed files with 56 additions and 10 deletions
|
@ -256,22 +256,57 @@ static HRESULT WINAPI localizedstrings_FindLocaleName(IDWriteLocalizedStrings *i
|
|||
WCHAR const *locale_name, UINT32 *index, BOOL *exists)
|
||||
{
|
||||
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface);
|
||||
FIXME("(%p)->(%s %p %p): stub\n", This, debugstr_w(locale_name), index, exists);
|
||||
return E_NOTIMPL;
|
||||
UINT32 i;
|
||||
|
||||
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(locale_name), index, exists);
|
||||
|
||||
*exists = FALSE;
|
||||
*index = ~0;
|
||||
|
||||
for (i = 0; i < This->count; i++) {
|
||||
if (!strcmpiW(This->data[i].locale, locale_name)) {
|
||||
*exists = TRUE;
|
||||
*index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI localizedstrings_GetLocaleNameLength(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].locale);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *locale_name, UINT32 size)
|
||||
static HRESULT WINAPI localizedstrings_GetLocaleName(IDWriteLocalizedStrings *iface, UINT32 index, WCHAR *buffer, UINT32 size)
|
||||
{
|
||||
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface);
|
||||
FIXME("(%p)->(%u %p %u): stub\n", This, index, locale_name, size);
|
||||
return E_NOTIMPL;
|
||||
|
||||
TRACE("(%p)->(%u %p %u)\n", This, index, buffer, size);
|
||||
|
||||
if (index >= This->count) {
|
||||
if (buffer) *buffer = 0;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (size < strlenW(This->data[index].locale)+1) {
|
||||
if (buffer) *buffer = 0;
|
||||
return E_NOT_SUFFICIENT_BUFFER;
|
||||
}
|
||||
|
||||
strcpyW(buffer, This->data[index].locale);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI localizedstrings_GetStringLength(IDWriteLocalizedStrings *iface, UINT32 index, UINT32 *length)
|
||||
|
|
|
@ -2051,14 +2051,16 @@ todo_wine
|
|||
static void test_GetFaceNames(void)
|
||||
{
|
||||
static const WCHAR obliqueW[] = {'O','b','l','i','q','u','e',0};
|
||||
static const WCHAR enus2W[] = {'e','n','-','U','s',0};
|
||||
static const WCHAR enusW[] = {'e','n','-','u','s',0};
|
||||
IDWriteLocalizedStrings *strings, *strings2;
|
||||
IDWriteGdiInterop *interop;
|
||||
IDWriteFactory *factory;
|
||||
UINT32 count, index;
|
||||
IDWriteFont *font;
|
||||
LOGFONTW logfont;
|
||||
WCHAR buffW[255];
|
||||
UINT32 count;
|
||||
BOOL exists;
|
||||
HRESULT hr;
|
||||
|
||||
factory = create_factory();
|
||||
|
@ -2087,13 +2089,22 @@ static void test_GetFaceNames(void)
|
|||
count = IDWriteLocalizedStrings_GetCount(strings);
|
||||
ok(count == 1, "got %d\n", count);
|
||||
|
||||
index = 1;
|
||||
exists = FALSE;
|
||||
hr = IDWriteLocalizedStrings_FindLocaleName(strings, enus2W, &index, &exists);
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(index == 0 && exists, "got %d, %d\n", index, exists);
|
||||
|
||||
count = 0;
|
||||
hr = IDWriteLocalizedStrings_GetLocaleNameLength(strings, 1, &count);
|
||||
ok(hr == E_FAIL, "got 0x%08x\n", hr);
|
||||
ok(count == ~0, "got %d\n", count);
|
||||
|
||||
/* for simulated faces names are also simulated */
|
||||
buffW[0] = 0;
|
||||
hr = IDWriteLocalizedStrings_GetLocaleName(strings, 0, buffW, sizeof(buffW)/sizeof(WCHAR));
|
||||
todo_wine {
|
||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||
ok(!lstrcmpW(buffW, enusW), "got %s\n", wine_dbgstr_w(buffW));
|
||||
}
|
||||
|
||||
buffW[0] = 0;
|
||||
hr = IDWriteLocalizedStrings_GetString(strings, 0, buffW, sizeof(buffW)/sizeof(WCHAR));
|
||||
|
|
Loading…
Reference in a new issue