|
|
@ -747,6 +747,99 @@ module.exports = { |
|
|
|
, 'Context2d#strokeText()'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#textAlign': function(assert){ |
|
|
|
var canvas = new Canvas(200,200) |
|
|
|
, ctx = canvas.getContext('2d'); |
|
|
|
|
|
|
|
assert.equal('start', ctx.textAlign); |
|
|
|
ctx.textAlign = 'center'; |
|
|
|
assert.equal('center', ctx.textAlign); |
|
|
|
ctx.textAlign = 'right'; |
|
|
|
assert.equal('right', ctx.textAlign); |
|
|
|
ctx.textAlign = 'end'; |
|
|
|
assert.equal('end', ctx.textAlign); |
|
|
|
ctx.textAlign = 'fail'; |
|
|
|
assert.equal('end', ctx.textAlign); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#textAlign= right': function(assert){ |
|
|
|
var canvas = new Canvas(200, 200) |
|
|
|
, ctx = canvas.getContext('2d') |
|
|
|
, path = __dirname + '/images/textAlign-right.png'; |
|
|
|
|
|
|
|
ctx.strokeRect(0,0,200,200); |
|
|
|
ctx.lineTo(0,100); |
|
|
|
ctx.lineTo(200,100); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.beginPath(); |
|
|
|
ctx.lineTo(100,0); |
|
|
|
ctx.lineTo(100,200); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.font = 'normal 20px Arial'; |
|
|
|
ctx.textAlign = 'right'; |
|
|
|
ctx.fillText("Wahoo", 100, 100); |
|
|
|
|
|
|
|
assertChecksum( |
|
|
|
canvas |
|
|
|
, path |
|
|
|
, 'cde33254c5c6de39e1a549edcb23d93e' |
|
|
|
, 'Context2d#textAlign= right failed'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#textAlign= center': function(assert){ |
|
|
|
var canvas = new Canvas(200, 200) |
|
|
|
, ctx = canvas.getContext('2d') |
|
|
|
, path = __dirname + '/images/textAlign-center.png'; |
|
|
|
|
|
|
|
ctx.strokeRect(0,0,200,200); |
|
|
|
ctx.lineTo(0,100); |
|
|
|
ctx.lineTo(200,100); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.beginPath(); |
|
|
|
ctx.lineTo(100,0); |
|
|
|
ctx.lineTo(100,200); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.font = 'normal 20px Arial'; |
|
|
|
ctx.textAlign = 'center'; |
|
|
|
ctx.fillText("Wahoo", 100, 100); |
|
|
|
|
|
|
|
assertChecksum( |
|
|
|
canvas |
|
|
|
, path |
|
|
|
, '31b217e572ce2d78f11c1ecf21713579' |
|
|
|
, 'Context2d#textAlign= center failed'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#textAlign= left': function(assert){ |
|
|
|
var canvas = new Canvas(200, 200) |
|
|
|
, ctx = canvas.getContext('2d') |
|
|
|
, path = __dirname + '/images/textAlign-left.png'; |
|
|
|
|
|
|
|
ctx.strokeRect(0,0,200,200); |
|
|
|
ctx.lineTo(0,100); |
|
|
|
ctx.lineTo(200,100); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.beginPath(); |
|
|
|
ctx.lineTo(100,0); |
|
|
|
ctx.lineTo(100,200); |
|
|
|
ctx.stroke(); |
|
|
|
|
|
|
|
ctx.font = 'normal 20px Arial'; |
|
|
|
ctx.textAlign = 'left'; |
|
|
|
ctx.fillText("Wahoo", 100, 100); |
|
|
|
|
|
|
|
assertChecksum( |
|
|
|
canvas |
|
|
|
, path |
|
|
|
, 'f22146910b2df4b96550611f45dda77a' |
|
|
|
, 'Context2d#textAlign= left failed'); |
|
|
|
}, |
|
|
|
|
|
|
|
'test Context2d#measureText()': function(assert){ |
|
|
|
var canvas = new Canvas(200, 200) |
|
|
|
, ctx = canvas.getContext('2d'); |
|
|
|