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.StackPresentation;
14: import org.eclipse.ui.tests.performance.TestRunnable;
15: import org.eclipse.ui.tests.performance.layout.PresentationWidgetFactory;
16:
17: public class PresentationActivateTest extends
18: PresentationPerformanceTest {
19:
20: private int type;
21: private int number;
22: private AbstractPresentationFactory factory;
23:
24: public PresentationActivateTest(
25: AbstractPresentationFactory factory, int type, int number) {
26: super (PresentationWidgetFactory.describePresentation(factory,
27: type)
28: + " activation");
29: this .type = type;
30: this .number = number;
31: this .factory = factory;
32: }
33:
34: protected void runTest() throws Throwable {
35: final PresentationTestbed testbed = createPresentation(factory,
36: type, number);
37:
38: exercise(new TestRunnable() {
39: public void run() throws Exception {
40:
41: startMeasuring();
42:
43: for (int i = 0; i < 100; i++) {
44: testbed
45: .setActive(StackPresentation.AS_ACTIVE_FOCUS);
46: processEvents();
47: testbed
48: .setActive(StackPresentation.AS_ACTIVE_NOFOCUS);
49: processEvents();
50: testbed.setActive(StackPresentation.AS_INACTIVE);
51: processEvents();
52: }
53:
54: stopMeasuring();
55: }
56: });
57:
58: commitMeasurements();
59: assertPerformance();
60: }
61: }
|