harness.html 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <!--
  2. /*
  3. * Copyright (C) 2010 Apple Inc. All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  15. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  16. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  17. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  18. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  19. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  20. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  21. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  22. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  23. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  24. * THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. -->
  27. <!DOCTYPE html>
  28. <html>
  29. <head>
  30. <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  31. <title>CSS 2.1 Test Harness</title>
  32. <link rel="stylesheet" href="harness.css" type="text/css" media="screen" charset="utf-8">
  33. <script src="http://code.jquery.com/jquery-1.4.2.min.js" type="text/javascript" charset="utf-8"></script>
  34. <script src="harness.js" type="text/javascript" charset="utf-8"></script>
  35. <script type="text/javascript" charset="utf-8">
  36. var gTestSuite;
  37. function setupTests()
  38. {
  39. gTestSuite = new TestSuite();
  40. }
  41. window.addEventListener('load', setupTests, false);
  42. function skipTest()
  43. {
  44. gTestSuite.skipTest(document.getElementById('skip-reason').value);
  45. }
  46. function invalidTest()
  47. {
  48. gTestSuite.invalidTest();
  49. }
  50. function failTest()
  51. {
  52. gTestSuite.failTest();
  53. }
  54. function passTest()
  55. {
  56. gTestSuite.passTest();
  57. }
  58. function goToNextUntested()
  59. {
  60. gTestSuite.goToNextIncompleteTest();
  61. }
  62. function goToTest()
  63. {
  64. var testName = prompt('Go to test:', '');
  65. // This accepts any of the following:
  66. // at-charset-010
  67. // at-charset-010.xht
  68. // xhtml1/at-charset-010
  69. // xhtml1/at-charset-010.xht
  70. // and will choose the format if specified.
  71. if (!gTestSuite.goToTestByName(testName))
  72. alert('Failed to find test ' + testName);
  73. }
  74. function formatChanged()
  75. {
  76. var newFormat;
  77. if (document.harness.format.html4.checked)
  78. newFormat = 'html4';
  79. else
  80. newFormat = 'xhtml1';
  81. gTestSuite.formatChanged(newFormat);
  82. }
  83. function testSelected()
  84. {
  85. var list = document.getElementById('test-list')
  86. if (list.selectedIndex >= 0)
  87. gTestSuite.goToTestIndex(list.selectedIndex);
  88. else
  89. gTestSuite.clearTest();
  90. }
  91. function resultsPopupChanged(popup)
  92. {
  93. gTestSuite.resultsPopupChanged(popup.selectedIndex);
  94. }
  95. function doExport()
  96. {
  97. gTestSuite.exportResults(document.getElementById('results-popup').selectedIndex);
  98. }
  99. function printTestIframe()
  100. {
  101. var testFrame = document.getElementById('test-frame');
  102. testFrame.contentWindow.print();
  103. }
  104. var gOverlayConfirmCallback;
  105. function showOverlay(overlayConfirmCallback)
  106. {
  107. document.getElementById('overlay-data').value = '';
  108. gOverlayConfirmCallback = overlayConfirmCallback;
  109. $('#overlay').addClass('visible');
  110. }
  111. function overlayCancel()
  112. {
  113. $('#overlay').removeClass('visible');
  114. }
  115. function overlayConfirm()
  116. {
  117. var data = document.getElementById('overlay-data').value;
  118. gOverlayConfirmCallback(data);
  119. $('#overlay').removeClass('visible');
  120. }
  121. function doImport()
  122. {
  123. document.getElementById('overlay-action').innerText = 'Enter results to import (in the same format as the exported results):';
  124. showOverlay(function(data) {
  125. gTestSuite.importResults(data);
  126. });
  127. }
  128. function doClear()
  129. {
  130. document.getElementById('overlay-action').innerText = 'Enter list of tests for which to clear results (so they can be re-tested):';
  131. showOverlay(function(data) {
  132. gTestSuite.clearResults(data);
  133. });
  134. }
  135. </script>
  136. </head>
  137. <body>
  138. <div class="controls">
  139. <form name="harness" onsubmit="return false;">
  140. <select id="chapters">
  141. <option>Test category</option>
  142. </select>
  143. <div class="progress">
  144. <div><span id="test-index">1</span> of <span id="chapter-test-count">200</span> unique tests</div>
  145. </div>
  146. <div class="details">
  147. <div class="name">
  148. <div class="test-type">
  149. <input type="radio" name="format" id="html4" onchange="formatChanged()" checked><label for="html4">HTML4</label><br>
  150. <input type="radio" name="format" id="xhtml1" onchange="formatChanged()"><label for="xhtml1">XHTML1</label>
  151. </div>
  152. <button onclick="goToNextUntested()" accesskey="n"><strong>N</strong>ext Untested</button>
  153. <button onclick="goToTest()" accesskey="g">Go to Test...</button>
  154. </div>
  155. </div>
  156. <div>
  157. <select id="test-list" size="40" onchange="testSelected()"></select>
  158. </div>
  159. </form>
  160. </div>
  161. <div class="actions">
  162. <span>Skip reason:</span> <input type="text" id="skip-reason" size="50">
  163. <button onclick="skipTest()" accesskey="s"><strong>S</strong>kip</button>
  164. <div class="note">Use <i>Control-Option-letter</i> to<br> trigger buttons via the keyboard.</div>
  165. <div class="action-buttons">
  166. <button onclick="invalidTest()" accesskey="i">Invalid</button>
  167. <button onclick="failTest()" accesskey="f"><strong>F</strong>ail</button>
  168. <button onclick="passTest()" accesskey="p"><strong>P</strong>ass</button>
  169. </div>
  170. </div>
  171. <div id="test-content">
  172. <div class="info">
  173. <div class="title">Title: <span id="test-title"></span></div>
  174. <div class="url">URL: <span id="test-url"></span></div>
  175. <div class="assertion">Assertion: <span id="test-assertion"></span></div>
  176. <div class="flags">Flags: <span id="test-flags"></span>
  177. <span id="warning">This test must be run over HTTP.</span>
  178. <button id="print-button" onclick="printTestIframe()">Print Preview</button>
  179. </div>
  180. </div>
  181. <div id="test-wrapper" class="frame-wrapper">
  182. <h2>Test</h2>
  183. <iframe id="test-frame"></iframe>
  184. </div>
  185. <div id="ref-wrapper" class="frame-wrapper">
  186. <h2>Reference</h2>
  187. <iframe id="ref-frame"></iframe>
  188. </div>
  189. </div>
  190. <div class="results">
  191. <div class="output-options">
  192. <p>Show results for:</p>
  193. <select id="results-popup" onchange="resultsPopupChanged(this)">
  194. </select>
  195. <div>
  196. <button id="export-button" onclick="doExport()">Export...</button>
  197. </div>
  198. <div class="custom">
  199. <button id="import-button" onclick="doImport()">Import...</button>
  200. <button id="import-button" onclick="doClear()">Clear Results...</button>
  201. </div>
  202. </div>
  203. <div id="output"></div>
  204. <div class="summary">
  205. <table>
  206. <tr>
  207. <th></th><th>Passed</th><th>Failed</th><th>Skipped</th><th>Invalid</th><th>Tested</th><th>Total</th><th>% done</th>
  208. </tr>
  209. <tr>
  210. <td class="label">HTML4:</td><td id="h-passed"></td><td id="h-failed"></td><td id="h-skipped"></td><td id="h-invalid"></td><td id="h-tested"></td><td id="h-total"></td><td id="h-percent"></td>
  211. </tr>
  212. <tr>
  213. <td class="label">XHTML1:</td><td id="x-passed"></td><td id="x-failed"></td><td id="x-skipped"></td><td id="x-invalid"></td><td id="x-tested"></td><td id="x-total"></td><td id="x-percent"></td>
  214. </tr>
  215. </table>
  216. </div>
  217. </div>
  218. <div id="overlay">
  219. <div class="overlay-contents">
  220. <p id="overlay-action"></p>
  221. <textarea id="overlay-data"></textarea>
  222. <p class="note">Pasting many lines of text here can be very slow in Safari 5. You can quit Safari and use a <a href="http://nightly.webkit.org/" title="WebKit Nightly Builds">WebKit nightly build</a> for importing or clearing.</p>
  223. <div class="buttons">
  224. <button onclick="overlayCancel()">Cancel</button><button onclick="overlayConfirm()">OK</button>
  225. </div>
  226. </div>
  227. </div>
  228. </body>
  229. </html>