Change textpath tests to work with changed method / return.

This commit is contained in:
Maximilian Krög
2020-10-20 23:20:10 +02:00
parent b6ee7084c9
commit b3968a4219

View File

@@ -28,7 +28,7 @@ describe('ol.geom.flat.drawTextOnPath', function () {
'', '',
{} {}
); );
expect(instructions).to.eql([[40, 0, 5, 0, 'foo']]); expect(instructions).to.eql([[50, 0, 15, 0, 'foo']]);
}); });
it('left-aligns text on a horizontal line', function () { it('left-aligns text on a horizontal line', function () {
@@ -45,7 +45,7 @@ describe('ol.geom.flat.drawTextOnPath', function () {
'', '',
{} {}
); );
expect(instructions).to.eql([[5, 0, 5, 0, 'foo']]); expect(instructions).to.eql([[15, 0, 15, 0, 'foo']]);
}); });
it('right-aligns text on a horizontal line', function () { it('right-aligns text on a horizontal line', function () {
@@ -63,7 +63,7 @@ describe('ol.geom.flat.drawTextOnPath', function () {
'', '',
{} {}
); );
expect(instructions).to.eql([[75, 0, 5, 0, 'foo']]); expect(instructions).to.eql([[85, 0, 15, 0, 'foo']]);
}); });
it('draws text on a vertical line', function () { it('draws text on a vertical line', function () {
@@ -82,7 +82,7 @@ describe('ol.geom.flat.drawTextOnPath', function () {
{} {}
); );
const a = (90 * Math.PI) / 180; const a = (90 * Math.PI) / 180;
expect(instructions).to.eql([[0, 40, 5, a, 'foo']]); expect(instructions).to.eql([[0, 50, 15, a, 'foo']]);
}); });
it('draws text on a diagonal line', function () { it('draws text on a diagonal line', function () {
@@ -138,19 +138,19 @@ describe('ol.geom.flat.drawTextOnPath', function () {
'', '',
{} {}
); );
expect(instructions[0]).to.eql([-20, 0, 5, 0, 'foo-foo-foo-foo']); expect(instructions[0]).to.eql([50, 0, 75, 0, 'foo-foo-foo-foo']);
expect(instructions.length).to.be(1); expect(instructions.length).to.be(1);
}); });
it('renders angled text', function () { it('renders angled text', function () {
const length = lineStringLength(angled, 0, angled.length, 2); const length = lineStringLength(angled, 0, angled.length, 2);
const startM = length / 2 - 15; const startM = length / 2 - 20;
const instructions = drawTextOnPath( const instructions = drawTextOnPath(
angled, angled,
0, 0,
angled.length, angled.length,
2, 2,
'foo', 'fooo',
startM, startM,
Infinity, Infinity,
1, 1,
@@ -159,11 +159,9 @@ describe('ol.geom.flat.drawTextOnPath', function () {
{} {}
); );
expect(instructions[0][3]).to.eql((45 * Math.PI) / 180); expect(instructions[0][3]).to.eql((45 * Math.PI) / 180);
expect(instructions[0][4]).to.be('f'); expect(instructions[0][4]).to.be('fo');
expect(instructions[1][3]).to.eql((45 * Math.PI) / 180); expect(instructions[1][3]).to.eql((-45 * Math.PI) / 180);
expect(instructions[1][4]).to.be('o'); expect(instructions[1][4]).to.be('oo');
expect(instructions[2][3]).to.eql((-45 * Math.PI) / 180);
expect(instructions[2][4]).to.be('o');
}); });
it('respects maxAngle', function () { it('respects maxAngle', function () {