[PATCH] gdiplus/tests: Some tests for GdipGetFontCollectionFamilyList() and system collection

Nikolay Sivov nsivov at codeweavers.com
Tue Nov 21 00:32:07 CST 2017


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/gdiplus/tests/font.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c
index 2cae48192e..6c7738cf90 100644
--- a/dlls/gdiplus/tests/font.c
+++ b/dlls/gdiplus/tests/font.c
@@ -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);
 }
-- 
2.15.0




More information about the wine-devel mailing list