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 6420 Details for
Bug 21013
[PropertiesView] ComboBoxPropertyDescriptor should provide a defualt label provider
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for org.eclipse.ui.tests
Tests-21013.patch (text/plain), 4.79 KB, created by
Kim Horne
on 2003-10-14 14:41:27 EDT
(
hide
)
Description:
Patch for org.eclipse.ui.tests
Filename:
MIME Type:
Creator:
Kim Horne
Created:
2003-10-14 14:41:27 EDT
Size:
4.79 KB
patch
obsolete
>Index: Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java,v >retrieving revision 1.5 >diff -u -r1.5 PropertySheetTestSuite.java >--- Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java 11 Mar 2003 21:23:54 -0000 1.5 >+++ Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java 14 Oct 2003 18:35:01 -0000 >@@ -31,5 +31,6 @@ > */ > public PropertySheetTestSuite() { > addTest(new TestSuite(PropertySheetAuto.class)); >+ addTest(new TestSuite(ComboBoxPropertyDescriptorTest.class)); > } > } >Index: Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/ComboBoxPropertyDescriptorTest.java >=================================================================== >RCS file: Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/ComboBoxPropertyDescriptorTest.java >diff -N Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/ComboBoxPropertyDescriptorTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/ComboBoxPropertyDescriptorTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,96 @@ >+/******************************************************************************* >+ * Copyright (c) 2003 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.propertysheet; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.jface.viewers.ILabelProvider; >+import org.eclipse.jface.viewers.LabelProvider; >+ >+import org.eclipse.ui.views.properties.ComboBoxLabelProvider; >+import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor; >+ >+/** >+ * Test for new functionality pertaining to Bug 21013. >+ * >+ * @since 3.0 >+ */ >+public class ComboBoxPropertyDescriptorTest extends TestCase { >+ >+ private String ID = "ID"; //$NON-NLS-1$ >+ private String NAME = "NAME"; //$NON-NLS-1$ >+ >+ private String [] values = {"One", "Two", "Three"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ >+ private ComboBoxPropertyDescriptor descriptor; >+ >+ /* (non-Javadoc) >+ * @see junit.framework.TestCase#setUp() >+ */ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ descriptor = new ComboBoxPropertyDescriptor(ID, NAME, values); >+ } >+ >+ /* (non-Javadoc) >+ * @see junit.framework.TestCase#tearDown() >+ */ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ /** >+ * Tests the case where the user does not set an ILabelProvider. >+ */ >+ public void testGetDefaultLabelProvider() { >+ ILabelProvider provider = descriptor.getLabelProvider(); >+ assertEquals("Default label provider is of the wrong type", //$NON-NLS-1$ >+ ComboBoxLabelProvider.class, >+ provider.getClass()); >+ >+ for (int i = 0; i < values.length; i++) { >+ String expected = values[i]; >+ assertEquals("Wrong label provided", //$NON-NLS-1$ >+ expected, >+ provider.getText(new Integer(i))); >+ >+ } >+ >+ testWrongLabel(provider, new Object()); >+ testWrongLabel(provider, null); >+ testWrongLabel(provider, new Integer(-1)); >+ testWrongLabel(provider, new Integer(values.length)); >+ } >+ >+ /** >+ * Tests that a bad element object (an Integer outside the accepted range, >+ * null or an other Object) returns the empty String. >+ * @param provider the provider to test against. >+ * @param element the element to test. >+ */ >+ public void testWrongLabel(ILabelProvider provider, Object element) { >+ assertEquals("Wrong label provided in bad case", //$NON-NLS-1$ >+ "", //$NON-NLS-1$ >+ provider.getText(element)); >+ } >+ >+ /** >+ * Tests the case where the user sets their own ILabelProvider. >+ */ >+ public void testSetGetLabelProvider() { >+ ILabelProvider provider = new LabelProvider(); >+ descriptor.setLabelProvider(provider); >+ ILabelProvider descProvider = descriptor.getLabelProvider(); >+ assertSame("Wrong label provider", //$NON-NLS-1$ >+ provider, >+ descProvider); >+ } >+ >+}
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 21013
:
6419
| 6420