This repository has been archived by the owner on Mar 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var assert = require( "assert" ); | ||
var path = require( "path" ); | ||
var childProcess = require( "child_process" ); | ||
var fs = require( "fs" ); | ||
|
||
// TODO glyphhanger --subset=*.ttf (file format conversion) | ||
// DONE glyphhanger --subset=*.ttf --whitelist=ABCD (reduce to whitelist characters) | ||
// TODO glyphhanger --subset=*.ttf --US_ASCII (reduce to US_ASCII characters) | ||
// TODO glyphhanger --subset=*.ttf --US_ASCII --whitelist=ABCD (reduce to US_ASCII union with whitelist) | ||
|
||
describe( "CLI (subset)", function() { | ||
it( "--subset --whitelist", function () { | ||
// due to some unknown permission issue, this test fails on travis | ||
if(process.env.TRAVIS) { | ||
this.skip(); | ||
} | ||
|
||
this.timeout( 10000 ); | ||
|
||
var fontPath = "test/fonts/sourcesanspro-regular.ttf"; | ||
|
||
let output = childProcess.execSync(`node cmd.js --whitelist=ABC --subset=${fontPath} --formats=ttf`, { | ||
cwd: path.resolve(__dirname, "..") | ||
}); | ||
|
||
var subsetPath = fontPath.split( ".ttf" ).join( "-subset.ttf" ); | ||
|
||
assert.ok( fs.existsSync( subsetPath ) ); | ||
fs.unlinkSync( subsetPath ); | ||
}); | ||
|
||
it( "--subset --whitelist --css", function () { | ||
// due to some unknown permission issue, this test fails on travis | ||
if(process.env.TRAVIS) { | ||
this.skip(); | ||
} | ||
|
||
this.timeout( 10000 ); | ||
|
||
var fontPath = "test/fonts/sourcesanspro-regular.ttf"; | ||
|
||
let output = childProcess.execSync(`node cmd.js --whitelist=ABC --subset=${fontPath} --formats=ttf --css`, { | ||
cwd: path.resolve(__dirname, "..") | ||
}); | ||
|
||
var subsetPath = fontPath.split( ".ttf" ).join( "-subset.ttf" ); | ||
assert.ok( fs.existsSync( subsetPath ) ); | ||
fs.unlinkSync( subsetPath ); | ||
|
||
var cssPath = fontPath.split( ".ttf" ).join( ".css" ); | ||
console.log( cssPath ); | ||
|
||
assert.ok( fs.existsSync( cssPath ) ); | ||
fs.unlinkSync( cssPath ); | ||
}); | ||
}); |