01: /*******************************************************************************
02: * Copyright (c) 2007 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: * Ashley Cambrell - bug 198904
11: ******************************************************************************/package org.eclipse.jface.tests.databinding;
12:
13: import org.eclipse.swt.widgets.Shell;
14:
15: /**
16: * Abstract test case that handles disposing of the Shell after each test.
17: *
18: * @since 1.1
19: */
20: public abstract class AbstractSWTTestCase extends
21: AbstractDefaultRealmTestCase {
22: private Shell shell;
23:
24: /*
25: * (non-Javadoc)
26: *
27: * @see org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase#setUp()
28: */
29: protected void setUp() throws Exception {
30: super .setUp();
31: }
32:
33: /*
34: * (non-Javadoc)
35: *
36: * @see org.eclipse.jface.tests.databinding.AbstractDefaultRealmTestCase#tearDown()
37: */
38: protected void tearDown() throws Exception {
39: super .tearDown();
40:
41: if (shell != null && !shell.isDisposed()) {
42: shell.dispose();
43: }
44: }
45:
46: /**
47: * Returns a Shell to be used in a test.
48: *
49: * @return shell
50: */
51: protected Shell getShell() {
52: if (shell == null || shell.isDisposed()) {
53: shell = new Shell();
54: }
55:
56: return shell;
57: }
58: }
|