summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/parsing-font-variant-ligatures.html
blob: 1facab519638192f5a66f67936822fbb6e27b00a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<pre id="console"></pre>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    function log(message)
    {
        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
    }

    function test(value, expectedCSSText, expectedComputedCSSText)
    {
        var element = document.createElement("div");
        element.style.setProperty("font-variant-ligatures", value);
        var cssText = element.style.fontVariantLigatures;
        document.body.appendChild(element);
        var computedCSSText = getComputedStyle(element).fontVariantLigatures;
        document.body.removeChild(element);
        if (cssText === expectedCSSText && computedCSSText == expectedComputedCSSText)
            log("PASS: '" + value + "' parsed as '" + expectedCSSText + "' and computed to '" + computedCSSText + "'");
        else {
            if (cssText !== expectedCSSText)
                log("FAIL: '" + value + "' parsed as '" + cssText + "' rather than '" + expectedCSSText + "'");
            if (computedCSSText !== expectedComputedCSSText)
                log("FAIL: '" + value + "' computed to '" + computedCSSText + "' rather than '" + expectedComputedCSSText + "'");
        }
    }

    test('initial', 'initial', 'normal');
    test('inherit', 'inherit', 'normal');
    test('normal', 'normal', 'normal');
    test('large', '', 'normal');
    test('25px', '', 'normal');
    test('normal normal', '', 'normal');
    test('normal no-common-ligatures', '', 'normal');

    log("");
    test('no-common-ligatures', 'no-common-ligatures', 'no-common-ligatures');
    test('common-ligatures', 'common-ligatures', 'common-ligatures');
    test('no-discretionary-ligatures', 'no-discretionary-ligatures', 'no-discretionary-ligatures');
    test('discretionary-ligatures', 'discretionary-ligatures', 'discretionary-ligatures');
    test('no-historical-ligatures', 'no-historical-ligatures', 'no-historical-ligatures');
    test('historical-ligatures', 'historical-ligatures', 'historical-ligatures');

    log("");
    test('no-common-ligatures no-common-ligatures', '', 'normal');
    test('common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures', 'common-ligatures no-discretionary-ligatures');
    test('common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures', 'common-ligatures no-discretionary-ligatures historical-ligatures');
    test('common-ligatures no-discretionary-ligatures normal', '', 'normal');
</script>