Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: layout/inspector/tests/chrome/chrome.toml
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="test_bug695639.css"?>
<!--
-->
onload="RunTest();">
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function RunTest() {
var rng = document.createRange();
var elem, fonts, f;
elem = document.getElementById("test").childNodes[0];
rng.setStart(elem, 0);
rng.setEnd(elem, 14);
fonts = InspectorUtils.getUsedFontFaces(rng);
is(fonts.length, 2, "number of fonts used for entire text");
// initial latin substring...
rng.setStart(elem, 0);
rng.setEnd(elem, 5); // "Hello"
fonts = InspectorUtils.getUsedFontFaces(rng);
is(fonts.length, 1, "number of fonts (1)");
f = fonts[0];
is(f.name, "Gentium Plus", "font name (1)");
// the space (where the line wraps) should also be Gentium
rng.setStart(elem, 5);
rng.setEnd(elem, 6); // space
fonts = InspectorUtils.getUsedFontFaces(rng);
is(fonts.length, 1, "number of fonts (2)");
f = fonts[0];
is(f.name, "Gentium Plus", "font name (2)");
// the Chinese text "ni hao" should NOT be in Gentium
rng.setStart(elem, 6);
rng.setEnd(elem, 8); // two Chinese characters on second line
fonts = InspectorUtils.getUsedFontFaces(rng);
is(fonts.length, 1, "number of fonts (3)");
f = fonts[0];
isnot(f.name, "Gentium Plus", "font name (3)");
// space and "world" should be Gentium again
rng.setStart(elem, 8);
rng.setEnd(elem, 14);
fonts = InspectorUtils.getUsedFontFaces(rng);
is(fonts.length, 1, "number of fonts (4)");
f = fonts[0];
is(f.name, "Gentium Plus", "font name (4)");
SimpleTest.finish();
}
]]>
</script>
<style type="text/css">
</style>
<div style="width: 2em;" class="test" id="test">Hello 你好 world</div>
</body>
</window>