misc changes
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / ProgressInfoComposite.java
index 7d779e4..2541c87 100644 (file)
@@ -6,7 +6,10 @@
  */
 package net.sourceforge.phpeclipse.phpunit;
 
+import net.sourceforge.phpeclipse.phpunit.testpool.TestPool;
+
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
@@ -24,9 +27,10 @@ public class ProgressInfoComposite extends Composite {
 
 
        private Label labelRuns, labelRunsVal; // Runs: 12
-       private Label labelErrors, labelErrorsVal;
-       private Label labelFailures, labelFailuresVal;
+       private Label labelErrors, labelErrorsImage, labelErrorsVal;
+       private Label labelFailures, labelFailuresImage, labelFailuresVal;
        
+               
        private ProgressBar progressBar;
 
        /**
@@ -53,6 +57,7 @@ public class ProgressInfoComposite extends Composite {
 
                Composite labelsComposite =
                        new Composite(this, SWT.NONE);
+               
                labelsComposite.setLayoutData(
                        new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
 
@@ -63,29 +68,45 @@ public class ProgressInfoComposite extends Composite {
                labelRunsVal = new Label(labelsComposite, SWT.NONE);
                labelRunsVal.setText("0 / 0");
 
+               labelFailuresImage = new Label(labelsComposite, SWT.NONE);
+               labelFailuresImage.setImage(PHPUnitImages.DESC_FAILURE.createImage());
                labelFailures = new Label(labelsComposite, SWT.NONE);
                labelFailures.setText("Failures: ");
                labelFailuresVal = new Label(labelsComposite, SWT.NONE);
                labelFailuresVal.setText("0");
 
+
+               labelErrorsImage = new Label(labelsComposite, SWT.NONE);
+               labelErrorsImage.setImage(PHPUnitImages.DESC_ERROR.createImage());
                labelErrors = new Label(labelsComposite, SWT.NONE);
                labelErrors.setText("Errors: ");
                labelErrorsVal = new Label(labelsComposite, SWT.NONE);
                labelErrorsVal.setText("0");            
        }
 
-       public void updateInfo(int numTests, int numTestsRun, int numFailures, int numErrors) {
+       public void resetInfo() {
+       
+               labelErrorsVal.setText("0");
+               labelFailuresVal.setText("0");
+               labelRunsVal.setText("0 / 0");
+               progressBar.setSelection(0);    
+       
+       }
+
+       public void updateInfo(TestPool testPool) {
+               
+               int numTestsOverall = testPool.getNumTestsOverall();
+               int numTestsRun = testPool.getNumTestsRun();
                
                //update progress bar
-               progressBar.setMaximum(numTests);
+               progressBar.setMaximum(numTestsOverall);
                progressBar.setSelection(numTestsRun);
-               
-               System.out.println("numTestsRun: " + numTestsRun);
+       
        
                //update labels
-               labelRunsVal.setText(numTestsRun + " / " + numTests);
-               labelFailuresVal.setText("" + numFailures);
-               labelErrorsVal.setText("" + numErrors);
+               labelRunsVal.setText(numTestsRun + " / " + numTestsOverall);
+               labelFailuresVal.setText("" + testPool.getNumFailures());
+               labelErrorsVal.setText("" + testPool.getNumErrors());
                
                //TODO: change Failures label to red if some exist.