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

Fix the screenshot test. #773

Merged
merged 1 commit into from
Feb 8, 2018
Merged
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
17 changes: 10 additions & 7 deletions tests/cases/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ describe('geo.core.map', function () {
var m, layer1, layer2, l1, l2;
var ss = {};

it('basic', function (done) {
it('set up test', function (done) {
m = createMap({
width: 64, height: 48, zoom: 2, center: {x: 7.5, y: 7.5}});
layer1 = m.createLayer('feature', {renderer: 'canvas'});
Expand All @@ -734,12 +734,15 @@ describe('geo.core.map', function () {
[{x: 0, y: 10}, {x: 5, y: 12}, {x: 2, y: 15}]]);

m.draw();
window.requestAnimationFrame(function () {
m.screenshot().then(function (result) {
expect(result.substr(0, 22)).toBe('data:image/png;base64,');
ss.basic = result;
done();
});
// make sure that drawing has occurred
window.requestAnimationFrame(done);
});
// all screen shots are in separate it blocks to make them more consistent
it('basic', function (done) {
m.screenshot().then(function (result) {
expect(result.substr(0, 22)).toBe('data:image/png;base64,');
ss.basic = result;
done();
});
});
it('jpeg', function (done) {
Expand Down