summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/fontfaceset-loadingdone.html
blob: 56b9545c0d30453cbd286954e90a04eca0033839 (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
51
52
53
<html>
<head>
<script src="../../resources/js-test.js"></script>
<style>
body {
  font-family: serif;
}
@font-face {
  font-family: 'ahem';
  src: url(../../resources/Ahem.ttf);
}
#test {
  position: absolute
}
#test span {
  font-family: ahem;
}
</style>
<script>
description('Test that onloadingdone is fired after style recalculation.');

window.jsTestIsAsync = true;

function runTests() {
    document.fonts.onloadingdone = function() {
        debug('loadingdone');
        testDiv = document.getElementById('test');
        shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px');
    };

    document.fonts.ready.then(function() {
        debug('ready promise fulfilled');
        shouldBeEqualToString('window.getComputedStyle(testDiv, 0).width', '48px');
        finishJSTest();
    });
}

if (document.fonts)
    runTests();
else {
    testFailed('document.fonts does not exist');
    finishJSTest();
}
</script>
</head>
<body>
  <div id=test>
    <a href="#">
      <span>aaa</span>
    </a>
  </div>
</body>
</html>