Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 88678

Summary: jUnits needed for caret querying API
Product: [Tools] GEF Reporter: Randy Hudson <hudsonr>
Component: GEF-Legacy Draw2dAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: ahunter.eclipse, mattscar
Version: unspecifiedKeywords: helpwanted
Target Milestone: 3.5.0 (Galileo) M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for org.eclipse.draw2d.test.CaretTests.java none

Description Randy Hudson CLA 2005-03-21 15:51:36 EST
Need to test API in TextFlow:
getNextOffset(Point offset, direction, int trailing[])
Comment 1 Matt Scarpino CLA 2007-08-11 02:05:41 EDT
Created attachment 75899 [details]
Patch for org.eclipse.draw2d.test.CaretTests.java 

This patch contains test cases for the getOffset(), getNextOffset(), and getCaretPlacement() methods.  Works fine on Windows, but I haven't tested other OSes.
Comment 2 Anthony Hunter CLA 2008-10-17 16:20:30 EDT
Test three did fail on Linux so I changed it to:

	public void testCaretPlacement() {
		offsetPoint = new Point(11, 21);
		offset = sentence.getOffset(offsetPoint, trail, null);
		CaretInfo info = sentence.getCaretPlacement(offset, trail[0] != 0);
		if (info.getBaseline() == 24) {
			// Windows XP
			assertEquals(info.getBaseline(), 24);
			assertEquals(info.getHeight(), 13);
			assertEquals(info.getLineHeight(), 13);
			assertEquals(info.getLineY(), 13);
			assertEquals(info.getX(), 12);
			assertEquals(info.getY(), 13);
		} else {
			// Red Hat Linux
			assertEquals(info.getBaseline(), 25);
			assertEquals(info.getHeight(), 14);
			assertEquals(info.getLineHeight(), 14);
			assertEquals(info.getLineY(), 14);
			assertEquals(info.getX(), 13);
			assertEquals(info.getY(), 14);
		}
	}


Otherwise I committed to HEAD.
Comment 3 Anthony Hunter CLA 2008-10-22 13:28:23 EDT
Hi Matt,

There is still failures on a different Linux OS:

http://emft.eclipse.org/gef//downloads/drops//3.5.0/I200810211645/testresults/html/org.eclipse.draw2d.test_linux.gtk.html

info.getBaseline() is 24 on Windows XP, 25 on RedHat Linux and 27 on another Linux.

What does this mean?
Comment 4 Anthony Hunter CLA 2008-11-05 13:28:24 EST
I commented out the tests for 3.5 M3.

If the tests are not fixed for 3.5 M4 we will have to remove this contribution.
Comment 5 Anthony Hunter CLA 2008-11-19 14:02:16 EST
Matt was not even CCed on the Bug and did not realize we were waiting for him.

Matt, need your answers here.

(In reply to comment #3)
> Hi Matt,
> 
> There is still failures on a different Linux OS:
> 
> http://emft.eclipse.org/gef//downloads/drops//3.5.0/I200810211645/testresults/html/org.eclipse.draw2d.test_linux.gtk.html
> 
> info.getBaseline() is 24 on Windows XP, 25 on RedHat Linux and 27 on another
> Linux.
> 
> What does this mean?
> 

(In reply to comment #4)
> I commented out the tests for 3.5 M3.
> 
> If the tests are not fixed for 3.5 M4 we will have to remove this contribution.
> 

Comment 6 Anthony Hunter CLA 2008-12-03 14:43:21 EST
(In reply to comment #4)
> I commented out the tests for 3.5 M3.
> 
> If the tests are not fixed for 3.5 M4 we will have to remove this contribution.
> 

Gone for now.