[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/unittest _TestResult.java, 1.1, 1.2
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2008-09-27 20:02:05
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20604/src/org/python/pydev/debug/unittest Modified Files: _TestResult.java _TestReportView.java _PyUnitTestRunner.java _TestReportContentProvider.java _ITestRunListener.java _TestReportLabelProvider.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: _TestReportContentProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_TestReportContentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _TestReportContentProvider.java 30 Mar 2008 21:45:18 -0000 1.1 --- _TestReportContentProvider.java 27 Sep 2008 19:59:09 -0000 1.2 *************** *** 23,101 **** // */ //public class TestReportContentProvider implements IStructuredContentProvider, ! // ITestRunListener { // ! // private TableViewer viewer; ! // private TestResult currentResult; ! // private String testFile; ! // ! // public TestReportContentProvider() { ! // PydevDebugPlugin.getDefault().addTestListener(this); ! // } // ! // public void dispose() { ! // PydevDebugPlugin.getDefault().removeTestListener(this); ! // } ! // ! // public Object[] getElements(Object inputElement) { ! // return ((List)inputElement).toArray(); ! // } // ! // private List getTestResults() { ! // return (List)viewer.getInput(); ! // } ! // ! // public void inputChanged(Viewer tableViewer, Object oldInput, ! // Object newInput) { ! // viewer = (TableViewer)tableViewer; ! // ! // } ! // public void testsStarted(int testCount, String testFile) { ! // this.testFile = testFile; ! // ((List)viewer.getInput()).clear(); ! // currentResult = null; ! // Control ctrl = viewer.getControl(); ! // if (ctrl == null || ctrl.isDisposed()) ! // return; ! // ctrl.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // if (!viewer.getControl().isDisposed()) ! // viewer.refresh(); ! // } ! // }); ! // } // // ! // public void testsFinished(String summary) { ! // addLastResult(); ! // } // // ! // public void testStarted(String klass, String method) { ! // addLastResult(); ! // currentResult = new TestResult(testFile, klass, method, 0, System.currentTimeMillis()); ! // } // ! // public void testOK(String klass, String method) { ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // currentResult.testFailed(failureType); ! // } // ! // private void addLastResult() { ! // if (currentResult != null) { ! // currentResult.testFinished(); ! // getTestResults().add(currentResult); ! // Control ctrl = viewer.getControl(); ! // if (ctrl == null || ctrl.isDisposed()) ! // return; ! // ctrl.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // int lineIndex = currentResult.isFailure() ? 0 : -1; ! // if (!viewer.getControl().isDisposed()) ! // viewer.insert(currentResult, lineIndex); ! // } ! // }); ! // } ! // } //} --- 23,101 ---- // */ //public class TestReportContentProvider implements IStructuredContentProvider, ! // ITestRunListener { // ! // private TableViewer viewer; ! // private TestResult currentResult; ! // private String testFile; ! // ! // public TestReportContentProvider() { ! // PydevDebugPlugin.getDefault().addTestListener(this); ! // } // ! // public void dispose() { ! // PydevDebugPlugin.getDefault().removeTestListener(this); ! // } ! // ! // public Object[] getElements(Object inputElement) { ! // return ((List)inputElement).toArray(); ! // } // ! // private List getTestResults() { ! // return (List)viewer.getInput(); ! // } ! // ! // public void inputChanged(Viewer tableViewer, Object oldInput, ! // Object newInput) { ! // viewer = (TableViewer)tableViewer; ! // ! // } ! // public void testsStarted(int testCount, String testFile) { ! // this.testFile = testFile; ! // ((List)viewer.getInput()).clear(); ! // currentResult = null; ! // Control ctrl = viewer.getControl(); ! // if (ctrl == null || ctrl.isDisposed()) ! // return; ! // ctrl.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // if (!viewer.getControl().isDisposed()) ! // viewer.refresh(); ! // } ! // }); ! // } // // ! // public void testsFinished(String summary) { ! // addLastResult(); ! // } // // ! // public void testStarted(String klass, String method) { ! // addLastResult(); ! // currentResult = new TestResult(testFile, klass, method, 0, System.currentTimeMillis()); ! // } // ! // public void testOK(String klass, String method) { ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // currentResult.testFailed(failureType); ! // } // ! // private void addLastResult() { ! // if (currentResult != null) { ! // currentResult.testFinished(); ! // getTestResults().add(currentResult); ! // Control ctrl = viewer.getControl(); ! // if (ctrl == null || ctrl.isDisposed()) ! // return; ! // ctrl.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // int lineIndex = currentResult.isFailure() ? 0 : -1; ! // if (!viewer.getControl().isDisposed()) ! // viewer.insert(currentResult, lineIndex); ! // } ! // }); ! // } ! // } //} Index: _PyUnitTestRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_PyUnitTestRunner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _PyUnitTestRunner.java 30 Mar 2008 21:45:18 -0000 1.1 --- _PyUnitTestRunner.java 27 Sep 2008 19:59:08 -0000 1.2 *************** *** 19,49 **** //public class PyUnitTestRunner { // ! // public static class ConsoleListener implements ITestRunListener { // ! // public void testsStarted(int testCount, String testFile) { ! // System.out.println("STARTING TEST RUN: " + ! // String.valueOf(testCount) + " tests"); ! // } // ! // public void testsFinished(String summary) { ! // System.out.println(summary); // ! // //MessageDialog.openInformation(null, "Test Results", messageLong); ! // } // ! // public void testStarted(String klass, String method) { ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // System.out.print(klass + " " + method + "... "); ! // System.out.println(failureType); ! // System.out.println(trace); ! // } // ! // public void testOK(String klass, String method) { ! // System.out.print(klass + " " + method + "... "); ! // System.out.println("OK"); ! // } ! // } // // public static final int BUFFER_SIZE = 1024 * 4; --- 19,49 ---- //public class PyUnitTestRunner { // ! // public static class ConsoleListener implements ITestRunListener { // ! // public void testsStarted(int testCount, String testFile) { ! // System.out.println("STARTING TEST RUN: " + ! // String.valueOf(testCount) + " tests"); ! // } // ! // public void testsFinished(String summary) { ! // System.out.println(summary); // ! // //MessageDialog.openInformation(null, "Test Results", messageLong); ! // } // ! // public void testStarted(String klass, String method) { ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // System.out.print(klass + " " + method + "... "); ! // System.out.println(failureType); ! // System.out.println(trace); ! // } // ! // public void testOK(String klass, String method) { ! // System.out.print(klass + " " + method + "... "); ! // System.out.println("OK"); ! // } ! // } // // public static final int BUFFER_SIZE = 1024 * 4; *************** *** 62,87 **** // // public PyUnitTestRunner(IProgressMonitor monitor, int port, String testFile) { ! // this.monitor = (SubProgressMonitor) monitor; ! // portToReadFrom = port; ! // this.testFile = testFile; // } // // public void readTestResults() throws IOException{ ! // ITestRunListener listener = new ConsoleListener(); ! // PydevDebugPlugin.getDefault().addTestListener(listener); // // //sleepALittle(1000); // try { ! // serverSocket = new ServerSocket(portToReadFrom); //read from this portToRead ! // try { ! // socketToRead = serverSocket.accept(); ! // try { ! // readMessage(); ! // } finally { ! // socketToRead.close(); ! // } ! // } finally { ! // serverSocket.close(); ! // } // } catch (SocketException e) { // e.printStackTrace(); --- 62,87 ---- // // public PyUnitTestRunner(IProgressMonitor monitor, int port, String testFile) { ! // this.monitor = (SubProgressMonitor) monitor; ! // portToReadFrom = port; ! // this.testFile = testFile; // } // // public void readTestResults() throws IOException{ ! // ITestRunListener listener = new ConsoleListener(); ! // PydevDebugPlugin.getDefault().addTestListener(listener); // // //sleepALittle(1000); // try { ! // serverSocket = new ServerSocket(portToReadFrom); //read from this portToRead ! // try { ! // socketToRead = serverSocket.accept(); ! // try { ! // readMessage(); ! // } finally { ! // socketToRead.close(); ! // } ! // } finally { ! // serverSocket.close(); ! // } // } catch (SocketException e) { // e.printStackTrace(); *************** *** 90,94 **** // throw e; // } finally { ! // PydevDebugPlugin.getDefault().removeTestListener(listener); // } // } --- 90,94 ---- // throw e; // } finally { ! // PydevDebugPlugin.getDefault().removeTestListener(listener); // } // } *************** *** 100,187 **** // */ // private void readMessage() throws IOException, SocketException { ! // reader = new BufferedReader( ! // new InputStreamReader(socketToRead.getInputStream())); // try { ! // String line = null; ! // while ((line = reader.readLine()) != null) { ! // System.out.println(line); ! // parseMessage(line); ! // } ! // } catch (SocketException e) { ! // //e.printStackTrace(); ! // } catch (IOException e) { ! // e.printStackTrace(); ! // } ! // finally { ! // reader.close(); // } // } // // private void parseMessage(String line) { ! // int start; ! // PydevDebugPlugin plugin = PydevDebugPlugin.getDefault(); ! // if (line.startsWith("starting tests ")) { ! // start = "starting tests ".length(); ! // int count = Integer.parseInt(line.substring(start)); ! // monitor.subTask("Starting test run"); ! // plugin.fireTestsStarted(count, testFile); ! // } ! // if (line.startsWith("ending tests ")) { ! // start = "ending tests ".length(); ! // String timeTaken = line.substring(start, line.indexOf(";")); ! // String result = line.substring(line.indexOf(";") + 1, ! // line.length()); ! // String summary = timeTaken +'\n'+ result; ! // monitor.subTask("Ending test run"); ! // plugin.fireTestsFinished(summary); ! // } ! // if (line.startsWith("starting test ")) { ! // start = "starting test ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // method = method.trim(); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // klass = klass.trim(); ! // monitor.subTask(line); ! // plugin.fireTestStarted(klass, method); ! // } ! // if (line.startsWith("test OK ")) { ! // start = "test OK ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // monitor.subTask(line); ! // plugin.fireTestOK(klass, method); ! // } ! // if (line.startsWith("failing test ")) { ! // start = "failing test ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // StringWriter buffer = new StringWriter(); ! // PrintWriter writer = new PrintWriter(buffer); ! // String frame = null; ! // String failureType = ""; ! // try { ! // while ((frame = reader.readLine()) != null && ! // (!frame.equals("END TRACE"))) { ! // //writer.println(frame); ! // ! // if (frame.startsWith("TYPE:")) { ! // int cnt = "TYPE:".length(); ! // failureType = frame.substring(cnt, frame.indexOf(".")); ! // } ! // else { ! // writer.println(frame); ! // } ! // } ! // ! // } catch (IOException e) { ! // e.printStackTrace(); ! // } ! // String trace = buffer.getBuffer().toString(); ! // monitor.subTask(line); ! // plugin.fireTestFailed(klass, method, failureType, trace); ! // } // } // /** --- 100,187 ---- // */ // private void readMessage() throws IOException, SocketException { ! // reader = new BufferedReader( ! // new InputStreamReader(socketToRead.getInputStream())); // try { ! // String line = null; ! // while ((line = reader.readLine()) != null) { ! // System.out.println(line); ! // parseMessage(line); ! // } ! // } catch (SocketException e) { ! // //e.printStackTrace(); ! // } catch (IOException e) { ! // e.printStackTrace(); ! // } ! // finally { ! // reader.close(); // } // } // // private void parseMessage(String line) { ! // int start; ! // PydevDebugPlugin plugin = PydevDebugPlugin.getDefault(); ! // if (line.startsWith("starting tests ")) { ! // start = "starting tests ".length(); ! // int count = Integer.parseInt(line.substring(start)); ! // monitor.subTask("Starting test run"); ! // plugin.fireTestsStarted(count, testFile); ! // } ! // if (line.startsWith("ending tests ")) { ! // start = "ending tests ".length(); ! // String timeTaken = line.substring(start, line.indexOf(";")); ! // String result = line.substring(line.indexOf(";") + 1, ! // line.length()); ! // String summary = timeTaken +'\n'+ result; ! // monitor.subTask("Ending test run"); ! // plugin.fireTestsFinished(summary); ! // } ! // if (line.startsWith("starting test ")) { ! // start = "starting test ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // method = method.trim(); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // klass = klass.trim(); ! // monitor.subTask(line); ! // plugin.fireTestStarted(klass, method); ! // } ! // if (line.startsWith("test OK ")) { ! // start = "test OK ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // monitor.subTask(line); ! // plugin.fireTestOK(klass, method); ! // } ! // if (line.startsWith("failing test ")) { ! // start = "failing test ".length(); ! // String method = line.substring(start, line.indexOf("(")); ! // String klass = line.substring(line.indexOf("(") + 1, ! // line.indexOf(")")); ! // StringWriter buffer = new StringWriter(); ! // PrintWriter writer = new PrintWriter(buffer); ! // String frame = null; ! // String failureType = ""; ! // try { ! // while ((frame = reader.readLine()) != null && ! // (!frame.equals("END TRACE"))) { ! // //writer.println(frame); ! // ! // if (frame.startsWith("TYPE:")) { ! // int cnt = "TYPE:".length(); ! // failureType = frame.substring(cnt, frame.indexOf(".")); ! // } ! // else { ! // writer.println(frame); ! // } ! // } ! // ! // } catch (IOException e) { ! // e.printStackTrace(); ! // } ! // String trace = buffer.getBuffer().toString(); ! // monitor.subTask(line); ! // plugin.fireTestFailed(klass, method, failureType, trace); ! // } // } // /** Index: _ITestRunListener.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_ITestRunListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _ITestRunListener.java 30 Mar 2008 21:45:18 -0000 1.1 --- _ITestRunListener.java 27 Sep 2008 19:59:09 -0000 1.2 *************** *** 15,22 **** // */ //public interface ITestRunListener { ! // void testsStarted(int testCount, String testFile); ! // void testsFinished(String summary); ! // void testStarted(String klass, String method); ! // void testOK(String klass, String method); ! // void testFailed(String klass, String method, String failureType, String trace); //} --- 15,22 ---- // */ //public interface ITestRunListener { ! // void testsStarted(int testCount, String testFile); ! // void testsFinished(String summary); ! // void testStarted(String klass, String method); ! // void testOK(String klass, String method); ! // void testFailed(String klass, String method, String failureType, String trace); //} Index: _TestResult.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_TestResult.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _TestResult.java 30 Mar 2008 21:45:18 -0000 1.1 --- _TestResult.java 27 Sep 2008 19:59:08 -0000 1.2 *************** *** 15,54 **** // */ //public class TestResult { ! // public final static int OK = 0; ! // public final static int FAIL = 1; ! // public final static int ERROR = 2; ! // public String testFile; ! // public String klass; ! // public String method; ! // public int status; ! // public long startTime; ! // public long endTime; ! // ! // public TestResult(String testFile, String klass, String method, int status, long startTime) { ! // this.testFile = testFile; ! // this.klass = klass; ! // this.method = method; ! // this.status = status; ! // this.startTime = startTime; ! // } ! // ! // public void testFailed(String failureType) { ! // //System.out.println("Failure type:" + failureType + ":"); ! // if (failureType.equals("FAIL")) ! // status = FAIL; ! // else if (failureType.equals("ERROR")) ! // status = ERROR; ! // } // ! // public boolean isFailure() { ! // return status != OK; ! // } // ! // public void testFinished() { ! // endTime = System.currentTimeMillis(); ! // } ! // ! // public long testDuration() { ! // return endTime - startTime; ! // } //} --- 15,54 ---- // */ //public class TestResult { ! // public final static int OK = 0; ! // public final static int FAIL = 1; ! // public final static int ERROR = 2; ! // public String testFile; ! // public String klass; ! // public String method; ! // public int status; ! // public long startTime; ! // public long endTime; ! // ! // public TestResult(String testFile, String klass, String method, int status, long startTime) { ! // this.testFile = testFile; ! // this.klass = klass; ! // this.method = method; ! // this.status = status; ! // this.startTime = startTime; ! // } ! // ! // public void testFailed(String failureType) { ! // //System.out.println("Failure type:" + failureType + ":"); ! // if (failureType.equals("FAIL")) ! // status = FAIL; ! // else if (failureType.equals("ERROR")) ! // status = ERROR; ! // } // ! // public boolean isFailure() { ! // return status != OK; ! // } // ! // public void testFinished() { ! // endTime = System.currentTimeMillis(); ! // } ! // ! // public long testDuration() { ! // return endTime - startTime; ! // } //} Index: _TestReportView.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_TestReportView.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _TestReportView.java 30 Mar 2008 21:45:18 -0000 1.1 --- _TestReportView.java 27 Sep 2008 19:59:08 -0000 1.2 *************** *** 53,138 **** //public class TestReportView extends ViewPart { // ! // private TableViewer viewer; ! // private DoubleClickTestAction doubleClickAction = new DoubleClickTestAction(); ! // private static Control colorLabel; ! // private static Control failuresCountLabel; ! // private static Control errorsCountLabel; ! // private ITestRunListener listener; ! // private boolean fIsDisposed= false; ! // ! // public class LabelListener implements ITestRunListener { // ! // private boolean success; ! // private int testsExecuted; ! // private int errCount; ! // private int failCount; ! // ! // private void setLabelTextColor(){ ! // Color green = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GREEN); ! // Color red = colorLabel.getDisplay().getSystemColor(SWT.COLOR_RED); ! // Color gray = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GRAY); ! // Color color; ! // if (testsExecuted == 0) ! // color = gray; ! // else ! // color = success? green: red; ! // colorLabel.setBackground(color); ! // colorLabel.redraw(); // ! // String strErrCount = Integer.toString(errCount); ! // String errText = "Errors: " + strErrCount; ! // ((Label)errorsCountLabel).setText(errText); ! // errorsCountLabel.redraw(); ! // ! // String strFailCount = Integer.toString(failCount); ! // String failText = "Failures: " + strFailCount; ! // ((Label)failuresCountLabel).setText(failText); ! // failuresCountLabel.redraw(); ! // } // ! // public void testsStarted(int testCount, String testFile) { ! // success = true; ! // testsExecuted = 0; ! // errCount = 0; ! // failCount = 0; ! // updateLabels(); ! // //postShowTestReportView(); ! // } // ! // public void testsFinished(String summary) { ! // //if (colorLabel == null || colorLabel.isDisposed()) ! // // return; ! // updateLabels(); ! // } // ! // private void updateLabels() { ! // colorLabel.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // if (colorLabel.isDisposed()) ! // return; ! // setLabelTextColor(); ! // } ! // }); ! // } // ! // public void testStarted(String klass, String method) { ! // testsExecuted++; ! // } // ! // public void testOK(String klass, String method) { // ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // success = false; ! // if (failureType.equals("ERROR")) ! // errCount++; ! // else if (failureType.equals("FAIL")) ! // failCount++; ! // if (colorLabel == null || colorLabel.isDisposed()) ! // return; ! // updateLabels(); ! // } ! // } // // private final class DoubleClickTestAction extends ProgressAction { --- 53,138 ---- //public class TestReportView extends ViewPart { // ! // private TableViewer viewer; ! // private DoubleClickTestAction doubleClickAction = new DoubleClickTestAction(); ! // private static Control colorLabel; ! // private static Control failuresCountLabel; ! // private static Control errorsCountLabel; ! // private ITestRunListener listener; ! // private boolean fIsDisposed= false; ! // ! // public class LabelListener implements ITestRunListener { // ! // private boolean success; ! // private int testsExecuted; ! // private int errCount; ! // private int failCount; ! // ! // private void setLabelTextColor(){ ! // Color green = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GREEN); ! // Color red = colorLabel.getDisplay().getSystemColor(SWT.COLOR_RED); ! // Color gray = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GRAY); ! // Color color; ! // if (testsExecuted == 0) ! // color = gray; ! // else ! // color = success? green: red; ! // colorLabel.setBackground(color); ! // colorLabel.redraw(); // ! // String strErrCount = Integer.toString(errCount); ! // String errText = "Errors: " + strErrCount; ! // ((Label)errorsCountLabel).setText(errText); ! // errorsCountLabel.redraw(); ! // ! // String strFailCount = Integer.toString(failCount); ! // String failText = "Failures: " + strFailCount; ! // ((Label)failuresCountLabel).setText(failText); ! // failuresCountLabel.redraw(); ! // } // ! // public void testsStarted(int testCount, String testFile) { ! // success = true; ! // testsExecuted = 0; ! // errCount = 0; ! // failCount = 0; ! // updateLabels(); ! // //postShowTestReportView(); ! // } // ! // public void testsFinished(String summary) { ! // //if (colorLabel == null || colorLabel.isDisposed()) ! // // return; ! // updateLabels(); ! // } // ! // private void updateLabels() { ! // colorLabel.getDisplay().syncExec(new Runnable() { ! // public void run() { ! // if (colorLabel.isDisposed()) ! // return; ! // setLabelTextColor(); ! // } ! // }); ! // } // ! // public void testStarted(String klass, String method) { ! // testsExecuted++; ! // } // ! // public void testOK(String klass, String method) { // ! // } // ! // public void testFailed(String klass, String method, String failureType, String trace) { ! // success = false; ! // if (failureType.equals("ERROR")) ! // errCount++; ! // else if (failureType.equals("FAIL")) ! // failCount++; ! // if (colorLabel == null || colorLabel.isDisposed()) ! // return; ! // updateLabels(); ! // } ! // } // // private final class DoubleClickTestAction extends ProgressAction { *************** *** 157,163 **** // String method = ((TestResult)obj).method; // if (realFile.exists() && !realFile.isDirectory()) { ! // Location loc = navigateToClassMethod(realFile, klass, method); // //ItemPointer p = new ItemPointer(realFile, new Location(-1, -1), null); ! // ItemPointer p = new ItemPointer(realFile, loc, null); // PyOpenAction act = new PyOpenAction(); // act.run(p); --- 157,163 ---- // String method = ((TestResult)obj).method; // if (realFile.exists() && !realFile.isDirectory()) { ! // Location loc = navigateToClassMethod(realFile, klass, method); // //ItemPointer p = new ItemPointer(realFile, new Location(-1, -1), null); ! // ItemPointer p = new ItemPointer(realFile, loc, null); // PyOpenAction act = new PyOpenAction(); // act.run(p); *************** *** 180,185 **** // // private Location navigateToClassMethod(File file, String klass, String method) { ! // Location loc = new Location(); ! // int lineCnt = 0; // //StringBuffer contents = new StringBuffer(); // BufferedReader input = null; --- 180,185 ---- // // private Location navigateToClassMethod(File file, String klass, String method) { ! // Location loc = new Location(); ! // int lineCnt = 0; // //StringBuffer contents = new StringBuffer(); // BufferedReader input = null; *************** *** 187,192 **** // boolean foundMethod = false; // // klass is of the form module.class; we only need class ! // String new_klass = klass.substring(klass.indexOf(".") + 1); ! // klass = new_klass; // try { // //use buffering --- 187,192 ---- // boolean foundMethod = false; // // klass is of the form module.class; we only need class ! // String new_klass = klass.substring(klass.indexOf(".") + 1); ! // klass = new_klass; // try { // //use buffering *************** *** 195,206 **** // String line = null; // while (( line = input.readLine()) != null){ ! // lineCnt++; ! // if (line.indexOf(klass) > 0) { ! // foundClass = true; ! // } ! // if (foundClass && (line.indexOf(method) > 0)){ ! // foundMethod = true; ! // break; ! // } // //contents.append(line); // //contents.append(System.getProperty("line.separator")); --- 195,206 ---- // String line = null; // while (( line = input.readLine()) != null){ ! // lineCnt++; ! // if (line.indexOf(klass) > 0) { ! // foundClass = true; ! // } ! // if (foundClass && (line.indexOf(method) > 0)){ ! // foundMethod = true; ! // break; ! // } // //contents.append(line); // //contents.append(System.getProperty("line.separator")); *************** *** 225,240 **** // } // if (foundClass && foundMethod) ! // loc.line = lineCnt; // return loc; // } // } ! // ! // public TableViewer getViewer(){ ! // return viewer; ! // } ! // /* (non-Javadoc) ! // * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) ! // */ ! // public void createPartControl(Composite parent) { // GridLayout layout = new GridLayout(); // layout.numColumns = 1; --- 225,240 ---- // } // if (foundClass && foundMethod) ! // loc.line = lineCnt; // return loc; // } // } ! // ! // public TableViewer getViewer(){ ! // return viewer; ! // } ! // /* (non-Javadoc) ! // * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) ! // */ ! // public void createPartControl(Composite parent) { // GridLayout layout = new GridLayout(); // layout.numColumns = 1; *************** *** 249,258 **** // labelData.grabExcessHorizontalSpace = true; // labelData.horizontalAlignment = GridData.FILL; ! // Color gray = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GRAY); ! // colorLabel.setBackground(gray); // colorLabel.setLayoutData(labelData); // // Image imageFailures = PydevDebugPlugin.getDefault().imageCache.get("icons/testfailures_ovr.gif"); ! // Image imageErrors = PydevDebugPlugin.getDefault().imageCache.get("icons/testerrors_ovr.gif"); // // Composite labelComposite = new Composite(parent, SWT.MULTI); --- 249,258 ---- // labelData.grabExcessHorizontalSpace = true; // labelData.horizontalAlignment = GridData.FILL; ! // Color gray = colorLabel.getDisplay().getSystemColor(SWT.COLOR_GRAY); ! // colorLabel.setBackground(gray); // colorLabel.setLayoutData(labelData); // // Image imageFailures = PydevDebugPlugin.getDefault().imageCache.get("icons/testfailures_ovr.gif"); ! // Image imageErrors = PydevDebugPlugin.getDefault().imageCache.get("icons/testerrors_ovr.gif"); // // Composite labelComposite = new Composite(parent, SWT.MULTI); *************** *** 260,264 **** // labelComposite.setLayout(labelLayout); // ! // Label failuresIconLabel = new Label(labelComposite, SWT.NONE); // failuresIconLabel.setImage(imageFailures); // failuresCountLabel = new Label(labelComposite, SWT.NONE); --- 260,264 ---- // labelComposite.setLayout(labelLayout); // ! // Label failuresIconLabel = new Label(labelComposite, SWT.NONE); // failuresIconLabel.setImage(imageFailures); // failuresCountLabel = new Label(labelComposite, SWT.NONE); *************** *** 271,280 **** // ((Label)errorsCountLabel).setText("Errors: "); // //errorsCountLabel.setSize(20,10); ! // // Table table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL ! // | SWT.V_SCROLL | SWT.FULL_SELECTION); ! // table.setHeaderVisible(true); ! // table.setLinesVisible(true); ! // // GridData layoutData = new GridData(); // layoutData.grabExcessHorizontalSpace = true; --- 271,280 ---- // ((Label)errorsCountLabel).setText("Errors: "); // //errorsCountLabel.setSize(20,10); ! // // Table table = new Table(parent, SWT.SINGLE | SWT.H_SCROLL ! // | SWT.V_SCROLL | SWT.FULL_SELECTION); ! // table.setHeaderVisible(true); ! // table.setLinesVisible(true); ! // // GridData layoutData = new GridData(); // layoutData.grabExcessHorizontalSpace = true; *************** *** 283,324 **** // layoutData.verticalAlignment = GridData.FILL; // table.setLayoutData(layoutData); ! // ! // TableColumn column = new TableColumn(table, SWT.NONE, 0); ! // column.setText("Test"); ! // column.setWidth(300); ! // column.setAlignment(SWT.LEFT); // ! // column = new TableColumn(table, SWT.NONE, 1); ! // column.setText("Time (ms)"); ! // column.setWidth(100); ! // column.setAlignment(SWT.RIGHT); // ! // viewer = new TableViewer(table); ! // viewer.setLabelProvider(new TestReportLabelProvider()); ! // viewer.setContentProvider(new TestReportContentProvider()); ! // viewer.setInput(new ArrayList()); // ! // hookViewerActions(); ! // ! // // Register listener for colorLabel ! // listener = new LabelListener(); ! // PydevDebugPlugin.getDefault().addTestListener(listener); ! // ! // } // ! // public void dispose() { ! // fIsDisposed = true; ! // if (listener != null) { ! // PydevDebugPlugin.getDefault().removeTestListener(listener); ! // } ! // } // ! // /* (non-Javadoc) ! // * @see org.eclipse.ui.IWorkbenchPart#setFocus() ! // */ ! // public void setFocus() { ! // viewer.getControl().setFocus(); // ! // } // // private void hookViewerActions() { --- 283,324 ---- // layoutData.verticalAlignment = GridData.FILL; // table.setLayoutData(layoutData); ! // ! // TableColumn column = new TableColumn(table, SWT.NONE, 0); ! // column.setText("Test"); ! // column.setWidth(300); ! // column.setAlignment(SWT.LEFT); // ! // column = new TableColumn(table, SWT.NONE, 1); ! // column.setText("Time (ms)"); ! // column.setWidth(100); ! // column.setAlignment(SWT.RIGHT); // ! // viewer = new TableViewer(table); ! // viewer.setLabelProvider(new TestReportLabelProvider()); ! // viewer.setContentProvider(new TestReportContentProvider()); ! // viewer.setInput(new ArrayList()); // ! // hookViewerActions(); ! // ! // // Register listener for colorLabel ! // listener = new LabelListener(); ! // PydevDebugPlugin.getDefault().addTestListener(listener); ! // ! // } // ! // public void dispose() { ! // fIsDisposed = true; ! // if (listener != null) { ! // PydevDebugPlugin.getDefault().removeTestListener(listener); ! // } ! // } // ! // /* (non-Javadoc) ! // * @see org.eclipse.ui.IWorkbenchPart#setFocus() ! // */ ! // public void setFocus() { ! // viewer.getControl().setFocus(); // ! // } // // private void hookViewerActions() { *************** *** 330,378 **** // } // ! // ! // private boolean isDisposed() { ! // return fIsDisposed; ! // } ! // ! // private void postSyncRunnable(Runnable r) { ! // if (!isDisposed()) ! // getDisplay().syncExec(r); ! // } ! // ! // private Display getDisplay() { ! // return getViewSite().getShell().getDisplay(); ! // } ! // ! // protected void postShowTestReportView() { ! // postSyncRunnable(new Runnable() { ! // public void run() { ! // if (isDisposed()) ! // return; ! // showTestReportView(); ! // } ! // }); ! // } ! // public void showTestReportView() { ! // String viewName = "org.python.pydev.debug.unittest.TestReportView"; ! // IWorkbenchWindow window= getSite().getWorkbenchWindow(); ! // IWorkbenchPage page= window.getActivePage(); ! // TestReportView testRunner= null; ! // ! // if (page != null) { ! // try { // show the result view ! // testRunner= (TestReportView)page.findView(viewName); ! // if(testRunner == null) { ! // IWorkbenchPart activePart= page.getActivePart(); ! // testRunner= (TestReportView)page.showView(viewName); ! // //restore focus ! // page.activate(activePart); ! // } else { ! // page.bringToTop(testRunner); ! // } ! // } catch (PartInitException pie) { ! // pie.printStackTrace(); ! // } ! // } ! // } // //} --- 330,378 ---- // } // ! // ! // private boolean isDisposed() { ! // return fIsDisposed; ! // } ! // ! // private void postSyncRunnable(Runnable r) { ! // if (!isDisposed()) ! // getDisplay().syncExec(r); ! // } ! // ! // private Display getDisplay() { ! // return getViewSite().getShell().getDisplay(); ! // } ! // ! // protected void postShowTestReportView() { ! // postSyncRunnable(new Runnable() { ! // public void run() { ! // if (isDisposed()) ! // return; ! // showTestReportView(); ! // } ! // }); ! // } ! // public void showTestReportView() { ! // String viewName = "org.python.pydev.debug.unittest.TestReportView"; ! // IWorkbenchWindow window= getSite().getWorkbenchWindow(); ! // IWorkbenchPage page= window.getActivePage(); ! // TestReportView testRunner= null; ! // ! // if (page != null) { ! // try { // show the result view ! // testRunner= (TestReportView)page.findView(viewName); ! // if(testRunner == null) { ! // IWorkbenchPart activePart= page.getActivePart(); ! // testRunner= (TestReportView)page.showView(viewName); ! // //restore focus ! // page.activate(activePart); ! // } else { ! // page.bringToTop(testRunner); ! // } ! // } catch (PartInitException pie) { ! // pie.printStackTrace(); ! // } ! // } ! // } // //} Index: _TestReportLabelProvider.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/unittest/_TestReportLabelProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _TestReportLabelProvider.java 30 Mar 2008 21:45:18 -0000 1.1 --- _TestReportLabelProvider.java 27 Sep 2008 19:59:09 -0000 1.2 *************** *** 25,69 **** //public class TestReportLabelProvider extends LabelProvider //implements ITableLabelProvider, IColorProvider { ! // ! // private Image[] images; ! // ! // public TestReportLabelProvider() { ! // images = new Image[3]; ! // images[TestResult.OK] = PydevDebugPlugin.getDefault().imageCache.get("icons/testok.gif"); ! // images[TestResult.FAIL] = PydevDebugPlugin.getDefault().imageCache.get("icons/testfail.gif"); ! // images[TestResult.ERROR] = PydevDebugPlugin.getDefault().imageCache.get("icons/testerr.gif"); ! // } ! // ! // ! // public String getColumnText(Object element, int columnIndex) { ! // TestResult result = (TestResult)element; ! // switch(columnIndex) { ! // case 0: ! // return result.method + " - " + result.klass; ! // case 1: ! // return Long.toString(result.testDuration()); ! // } ! // return null; ! // } // ! // public Image getColumnImage(Object element, int columnIndex) { ! // if (columnIndex == 0) ! // return images[((TestResult)element).status]; ! // return null; ! // } // ! // public void dispose() { ! // for (int i = 0; i < images.length; i++) ! // images[i].dispose(); ! // } ! // ! // public Color getForeground(Object element) { ! // if (((TestResult)element).isFailure()) ! // return Display.getDefault().getSystemColor(SWT.COLOR_RED); ! // return null; ! // } ! // ! // public Color getBackground(Object element) { ! // return null; ! // } //} --- 25,69 ---- //public class TestReportLabelProvider extends LabelProvider //implements ITableLabelProvider, IColorProvider { ! // ! // private Image[] images; ! // ! // public TestReportLabelProvider() { ! // images = new Image[3]; ! // images[TestResult.OK] = PydevDebugPlugin.getDefault().imageCache.get("icons/testok.gif"); ! // images[TestResult.FAIL] = PydevDebugPlugin.getDefault().imageCache.get("icons/testfail.gif"); ! // images[TestResult.ERROR] = PydevDebugPlugin.getDefault().imageCache.get("icons/testerr.gif"); ! // } ! // ! // ! // public String getColumnText(Object element, int columnIndex) { ! // TestResult result = (TestResult)element; ! // switch(columnIndex) { ! // case 0: ! // return result.method + " - " + result.klass; ! // case 1: ! // return Long.toString(result.testDuration()); ! // } ! // return null; ! // } // ! // public Image getColumnImage(Object element, int columnIndex) { ! // if (columnIndex == 0) ! // return images[((TestResult)element).status]; ! // return null; ! // } // ! // public void dispose() { ! // for (int i = 0; i < images.length; i++) ! // images[i].dispose(); ! // } ! // ! // public Color getForeground(Object element) { ! // if (((TestResult)element).isFailure()) ! // return Display.getDefault().getSystemColor(SWT.COLOR_RED); ! // return null; ! // } ! // ! // public Color getBackground(Object element) { ! // return null; ! // } //} |