Index: modules/simpletest/drupal_reporter.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_reporter.php,v retrieving revision 1.1 diff -u -r1.1 drupal_reporter.php --- drupal_reporter.php 20 Apr 2008 18:34:43 -0000 1.1 +++ drupal_reporter.php 20 May 2008 23:59:54 -0000 @@ -58,10 +58,11 @@ function paintPass($message, $group) { parent::paintPass($message); if ($group == 'Other') { - $group = t($group); + $info = $this->test_info_stack[count($this->test_info_stack) - 1]; + $group = $info['name']; } $this->test_stack[] = array( - 'data' => array($message, "[$group]", t('Pass'), theme('image', 'misc/watchdog-ok.png')), + 'data' => array($message, array('data' => "$group", 'class' => 'simpletest-group'), t('Pass'), theme('image', 'misc/watchdog-ok.png')), 'class' => 'simpletest-pass', ); } @@ -77,10 +78,11 @@ function paintFail($message, $group) { parent::paintFail($message); if ($group == 'Other') { - $group = t($group); + $info = $this->test_info_stack[count($this->test_info_stack) - 1]; + $group = $info['name']; } $this->test_stack[] = array( - 'data' => array($message, "[$group]", t('Fail'), theme('image', 'misc/watchdog-error.png')), + 'data' => array($message, array('data' => "$group", 'class' => 'simpletest-group'), t('Fail'), theme('image', 'misc/watchdog-error.png')), 'class' => 'simpletest-fail', ); } @@ -94,7 +96,7 @@ function paintError($message) { parent::paintError($message); $this->test_stack[] = array( - 'data' => array($message, '[PHP]', t('Exception'), theme('image', 'misc/watchdog-warning.png')), + 'data' => array($message, array('data' => "PHP", 'class' => 'simpletest-group'), t('Exception'), theme('image', 'misc/watchdog-warning.png')), 'class' => 'simpletest-exception', ); } @@ -121,16 +123,17 @@ $this->writeToLastField($this->form, array( '#type' => 'fieldset', '#title' => $test_name, + '#attributes' => array('class' => 'simpletest-results'), '#weight' => $this->weight++, ), $this->form_depth); - if (! isset($this->_size)) { + if (!isset($this->_size)) { $this->_size = $size; } if (($c = count($this->test_info_stack)) > 0) { $info = $this->test_info_stack[$c - 1]; - $this->writeContent('' . $info['name'] . ': ' . $info['description'], $this->getParentWeight() ); + $this->writeContent('' . $info['name'] . ': ' . $info['description'], $this->getParentWeight()); } $this->_test_stack[] = $test_name; @@ -174,7 +177,7 @@ $this->writeToLastField($this->form, $write, $this->form_depth); $this->writeContent('' . $this->getPassCount() . ' passes, ' . $this->getFailCount() . ' fails and ' . $this->getExceptionCount() . ' exceptions.', $parent_weight, $class); if (count($this->test_stack) != 0) { - $this->writeContent(theme('table', array(), $this->test_stack)); + $this->writeContent(theme('table', array(t('Details'), t('Category'), t('Outcome')), $this->test_stack)); $this->test_stack = array(); } array_pop($this->form_depth); Index: modules/simpletest/simpletest.js =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.js,v retrieving revision 1.1 diff -u -r1.1 simpletest.js --- simpletest.js 20 Apr 2008 18:23:29 -0000 1.1 +++ simpletest.js 21 May 2008 00:05:17 -0000 @@ -27,6 +27,7 @@ } }); } + Drupal.behaviors.simpleTestSelectAll = function() { $('td.simpletest-select-all').each(function() { var checkboxes = Drupal.settings.simpleTest['simpletest-test-group-'+ $(this).attr('id')].testNames, @@ -55,4 +56,46 @@ } $(this).append(checkbox); }); +}; + +Drupal.behaviors.simpleTestFilterForm = function() { + var refreshAll = function() { + $('tr.simpletest-pass').show(); + $('tr.simpletest-fail').show(); + $('tr.simpletest-exception').show(); + if (!($('input#edit-outcome-pass').is(':checked'))) { + $('tr.simpletest-pass').hide(); + } + if (!($('input#edit-outcome-fail').is(':checked'))) { + $('tr.simpletest-fail').hide(); + } + if (!($('input#edit-outcome-exception').is(':checked'))) { + $('tr.simpletest-exception').hide(); + } + groupFilter(); + $('fieldset.simpletest-results').each(function() { + if (($(this).find('tr:visible').length) <= 1) { + $(this).hide(); + } + else { + $(this).show(); + } + }); + }; + var groupFilter = function(parent_fieldset) { + var text = $('input#edit-group').val(); + $('tr > td.simpletest-group > strong').each(function() { + var group = $(this).text(); + group = group.toLowerCase(); + if (group.indexOf(text.toLowerCase()) == -1) { + $(this).parent().parent().hide(); + } + }); + }; + $('input.simpletest-filter:checkbox').change(function() { + refreshAll(); + }); + $('input.simpletest-filter:text').keyup(function() { + refreshAll(); + }); }; \ No newline at end of file Index: modules/simpletest/simpletest.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.module,v retrieving revision 1.1 diff -u -r1.1 simpletest.module --- simpletest.module 20 Apr 2008 18:23:29 -0000 1.1 +++ simpletest.module 20 May 2008 23:38:38 -0000 @@ -85,7 +85,7 @@ $output = drupal_get_form('simpletest_overview_form'); if (simpletest_running_output()) { - return simpletest_running_output() . $output; + return drupal_get_form('simpletest_filter_form') . simpletest_running_output() . $output; } else { return $output; @@ -474,5 +474,35 @@ ); return system_settings_form($form); - } + +/** + * FAPI callback for the SimpleTest filter-test-results form. + */ +function simpletest_filter_form() { + $form = array(); + $form['outcome'] = array( + '#type' => 'checkboxes', + '#title' => t('Filter by outcome'), + '#options' => array(), + '#attributes' => array('class' => 'container-inline'), + '#default_value' => array(), + ); + $categories = array('pass' => t('Passes'), 'fail' => t('Fails'), 'exception' => t('Exceptions')); + foreach ($categories as $outcome => $readable) { + $form['outcome'][$outcome] = array( + '#type' => 'checkbox', + '#title' => $readable, + '#attributes' => array('class' => 'simpletest-filter'), + '#default_value' => TRUE, + ); + } + $form['group'] = array( + '#type' => 'textfield', + '#title' => t('Filter by category'), + '#length' => 20, + '#default_value' => '', + '#attributes' => array('class' => 'container-inline simpletest-filter'), + ); + return $form; +} \ No newline at end of file Index: modules/simpletest/simpletest.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.php,v retrieving revision 1.1 diff -u -r1.1 simpletest.php --- simpletest.php 20 Apr 2008 18:23:29 -0000 1.1 +++ simpletest.php 21 May 2008 00:03:16 -0000 @@ -316,7 +316,7 @@ continue; } if ($this->_frameMatchesPrefix($frame)) { - return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']'; + return ' at [' . str_replace('\\', '/', substr(str_replace(getcwd(), '', $frame['file']), 1)) . ' line ' . $frame['line'] . ']'; } } return '';