forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget-system-fonts.html
More file actions
33 lines (30 loc) · 1.33 KB
/
get-system-fonts.html
File metadata and controls
33 lines (30 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test() {
function hasFontFamily(fontFamilies, fontFamily) {
return (fontFamilies.includes(fontFamily) ? "Includes " : "Missing ") + fontFamily;
}
function fontFamilyNamesCallback(error, fontFamilyNames) {
InspectorTest.assert(!error, "Error in getting font family names.");
if (!error) {
InspectorTest.assert(fontFamilyNames.length >= 5, "Has at least 5 fonts");
// We can't count on any font existing on every platform, so we list enough fonts here
// such that at least one will exist. Update your port's test expectations as needed.
InspectorTest.log(hasFontFamily(fontFamilyNames, "Arial"));
InspectorTest.log(hasFontFamily(fontFamilyNames, "Times"));
InspectorTest.log(hasFontFamily(fontFamilyNames, "DejaVu Sans"));
InspectorTest.log(hasFontFamily(fontFamilyNames, "Liberation Serif"));
}
InspectorTest.completeTest();
}
CSSAgent.getSupportedSystemFontFamilyNames(fontFamilyNamesCallback);
}
</script>
</head>
<body onload="runTest()">
<p>This test ensures that the inspector can enumerate system font families, and checks for the existence of common fonts.</p>
</body>
</html>