dwrite/tests: Add some tests for reference objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
07833cce8f
commit
725a787f45
|
@ -7558,12 +7558,12 @@ static void test_CreateFontFaceReference(void)
|
||||||
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
|
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
|
||||||
IDWriteFontFace3 *fontface, *fontface1;
|
IDWriteFontFace3 *fontface, *fontface1;
|
||||||
IDWriteFontFaceReference *ref, *ref1;
|
IDWriteFontFaceReference *ref, *ref1;
|
||||||
|
IDWriteFontCollection1 *collection;
|
||||||
IDWriteFontFile *file, *file1;
|
IDWriteFontFile *file, *file1;
|
||||||
IDWriteFactory3 *factory;
|
IDWriteFactory3 *factory;
|
||||||
|
UINT32 index, count, i;
|
||||||
IDWriteFont3 *font3;
|
IDWriteFont3 *font3;
|
||||||
IDWriteFont *font;
|
|
||||||
ULONG refcount;
|
ULONG refcount;
|
||||||
UINT32 index;
|
|
||||||
WCHAR *path;
|
WCHAR *path;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
@ -7672,47 +7672,87 @@ todo_wine
|
||||||
IDWriteFontFile_Release(file);
|
IDWriteFontFile_Release(file);
|
||||||
IDWriteFontFile_Release(file1);
|
IDWriteFontFile_Release(file1);
|
||||||
|
|
||||||
/* references returned from IDWriteFont3 */
|
/* References returned from IDWriteFont3/IDWriteFontFace3. */
|
||||||
font = get_tahoma_instance((IDWriteFactory *)factory, DWRITE_FONT_STYLE_NORMAL);
|
hr = IDWriteFactory3_GetSystemFontCollection(factory, FALSE, &collection, FALSE);
|
||||||
hr = IDWriteFont_QueryInterface(font, &IID_IDWriteFont3, (void**)&font3);
|
ok(hr == S_OK, "Failed to get system collection, hr %#x.\n", hr);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
||||||
IDWriteFont_Release(font);
|
|
||||||
|
|
||||||
hr = IDWriteFont3_GetFontFaceReference(font3, &ref);
|
count = IDWriteFontCollection1_GetFontFamilyCount(collection);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
for (i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
IDWriteFontFamily1 *family;
|
||||||
|
UINT32 font_count, j;
|
||||||
|
|
||||||
hr = IDWriteFont3_GetFontFaceReference(font3, &ref1);
|
hr = IDWriteFontCollection1_GetFontFamily(collection, i, &family);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "Failed to get family, hr %#x.\n", hr);
|
||||||
ok(ref != ref1, "got %p, %p\n", ref1, ref);
|
|
||||||
|
|
||||||
IDWriteFontFaceReference_Release(ref);
|
font_count = IDWriteFontFamily1_GetFontCount(family);
|
||||||
IDWriteFontFaceReference_Release(ref1);
|
|
||||||
|
|
||||||
/* references returned from IDWriteFontFace3 */
|
for (j = 0; j < font_count; j++)
|
||||||
hr = IDWriteFont3_CreateFontFace(font3, &fontface);
|
{
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
IDWriteFontFaceReference1 *ref2;
|
||||||
|
|
||||||
hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref);
|
hr = IDWriteFontFamily1_GetFont(family, j, &font3);
|
||||||
todo_wine
|
ok(hr == S_OK, "Failed to get font, hr %#x.\n", hr);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
||||||
|
|
||||||
hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref1);
|
hr = IDWriteFont3_GetFontFaceReference(font3, &ref);
|
||||||
todo_wine
|
ok(hr == S_OK, "Failed to get reference object, hr %#x.\n", hr);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
|
||||||
if (hr == S_OK)
|
|
||||||
ok(ref == ref1, "got %p, %p\n", ref1, ref);
|
|
||||||
|
|
||||||
if (hr == S_OK) {
|
hr = IDWriteFont3_GetFontFaceReference(font3, &ref1);
|
||||||
hr = IDWriteFontFaceReference_CreateFontFace(ref, &fontface1);
|
ok(hr == S_OK, "Failed to get reference object, hr %#x.\n", hr);
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(ref != ref1, "Unexpected reference object %p, %p.\n", ref1, ref);
|
||||||
ok(fontface1 == fontface, "got %p, %p\n", fontface1, fontface);
|
|
||||||
IDWriteFontFace3_Release(fontface1);
|
|
||||||
|
|
||||||
IDWriteFontFaceReference_Release(ref);
|
hr = IDWriteFont3_CreateFontFace(font3, &fontface);
|
||||||
IDWriteFontFaceReference_Release(ref1);
|
ok(hr == S_OK, "Failed to create a fontface, hr %#x.\n", hr);
|
||||||
}
|
|
||||||
IDWriteFontFace3_Release(fontface);
|
/* Fonts present regular properties as axis values, for non-variable fonts too.
|
||||||
IDWriteFont3_Release(font3);
|
Normally it would include weight/width/slant/italic, but could also contain optical size axis. */
|
||||||
|
if (SUCCEEDED(hr = IDWriteFontFaceReference_QueryInterface(ref, &IID_IDWriteFontFaceReference1,
|
||||||
|
(void **)&ref2)))
|
||||||
|
{
|
||||||
|
UINT32 axis_count = IDWriteFontFaceReference1_GetFontAxisValueCount(ref2);
|
||||||
|
todo_wine
|
||||||
|
ok(axis_count > 0, "Unexpected axis value count.\n");
|
||||||
|
IDWriteFontFaceReference1_Release(ref2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDWriteFontFaceReference_Release(ref);
|
||||||
|
IDWriteFontFaceReference_Release(ref1);
|
||||||
|
|
||||||
|
hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref);
|
||||||
|
todo_wine
|
||||||
|
ok(hr == S_OK, "Failed to get a reference, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
hr = IDWriteFontFace3_GetFontFaceReference(fontface, &ref1);
|
||||||
|
todo_wine
|
||||||
|
ok(hr == S_OK, "Failed to get a reference, hr %#x.\n", hr);
|
||||||
|
if (hr == S_OK)
|
||||||
|
ok(ref == ref1, "Unexpected reference %p, %p.\n", ref1, ref);
|
||||||
|
|
||||||
|
if (hr == S_OK) {
|
||||||
|
hr = IDWriteFontFaceReference_CreateFontFace(ref, &fontface1);
|
||||||
|
ok(hr == S_OK, "Failed to create fontface, hr %#x.\n", hr);
|
||||||
|
ok(fontface1 == fontface, "Unexpected fontface %p, %p.\n", fontface1, fontface);
|
||||||
|
IDWriteFontFace3_Release(fontface1);
|
||||||
|
|
||||||
|
if (SUCCEEDED(hr = IDWriteFontFaceReference_QueryInterface(ref, &IID_IDWriteFontFaceReference1,
|
||||||
|
(void **)&ref2)))
|
||||||
|
{
|
||||||
|
UINT32 axis_count = IDWriteFontFaceReference1_GetFontAxisValueCount(ref2);
|
||||||
|
ok(!axis_count, "Unexpected axis value count.\n");
|
||||||
|
IDWriteFontFaceReference1_Release(ref2);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDWriteFontFaceReference_Release(ref);
|
||||||
|
IDWriteFontFaceReference_Release(ref1);
|
||||||
|
}
|
||||||
|
IDWriteFontFace3_Release(fontface);
|
||||||
|
|
||||||
|
IDWriteFont3_Release(font3);
|
||||||
|
}
|
||||||
|
|
||||||
|
IDWriteFontFamily1_Release(family);
|
||||||
|
}
|
||||||
|
IDWriteFontCollection1_Release(collection);
|
||||||
|
|
||||||
refcount = IDWriteFactory3_Release(factory);
|
refcount = IDWriteFactory3_Release(factory);
|
||||||
ok(refcount == 0, "factory not released, %u\n", refcount);
|
ok(refcount == 0, "factory not released, %u\n", refcount);
|
||||||
|
|
Loading…
Reference in New Issue