01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.tests.performance.presentations;
11:
12: import org.eclipse.ui.presentations.AbstractPresentationFactory;
13: import org.eclipse.ui.presentations.IPresentablePart;
14: import org.eclipse.ui.tests.performance.TestRunnable;
15: import org.eclipse.ui.tests.performance.layout.PresentationWidgetFactory;
16:
17: public class PresentationSelectTest extends PresentationPerformanceTest {
18:
19: private int type;
20: private int number;
21: private AbstractPresentationFactory factory;
22:
23: public PresentationSelectTest(AbstractPresentationFactory factory,
24: int type, int number) {
25: super (PresentationWidgetFactory.describePresentation(factory,
26: type)
27: + " selection change");
28: this .type = type;
29: this .number = number;
30: this .factory = factory;
31: }
32:
33: protected void runTest() throws Throwable {
34: final PresentationTestbed testbed = createPresentation(factory,
35: type, number);
36:
37: final IPresentablePart[] parts = testbed.getPartList();
38:
39: exercise(new TestRunnable() {
40: public void run() throws Exception {
41:
42: startMeasuring();
43:
44: for (int i = 0; i < parts.length; i++) {
45: IPresentablePart part = parts[i];
46:
47: testbed.setSelection(part);
48: processEvents();
49: }
50:
51: stopMeasuring();
52: }
53: });
54:
55: commitMeasurements();
56: assertPerformance();
57: }
58: }
|