| <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> |
| <html> |
| <head> |
| <meta name="viewport" content="width=640, initial-scale=0.5"> |
| <style> |
| #square { |
| position: absolute; |
| width: 10vw; |
| height: 10vh; |
| border: 2px solid black; |
| } |
| |
| #output { |
| width: 100%; |
| height: 100%; |
| overflow: scroll; |
| } |
| |
| body { |
| margin: 0; |
| width: 100%; |
| height: 100%; |
| } |
| </style> |
| <script src="../../../resources/ui-helper.js"></script> |
| <script> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.waitUntilDone(); |
| } |
| |
| async function runTest() { |
| const appendOutput = message => { |
| output.appendChild(document.createTextNode(message)); |
| output.appendChild(document.createElement("br")); |
| }; |
| |
| for (let targetScale of [0.5, 0.75, 1, 1.25, 1.5, 1.25, 1, 0.75, 0.5]) { |
| appendOutput(`setViewScale(${targetScale.toFixed(2)})`); |
| |
| await UIHelper.setViewScale(targetScale); |
| await Promise.all([UIHelper.ensureVisibleContentRectUpdate(), UIHelper.ensurePresentationUpdate()]); |
| |
| appendOutput(`window size: [${innerWidth}, ${innerHeight}]`); |
| appendOutput(`square size: [${square.clientWidth}, ${square.clientHeight}]`); |
| appendOutput(`zoom scale: ${(await UIHelper.zoomScale()).toFixed(2)}`); |
| appendOutput(""); |
| } |
| |
| testRunner.notifyDone(); |
| } |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <div id="square"></div> |
| <pre id="output"></pre> |
| </body> |
| </html> |