forked from mapnik/node-mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fonts.test.js
27 lines (23 loc) · 826 Bytes
/
fonts.test.js
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
var mapnik = require('mapnik');
var assert = require('assert');
var fs = require('fs');
function oc(a) {
var o = {};
for (var i = 0; i < a.length; i++) {
o[a[i]] = '';
}
return o;
}
exports['test fonts'] = function(beforeExit) {
// make sure we have default fonts
assert.ok('DejaVu Sans Bold' in oc(mapnik.fonts()));
// make sure system font was loaded
if (process.platform == 'darwin') {
assert.ok('Times Regular' in oc(mapnik.fonts()));
// it should already be loaded so trying to register more should return false
assert.ok(!mapnik.register_fonts('/System/Library/Fonts/', { recurse: true }));
}
// will return true if new fonts are found
// but should return false as we now call at startup
assert.ok(!mapnik.register_system_fonts());
};