94605d5a8aa7b83031798af840e22d654b7279ab
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / PHPUnitView.java
1 package net.sourceforge.phpeclipse.phpunit;
2
3
4 import org.eclipse.swt.SWT;
5 import org.eclipse.swt.widgets.Composite;
6 import org.eclipse.swt.widgets.Label;
7 import org.eclipse.swt.widgets.Text;
8 import org.eclipse.ui.part.ViewPart;
9
10 /**
11  * @author Ali Echihabi
12  *
13  * To change the template for this generated type comment go to
14  * Window>Preferences>Java>Code Generation>Code and Comments
15  */
16 /*
17  * Created on May 22, 2004
18  *
19  * To change the template for this generated file go to
20  * Window>Preferences>Java>Code Generation>Code and Comments
21  */
22
23 /**
24  * @author Ali Echihabi (ali_echihabi@ieee.org)
25  *
26  * Plugin for PHP unit Testing.
27  * www.phpeclipse.de
28  * 
29  * This the main view showing the progress and reports.
30  * 
31  */
32
33
34 public class PHPUnitView extends ViewPart {
35
36         /*
37          * like J Unit
38          * a tree.
39          * The first level nodes are the test suites.
40          * children are nested test suites.
41          * leafs: test functions.
42          */
43         
44         
45         private int numTests; // total number of tests
46         private int numTestsRun; // number of tests run so far
47         private int numFailures; // number of failures so far
48         private int numErrors; // number of errors so far
49         private int numPasses; // number of passes so far (they should add up)   
50
51         Label labelRuns, labelRunsVal; // Runs: 12
52         Label labelErrors, labelErrorsVal;
53         Label labelFailures, labelFailuresVal;
54         
55         Text reportArea; // TODO: replace with Tree display like JUnit
56
57         public PHPUnitView() {
58                 
59         }
60         
61         public void createPartControl(Composite parent) {
62                 
63                 //viewer = new TreeViewer(parent);
64                 labelRuns = new Label(parent, SWT.WRAP);
65                 labelRuns.setText("Runs: ");
66                 labelRunsVal = new Label(parent, SWT.WRAP);
67                 labelRunsVal.setText("0 / 0");
68                 
69                 labelFailures = new Label(parent, SWT.WRAP);
70                 labelFailures.setText("Failures: ");
71                 labelFailuresVal = new Label(parent, SWT.WRAP);
72                 labelFailuresVal.setText("0");
73                 
74                 labelErrors = new Label(parent, SWT.WRAP);
75                 labelErrors.setText("Errors: ");
76                 labelErrorsVal = new Label(parent, SWT.WRAP);
77                 labelErrorsVal.setText("0");
78
79                 reportArea = new Text(parent, SWT.MULTI | SWT.BORDER |
80                 SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
81                 
82                 // TODO layout!
83         }
84
85         /* (non-Javadoc)
86          * @see org.eclipse.ui.IWorkbenchPart#setFocus()
87          */
88         public void setFocus() {
89                 markTestPass("hello");
90         }
91
92         /**
93          * mark the given test as passed in the GUI.
94          * 
95          * @param testID
96          */
97         private void markTestPass(String testID) {
98                 
99                 // testid, use it in hashmap to retrieve tree item of test and
100                 // change icon color, increment pass counter, etc...
101                 
102                 
103                 //for now:
104                 reportArea.append("test passed");
105         }
106
107         
108         
109         
110         
111         
112
113 }