Changeset 153625 in webkit
- Timestamp:
- Aug 1, 2013 5:01:21 PM (11 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r153624 r153625 1 2013-08-01 Dean Jackson <dino@apple.com> 2 3 Minor cleanup for srcset tests 4 https://bugs.webkit.org/show_bug.cgi?id=119407 5 6 Reviewed by Tim Horton. 7 8 Other than small typos and style tweaks, there are three 9 main changes here: 10 11 1. Collect duplicated code into a helper file. 12 2. Make sure the tests that add or remove the attributes 13 can run standalone outside of DRT. 14 3. Update the -simple test with new images that make it 15 more clear what srcset is doing. 16 17 * fast/hidpi/image-srcset-change-dynamically-from-js.html: 18 * fast/hidpi/image-srcset-invalid-inputs-correct-src.html: 19 * fast/hidpi/image-srcset-invalid-inputs-except-one.html: 20 * fast/hidpi/image-srcset-invalid-inputs.html: 21 * fast/hidpi/image-srcset-only-src-attribute.html: 22 * fast/hidpi/image-srcset-remove-dynamically-from-js.html: 23 * fast/hidpi/image-srcset-same-alternative-for-both-attributes.html: 24 * fast/hidpi/image-srcset-simple.html: 25 * fast/hidpi/image-srcset-src-selection.html: 26 * fast/hidpi/resources/image-set-1x.png: Added. 27 * fast/hidpi/resources/image-set-2x.png: Added. 28 * fast/hidpi/resources/srcset-helper.js: Added. 29 * platform/mac/fast/hidpi/image-srcset-simple-expected.png: 30 * platform/mac/fast/hidpi/image-srcset-simple-expected.txt: 31 1 32 2013-08-01 Romain Perier <romain.perier@gmail.com> 2 33 -
trunk/LayoutTests/fast/hidpi/image-srcset-change-dynamically-from-js.html
r153624 r153625 2 2 <head> 3 3 <script> 4 function updateSrc() { 5 var img = document.getElementById("foo"); 6 img.src = "resources/blue-100-px-square.png" 7 img.srcset = "resources/green-200-px-square.png"; 8 } 9 4 10 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 11 if (!window.testRunner || !window.sessionStorage) { 12 updateSrc(); 6 13 return; 14 } 7 15 8 16 if (!sessionStorage.scaleFactorIsSet) { … … 10 18 testRunner.setBackingScaleFactor(1, scaleFactorIsSet); 11 19 } 12 20 13 21 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 22 delete sessionStorage.pageReloaded; 15 23 delete sessionStorage.scaleFactorIsSet; 24 updateSrc(); 16 25 testRunner.notifyDone(); 17 // Updating srcset attribute on the fly before reloading the page18 var img = document.getElementById("foo");19 img.src = "resources/blue-100-px-square.png"20 img.srcset = "resources/green-200-px-square.png";21 26 } else { 22 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor,27 // Right now there is a bug that srcset does not properly deal with dynamic changes to the scale factor, 23 28 // so to work around that, we must reload the page to get the 1x image. 24 29 sessionStorage.pageReloaded = true; … … 26 31 } 27 32 } 28 33 29 34 function scaleFactorIsSet() { 30 35 sessionStorage.scaleFactorIsSet = true; -
trunk/LayoutTests/fast/hidpi/image-srcset-invalid-inputs-correct-src.html
r153624 r153625 2 2 <head> 3 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(1, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 4 var targetScaleFactor = 1; 30 5 </script> 6 <script src="resources/srcset-helper.js"></script> 31 7 </head> 32 8 -
trunk/LayoutTests/fast/hidpi/image-srcset-invalid-inputs-except-one.html
r153624 r153625 1 1 <html> 2 2 <head> 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(2, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 30 </script> 3 <script src="resources/srcset-helper.js"></script> 31 4 </head> 32 5 -
trunk/LayoutTests/fast/hidpi/image-srcset-invalid-inputs.html
r153624 r153625 1 1 <html> 2 2 <head> 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(2, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 30 </script> 3 <script src="resources/srcset-helper.js"></script> 31 4 </head> 32 5 -
trunk/LayoutTests/fast/hidpi/image-srcset-only-src-attribute.html
r153624 r153625 1 1 <html> 2 2 <head> 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(2, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 30 </script> 3 <script src="resources/srcset-helper.js"></script> 31 4 </head> 32 5 -
trunk/LayoutTests/fast/hidpi/image-srcset-remove-dynamically-from-js.html
r153624 r153625 2 2 <head> 3 3 <script> 4 function updateSrc() { 5 var img = document.getElementById("foo"); 6 img.src = ""; 7 } 8 4 9 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 10 if (!window.testRunner || !window.sessionStorage) { 11 updateSrc(); 6 12 return; 13 } 7 14 8 15 if (!sessionStorage.scaleFactorIsSet) { … … 10 17 testRunner.setBackingScaleFactor(1, scaleFactorIsSet); 11 18 } 12 19 13 20 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 21 delete sessionStorage.pageReloaded; 15 22 delete sessionStorage.scaleFactorIsSet; 23 updateSrc(); 16 24 testRunner.notifyDone(); 17 // Updating srcset attribute on the fly before reloading the page18 var img = document.getElementById("foo");19 img.src = "";20 25 } else { 21 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor,26 // Right now there is a bug that srcset does not properly deal with dynamic changes to the scale factor, 22 27 // so to work around that, we must reload the page to get the 1x image. 23 28 sessionStorage.pageReloaded = true; … … 25 30 } 26 31 } 27 32 28 33 function scaleFactorIsSet() { 29 34 sessionStorage.scaleFactorIsSet = true; -
trunk/LayoutTests/fast/hidpi/image-srcset-same-alternative-for-both-attributes.html
r153624 r153625 2 2 <head> 3 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(1, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 4 var targetScaleFactor = 1; 30 5 </script> 6 <script src="resources/srcset-helper.js"></script> 31 7 </head> 32 8 -
trunk/LayoutTests/fast/hidpi/image-srcset-simple.html
r153624 r153625 1 1 <html> 2 2 <head> 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(2, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 2x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 30 </script> 3 <script src="resources/srcset-helper.js"></script> 31 4 </head> 32 5 33 6 <body id="body"> 34 <div>This test passes if the div below is a blue 100px square when the deviceScaleFactor is 1, and if it is a 100px green squarewhen the deviceScaleFactor is 2.</div>35 <img height="100" width="100" src="" srcset="resources/ blue-100-px-square.png 1x, resources/deleteButton.png 3x, resources/green-200-px-square.png 2x"></img>7 <div>This test passes if the image below says 1x with a reddish background when the deviceScaleFactor is 1, and if says 2x with a greenish background when the deviceScaleFactor is 2.</div> 8 <img height="100" width="100" src="" srcset="resources/image-set-1x.png 1x, resources/deleteButton.png 3x, resources/image-set-2x.png 2x"></img> 36 9 </body> 37 10 </html> -
trunk/LayoutTests/fast/hidpi/image-srcset-src-selection.html
r153624 r153625 2 2 <head> 3 3 <script> 4 function runTest() { 5 if (!window.testRunner || !window.sessionStorage) 6 return; 7 8 if (!sessionStorage.scaleFactorIsSet) { 9 testRunner.waitUntilDone(); 10 testRunner.setBackingScaleFactor(1, scaleFactorIsSet); 11 } 12 13 if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { 14 delete sessionStorage.pageReloaded; 15 delete sessionStorage.scaleFactorIsSet; 16 testRunner.notifyDone(); 17 } else { 18 // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, 19 // so to work around that, we must reload the page to get the 1x image. 20 sessionStorage.pageReloaded = true; 21 document.location.reload(true); 22 } 23 } 24 25 function scaleFactorIsSet() { 26 sessionStorage.scaleFactorIsSet = true; 27 } 28 29 window.onload = runTest; 4 var targetScaleFactor = 1; 30 5 </script> 6 <script src="resources/srcset-helper.js"></script> 31 7 </head> 32 8 -
trunk/LayoutTests/platform/mac/fast/hidpi/image-srcset-simple-expected.txt
r153624 r153625 5 5 RenderBody {BODY} at (8,8) size 784x584 6 6 RenderBlock {DIV} at (0,0) size 784x36 7 RenderText {#text} at (0,0) size 7 61x368 text run at (0,0) width 7 61: "This test passes if the div below is a blue 100px square when the deviceScaleFactor is 1, and if it is a 100px green square"9 text run at (0,18) width 207: "when the deviceScaleFactor is 2."7 RenderText {#text} at (0,0) size 775x36 8 text run at (0,0) width 775: "This test passes if the image below says 1x with a reddish background when the deviceScaleFactor is 1, and if says 2x with" 9 text run at (0,18) width 354: "a greenish background when the deviceScaleFactor is 2." 10 10 RenderBlock (anonymous) at (0,36) size 784x100 11 11 RenderImage {IMG} at (0,0) size 100x100
Note: See TracChangeset
for help on using the changeset viewer.