paper.js/test/tests/TextItem.js

30 lines
962 B
JavaScript
Raw Normal View History

/*
* Paper.js - The Swiss Army Knife of Vector Graphics Scripting.
* http://paperjs.org/
*
2014-01-03 19:47:16 -05:00
* Copyright (c) 2011 - 2014, Juerg Lehni & Jonathan Puckey
* http://scratchdisk.com/ & http://jonathanpuckey.com/
*
* Distributed under the MIT license. See LICENSE file for details.
*
* All rights reserved.
*/
module('TextItem');
test('PointText', function() {
2014-08-16 13:24:54 -04:00
var text = new PointText({
fontFamily: 'Arial',
fontSize: 14,
point: [100, 100],
content: 'Hello World!'
});
compareColors(text.fillColor, new Color(0, 0, 0), 'text.fillColor should be black by default');
comparePoints(text.point, { x: 100, y: 100 }, 'text.point');
comparePoints(text.bounds.point, { x: 100, y: 87.4 }, 'text.bounds.point');
compareSize(text.bounds.size, { width: 77, height: 16.8 }, 'text.bounds.size', { tolerance: 1.0 });
2014-08-16 13:24:54 -04:00
equals(function() {
return text.hitTest(text.bounds.center) != null;
}, true);
});