]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#464] Run all core tests from Popcorn API Test Suite
authorrwldrn <waldron.rick@gmail.com>
Tue, 5 Apr 2011 15:25:24 +0000 (11:25 -0400)
committerrwldrn <waldron.rick@gmail.com>
Tue, 5 Apr 2011 15:25:24 +0000 (11:25 -0400)
test/butter_test.html
test/index.html
test/popcorn.unit.js
test/ready.html

index 085974c9c3d549838d0b88d8f6e41ca223625f00..77b4bdb71006e51450870d29da89e5bf13587b67 100644 (file)
@@ -3,12 +3,85 @@
   <head>
     <title>Popcorn Butter Test</title>
     <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
+    <style>
+      body {
+        margin: 3px;
+        padding: 0px;
+      }
+      h3 {
+        margin: 3px;
+        padding: 0px;
+      }
+      h2 {
+        display: inline;
+        margin: 3px;
+        padding: 0px;
+      }    
+      .pass {
+        color: #33FF00;
+      }
+      .expect {
+        color: #2d2d2d;
+      }    
+      .fail {
+        color: #FF0000;
+      }
+    </style>    
     <script src="jquery.js"></script>
     <script src="qunit/qunit.js"></script>
     <script src="../popcorn.js"></script>
     <script src="butter.unit.js"></script>
+
+    <script>
+    (function( Popcorn, $ ) {
+
+      var results = {
+            pass: 0, 
+            fail: 0,
+            expect: 40
+          };
+
+      $(function() {
+
+        function isComplete( callback ) {
+
+          if ( !QUnit.config.queue.length ) {
+            // is complete
+
+            callback && callback( QUnit.config.stats );
+
+          } else {
+            setTimeout(function() {
+              isComplete( callback );
+            }, 10 );
+          }
+        }
+
+        isComplete(function( qResults ) {
+
+          //  Hack together the results as used in ready.html
+          results.pass = qResults.all - qResults.bad;
+          results.fail = qResults.bad;
+          results.expect = qResults.all;
+
+          $.each( results, function( name, value ) {
+            $("#qunit-header").before( 
+              $("<h2>", {
+                className: name, 
+                html: name + ": " + value  
+              }) 
+            );
+          });
+        
+        });
+      });
+    })( Popcorn, jQuery );
+
+    </script>
   </head>
   <body>
+    <h3>Butter Dependencies<h3>
+    
     <h1 id="qunit-header">Butter Popcorn Dependencies</h1>
     <h2 id="qunit-banner"></h2>
     <div id="qunit-testrunner-toolbar"></div>
     <ol id="qunit-tests"></ol>
     <div id="qunit-fixture">
     </div>
-    <div id="video-container">
+    <div id="video-container" style="display:none">
       <video id="video" />
     </div>
-    <div id="test-target">
+    <div id="test-target" style="display:none">
     </div>
   </body>
 </html>
index c891c93f63c7cb9c862e44c9d00699078593821e..3dde4c0fb889957cf8b17311a4788aedc4ef8b87 100644 (file)
@@ -7,6 +7,7 @@
 
   
   <script src="qunit/qunit.js"></script>
+  
   <!-- 
     do not move - this must be called immediately prior to 
     popcorn-api-draft.js
   <script src="popcorn.unit.js"></script>
 </head>
 <body>
-  <h1 id="qunit-header">Popcorn API</h1>
+  <h1 id="qunit-header">
+    Popcorn.js API
+    <iframe id="butter-tests" data-src="butter_test.html" style="width:325px;height:60px;float:right;border:0px;margin:-10px 20px 0 -10px;background:#fff" ></iframe>
+
+    <iframe id="ready-tests" data-src="ready.html" style="width:325px;height:60px;float:right;border:0px;margin:-10px 20px 0 -10px;background:#fff" ></iframe>
+
+  </h1>
   <h2 id="qunit-banner"></h2>
   <div id="qunit-testrunner-toolbar"></div>
   <h2 id="qunit-userAgent"></h2>
@@ -31,7 +38,7 @@
   </div>
   
   <video id='video'
-       style="display:;width:300px" 
+    style="display:;width:300px" 
     controls 
     poster="poster.png"> 
 
 
   </video>
 
-       <audio id='audio' src="italia.ogg" data-timeline-sources="data/parserData.json" controls> 
-       </audio>
-
-
-       <iframe id="butter-tests" data-src="butter_test.html" style="width:100%;height:100px" ></iframe>
-
-       <iframe id="ready-tests" data-src="ready.html" style="width:100%;height:100px" ></iframe>
-
-       <!-- Position Tests Adapted From jQuery offsets/dimensions Tests -->
-       <style type="text/css" media="screen">
-               #position-tests { display:none;margin:0; position: fixed;top:0px;left:0px;      }
-               
-               div.absolute { position: absolute; margin: 0px; width: 100px; height: 100px; background: #fff; }
-               #absolute-1 { top: 0; left: 0; }
-               #absolute-1-1 { top: 1px; left: 1px; }
-               #absolute-1-1-1 { top: 1px; left: 1px; }
-               #absolute-2 { top: 19px; left: 19px; }
-
-               div.relative { position: relative; top: 0; left: 0; width: 100px; height: 100px; background: #fff; overflow: hidden; }
-               #relative-2 { top: 20px; left: 20px; }
+  <audio id='audio' src="italia.ogg" data-timeline-sources="data/parserData.json" controls> 
+  </audio>
 
-               div.fixed { position: fixed; width: 100px; height: 100px; background: #fff; overflow: hidden; }
-               #fixed-1 { top: 0; left: 0; }
-               #fixed-2 { top: 20px; left: 20px; }
 
-               div.static { position: static; top: 0; left: 0; width: 100px; height: 100px; background: #fff; overflow: hidden; }
-               #static-2 { top: 20px; left: 20px; }            
 
-       </style>
 
-       <div id="position-tests">
-               <div id="absolute-1" class="absolute"><video id="vid-absolute-1" src="trailer.ogv" style="visibility:hidden"></video>
-                       <div id="absolute-1-1" class="absolute"><video  id="vid-absolute-1-1"" src="trailer.ogv" style="visibility:hidden"></video>
-                               <div id="absolute-1-1-1" class="absolute"><video  id="vid-absolute-1-1-1" src="trailer.ogv" style="visibility:hidden"></video></div>
-                       </div>
-               </div>
-               <div id="absolute-2" class="absolute"><video  id="vid-absolute-2" src="trailer.ogv" style="visibility:hidden"></video></div>
-
-               <div id="relative-1" class="relative"><video  id="vid-relative-1" src="trailer.ogv" style="visibility:hidden"></video>
-                       <div id="relative-1-1" class="relative"><video  id="vid-relative-1-1" src="trailer.ogv" style="visibility:hidden"></video>
-                               <div id="relative-1-1-1" class="relative"><video  id="vid-relative-1-1-1" src="trailer.ogv" style="visibility:hidden"></video></div>
-                       </div>
-               </div>
-               <div id="relative-2" class="relative"><video  id="vid-relative-2" src="trailer.ogv" style="visibility:hidden"></video></div>
-
-
-               <div id="fixed-1" class="fixed"><video  id="vid-fixed-1" src="trailer.ogv" style="visibility:hidden"></video></div>
-               <div id="fixed-2" class="fixed"><video  id="vid-fixed-2" src="trailer.ogv" style="visibility:hidden"></video></div>
-
-               <div id="static-1" class="static"><video  id="vid-static-1" src="trailer.ogv" style="visibility:hidden">
-                       <div id="static-1-1" class="static"><video  id="vid-static-1-1" src="trailer.ogv" style="visibility:hidden">
-                               <div id="static-1-1-1" class="static"><video  id="vid-static-1-1-1" src="trailer.ogv" style="visibility:hidden"></div>
-                       </div>
-               </div>
-               <div id="static-2" class="static"><video  id="vid-static-2" src="trailer.ogv" style="visibility:hidden"></div>
+  <!-- Position Tests Adapted From jQuery offsets/dimensions Tests -->
+  <style type="text/css" media="screen">
+    #position-tests { display:none;margin:0; position: fixed;top:0px;left:0px;  }
+    
+    div.absolute { position: absolute; margin: 0px; width: 100px; height: 100px; background: #fff; }
+    #absolute-1 { top: 0; left: 0; }
+    #absolute-1-1 { top: 1px; left: 1px; }
+    #absolute-1-1-1 { top: 1px; left: 1px; }
+    #absolute-2 { top: 19px; left: 19px; }
+
+    div.relative { position: relative; top: 0; left: 0; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+    #relative-2 { top: 20px; left: 20px; }
+
+    div.fixed { position: fixed; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+    #fixed-1 { top: 0; left: 0; }
+    #fixed-2 { top: 20px; left: 20px; }
+
+    div.static { position: static; top: 0; left: 0; width: 100px; height: 100px; background: #fff; overflow: hidden; }
+    #static-2 { top: 20px; left: 20px; }    
+
+  </style>
+
+  <div id="position-tests">
+    <div id="absolute-1" class="absolute"><video id="vid-absolute-1" src="trailer.ogv" style="visibility:hidden"></video>
+      <div id="absolute-1-1" class="absolute"><video  id="vid-absolute-1-1"" src="trailer.ogv" style="visibility:hidden"></video>
+        <div id="absolute-1-1-1" class="absolute"><video  id="vid-absolute-1-1-1" src="trailer.ogv" style="visibility:hidden"></video></div>
+      </div>
+    </div>
+    <div id="absolute-2" class="absolute"><video  id="vid-absolute-2" src="trailer.ogv" style="visibility:hidden"></video></div>
+
+    <div id="relative-1" class="relative"><video  id="vid-relative-1" src="trailer.ogv" style="visibility:hidden"></video>
+      <div id="relative-1-1" class="relative"><video  id="vid-relative-1-1" src="trailer.ogv" style="visibility:hidden"></video>
+        <div id="relative-1-1-1" class="relative"><video  id="vid-relative-1-1-1" src="trailer.ogv" style="visibility:hidden"></video></div>
+      </div>
+    </div>
+    <div id="relative-2" class="relative"><video  id="vid-relative-2" src="trailer.ogv" style="visibility:hidden"></video></div>
+
+
+    <div id="fixed-1" class="fixed"><video  id="vid-fixed-1" src="trailer.ogv" style="visibility:hidden"></video></div>
+    <div id="fixed-2" class="fixed"><video  id="vid-fixed-2" src="trailer.ogv" style="visibility:hidden"></video></div>
+
+    <div id="static-1" class="static"><video  id="vid-static-1" src="trailer.ogv" style="visibility:hidden">
+      <div id="static-1-1" class="static"><video  id="vid-static-1-1" src="trailer.ogv" style="visibility:hidden">
+        <div id="static-1-1-1" class="static"><video  id="vid-static-1-1-1" src="trailer.ogv" style="visibility:hidden"></div>
+      </div>
+    </div>
+    <div id="static-2" class="static"><video  id="vid-static-2" src="trailer.ogv" style="visibility:hidden"></div>
 
-       </div>
+  </div>
 
-       
+  
 </body>
 </html>
index 59e0b9a9e49e1c6920575dba76636bac1c5a9e98..97bcbebf9ee024a7f356745f3108225dd3cbffff 100755 (executable)
@@ -2087,5 +2087,14 @@ test("Last Check", function () {
 
   } catch (e) {};
 
+       //      Trigger follow-up tests to run in iframes
+       (function( $ ) {
+
+               $("iframe[data-src]").attr( "src", function() {
+                       return $(this).data("src");
+               });
+       
+       })( jQuery );
+
 });
 
index 3b835a6d041b9bbafab3a8edd0ff4bd0a85757bb..8ea32a246951aeacc9d40df43681136715758315 100644 (file)
-<!DOCTYPE html>
-<html>
-<head>
-  <title>Popcorn API</title>
-  <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">
-  <script src="../popcorn.js"></script>
-  <script>
-  
-  Popcorn(function (e) {
-
-    console.log("Popcorn(function() { /../ }) 1");
-    
-    var p = Popcorn("#video");
-    
-    
-    p.exec( 4, function () {
-
-      
-
-    }).play();
-    
-  });
-
-  Popcorn(function () {
-  
-    console.log("Popcorn(function() { /../ }) 2");
-  
-  });  
-  </script>
-  
-</head>
-<body>
-  <video id='video'style="display:" 
-    controls 
-    poster="http://media.w3.org/2010/05/sintel/poster.png"> 
-
-    <source id='mp4'
-      src="http://media.w3.org/2010/05/sintel/trailer.mp4"
-      type='video/mp4; codecs="avc1, mp4a"'> 
-
-    <source id='ogv'
-      src="http://media.w3.org/2010/05/sintel/trailer.ogv"
-      type='video/ogg; codecs="theora, vorbis"'> 
-
-    <p>Your user agent does not support the HTML5 Video element.</p> 
-
-  </video>   
-</body>
-</html>
+<!doctype html>\r
+<html>\r
+<head>\r
+  <title>Popcorn API</title>\r
+  <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen">\r
+\r
+       <style>\r
+               body {\r
+                       margin: 3px;\r
+                       padding: 0px;\r
+               }\r
+               h3 {\r
+                       margin: 3px;\r
+                       padding: 0px;\r
+               }\r
+               h2 {\r
+                       display: inline;\r
+                       margin: 3px;\r
+                       padding: 0px;\r
+               }               \r
+               .pass {\r
+                       color: #33FF00;\r
+               }\r
+               .expect {\r
+                       color: #2d2d2d;\r
+               }               \r
+               .fail {\r
+                       color: #FF0000;\r
+               }\r
+       </style>\r
+       <script src="jquery.js"></script>\r
+  <script src="../popcorn.js"></script>\r
+  <script>\r
+       (function( Popcorn, $ ) {\r
+\r
+               var readyCalled = 0, \r
+                               readyOrder = [], \r
+                               readyComposed = "Ready Callback 1,Ready Callback 2", \r
+                               results = {\r
+                                       pass: 0, \r
+                                       fail: 0,\r
+                                       expect: 2\r
+                               };\r
+\r
+               $(function() {\r
+                 readyCalled++;\r
+               });\r
+\r
+               Popcorn(function (e) {\r
+\r
+                 readyCalled++;\r
+                 readyOrder.push("Ready Callback 1");\r
+                 \r
+                 Popcorn("#video").exec( 1, function () {\r
+\r
+                               results[ \r
+                                       ( readyCalled === 3 ? "pass" : "fail" ) \r
+                               ]++;\r
+\r
+                               if ( readyOrder.join(",") === readyComposed ) {\r
+                                       results.pass++;\r
+                               }\r
+\r
+                               $.each( results, function( name, value ) {\r
+                                       $("video").before( \r
+                                               $("<h2>", {\r
+                                                       className: name, \r
+                                                       html: name + ": " + value  \r
+                                               }) \r
+                                       );\r
+                               });\r
+\r
+                 }).play().volume(0);\r
+                 \r
+               });\r
+\r
+               Popcorn(function () {\r
+                 \r
+                 readyCalled++;\r
+                 readyOrder.push("Ready Callback 2");\r
+\r
+               });     \r
+       })( Popcorn, jQuery );\r
+\r
+  </script>\r
+  \r
+</head>\r
+<body>\r
+       <h3>Popcorn(/* DOM Ready */)<h3>\r
+\r
+  <video id='video'style="display:none" \r
+    controls \r
+    poster="http://media.w3.org/2010/05/sintel/poster.png"> \r
+\r
+    <source id='mp4'\r
+      src="http://media.w3.org/2010/05/sintel/trailer.mp4"\r
+      type='video/mp4; codecs="avc1, mp4a"'> \r
+\r
+    <source id='ogv'\r
+      src="http://media.w3.org/2010/05/sintel/trailer.ogv"\r
+      type='video/ogg; codecs="theora, vorbis"'> \r
+\r
+    <p>Your user agent does not support the HTML5 Video element.</p> \r
+\r
+  </video>   \r
+</body>\r
+</html>\r