chromium/third_party/blink/web_tests/svg/zoom/text/lowdpi-zoom-text.html

<!DOCTYPE HTML>
<html>
<style>
    html {
        zoom: 1.25;
    }
</style>
<body>
Test for crbug.com/405468: zoom should not affect getComputedTextLength().<br>
<svg width="400" height="300">
    <text y="30" class="testLowDPI" font-size="16px">1 regular 16px abcd</text>
    <text y="60" class="testLowDPI" font-size="16px" text-rendering="geometricPrecision">1 geometric precision 16px abcd</text>
    <text y="90" class="testLowDPI" font-size="12px">1 regular 12px abcd</text>

    <text y="130" class="testHighDPI" font-size="16px">2 regular 16px abcd</text>
    <text y="160" class="testHighDPI" font-size="16px" text-rendering="geometricPrecision">2 geometric precision 16px abcd</text>
    <text y="190" class="testHighDPI" font-size="12px">2 regular 12px abcd</text>
</svg>
<script>
    if (window.testRunner) {
        testRunner.waitUntilDone();
        testRunner.dumpAsText();
        testRunner.setBackingScaleFactor(1, function() {
            runTest('testLowDPI');
            testRunner.setBackingScaleFactor(2, function() {
                runTest('testHighDPI');
                testRunner.notifyDone();
            });
        });
    }

    function runTest(className) {
        var textElements = document.getElementsByClassName(className);
        for (var t = 0; t < textElements.length; t++) {
            var text = textElements[t];
            var longerLength = text.getComputedTextLength();
            // Remove one character from the text so that it is now shorter.
            text.textContent = text.textContent.substring(0, text.textContent.length - 1);
            var shorterLength = text.getComputedTextLength();

            if (longerLength > shorterLength)
                text.textContent = "PASS";
            else
                text.textContent = "FAIL, " + longerLength + " should be greater than " + shorterLength;
        }
    }
</script>
</body>
</html>