test.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <html>
  2. <head>
  3. <title>Test colors</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <style type="text/css">
  6. @import "../../../dojo/resources/dojo.css";
  7. @import "../../../dijit/tests/css/dijitTests.css";
  8. .pane { margin-top: 2em; }
  9. </style>
  10. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
  11. <script type="text/javascript" src="colors2.js"></script>
  12. <script type="text/javascript">
  13. dojo.require("dojox.encoding.tests.colors");
  14. //dojo.require("dojox.encoding.tests.colors2");
  15. dojo.require("dojox.encoding.tests.colors3");
  16. var dct = dojox.encoding.tests;
  17. var test = function(c1, c2, result){
  18. var empty = {};
  19. for(var i in c1){
  20. if(i in empty){ continue; }
  21. if(!(i in c2)){
  22. result.push("<div>" + i + " is missing.</div>");
  23. continue;
  24. }
  25. var v1 = c1[i], v2 = c2[i];
  26. if(v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]){
  27. result.push("<div>" + i + " doesn't match.</div>");
  28. continue;
  29. }
  30. result.push("<div style='color: green'>" + i + " is ok.</div>");
  31. }
  32. };
  33. var run = function(){
  34. var result = [];
  35. result.push("<p><strong>Comparing colors to colors3.</strong></p>");
  36. test(dct.colors, dct.colors3, result);
  37. result.push("<p><strong>Comparing colors3 to colors.</strong></p>");
  38. test(dct.colors3, dct.colors, result);
  39. /*
  40. result.push("<p><strong>Comparing colors to colors2.</strong></p>");
  41. test(dct.colors, dct.colors2, result);
  42. result.push("<p><strong>Comparing colors2 to colors.</strong></p>");
  43. test(dct.colors2, dct.colors, result);
  44. */
  45. dojo.byId("status").innerHTML = result.join("\n");
  46. };
  47. dojo.addOnLoad(function(){
  48. dojo.connect(dojo.byId("run"), "onclick", run);
  49. });
  50. </script>
  51. </head>
  52. <body>
  53. <h1>Test colors</h1>
  54. <p><button id="run">Run</button></p>
  55. <div id="status" class="pane"><em>No status yet.</em></div>
  56. </body>
  57. </html>