mirror of
https://github.com/mapbox/node-fontnik.git
synced 2026-01-25 16:02:44 +00:00
test coverage of invalid font files
This commit is contained in:
parent
90224b0706
commit
4b754af222
@ -234,7 +234,7 @@ void RangeAsync(uv_work_t* req) {
|
||||
{
|
||||
FT_Error face_error = FT_New_Face(library, baton->file_name.c_str(), i, &ft_face);
|
||||
if (face_error) {
|
||||
baton->error_name = std::string("could not open Face") + baton->file_name;
|
||||
baton->error_name = std::string("could not open Face: '") + baton->file_name + "'";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
16
test/test.js
16
test/test.js
@ -48,6 +48,14 @@ describe('load', function() {
|
||||
done();
|
||||
});
|
||||
|
||||
it('non existent font loading', function(done) {
|
||||
var doesnotexistsans = opensans.replace('Regular','baloney');
|
||||
fontnik.load(doesnotexistsans, function(err, faces) {
|
||||
assert.ok(err.message.indexOf('could not open face'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('load typeerror callback', function(done) {
|
||||
assert.throws(function() {
|
||||
fontnik.load(firasans);
|
||||
@ -89,6 +97,14 @@ describe('range', function() {
|
||||
});
|
||||
});
|
||||
|
||||
it('range filepath does not exist', function(done) {
|
||||
var doesnotexistsans = opensans.replace('Regular','baloney');
|
||||
fontnik.range(doesnotexistsans, 0, 256, function(err, faces) {
|
||||
assert.ok(err.message.indexOf('could not open face'));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('range typeerror filepath', function(done) {
|
||||
assert.throws(function() {
|
||||
fontnik.range(12, 0, 256, function(err, data) {});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user