Bug 283215 testSashWeights in I20090710-1930
There was a failure in tonight's M5 candidate. Is this a problem, or is the test no longer valid. Child count mismatch; expected: 2actual: 3 junit.framework.AssertionFailedError: Child count mismatch; expected: 2actual: 3 at org.eclipse.e4.ui.tests.workbench.RenderingTestCase.checkResults(RenderingTestCase.java:202) at org.eclipse.e4.ui.tests.workbench.RenderingTestCase.checkResults(RenderingTestCase.java:209) at org.eclipse.e4.ui.tests.workbench.RenderingTestCase$2.run(RenderingTestCase.java:178) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.tests.workbench.RenderingTestCase.createModel(RenderingTestCase.java:163) at org.eclipse.e4.ui.tests.workbench.MSashTest.testSashWeights(MSashTest.java:54) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:354) at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:206) at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:35) at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31) at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:574) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311) at org.eclipse.equinox.launcher.Main.main(Main.java:1287) at org.eclipse.core.launcher.Main.main(Main.java:34)
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MSashTest.java
Rectangle r1 = c1.getBounds();
		MContributedPart v2 = (MContributedPart) sf.getChildren().get(1);
		Composite c2 = (Composite) v2.getWidget();
		Rectangle r2 = c2.getBounds();
		assertTrue("SWT controls should be equal:", r1.width == r2.width);
		SashForm sfw = (SashForm) sf.getWidget();
		int[] w = { 75, 25 };
		sfw.setWeights(w);
		sfw.layout(true);
		testWeights(sf, 75, 25);
		sf.getWeights().clear();
		sf.getWeights().add(new Integer(40));
		sf.getWeights().add(new Integer(60));
		testWeights(sf, 40, 60);
	}
	private void testWeights(MSashForm sf, double w1, double w2) {
		double baseRatio = w1 / w2;
		System.out.println("Base Ratio: " + baseRatio);
		
		Integer sf1 = (Integer) sf.getWeights().get(0);
		Integer sf2 = (Integer) sf.getWeights().get(1);
		checkRatio("MSashForm", sf1, sf2, baseRatio);
		
		SashForm sfw = (SashForm) sf.getWidget();
		int[] sfwWghts = sfw.getWeights();
		checkRatio("SWT SashForm", sfwWghts[0], sfwWghts[1], baseRatio);
		
		Composite c1 = (Composite) sfw.getChildren()[0];
		Composite c2 = (Composite) sfw.getChildren()[1];
		checkRatio("Control Bounds", c1.getSize().y, c2.getSize().y, baseRatio);