Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: LayoutTests/fast/css/fontfaceset-set-operations.html

Issue 137253005: [Font Load Events] Partial implementation of SetClass operations for FontFaceSet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/css/fontfaceset-set-operations.html
diff --git a/LayoutTests/fast/css/fontfaceset-set-operations.html b/LayoutTests/fast/css/fontfaceset-set-operations.html
new file mode 100644
index 0000000000000000000000000000000000000000..fba170b225e4b71a8c37ada970eb0b14b09ea340
--- /dev/null
+++ b/LayoutTests/fast/css/fontfaceset-set-operations.html
@@ -0,0 +1,50 @@
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+<style>
+@font-face {
+ font-family: Font1;
+ src: local(Arial);
+}
+
+@font-face {
+ font-family: Font2;
+ src: local(Arial);
+}
+
+@font-face {
+ font-family: Font3;
+ src: local(Arial);
+}
+</style>
+<script>
+description('Tests set operations of FontFaceSet.');
+
+function runTests() {
+ shouldBe('document.fonts.size', '3');
+
+ faces = [];
+ document.fonts.forEach(function(face) { faces.push(face); });
+ shouldBe('faces.length', '3');
+
+ shouldBeEqualToString('faces[0].family', 'Font1');
+ shouldBeEqualToString('faces[1].family', 'Font2');
+ shouldBeEqualToString('faces[2].family', 'Font3');
+
+ shouldBeTrue('document.fonts.has(faces[0])');
+ shouldBeTrue('document.fonts.has(faces[1])');
+ shouldBeTrue('document.fonts.has(faces[2])');
+ shouldBeFalse('document.fonts.has(new FontFace("MyFont", "local(Arial)", {}))');
+ shouldThrow('document.fonts.has("Font1")', '"TypeError: Failed to execute \'has\' on \'FontFaceSet\': The argument is not a FontFace."');
+}
+
+if (document.fonts)
+ runTests();
+else
+ testFailed('document.fonts does not exist');
+
+</script>
+</head>
+<body>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698