gdiplus/tests: Some tests for GdipGetFontCollectionFamilyList() and system collection.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-11-21 09:32:07 +03:00 committed by Alexandre Julliard
parent b8d01f9e1e
commit 4616954a9d

View file

@ -1110,6 +1110,60 @@ todo_wine
DeleteDC(hdc);
}
static void test_GdipGetFontCollectionFamilyList(void)
{
GpFontFamily *family, *family2;
GpFontCollection *collection;
INT found, count;
GpStatus status;
status = GdipNewInstalledFontCollection(&collection);
ok(status == Ok, "Failed to get system collection, status %d.\n", status);
count = 0;
status = GdipGetFontCollectionFamilyCount(collection, &count);
ok(status == Ok, "Failed to get family count, status %d.\n", status);
ok(count > 0, "Unexpected empty collection.\n");
status = GdipGetFontCollectionFamilyList(NULL, 0, NULL, NULL);
ok(status == InvalidParameter, "Unexpected status %d.\n", status);
found = 123;
status = GdipGetFontCollectionFamilyList(NULL, 0, NULL, &found);
ok(status == InvalidParameter, "Unexpected status %d.\n", status);
ok(found == 123, "Unexpected list count %d.\n", found);
status = GdipGetFontCollectionFamilyList(collection, 0, NULL, NULL);
ok(status == InvalidParameter, "Unexpected status %d.\n", status);
found = 123;
status = GdipGetFontCollectionFamilyList(collection, 0, NULL, &found);
ok(status == InvalidParameter, "Unexpected status %d.\n", status);
ok(found == 123, "Unexpected list count %d.\n", found);
found = 123;
status = GdipGetFontCollectionFamilyList(collection, 1, NULL, &found);
ok(status == InvalidParameter, "Unexpected status %d.\n", status);
ok(found == 123, "Unexpected list count %d.\n", found);
family = NULL;
found = 0;
status = GdipGetFontCollectionFamilyList(collection, 1, &family, &found);
ok(status == Ok, "Failed to get family list, status %d.\n", status);
ok(found == 1, "Unexpected list count %d.\n", found);
ok(family != NULL, "Expected family instance.\n");
family = NULL;
found = 0;
status = GdipGetFontCollectionFamilyList(collection, 1, &family2, &found);
ok(status == Ok, "Failed to get family list, status %d.\n", status);
ok(found == 1, "Unexpected list count %d.\n", found);
ok(family2 != family, "Unexpected family instance.\n");
GdipDeleteFontFamily(family);
GdipDeleteFontFamily(family2);
}
START_TEST(font)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -1139,6 +1193,7 @@ START_TEST(font)
test_getgenerics();
test_installedfonts();
test_heightgivendpi();
test_GdipGetFontCollectionFamilyList();
GdiplusShutdown(gdiplusToken);
}