Index: LayoutTests/fast/css/font-face-unicode-range-load.html |
diff --git a/LayoutTests/fast/css/font-face-unicode-range-load.html b/LayoutTests/fast/css/font-face-unicode-range-load.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ba8c14a526acffa62da9514faa640880be8238e |
--- /dev/null |
+++ b/LayoutTests/fast/css/font-face-unicode-range-load.html |
@@ -0,0 +1,67 @@ |
+<html> |
+<head> |
+<script src="../js/resources/js-test-pre.js"></script> |
+<script> |
+description('Tests that unicode-range descriptor is used to selectively download fonts that are used in document.'); |
+ |
+window.jsTestIsAsync = true; |
+ |
+var latin1Loaded = false; |
+var cyrillicLoaded = false; |
+var arabicLoaded = false; |
+ |
+function runTests() { |
+ document.fontloader.addEventListener('load', onload); |
+ document.fontloader.notifyWhenFontsReady(verify); |
+} |
+ |
+function onload(e) { |
+ var src = e.fontface.style.getPropertyValue('src'); |
+ if (src.indexOf('Latin1') >= 0) |
+ latin1Loaded = true; |
+ if (src.indexOf('Cyrillic') >= 0) |
+ cyrillicLoaded = true; |
+ if (src.indexOf('Arabic') >= 0) |
+ arabicLoaded = true; |
+} |
+ |
+function verify() { |
+ shouldBeTrue('latin1Loaded'); // Latin-1 font is loaded for basic font metrics. |
+ shouldBeTrue('cyrillicLoaded'); |
+ shouldBeFalse('arabicLoaded'); |
+ finishJSTest(); |
+} |
+ |
+if (document.fontloader) |
+ runTests(); |
+else { |
+ testFailed('document.fontloader does not exist'); |
+ finishJSTest(); |
+} |
+</script> |
+<style> |
+@font-face { |
+ font-family: TestFont; |
+ src: url('../../resources/NonExistentLatin1.woff'), local(Ahem); |
+ unicode-range: U+00-0FF; /* Latin-1 */ |
+} |
+@font-face { |
+ font-family: TestFont; |
+ src: url('../../resources/NonExistentCyrillic.woff'), local(Ahem); |
+ unicode-range: U+0400-04FF; /* Cyrillic */ |
+} |
+@font-face { |
+ font-family: TestFont; |
+ src: url('../../resources/NonExistentArabic.woff'), local(Ahem); |
+ unicode-range: U+0600-06FF; /* Arabic */ |
+} |
+#test { |
+ font-family: TestFont; |
+} |
+</style> |
+</head> |
+<body> |
+ <p id="test">Проверка</p> |
+ <script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |