Bug 124506 - Bugs in advanced graphics
Summary: Bugs in advanced graphics
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy Draw2d (show other bugs)
Version: 3.2   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 340214 340256
Blocks:
  Show dependency tree
 
Reported: 2006-01-19 11:56 EST by Pratik Shah CLA
Modified: 2011-03-16 18:38 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pratik Shah CLA 2006-01-19 11:56:37 EST
The following tests in AdvancedGraphicsTests fail on at least one platform.

testInterpolation()
testPathDraw()
testPathFill()

They have been commented out for now and are most likely caused by bugs in SWT.  Regardless, we should investigate the problems and open bugs against SWT.
Comment 1 Alexander Nyßen CLA 2011-03-15 14:09:10 EDT
Verified that testInterpolation() and testPathFill() run without problems on Mac OS X Carbon and Cocoa, while testPathDraw() fails on both platforms.
Comment 2 Alexander Nyßen CLA 2011-03-15 18:52:22 EDT
The problem seems to be related to the fact that either SWTGraphics or in the underlying GC path drawing does not seem to be side-effect free. When executing each test within testPathDraw() individually (by uncommenting all others and running the test) it does not lead to problems (as the SWTGraphics and GC are disposed by teardown() and replaced by new instances by setUp() in between). 

If however changing the method to execute the tests individually but without diposing/creating new GC/SWTGraphics in between (as listed below) on Mac Cocoa (with SWT 3.7M5) an invalid memory access error (Invalid memory access of location 0x11c07b1cc rip=0x7fff832dfb3a) can be reproduced. 

public void testPathDraw() {

		class PathSettings implements Runnable {
			private final int antialias;
			private final Color color;
			private final int style;
			private final int width;

			PathSettings(int antialias, int width, int style, Color color) {
				this.antialias = antialias;
				this.width = width;
				this.style = style;
				this.color = color;
			}

			public void run() {
				g.setAntialias(antialias);
				g.setLineWidth(width);
				g.setLineStyle(style);
				g.setForegroundColor(color);
			}
		}

		g.setBackgroundColor(ColorConstants.darkBlue);

		Runnable tests[] = new Runnable[5];
		tests[0] = new PathSettings(SWT.ON, 3, SWT.LINE_SOLID,
				ColorConstants.darkBlue);
		tests[1] = new PathSettings(SWT.OFF, 0, SWT.LINE_DOT,
				ColorConstants.red);
		tests[2] = new PathSettings(SWT.DEFAULT, 1, SWT.LINE_DOT,
				ColorConstants.darkBlue);
		tests[3] = new PathSettings(SWT.DEFAULT, 2, SWT.LINE_DOT,
				ColorConstants.darkGreen);
		tests[4] = new PathSettings(SWT.ON, 2, SWT.LINE_DASHDOTDOT,
				ColorConstants.black);
		for (int i = 0; i < tests.length; i++) {
			performTestcase(new Runnable() {
				public void run() {
					g.drawPath(path1);
					g.drawPath(path2);
				}
			}, new Runnable[] { tests[i] });
		}
	}
Comment 3 Randy Hudson CLA 2011-03-15 21:27:28 EDT
> If however changing the method to execute the tests individually but without
> diposing/creating new GC/SWTGraphics in between (as listed below) on Mac Cocoa
> (with SWT 3.7M5) an invalid memory access error (Invalid memory access of
> location 0x11c07b1cc rip=0x7fff832dfb3a) can be reproduced.

You need to report this to the SWT team with minimum set of steps on how to reproduce.
Comment 4 Alexander Nyßen CLA 2011-03-16 02:55:43 EDT
(In reply to comment #3)
> > If however changing the method to execute the tests individually but without
> > diposing/creating new GC/SWTGraphics in between (as listed below) on Mac Cocoa
> > (with SWT 3.7M5) an invalid memory access error (Invalid memory access of
> > location 0x11c07b1cc rip=0x7fff832dfb3a) can be reproduced.
> 
> You need to report this to the SWT team with minimum set of steps on how to
> reproduce.

Yes, I know. I am currently working on an SWT-only snippet to reproduce it.
Comment 5 Alexander Nyßen CLA 2011-03-16 14:49:50 EDT
(In reply to comment #1)
> Verified that testInterpolation() and testPathFill() run without problems on
> Mac OS X Carbon and Cocoa, while testPathDraw() fails on both platforms.

On Windows 7, testInterpolation() and testDrawPath() fails.
Comment 6 Alexander Nyßen CLA 2011-03-16 16:34:01 EDT
(In reply to comment #5)
> (In reply to comment #1)
> > Verified that testInterpolation() and testPathFill() run without problems on
> > Mac OS X Carbon and Cocoa, while testPathDraw() fails on both platforms.
> 
> On Windows 7, testInterpolation() and testDrawPath() fails.
The same holds for Windows XP. On Ubuntu, all tests run fine.

The HACK within assertImageEquality to tolerate a color difference of 4 does not seem to be needed (a difference of 1 is also enough on all platforms where the respective tests succeed).
Comment 7 Alexander Nyßen CLA 2011-03-16 16:51:46 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > > If however changing the method to execute the tests individually but without
> > > diposing/creating new GC/SWTGraphics in between (as listed below) on Mac Cocoa
> > > (with SWT 3.7M5) an invalid memory access error (Invalid memory access of
> > > location 0x11c07b1cc rip=0x7fff832dfb3a) can be reproduced.
> > 
> > You need to report this to the SWT team with minimum set of steps on how to
> > reproduce.
> 
> Yes, I know. I am currently working on an SWT-only snippet to reproduce it.

Reported this as SWT bug #340214.
Comment 8 Alexander Nyßen CLA 2011-03-16 16:54:39 EDT
(In reply to comment #5)
> (In reply to comment #1)
> > Verified that testInterpolation() and testPathFill() run without problems on
> > Mac OS X Carbon and Cocoa, while testPathDraw() fails on both platforms.
> 
> On Windows 7, testInterpolation() and testDrawPath() fails.

Actually, on Windows 7 the discrepancy between the related two path images can be observed with the naked eye. On Mac and Windows XP it is less obvious.
Comment 9 Alexander Nyßen CLA 2011-03-16 18:38:11 EDT
Opened SWT bug #340256 to keep track of the interpolation problem that occurs on Windows (attached an SWT-only snippet to reproduce the underlying problem there).