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
commit d30340a809
18 changed files with 558 additions and 478 deletions

View file

@ -5,17 +5,14 @@
* @license LGPLv3 <http://www.gnu.org/licenses/lgpl-3.0.txt>
* @author Fabian Jakobs <fabian AT ajax DOT org>
*/
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";
@ -32,17 +29,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()