Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 165298
Collapse All | Expand All

(-)projection/org/eclipse/text/tests/ProjectionMappingTest.java (+35 lines)
Lines 59-64 Link Here
59
		return buffer.toString();
59
		return buffer.toString();
60
	}
60
	}
61
	
61
	
62
	private String getProjectionAtEndSlaveContent() {
63
		StringBuffer buffer= new StringBuffer(getOriginalMasterContent());
64
		// fold all into line 1
65
		buffer.delete(40, 160);
66
		buffer.delete(0, 20);
67
		return buffer.toString();
68
	}
69
	
62
	private String getLineWrappingSlaveContent() {
70
	private String getLineWrappingSlaveContent() {
63
		StringBuffer buffer= new StringBuffer(getOriginalMasterContent());
71
		StringBuffer buffer= new StringBuffer(getOriginalMasterContent());
64
		buffer.delete(80, 180);
72
		buffer.delete(80, 180);
Lines 89-94 Link Here
89
		addProjection(60, 20, 20);
97
		addProjection(60, 20, 20);
90
	}
98
	}
91
99
100
	private void createProjectionAtEnd() {
101
		fMasterDocument.set(getOriginalMasterContent());
102
		fSlaveDocument.set(getProjectionAtEndSlaveContent());
103
		addProjection(20, 0, 20);
104
	}
105
92
	private void createIdenticalProjection() {
106
	private void createIdenticalProjection() {
93
		fMasterDocument.set(getOriginalMasterContent());
107
		fMasterDocument.set(getOriginalMasterContent());
94
		fSlaveDocument.set(getOriginalMasterContent());
108
		fSlaveDocument.set(getOriginalMasterContent());
Lines 506-511 Link Here
506
		}
520
		}
507
	}
521
	}
508
522
523
	public void test9c() {
524
		// test toImageLine
525
		
526
		createProjectionAtEnd();
527
		try {
528
			assertEquals(-1, fProjectionMapping.toImageLine(0));
529
			assertEquals( 0, fProjectionMapping.toImageLine(1));
530
			// this fails
531
			assertEquals(-1, fProjectionMapping.toImageLine(2));
532
			assertEquals(-1, fProjectionMapping.toImageLine(3));
533
			assertEquals(-1, fProjectionMapping.toImageLine(4));
534
			assertEquals(-1, fProjectionMapping.toImageLine(5));
535
			assertEquals(-1, fProjectionMapping.toImageLine(6));
536
			assertEquals(-1, fProjectionMapping.toImageLine(7));
537
			assertEquals(-1, fProjectionMapping.toImageLine(8));
538
			assertEquals(-1, fProjectionMapping.toImageLine(9));
539
		} catch (BadLocationException e) {
540
			assertTrue(false);
541
		}
542
	}
543
509
	public void test9b() {
544
	public void test9b() {
510
		// test toImageLine
545
		// test toImageLine
511
		// test non-line wrapping, well distributed projection of empty lines
546
		// test non-line wrapping, well distributed projection of empty lines

Return to bug 165298