Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better testing for GSUB #91

Merged
merged 7 commits into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fonts/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"Source" fonts retrieved from https://github.com/adobe-fonts/source-code-pro and used for testing purposes only.
"Recursive" retrieved from https://github.com/arrowtype/recursive and used for testing purposes only.
"OpenSans" retrieved from https://www.opensans.com/ and used for testing purposes only.
31 changes: 22 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,35 @@
<html>
<head>
<meta charset="utf-8">
<title>Font.js testing page</title>
<title>Font.js unit tests</title>
<script src="./lib/inflate.js" defer></script>
<script src="./lib/unbrotli.js" defer></script>
<script src="./Font.js" type="module" defer></script>
<script src="./index.js" defer></script>
<script src="./testing/browser/test.js" type="module" defer></script>
<style>
span {
font-family: "Adobe Source Code Pro";
div {
white-space: pre-wrap;
border: 1px solid black;
border-bottom: none;
}
div:first-child { border-bottom: none; }
div:last-child { border-bottom: 1px solid black; }
div:nth-child(2n-1) { background-color: #EEE; }
div.pass:before { content: "✔️"; }
div.fail:before { content: "❌"; }
</style>
</head>
<body>
<p>Loading all fonts, and applying them as CSS webfont. <a href="./test/index.html">Click here</a> to run tests. <a href="https://github.com/Pomax/Font.js">Click here</a> to go to the repo.</p>

<section id='matrix'>
<h2>matrix</h2>
</section>
<h1>Test Results</h1>
<h3>Back to <a href="../index.html">index.html</a></h3>
</body>
<script>
const tests = [];
document.addEventListener(`testend`, e => {
tests.push(e.detail.test);
if (tests.length === 2) {
document.body.id = "finished";
}
});
</script>
</html>
2 changes: 0 additions & 2 deletions old tests/README.md

This file was deleted.

122 changes: 0 additions & 122 deletions old tests/gsub/test.elaborate.js

This file was deleted.

23 changes: 0 additions & 23 deletions old tests/gsub/test.segments.js

This file was deleted.

25 changes: 0 additions & 25 deletions old tests/index.html

This file was deleted.

2 changes: 0 additions & 2 deletions old tests/test.js

This file was deleted.

46 changes: 0 additions & 46 deletions old tests/test.otf.js

This file was deleted.

46 changes: 0 additions & 46 deletions old tests/test.ttf.js

This file was deleted.

13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
"src": "src"
},
"scripts": {
"start": "",
"clean": "prettier --write \"src/**/*.js\"",
"jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --verbose=false ./test/"
"test": "run-s clean test:jest test:browser",
"test:browser": "run-p test:server test:puppeteer",
"test:server": "node ./testing/browser/server.js",
"test:puppeteer": "node ./testing/browser/puppeteer.js",
"test:jest": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --verbose=false ./testing/node/"
},
"repository": {
"type": "git",
Expand All @@ -32,7 +37,11 @@
"homepage": "https://github.com/Pomax/font.js#readme",
"devDependencies": {
"cross-env": "^7.0.2",
"express": "^4.17.1",
"jest": "^26.5.3",
"prettier": "^2.1.1"
"npm-run-all": "^4.1.5",
"open-cli": "^6.0.1",
"prettier": "^2.1.1",
"puppeteer": "^5.3.1"
}
}
4 changes: 2 additions & 2 deletions src/opentype/tables/advanced/shared/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ParsedData } from "../../../../parser.js";
class FeatureList extends ParsedData {
static EMPTY = {
featureCount: 0,
featureRecords: []
}
featureRecords: [],
};

constructor(p) {
super(p);
Expand Down
2 changes: 1 addition & 1 deletion src/opentype/tables/advanced/shared/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class LookupTable extends ParsedData {

// FIXME: make this a lazy .subtables array instead?
getSubTable(index) {
const builder = (this.ctType === `GSUB`) ? GSUBtables : GPOStables;
const builder = this.ctType === `GSUB` ? GSUBtables : GPOStables;
this.parser.currentPosition = this.start + this.subtableOffsets[index];
return builder.buildSubtable(this.lookupType, this.parser);
}
Expand Down
4 changes: 2 additions & 2 deletions src/opentype/tables/advanced/shared/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { ParsedData } from "../../../../parser.js";
class ScriptList extends ParsedData {
static EMPTY = {
scriptCount: 0,
scriptRecords: []
}
scriptRecords: [],
};

constructor(p) {
super(p);
Expand Down
Loading