01: /*******************************************************************************
02: * Copyright (c) 2005, 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.jface.tests.performance;
11:
12: import org.eclipse.swt.widgets.TableItem;
13: import org.eclipse.ui.tests.performance.TestRunnable;
14:
15: public class FastTableViewerRefreshTest extends TableViewerRefreshTest {
16:
17: public FastTableViewerRefreshTest(String testName, int tagging) {
18: super (testName, tagging);
19: }
20:
21: public FastTableViewerRefreshTest(String testName) {
22: super (testName);
23: }
24:
25: /**
26: * Test the time for doing a refresh.
27: *
28: * @throws Throwable
29: */
30: public void testRefreshMultiple() throws Throwable {
31: openBrowser();
32:
33: exercise(new TestRunnable() {
34: public void run() {
35: startMeasuring();
36: for (int i = 0; i < 10; i++) {
37: viewer.refresh();
38: processEvents();
39:
40: }
41: stopMeasuring();
42: }
43: }, MIN_ITERATIONS, slowGTKIterations(),
44: JFacePerformanceSuite.MAX_TIME);
45:
46: commitMeasurements();
47: assertPerformance();
48: }
49:
50: /**
51: * Test the time for doing a refresh.
52: *
53: * @throws Throwable
54: */
55: public void testUpdateMultiple() throws Throwable {
56: openBrowser();
57:
58: exercise(
59: new TestRunnable() {
60: public void run() {
61: startMeasuring();
62: for (int i = 0; i < 10; i++) {
63: TableItem[] items = viewer.getTable()
64: .getItems();
65: for (int j = 0; j < items.length; j++) {
66: TableItem item = items[j];
67: Object element = RefreshTestContentProvider.allElements[j];
68: viewer.testUpdateItem(item, element);
69: }
70: processEvents();
71: }
72:
73: stopMeasuring();
74:
75: }
76: }, MIN_ITERATIONS, slowGTKIterations(),
77: JFacePerformanceSuite.MAX_TIME);
78:
79: commitMeasurements();
80: assertPerformance();
81: }
82:
83: }
|