Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 16682 Details for
Bug 81338
[PresentationAPI] Add tests for presentations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
81338_tests_patch.txt (text/plain), 12.15 KB, created by
Stefan Xenos
on 2004-12-15 17:15:24 EST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2004-12-15 17:15:24 EST
Size:
12.15 KB
patch
obsolete
>Index: Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java,v >retrieving revision 1.40 >diff -u -r1.40 UiTestSuite.java >--- Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java 9 Dec 2004 16:22:50 -0000 1.40 >+++ Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java 15 Dec 2004 22:13:47 -0000 >@@ -33,6 +33,7 @@ > import org.eclipse.ui.tests.multipageeditor.MultiPageEditorTestSuite; > import org.eclipse.ui.tests.navigator.NavigatorTestSuite; > import org.eclipse.ui.tests.preferences.PreferencesTestSuite; >+import org.eclipse.ui.tests.presentation.PresentablePartFolderTest; > import org.eclipse.ui.tests.presentations.PresentationsTestSuite; > import org.eclipse.ui.tests.propertysheet.PropertySheetTestSuite; > import org.eclipse.ui.tests.themes.ThemesTestSuite; >@@ -54,6 +55,8 @@ > * Construct the test suite. > */ > public UiTestSuite() { >+ addTest(new TestSuite(PresentablePartFolderTest.class)); >+ > addTest(new UIAutomatedSuite()); > addTest(new TestSuite(NestedSyncExecDeadlockTest.class)); > addTest(new ApiTestSuite()); >Index: Eclipse UI Tests/org/eclipse/ui/tests/presentation/PresentablePartFolderTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/presentation/PresentablePartFolderTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/presentation/PresentablePartFolderTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/presentation/PresentablePartFolderTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,101 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.presentation; >+ >+import junit.framework.Assert; >+ >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder; >+import org.eclipse.ui.internal.presentations.newapi.AbstractTabFolder; >+import org.eclipse.ui.internal.presentations.newapi.PresentablePartFolder; >+import org.eclipse.ui.tests.util.UITestCase; >+ >+/** >+ * >+ * @since 3.1 >+ */ >+public class PresentablePartFolderTest extends UITestCase { >+ >+ private Shell testShell; >+ private PresentablePartFolder folder; >+ private TestPresentablePart part; >+ >+ >+ /** >+ * @param testName >+ */ >+ public PresentablePartFolderTest(String testName) { >+ super(testName); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.util.UITestCase#doSetUp() >+ */ >+ protected void doSetUp() throws Exception { >+ testShell = new Shell(SWT.NONE); >+ >+ folder = createPartFolder(testShell); >+ testShell.open(); >+ testShell.pack(true); >+ >+ part = new TestPresentablePart(testShell); >+ >+ folder.insert(part, 0); >+ folder.select(part); >+ >+ super.doSetUp(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.tests.util.UITestCase#doTearDown() >+ */ >+ protected void doTearDown() throws Exception { >+ testShell.dispose(); >+ testShell = null; >+ super.doTearDown(); >+ Assert.assertFalse(part.hasListeners()); >+ } >+ >+ protected AbstractTabFolder createTabFolder(Composite parent) { >+ AbstractTabFolder result = new DefaultTabFolder(parent, SWT.BORDER, >+ true, true); >+ >+ return result; >+ } >+ >+ protected final PresentablePartFolder createPartFolder(Composite parent) { >+ PresentablePartFolder result = new PresentablePartFolder(createTabFolder(parent)); >+ >+ return result; >+ } >+ >+ public void testListeners() throws Exception { >+ } >+ >+ public void testFolderDisposeFirst() throws Exception { >+ part.enableViewMenu(true); >+ part.enableToolbar(true); >+ >+ folder.getTabFolder().getControl().dispose(); >+ part.getControl().dispose(); >+ } >+ >+ public void testPartDisposeFirst() throws Exception { >+ part.enableViewMenu(true); >+ part.enableToolbar(true); >+ >+ part.getControl().dispose(); >+ folder.getTabFolder().getControl().dispose(); >+ } >+ >+} >Index: Eclipse UI Tests/org/eclipse/ui/tests/presentation/TestPresentablePart.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/presentation/TestPresentablePart.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/presentation/TestPresentablePart.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/presentation/TestPresentablePart.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,227 @@ >+/******************************************************************************* >+ * Copyright (c) 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.ui.tests.presentation; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.graphics.Point; >+import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.layout.FillLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Text; >+import org.eclipse.swt.widgets.ToolBar; >+import org.eclipse.swt.widgets.ToolItem; >+import org.eclipse.ui.IPropertyListener; >+import org.eclipse.ui.presentations.IPartMenu; >+import org.eclipse.ui.presentations.IPresentablePart; >+ >+/** >+ * @since 3.1 >+ */ >+public class TestPresentablePart implements IPresentablePart { >+ >+ private Composite ctrl; >+ private Control toolbar = null; >+ private List listeners = new ArrayList(); >+ private String name = ""; >+ private String title = ""; >+ private String contentDescription = ""; >+ private Image titleImage = ImageDescriptor.getMissingImageDescriptor().createImage(); >+ private boolean dirty = false; >+ private String toolTip = ""; >+ private boolean busy = false; >+ private boolean closeable = true; >+ private boolean hasMenu = false; >+ private IPartMenu testMenu = new IPartMenu() { >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPartMenu#showMenu(org.eclipse.swt.graphics.Point) >+ */ >+ public void showMenu(Point location) { >+ >+ } >+ }; >+ >+ public TestPresentablePart(Composite parent) { >+ ctrl = new Composite(parent, SWT.NONE); >+ ctrl.setLayout(new FillLayout()); >+ // Create a text box so that we can accept focus >+ new Text(parent, SWT.BORDER); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#setBounds(org.eclipse.swt.graphics.Rectangle) >+ */ >+ public void setBounds(Rectangle bounds) { >+ if (!ctrl.isDisposed()) { >+ ctrl.setBounds(bounds); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#setVisible(boolean) >+ */ >+ public void setVisible(boolean isVisible) { >+ if (!ctrl.isDisposed()) { >+ ctrl.setVisible(isVisible); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#setFocus() >+ */ >+ public void setFocus() { >+ if (!ctrl.isDisposed()) { >+ ctrl.setFocus(); >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#addPropertyListener(org.eclipse.ui.IPropertyListener) >+ */ >+ public void addPropertyListener(IPropertyListener listener) { >+ listeners.add(listener); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#removePropertyListener(org.eclipse.ui.IPropertyListener) >+ */ >+ public void removePropertyListener(IPropertyListener listener) { >+ listeners.remove(listener); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getName() >+ */ >+ public String getName() { >+ return name; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getTitle() >+ */ >+ public String getTitle() { >+ return title; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getTitleStatus() >+ */ >+ public String getTitleStatus() { >+ return contentDescription; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getTitleImage() >+ */ >+ public Image getTitleImage() { >+ return titleImage; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getTitleToolTip() >+ */ >+ public String getTitleToolTip() { >+ return toolTip; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#isDirty() >+ */ >+ public boolean isDirty() { >+ return dirty; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#isBusy() >+ */ >+ public boolean isBusy() { >+ return busy; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#isCloseable() >+ */ >+ public boolean isCloseable() { >+ return closeable; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getToolBar() >+ */ >+ public Control getToolBar() { >+ return toolbar; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getMenu() >+ */ >+ public IPartMenu getMenu() { >+ return hasMenu ? testMenu : null; >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.presentations.IPresentablePart#getControl() >+ */ >+ public Control getControl() { >+ return ctrl; >+ } >+ >+ public void firePropertyChange(int propertyId) { >+ for (int i = 0; i < listeners.size(); i++) { >+ ((IPropertyListener) listeners.get(i)).propertyChanged(this, >+ propertyId); >+ } >+ } >+ >+ public boolean hasToolbar() { >+ return toolbar != null; >+ } >+ >+ public boolean hasListeners() { >+ return !listeners.isEmpty(); >+ } >+ >+ public void enableToolbar(boolean enable) { >+ if (enable == hasToolbar()) { >+ return; >+ } >+ >+ if (enable) { >+ ToolBar tb = new ToolBar(ctrl.getParent(), SWT.FLAT | SWT.WRAP); >+ toolbar = tb; >+ new ToolItem(tb, SWT.PUSH); >+ } else { >+ toolbar.dispose(); >+ toolbar = null; >+ } >+ >+ firePropertyChange(IPresentablePart.PROP_TOOLBAR); >+ } >+ >+ public void enableViewMenu(boolean enabled) { >+ if (hasMenu == enabled) { >+ return; >+ } >+ >+ hasMenu = enabled; >+ firePropertyChange(IPresentablePart.PROP_PANE_MENU); >+ } >+ >+ public void dispose() { >+ ctrl.dispose(); >+ enableToolbar(false); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 81338
: 16682