1 /*************************************************************************
2 * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
4 * Plugin for PHP unit Testing.
7 *************************************************************************/
10 package net.sourceforge.phpeclipse.phpunit;
12 import net.sourceforge.phpeclipse.phpunit.testpool.TestCase;
13 import net.sourceforge.phpeclipse.phpunit.testpool.TestSuite;
15 import org.eclipse.jface.resource.ImageDescriptor;
16 import org.eclipse.jface.viewers.LabelProvider;
17 import org.eclipse.swt.graphics.Image;
20 public class TestPoolLabelProvider extends LabelProvider {
22 public String getText(Object element) {
26 if(element instanceof TestSuite)
27 return ((TestSuite)element).getName();
28 else if(element instanceof TestCase) {
30 text = ((TestCase)element).getTestName();
32 //has the form: TESTSUITENAME_TESTNAME
36 text = "UNKNOWN ELEMENT TYPE";
42 public Image getImage(Object element) {
45 ImageDescriptor descriptor = null;
47 if(element instanceof TestSuite) {
49 TestSuite suite = (TestSuite)element;
50 descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
54 descriptor = PHPUnitImages.DESC_TEST_SUITE_ERROR;
55 else if(suite.hasFailure())
56 descriptor = PHPUnitImages.DESC_TEST_SUITE_FAILURE;
57 else if(suite.isAllPass())
58 descriptor = PHPUnitImages.DESC_TEST_SUITE_PASS;
61 } else if(element instanceof TestCase) {
63 TestCase test = (TestCase)element;
65 descriptor = PHPUnitImages.DESC_TEST_PASS;
68 descriptor = PHPUnitImages.DESC_TEST_ERROR;
69 else if(test.isFailure())
70 descriptor = PHPUnitImages.DESC_TEST_FAILURE;
71 else if(test.isPass())
72 descriptor = PHPUnitImages.DESC_TEST_PASS;
76 image = descriptor.createImage();