This commit is contained in:
Joe Walker 2010-11-26 17:09:26 +00:00
commit 8f0d0a555f
22 changed files with 570 additions and 497 deletions

View file

@ -34,17 +34,14 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
require("../../../support/paths");
var Document = "../document",
VirtualRenderer = "../virtual_renderer",
assert = "../assertions";
require.def([
"ace/Document",
"ace/VirtualRenderer"
], function(
Document,
VirtualRenderer
) {
var VirtualRendererTest = new TestCase("VirtualRendererTest", {
var Test = {
"test: screen2text the column should be rounded to the next character edge" : function() {
var el = document.createElement("div");
el.style.left = "0px";
@ -61,17 +58,20 @@ var VirtualRendererTest = new TestCase("VirtualRendererTest", {
renderer.characterWidth = 10;
renderer.lineHeight = 15;
assertPosition(0, 0, renderer.screenToTextCoordinates(0, 0));
assertPosition(0, 0, renderer.screenToTextCoordinates(4, 0));
assertPosition(0, 1, renderer.screenToTextCoordinates(5, 0));
assertPosition(0, 1, renderer.screenToTextCoordinates(9, 0));
assertPosition(0, 1, renderer.screenToTextCoordinates(10, 0));
assertPosition(0, 1, renderer.screenToTextCoordinates(14, 0));
assertPosition(0, 2, renderer.screenToTextCoordinates(15, 0));
assert.position(renderer.screenToTextCoordinates(0, 0), 0, 0);
assert.position(renderer.screenToTextCoordinates(4, 0), 0, 0);
assert.position(renderer.screenToTextCoordinates(5, 0), 0, 1);
assert.position(renderer.screenToTextCoordinates(9, 0), 0, 1);
assert.position(renderer.screenToTextCoordinates(10, 0), 0, 1);
assert.position(renderer.screenToTextCoordinates(14, 0), 0, 1);
assert.position(renderer.screenToTextCoordinates(15, 0), 0, 2);
document.body.removeChild(el);
}
// change tab size after setDocument (for text layer)
});
};
});
module.exports = require("async/test").testcase(Test);
if (module === require.main)
module.exports.exec()