Backport of Bug 116237 [Markers] Performance Tests Failing: OpenCloseViewTest#showView:org.eclipse.ui.views.BookmarkView()
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/performance/layout/ResizeTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/performance/layout/ResizeTest.java index 7d86a70..9305b47 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/performance/layout/ResizeTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/performance/layout/ResizeTest.java
@@ -17,79 +17,92 @@ import org.eclipse.test.performance.Dimension; import org.eclipse.ui.WorkbenchException; import org.eclipse.ui.tests.performance.BasicPerformanceTest; -import org.eclipse.ui.tests.performance.TestRunnable; /** - * Measures the time to resize the widget 10 times, including the time required to redraw. + * Measures the time to resize the widget 10 times, including the time required + * to redraw. * * @since 3.1 */ public class ResizeTest extends BasicPerformanceTest { - private TestWidgetFactory widgetFactory; - private int xIterations = 10; - private int yIterations = 10; - private String tagString; + private TestWidgetFactory widgetFactory; - /** - * @param testName - */ - public ResizeTest(TestWidgetFactory widgetFactory) { - this(widgetFactory, NONE, widgetFactory.getName() + " setSize"); - } - - /** - * @param testName - */ - public ResizeTest(TestWidgetFactory widgetFactory, int tagging, String tagString) { - super(widgetFactory.getName() + " setSize",tagging); - this.tagString = tagString; - this.widgetFactory = widgetFactory; - } + private int xIterations = 10; - /** - * Run the test - */ - protected void runTest() throws CoreException, WorkbenchException { + private int yIterations = 10; - tagIfNecessary(tagString,Dimension.ELAPSED_PROCESS); - - widgetFactory.init(); - final Composite widget = widgetFactory.getControl(); - Rectangle initialBounds = widget.getBounds(); - final Point maxSize = widgetFactory.getMaxSize(); - - waitForBackgroundJobs(); - processEvents(); - - exercise(new TestRunnable() { - public void run() { - - for (int xIteration = 0; xIteration < xIterations; xIteration++) { - - startMeasuring(); - - for (int yIteration = 0; yIteration < yIterations; yIteration++) { - // Avoid giving the same x value twice in a row in order to make it hard to cache - int xSize = maxSize.x * ((xIteration + yIteration) % xIterations) / xIterations; - int ySize = maxSize.y * yIteration / yIterations; - - widget.setSize(xSize, ySize); - - processEvents(); - } - - stopMeasuring(); - } - - } - }); - - commitMeasurements(); - assertPerformance(); - - widget.setBounds(initialBounds); - widgetFactory.done(); - } - + private String tagString; + + + + /** + * Create a new instance of the receiver. + * @param factory + */ + public ResizeTest(TestWidgetFactory factory) { + this(factory, NONE, factory.getName() + " setSize"); + } + + + + /** + * Create a new instance of the receiver. + * @param factory + * @param tagging + * @param tag + */ + public ResizeTest(TestWidgetFactory factory, int tagging, + String tag) { + super(factory.getName() + " setSize", tagging); + this.tagString = tag; + this.widgetFactory = factory; + } + + /** + * Run the test + */ + protected void runTest() throws CoreException, WorkbenchException { + + tagIfNecessary(tagString, Dimension.ELAPSED_PROCESS); + + widgetFactory.init(); + final Composite widget = widgetFactory.getControl(); + Rectangle initialBounds = widget.getBounds(); + final Point maxSize = widgetFactory.getMaxSize(); + + waitForBackgroundJobs(); + processEvents(); + for (int j = 0; j < 100; j++) { + + startMeasuring(); + for (int i = 0; i < 10; i++) { + + for (int xIteration = 0; xIteration < xIterations; xIteration += 5) { + + for (int yIteration = 0; yIteration < yIterations; yIteration++) { + // Avoid giving the same x value twice in a row in order + // to make it hard to cache + int xSize = maxSize.x + * ((xIteration + yIteration) % xIterations) + / xIterations; + int ySize = maxSize.y * yIteration / yIterations; + + widget.setSize(xSize, ySize); + + processEvents(); + } + + } + + } + stopMeasuring(); + } + commitMeasurements(); + assertPerformance(); + + widget.setBounds(initialBounds); + widgetFactory.done(); + } + }