Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Merge 14172e0 into 3363d72
Browse files Browse the repository at this point in the history
  • Loading branch information
jtenner committed Oct 30, 2019
2 parents 3363d72 + 14172e0 commit e507099
Show file tree
Hide file tree
Showing 77 changed files with 50,191 additions and 54,794 deletions.
2 changes: 1 addition & 1 deletion __tests__/Buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Buffers", () => {
var bufferPointer: number = wasm.writeThreeTimes();

// @ts-ignore
var data = new Float64Array(wasm.memory.buffer, bufferPointer + 16, 0x10000);
var data = new Float64Array(wasm.memory.buffer, bufferPointer, 0x10000);

expect(data[0]).toBe(0);
expect(data[1]).toBe(4);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.arc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.arcTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.bezierCurveTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.clearRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.drawImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.drawImageSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.drawImageSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.ellipse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.fillRect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
8 changes: 4 additions & 4 deletions __tests__/CanvasRenderingContext2D.fillText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand All @@ -30,7 +30,7 @@ type FillTextArgs = [number, number];

describe("fillText function", () => {
it("should call fillText with expected values", () => {
wasm.fillText(wasm.newString("test!"), 1, 2);
wasm.fillText(wasm.__allocString("test!"), 1, 2);
wasm.commit();
expect(ctx.fillText).toBeCalledWith("test!", 1, 2);
});
Expand All @@ -46,15 +46,15 @@ describe("fillText function", () => {

finiteTests.forEach((args: FillTextArgs, index: number) => {
it("should not call fillText if argument " + index + " is " + args[index % 2], () => {
wasm.fillText(wasm.newString("test!"), ...args);
wasm.fillText(wasm.__allocString("test!"), ...args);
wasm.commit();
expect(ctx.fillText).not.toBeCalled();
});
});

it("should not call fillText if text length is 0", () => {
wasm.createImage();
wasm.fillText(wasm.newString(""), 1, 2);
wasm.fillText(wasm.__allocString(""), 1, 2);
wasm.commit();
expect(ctx.fillText).not.toBeCalled();
});
Expand Down
8 changes: 4 additions & 4 deletions __tests__/CanvasRenderingContext2D.fillTextWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand All @@ -30,7 +30,7 @@ type FillTextArgs = [number, number, number];

describe("fillTextWidth function", () => {
it("should call fillTextWidth with expected values", () => {
wasm.fillTextWidth(wasm.newString("test!"), 1, 2, 3);
wasm.fillTextWidth(wasm.__allocString("test!"), 1, 2, 3);
wasm.commit();
expect(ctx.fillText).toBeCalledWith("test!", 1, 2, 3);
});
Expand All @@ -49,15 +49,15 @@ describe("fillTextWidth function", () => {

finiteTests.forEach((args: FillTextArgs, index: number) => {
it("should not call fillTextWidth if argument " + index + " is " + args[index % 3], () => {
wasm.fillTextWidth(wasm.newString("test!"), ...args);
wasm.fillTextWidth(wasm.__allocString("test!"), ...args);
wasm.commit();
expect(ctx.fillText).not.toBeCalled();
});
});

it("should not call fillTextWidth if text length is 0", () => {
wasm.createImage();
wasm.fillTextWidth(wasm.newString(""), 1, 2, 3);
wasm.fillTextWidth(wasm.__allocString(""), 1, 2, 3);
wasm.commit();
expect(ctx.fillText).not.toBeCalled();
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.globalAlpha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.lineDashOffset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.lineTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.lineWidth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
8 changes: 4 additions & 4 deletions __tests__/CanvasRenderingContext2D.measureText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand All @@ -30,15 +30,15 @@ beforeEach(() => {

describe("measureText", () => {
it("should call measureText text", () => {
var i = wasm.measureText(wasm.newString("test"));
var i = wasm.measureText(wasm.__allocString("test"));
expect(ctx.measureText).toBeCalledWith("test");
expect(i).toBe(4); // in the testing environment measureText returns text length
});

it("should update the font when measureText is called", () => {
var font = "12pt Times New Roman";
wasm.font(wasm.newString(font));
wasm.measureText(wasm.newString("test"));
wasm.font(wasm.__allocString(font));
wasm.measureText(wasm.__allocString("test"));
expect(ctx.font).toBe(`16px "Times New Roman"`);
expect(ctx.measureText).toBeCalledWith("test");
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.miterLimit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.moveTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.quadraticCurveTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.rect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.rotate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ run<Matrix>({
[4, 3, 2, 1, 0, -1],
],
getValue(wasm): Matrix {
return Array.from(wasm.getArray(Float64Array as any, wasm.getTransform())) as Matrix;
return wasm.__getArray(wasm.getTransform()) as Matrix;
},
setValue(wasm, value): void {
wasm.setTransform(value[0], value[1], value[2], value[3], value[4], value[5]);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/CanvasRenderingContext2D.save-restore.fillStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ run<string>({
name: "fillStyle",
values: ["one", "two", "three", "four", "five"],
getValue(wasm): string {
return wasm.getString(wasm.getFillStyle());
return wasm.__getString(wasm.getFillStyle());
},
setValue(wasm, value): void {
wasm.setFillStyle(wasm.newString(value));
wasm.setFillStyle(wasm.__allocString(value));
},
});
4 changes: 2 additions & 2 deletions __tests__/CanvasRenderingContext2D.save-restore.filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ run<string>({
name: "filter",
values: ["one", "two", "three", "four", "five"],
getValue(wasm): string {
return wasm.getString(wasm.getFilter());
return wasm.__getString(wasm.getFilter());
},
setValue(wasm, value): void {
wasm.setFilter(wasm.newString(value));
wasm.setFilter(wasm.__allocString(value));
},
});
4 changes: 2 additions & 2 deletions __tests__/CanvasRenderingContext2D.save-restore.font.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ run<string>({
name: "font",
values: ["one", "two", "three", "four", "five"],
getValue(wasm): string {
return wasm.getString(wasm.getFont());
return wasm.__getString(wasm.getFont());
},
setValue(wasm, value): void {
wasm.setFont(wasm.newString(value));
wasm.setFont(wasm.__allocString(value));
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ run<string>({
name: "shadowColor",
values: ["one", "two", "three", "four", "five"],
getValue(wasm): string {
return wasm.getString(wasm.getShadowColor());
return wasm.__getString(wasm.getShadowColor());
},
setValue(wasm, value): void {
wasm.setShadowColor(wasm.newString(value));
wasm.setShadowColor(wasm.__allocString(value));
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ run<string>({
name: "strokeStyle",
values: ["one", "two", "three", "four", "five"],
getValue(wasm): string {
return wasm.getString(wasm.getStrokeStyle());
return wasm.__getString(wasm.getStrokeStyle());
},
setValue(wasm, value): void {
wasm.setStrokeStyle(wasm.newString(value));
wasm.setStrokeStyle(wasm.__allocString(value));
},
});
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.setTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.shadowBlur.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.shadowOffsetX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down
2 changes: 1 addition & 1 deletion __tests__/CanvasRenderingContext2D.shadowOffsetY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ beforeEach(() => {
test: {
log: console.log.bind(console),
logStr(ptr: number) {
console.log(wasm.getString(ptr));
console.log(wasm.__getString(ptr));
},
}
});
Expand Down

0 comments on commit e507099

Please sign in to comment.