OLD | NEW |
---|---|
1 <html> | 1 <html> |
esprehn
2014/05/20 06:56:04
These tests all need doctypes. <!DOCTYPE html>.
w
| |
2 <head> | 2 <head> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 <script src="resources/currentSrcHelper.js"></script> | |
4 <script> | 5 <script> |
5 if (window.testRunner) | 6 if (window.testRunner) |
6 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
7 | 8 |
8 addEventListener("load", function() { | 9 addEventListener("load", function() { |
esprehn
2014/05/20 06:56:04
onload = function() { is usually preferred.
| |
10 shouldBeTrue('document.getElementById("simple").currentSrc.indexOf("file ://") == 0'); | |
9 shouldBe('document.getElementById("simple").clientWidth', '(window.inner Width)'); | 11 shouldBe('document.getElementById("simple").clientWidth', '(window.inner Width)'); |
10 shouldBe('document.getElementById("simple").currentSrc', '"../../hidpi/r esources/image-set-2x.png"'); | 12 shouldBe('currentSrcFileName("simple")', '"image-set-2x.png"'); |
11 shouldBe('document.getElementById("small_sizes").clientWidth', '300'); | 13 shouldBe('document.getElementById("small_sizes").clientWidth', '300'); |
12 shouldBe('document.getElementById("small_sizes").currentSrc', '"../../hi dpi/resources/image-set-1x.png"'); | 14 shouldBe('currentSrcFileName("small_sizes")', '"image-set-1x.png"'); |
13 shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', ' 400'); | 15 shouldBe('document.getElementById("sizes_x_descriptors").clientWidth', ' 400'); |
14 shouldBe('document.getElementById("sizes_x_descriptors").currentSrc', '" ../../hidpi/resources/image-set-1x.png"'); | 16 shouldBe('currentSrcFileName("sizes_x_descriptors")', '"image-set-1x.png "'); |
15 shouldBe('document.getElementById("sizes_src").clientWidth', '400'); | 17 shouldBe('document.getElementById("sizes_src").clientWidth', '400'); |
16 shouldBe('document.getElementById("sizes_src").currentSrc', '"../../hidp i/resources/image-set-1x.png"'); | 18 shouldBe('currentSrcFileName("sizes_src")', '"image-set-1x.png"'); |
17 shouldBe('document.getElementById("default_sizes").clientWidth', 'window .innerWidth'); | 19 shouldBe('document.getElementById("default_sizes").clientWidth', 'window .innerWidth'); |
18 shouldBe('document.getElementById("default_sizes").currentSrc', '"../../ hidpi/resources/image-set-2x.png"'); | 20 shouldBe('currentSrcFileName("default_sizes")', '"image-set-2x.png"'); |
19 shouldBe('document.getElementById("invalid_length").clientWidth', 'windo w.innerWidth'); | 21 shouldBe('document.getElementById("invalid_length").clientWidth', 'windo w.innerWidth'); |
20 shouldBe('document.getElementById("invalid_length").currentSrc', '"../.. /hidpi/resources/image-set-2x.png"'); | 22 shouldBe('currentSrcFileName("invalid_length")', '"image-set-2x.png"'); |
21 shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64); | 23 shouldBeCloseTo('document.getElementById("src_and_w").clientWidth', 700, 1/64); |
22 shouldBe('document.getElementById("src_and_w").currentSrc', '"resources/ image-set-4x.png"'); | 24 shouldBe('currentSrcFileName("src_and_w")', '"image-set-4x.png"'); |
23 shouldBeCloseTo('document.getElementById("src_and_w2").clientWidth', 700 , 1/64); | 25 shouldBeCloseTo('document.getElementById("src_and_w2").clientWidth', 700 , 1/64); |
24 shouldBe('document.getElementById("src_and_w2").currentSrc', '"../../hid pi/resources/image-set-1x.png"'); | 26 shouldBe('currentSrcFileName("src_and_w2")', '"image-set-1x.png"'); |
25 shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1 /64); | 27 shouldBeCloseTo('document.getElementById("x_and_w").clientWidth', 700, 1 /64); |
26 shouldBe('document.getElementById("x_and_w").currentSrc', '"resources/im age-set-4x.png"'); | 28 shouldBe('currentSrcFileName("x_and_w")', '"image-set-4x.png"'); |
27 shouldBe('document.getElementById("x_and_w2").clientWidth', '400'); | 29 shouldBe('document.getElementById("x_and_w2").clientWidth', '400'); |
28 shouldBe('document.getElementById("x_and_w2").currentSrc', '"../../hidpi /resources/image-set-2x.png"'); | 30 shouldBe('currentSrcFileName("x_and_w2")', '"image-set-2x.png"'); |
29 shouldBe('document.getElementById("x_and_w3").clientWidth', '400'); | 31 shouldBe('document.getElementById("x_and_w3").clientWidth', '400'); |
30 shouldBe('document.getElementById("x_and_w3").currentSrc', '"../../hidpi /resources/image-set-2x.png"'); | 32 shouldBe('currentSrcFileName("x_and_w3")', '"image-set-2x.png"'); |
31 shouldBe('document.getElementById("half_size").clientWidth', '(window.in nerWidth/2)'); | 33 shouldBe('document.getElementById("half_size").clientWidth', '(window.in nerWidth/2)'); |
32 shouldBe('document.getElementById("half_size").currentSrc', '"../../hidp i/resources/image-set-2x.png"'); | 34 shouldBe('currentSrcFileName("half_size")', '"image-set-2x.png"'); |
33 shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(w indow.innerWidth/100)'); | 35 shouldBe('document.getElementById("infitisimal_sizes").clientWidth', '(w indow.innerWidth/100)'); |
34 shouldBe('document.getElementById("infitisimal_sizes").currentSrc', '".. /../hidpi/resources/image-set-2x.png"'); | 36 shouldBe('currentSrcFileName("infitisimal_sizes")', '"image-set-2x.png"' ); |
35 }, false); | 37 }, false); |
36 </script> | 38 </script> |
37 </head> | 39 </head> |
38 | 40 |
39 <body id="body"> | 41 <body id="body"> |
40 <img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="../. ./hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w"> | 42 <img id="simple" src="" sizes="(max-width: 300px) 400px, 800px" srcset="../. ./hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w"> |
41 <img id="small_sizes" src="" sizes="300px" srcset="../../hidpi/resources/ima ge-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w"> | 43 <img id="small_sizes" src="" sizes="300px" srcset="../../hidpi/resources/ima ge-set-1x.png 400w, ../../hidpi/resources/image-set-2x.png 800w"> |
42 <!-- 'sizes' has no imapct on 'x' or 'src' resources --> | 44 <!-- 'sizes' has no imapct on 'x' or 'src' resources --> |
43 <img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../hidpi/resour ces/image-set-1x.png 1x, ../../hidpi/resources/image-set-2x.png 2x"> | 45 <img id="sizes_x_descriptors" src="" sizes="50vw" srcset="../../hidpi/resour ces/image-set-1x.png 1x, ../../hidpi/resources/image-set-2x.png 2x"> |
44 <img id="sizes_src" src="../../hidpi/resources/image-set-1x.png" sizes="50vw "> | 46 <img id="sizes_src" src="../../hidpi/resources/image-set-1x.png" sizes="50vw "> |
45 <!-- Missing sizes or an invalid one, give a source size of 100vw --> | 47 <!-- Missing sizes or an invalid one, give a source size of 100vw --> |
46 <img id="default_sizes" src="" srcset="../../hidpi/resources/image-set-1x.pn g 400w, ../../hidpi/resources/image-set-2x.png 800w, resources/image-set-4x.png 1600w"> | 48 <img id="default_sizes" src="" srcset="../../hidpi/resources/image-set-1x.pn g 400w, ../../hidpi/resources/image-set-2x.png 800w, resources/image-set-4x.png 1600w"> |
47 <img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset ="../../hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2 x.png 800w"> | 49 <img id="invalid_length" src="" sizes="(max-width: 300px) 400w, 800w" srcset ="../../hidpi/resources/image-set-1x.png 400w, ../../hidpi/resources/image-set-2 x.png 800w"> |
48 <!-- Make sure that the img src is not picked when 'w' is present --> | 50 <!-- Make sure that the img src is not picked when 'w' is present --> |
49 <img id="src_and_w" src="../../hidpi/resources/image-set-1x.png" sizes="700p x" srcset="resources/image-set-4x.png 1600w"> | 51 <img id="src_and_w" src="../../hidpi/resources/image-set-1x.png" sizes="700p x" srcset="resources/image-set-4x.png 1600w"> |
50 <img id="src_and_w2" src="../../hidpi/resources/image-set-2x.png" sizes="700 px" srcset="../../hidpi/resources/image-set-1x.png 400w"> | 52 <img id="src_and_w2" src="../../hidpi/resources/image-set-2x.png" sizes="700 px" srcset="../../hidpi/resources/image-set-1x.png 400w"> |
51 <img id="x_and_w" sizes="700px" srcset="../../hidpi/resources/image-set-1x.p ng 0.5x, resources/image-set-4x.png 1600w"> | 53 <img id="x_and_w" sizes="700px" srcset="../../hidpi/resources/image-set-1x.p ng 0.5x, resources/image-set-4x.png 1600w"> |
52 <!-- The 'x' resource should be picked, and 'sizes' have no impact on its in trisic size --> | 54 <!-- The 'x' resource should be picked, and 'sizes' have no impact on its in trisic size --> |
53 <img id="x_and_w2" sizes="700px" srcset="../../hidpi/resources/image-set-2x. png 2x, resources/image-set-4x.png 16000w"> | 55 <img id="x_and_w2" sizes="700px" srcset="../../hidpi/resources/image-set-2x. png 2x, resources/image-set-4x.png 16000w"> |
54 <img id="x_and_w3" sizes="700px" srcset="resources/image-set-4x.png 16000w, ../../hidpi/resources/image-set-2x.png 2x"> | 56 <img id="x_and_w3" sizes="700px" srcset="resources/image-set-4x.png 16000w, ../../hidpi/resources/image-set-2x.png 2x"> |
55 <!-- The intrinsic size should be identical to the 'sizes' value --> | 57 <!-- The intrinsic size should be identical to the 'sizes' value --> |
56 <img id="half_size" sizes="50vw" srcset="../../hidpi/resources/image-set-2x. png 800w, resources/image-set-4x.png 16000w"> | 58 <img id="half_size" sizes="50vw" srcset="../../hidpi/resources/image-set-2x. png 800w, resources/image-set-4x.png 16000w"> |
57 <img id="infitisimal_sizes" sizes="1vw" srcset="../../hidpi/resources/image- set-2x.png 800w, resources/image-set-4x.png 16000w"> | 59 <img id="infitisimal_sizes" sizes="1vw" srcset="../../hidpi/resources/image- set-2x.png 800w, resources/image-set-4x.png 16000w"> |
58 </body> | 60 </body> |
59 </html> | 61 </html> |
OLD | NEW |