-
Notifications
You must be signed in to change notification settings - Fork 0
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
caoxun03
committed
Feb 9, 2021
1 parent
9a96f7a
commit d0b0872
Showing
1 changed file
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const expect = require('chai').expect; | ||
import { Canvas } from '../../src'; | ||
const container = document.createElement('canvas'); | ||
document.body.appendChild(container); | ||
|
||
describe('#726', () => { | ||
it('Total canvas memory use exceeds xxxMB bug', () => { | ||
const canvas = new Canvas({ | ||
container, | ||
width: 600, | ||
height: 500, | ||
}); | ||
|
||
const canvasEl = canvas.get('el'); | ||
const pixelRatio = canvas.getPixelRatio(); | ||
|
||
expect(canvasEl.width).eql(600 * pixelRatio); | ||
expect(canvasEl.height).eql(500 * pixelRatio); | ||
|
||
canvas.destroy(); | ||
|
||
// 销毁canvas后需要设置宽高为0 | ||
// 解决ios场景下 canvas无法进行垃圾回收的问题 | ||
expect(canvasEl.width).eql(0); | ||
expect(canvasEl.height).eql(0); | ||
}); | ||
}); |