Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Image should return a size of 250x166 regardless of zoom level.</title> |
| 3 <head> | 3 <script src="../../resources/testharness.js"></script> |
| 4 <style> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 #test_wrap { | 5 <div style="height:166px; width:250px; overflow:hidden;"> |
| 6 width: 250px; | 6 <img src="resources/green-256x256.jpg" style="width: 100%; height:100%"> |
| 7 height: 166px; | 7 <script> |
| 8 overflow: hidden; | 8 test(function() { |
| 9 } | 9 document.body.zoom = 1.0; |
|
fs
2016/08/19 08:24:04
I think the intention of this was to reset the zoo
sivag
2016/08/19 09:21:21
Done.
| |
| 10 | 10 var imageElement = document.querySelector('img'); |
| 11 #test_img { | 11 var wrapElement = document.querySelector('div'); |
| 12 width: 100%; | 12 function testSize(zoomLevel) { |
| 13 height: 100%; | 13 document.body.zoom = zoomLevel; |
|
fs
2016/08/19 08:24:03
I'm not aware of any 'zoom' property on HTMLBodyEl
sivag
2016/08/19 09:21:21
Ok, i tried using document.body.style.zoom, instea
fs
2016/08/19 09:38:18
Ok, well it kind of figures I guess =). How many o
| |
| 14 } | 14 assert_equals(imageElement.offsetWidth, 250); |
| 15 </style> | 15 assert_equals(imageElement.offsetHeight, 166); |
| 16 <script src="../../resources/js-test.js"></script> | 16 assert_equals(wrapElement.offsetWidth, 250); |
| 17 </head> | 17 assert_equals(wrapElement.offsetHeight, 166); |
| 18 <body> | 18 } |
| 19 <div id="test_wrap"> | 19 for (var i = 90; i <= 200; i += 5) { |
| 20 <img id="test_img" src="resources/green-256x256.jpg"> | 20 testSize(i/100); |
| 21 </div> | 21 } |
|
fs
2016/08/19 08:24:04
You can drop the {}
sivag
2016/08/19 09:21:21
Done.
| |
| 22 <p> | 22 }); |
| 23 Image should return a size of 250x166 regardless of zoom level. | 23 </script> |
| 24 </p> | |
| 25 <script> | |
| 26 var imageElement = document.getElementById('test_img'); | |
| 27 var wrapElement = document.getElementById('test_wrap'); | |
| 28 | |
| 29 function getSize(zoomLevel) | |
| 30 { | |
| 31 document.body.zoom = zoomLevel; | |
| 32 return { | |
| 33 imageWidth: imageElement.offsetWidth, | |
| 34 imageHeight: imageElement.offsetHeight, | |
| 35 wrapWidth: wrapElement.offsetWidth, | |
| 36 wrapHeight: wrapElement.offsetHeight | |
| 37 }; | |
| 38 } | |
| 39 | |
| 40 for (var i = 90; i <= 200; i += 5) { | |
| 41 shouldBe('getSize(' + (i / 100) + ').imageWidth', '250'); | |
| 42 shouldBe('getSize(' + (i / 100) + ').imageHeight', '166'); | |
| 43 shouldBe('getSize(' + (i / 100) + ').wrapWidth', '250'); | |
| 44 shouldBe('getSize(' + (i / 100) + ').wrapHeight', '166'); | |
| 45 } | |
| 46 document.body.zoom = 1.0; | |
| 47 </script> | |
| 48 </body> | |
| 49 </html> | |
| OLD | NEW |