Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dhowe committed Nov 22, 2024
1 parent 10bdb93 commit 8156967
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions src/type/text2d.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

/*
* NEXT: then get axes and values from font, test with other loading methods, do sliders
* TODO:
* - variable fonts
* - textToPoints: line-breaking, alignments, rectMode
* - textToPaths: return value ?
* - get axes and values for parsed fonts
* - cache parsed fonts (and/or lazy load)
* - test textToPoints with google/variable fonts
* - more with variable fonts, do slider example
* - better font-loading (google fonts, font-face declarations, multiple fonts with Promise.all())
* - add test for line-height property in textFont() and textProperty()
* - how does this integrate with textLeading?
* - spurious warning in oneoff.html (local)
*
* ON-HOLD:
* - textToPoints: alignments, line-breaking, better thresholding, scaling for small fonts
* - textToPoints: line-breaking, alignments, rectMode
*
* PR-QUESTIONS:
* - textProperty(ies) -> properties in states, mapped-states, context and canvas.style [PR]
Expand Down
8 changes: 4 additions & 4 deletions test/unit/type/loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ suite('Loading Fonts', function () {
const fontFile = '/unit/assets/acmesa.ttf';

test('loadFont.await', async () => {
const pFont = await myp5.loadFont(fontFile);
const pFont = await myp5.loadFont(fontFile, 'fredTheFont');
assert.ok(pFont, 'acmesa.ttf loaded');
assert.equal(pFont.name, 'acmesa');
assert.equal(pFont.name, 'fredTheFont');
assert.isTrue(pFont instanceof p5.Font);
});

test('loadFont.then', async () => new Promise(done => {

myp5.loadFont(fontFile).then(pFont => {
myp5.loadFont(fontFile, 'acmesa').then(pFont => {
assert.ok(pFont, 'acmesa.ttf loaded');
assert.equal(pFont.name, 'acmesa');
assert.isTrue(pFont instanceof p5.Font);
Expand All @@ -39,7 +39,7 @@ suite('Loading Fonts', function () {
myp5.loadFont(fontFile, (pFont) => {

assert.ok(pFont, 'acmesa.ttf loaded');
assert.equal(pFont.name, 'acmesa');
assert.equal(pFont.name, 'A.C.M.E. Secret Agent');
assert.isTrue(pFont instanceof p5.Font);
done();
});
Expand Down

0 comments on commit 8156967

Please sign in to comment.