Changeset 90081 in webkit
- Timestamp:
- Jun 29, 2011 7:30:02 PM (13 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r90079 r90081 1 2011-06-29 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 new-run-webkit-tests: images page switch actual and expected images before they're loaded 6 https://bugs.webkit.org/show_bug.cgi?id=63199 7 8 We now preload the images and keep the DOM nodes in memory instead of 9 going back to the MemoryCache all the time. (Also, remove some nutty 10 </img> HTML.) 11 12 * Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py: 13 1 14 2011-06-29 Adam Barth <abarth@webkit.org> 2 15 -
trunk/Tools/Scripts/webkitpy/layout_tests/layout_package/test_result_writer.py
r89899 r90081 233 233 # FIXME: old-run-webkit-tests shows the diff percentage as the text contents of the "diff" link. 234 234 # FIXME: old-run-webkit-tests include a link to the test file. 235 html = """<!DOCTYPE HTML><title>%(title)s</title> 235 html = """<!DOCTYPE HTML> 236 <html> 237 <head> 238 <title>%(title)s</title> 236 239 <style>.label{font-weight:bold}</style> 240 </head> 241 <body> 237 242 Difference between images: <a href="%(diff_filename)s">diff</a><br> 238 <div class=imageText></div><img class=animatedImage data-prefix="%(prefix)s"></img>; 243 <div class=imageText></div> 244 <div class=imageContainer data-prefix="%(prefix)s">Loading...</div> 239 245 <script> 240 function toggleImages() 241 { 242 var image = document.querySelector('.animatedImage'); 243 var text = document.querySelector('.imageText'); 246 (function() { 247 var preloadedImageCount = 0; 248 function preloadComplete() { 249 ++preloadedImageCount; 250 if (preloadedImageCount < 2) 251 return; 252 toggleImages(); 253 setInterval(toggleImages, 2000) 254 } 255 256 function preloadImage(url) { 257 image = new Image(); 258 image.addEventListener('load', preloadComplete); 259 image.src = url; 260 return image; 261 } 262 263 function toggleImages() { 244 264 if (text.textContent == 'Expected Image') { 245 265 text.textContent = 'Actual Image'; 246 image.src = image.getAttribute('data-prefix') + '-actual.png';266 container.replaceChild(actualImage, container.firstChild); 247 267 } else { 248 268 text.textContent = 'Expected Image'; 249 image.src = image.getAttribute('data-prefix') + '-expected.png';269 container.replaceChild(expectedImage, container.firstChild); 250 270 } 251 271 } 252 toggleImages(); 253 setInterval(toggleImages, 2000) 272 273 var text = document.querySelector('.imageText'); 274 var container = document.querySelector('.imageContainer'); 275 var actualImage = preloadImage(container.getAttribute('data-prefix') + '-actual.png'); 276 var expectedImage = preloadImage(container.getAttribute('data-prefix') + '-expected.png'); 277 })(); 254 278 </script> 279 </body> 280 </html> 255 281 """ % { 'title': self._testname, 'diff_filename': self._output_testname('-diff.png'), 'prefix': self._output_testname('') } 256 282 self._port._filesystem.write_binary_file(diffs_html_filename, html)
Note: See TracChangeset
for help on using the changeset viewer.