OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>Image should return a size of 250x166 regardless of zoom level.</title> | 2 <title>Image should return a size of 250x166 regardless of zoom level.</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <div style="height:166px; width:250px; overflow:hidden;"> | 5 <div style="height:166px; width:250px; overflow:hidden;"> |
6 <img src="resources/green-256x256.jpg" style="width: 100%; height:100%"> | 6 <img src="resources/green-256x256.jpg" style="width: 100%; height:100%"> |
7 <script> | 7 <script> |
8 test(function() { | 8 test(function() { |
9 var imageElement = document.querySelector('img'); | 9 var imageElement = document.querySelector('img'); |
10 var wrapElement = document.querySelector('div'); | 10 var wrapElement = document.querySelector('div'); |
11 function testSize(zoomLevel) { | 11 function testSize(zoomLevel) { |
12 document.body.style.zoom = zoomLevel; | 12 document.body.style.zoom = zoomLevel; |
13 assert_equals(imageElement.offsetWidth, 250); | 13 assert_equals(imageElement.offsetWidth, 250); |
14 assert_equals(imageElement.offsetHeight, 166); | 14 assert_equals(imageElement.offsetHeight, 166); |
15 assert_equals(wrapElement.offsetWidth, 250); | 15 assert_equals(wrapElement.offsetWidth, 250); |
16 assert_equals(wrapElement.offsetHeight, 166); | 16 assert_equals(wrapElement.offsetHeight, 166); |
17 } | 17 } |
18 for (var i = 90; i <= 200; i += 5) | 18 for (var i = 90; i <= 200; i += 5) |
19 testSize(i/100); | 19 testSize(i/100); |
20 document.body.style.zoom = 1.0; | 20 document.body.style.zoom = 1.0; |
21 }); | 21 }); |
22 </script> | 22 </script> |
OLD | NEW |