Fixed a bug in single line tabbing that caused

the tab length not being taken into account.

Added DOM emulation to the unit tests so that they
can be run from node.

Extended the Mockrenderer for the unit tests.

Made the majority of the unit tests work again
(barring those for moveLinesUp, see below).

Fixed a bug in moveLinesUp that caused an empty
line to be inserted. However, this fix causes the
editor to break (need to look at this).
This commit is contained in:
Eddy Bruel 2010-11-24 13:27:38 +01:00 • committed by Joe Walker
commit 215cfbf4bf
18 changed files with 555 additions and 474 deletions

View file

@ -35,16 +35,14 @@
*
* ***** END LICENSE BLOCK ***** */
require.def([
"ace/Document",
"ace/VirtualRenderer"
], function(
Document,
VirtualRenderer
) {
var VirtualRendererTest = new TestCase("VirtualRendererTest", {
require("../../../support/paths");
var Document = "../document",
VirtualRenderer = "../virtual_renderer",
assert = "../assertions";
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 +59,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()