diff options
Diffstat (limited to 'site/app/views/tests/index.thtml')
-rw-r--r-- | site/app/views/tests/index.thtml | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/site/app/views/tests/index.thtml b/site/app/views/tests/index.thtml new file mode 100644 index 0000000..b9c6d21 --- /dev/null +++ b/site/app/views/tests/index.thtml @@ -0,0 +1,131 @@ +<?php +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is addons.mozilla.org site. + * + * The Initial Developer of the Original Code is + * Justin Scott <fligtar@gmail.com>. + * Portions created by the Initial Developer are Copyright (C) 2006 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ +?> +<? +// deactivate locales in URLs for this page +$html->addLocale = false; +?> +<br> +<div align="center"> +<form> + <input type="text" id="test-search" name="case" /> + <input type="submit" value="Test Case"> +</form> +</div> +<script language="JavaScript" type="text/javascript"> + $(document).ready(function() { + $('#test-search').autocomplete("<?=$html->url('/tests/search')?>", { minChars: 4 }); + }); + $('#test-search').focus(); +</script> +<table width="100%" cellspacing=0 cellpadding=2> + <tr> + <td valign="top"> + <p>Available Test Cases: (<a href="javascript:void(0);" onClick="expandNodes();">Expand All</a>)</p> + <ul class="testlist"> + <?php + $testlist = TestManager::getTestCaseList(); + + foreach ($testlist as $k=>$testCase) { + $nodes = explode('/', $testCase, 3); + if (!empty($testlist[$k+1])) { + $nextNodes = explode('/', $testlist[$k+1], 3); + } + + for ($i = -1; $i <= 3; $i++) { + if (empty($previousNodes[$i])) { + $previousNodes[$i] = ''; + } + if (empty($nodes[$i])) { + $nodes[$i] = ''; + } + if (empty($nextNodes[$i])) { + $nextNodes[$i] = ''; + } + } + + foreach ($nodes as $n => $node) { + if ($previousNodes[$n] != $node && !empty($node)) { + if ($previousNodes[$n-1] != $nodes[$n-1]) { + echo '<ul class="'.$nodes[$n-1].'" style="display: none;">'; + } + + if (strpos($node, '.') !== false) { + echo '<li class="file"><a href="?case='.urlencode($testCase).'">'.$node.'</a></li>'; + } + else { + $directory = ''; + for ($i = 0; $i <= $n; $i++) { + $dirNode = $nodes[$i]; + if (strpos($dirNode, '.') === false && !empty($dirNode)) { + $directory .= $dirNode.'/'; + } + } + + echo '<li class="directory"><a href="javascript:void(0);" onClick="toggleNode(\''.$node.'\');">'.$node.'</a> <a class="rundirectory" href="?directory='.urlencode($directory).'" title="Run Directory">√</a></li>'; + } + + if ($nextNodes[$n-1] != $nodes[$n-1]) { + echo '</ul>'; + } + } + } + $previousNodes = $nodes; + } + ?> + </ul> + </td> + <td valign="top"> + <p>Available Group Tests:</p> + <ul class="testlist"> + <?php + foreach($_GET['groups'] as $groupid => $group) { + $count = 0; + foreach($group['cases'] as $case) { + if (strpos($case, '*') !== false) { + $count += count(TestManager::getTestCaseList(TESTS.str_replace('/*', '', $case))); + } + else { + $count++; + } + } + echo '<li><a href="'.$html->url('/tests/group/'.$groupid).'">'.$group['name'].'</a> ['.$count.'] ('.$group['description'].')</li>'; + } + ?> + </ul> + </td> + </tr></table> |