| <html> |
| <head> |
| <title>Test that print restores previous media type</title> |
| <style type="text/css"> |
| |
| </style> |
| <script type="text/javascript" charset="utf-8"> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| window.internals.settings.setMediaTypeOverride("handheld"); |
| } |
| |
| function log(m) |
| { |
| var results = document.getElementById('results'); |
| results.innerHTML += m + '<br>'; |
| } |
| |
| function shouldBe(aDescription, a, b) |
| { |
| if (a === b) { |
| log("PASS: " + aDescription + " should be '" + b + "' and is."); |
| } else { |
| log("FAIL: " + aDescription + " should be '" + b + "' but instead is '" + a + "'."); |
| } |
| } |
| |
| function runTests() |
| { |
| log("Media type is set to 'handheld' to be different than the default 'screen'"); |
| shouldBe("window.styleMedia.type", window.styleMedia.type, "handheld"); |
| log("<br>The page is printed, which changes the media type to 'print', and then back"); |
| window.print(); |
| shouldBe("window.styleMedia.type", window.styleMedia.type, "handheld"); |
| } |
| </script> |
| </head> |
| <body onload="runTests()"> |
| <div id="results"></div> |
| </body> |
| </html> |