| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html id="html_element"> | 2 <html id="html_element"> |
| 3 <head id="head_element"> | 3 <head id="head_element"> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <p id="description"></p> | 7 <p id="description"></p> |
| 8 <div id="console"></div> | 8 <div id="console"></div> |
| 9 <script> | 9 <script> |
| 10 description("This tests page style selection."); | 10 description("This tests page style selection."); |
| 11 | 11 |
| 12 function appendStyle(styleString) | 12 function appendStyle(styleString) |
| 13 { | 13 { |
| 14 var styleElement = document.createElement("style"); | 14 var styleElement = document.createElement("style"); |
| 15 styleElement.innerHTML = styleString; | 15 styleElement.innerHTML = styleString; |
| 16 document.getElementById("head_element").appendChild(styleElement); | 16 document.getElementById("head_element").appendChild(styleElement); |
| 17 } | 17 } |
| 18 | 18 |
| 19 if (window.testRunner) { | 19 if (window.testRunner) { |
| 20 testRunner.dumpAsText(); | 20 testRunner.dumpAsText(); |
| 21 | 21 |
| 22 debug("Default margin is auto."); | 22 debug("Default margin is auto."); |
| 23 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "auto"
); | 23 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "auto"
); |
| 24 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "auto"
); | 24 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "auto"
); |
| 25 shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "auto"
); | 25 shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "auto"
); |
| 26 shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "auto"
); | 26 shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "auto"
); |
| 27 shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "auto"
); | 27 shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "auto"
); |
| 28 | 28 |
| 29 debug("Set margin to 200px via user style sheet."); | 29 debug("Set margin to 200px via user style sheet."); |
| 30 testRunner.addUserStyleSheet("@page { margin:200px; }", true); | 30 testRunner.injectStyleSheet("@page { margin:200px; }", true); |
| 31 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "200")
; | 31 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "200")
; |
| 32 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "200")
; | 32 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "200")
; |
| 33 shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "200")
; | 33 shouldBeEqualToString("internals.pageProperty('margin-left', 2)", "200")
; |
| 34 shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "200")
; | 34 shouldBeEqualToString("internals.pageProperty('margin-left', 3)", "200")
; |
| 35 shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "200")
; | 35 shouldBeEqualToString("internals.pageProperty('margin-left', 4)", "200")
; |
| 36 | 36 |
| 37 debug("Set margin to 100px."); | 37 debug("Set margin to 100px."); |
| 38 appendStyle("@page { margin:100px; }"); | 38 appendStyle("@page { margin:100px; }"); |
| 39 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "100")
; | 39 shouldBeEqualToString("internals.pageProperty('margin-left', 0)", "100")
; |
| 40 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "100")
; | 40 shouldBeEqualToString("internals.pageProperty('margin-left', 1)", "100")
; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250"); | 91 shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250"); |
| 92 appendStyle("@media screen { @page { size:300px 500px; } }"); | 92 appendStyle("@media screen { @page { size:300px 500px; } }"); |
| 93 shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250"); | 93 shouldBeEqualToString("internals.pageProperty('size', 0)", "150 250"); |
| 94 | 94 |
| 95 } else { | 95 } else { |
| 96 testFailed("This test can be run only with window.testRunner"); | 96 testFailed("This test can be run only with window.testRunner"); |
| 97 } | 97 } |
| 98 </script> | 98 </script> |
| 99 </body> | 99 </body> |
| 100 </html> | 100 </html> |
| OLD | NEW |