From cb23fdbf92f14f243ef68a7c4e009493c1dd0ac2 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 6 Mar 2012 15:51:04 -0700 Subject: [PATCH] Add spec for position translation with folds + line wrapping --- spec/atom/renderer-spec.coffee | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/atom/renderer-spec.coffee b/spec/atom/renderer-spec.coffee index 27f3ab6e8..7a3acf3a7 100644 --- a/spec/atom/renderer-spec.coffee +++ b/spec/atom/renderer-spec.coffee @@ -431,12 +431,17 @@ fdescribe "Renderer", -> renderer.createFold([[4, 10], [4, 15]]) expect(renderer.screenPositionForBufferPosition([4, 5])).toEqual [4, 5] - expect(renderer.screenPositionForBufferPosition([4, 15])).toEqual [4, 13] - expect(renderer.screenPositionForBufferPosition([4, 20])).toEqual [4, 18] - expect(renderer.bufferPositionForScreenPosition([4, 5])).toEqual [4, 5] + + expect(renderer.screenPositionForBufferPosition([4, 15])).toEqual [4, 13] expect(renderer.bufferPositionForScreenPosition([4, 13])).toEqual [4, 15] + + expect(renderer.screenPositionForBufferPosition([4, 20])).toEqual [4, 18] expect(renderer.bufferPositionForScreenPosition([4, 18])).toEqual [4, 20] - - + describe "when there is a fold on a wrapped line", -> + it "translates positions accounting for both the fold and the wrapped line", -> + renderer.setMaxLineLength(50) + renderer.createFold([[3, 51], [3, 58]]) + expect(renderer.screenPositionForBufferPosition([3, 58])).toEqual [4, 3] + expect(renderer.bufferPositionForScreenPosition([4, 3])).toEqual [3, 58]