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..6cd7e47429a4e05d340f2badab564506898302ee |
--- /dev/null |
+++ b/LayoutTests/fast/css/fontfaceset-set-operations.html |
@@ -0,0 +1,60 @@ |
+<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'); |
+ |
+ thisArg = {}; |
+ faces = []; |
+ document.fonts.forEach(function(face, faceAgain, set) { |
+ if (faces.length == 0) { |
+ callbackArgs = arguments; |
+ thisValue = this; |
+ shouldBeTrue('callbackArgs[0] === callbackArgs[1]'); |
+ shouldBeTrue('callbackArgs[2] === document.fonts'); |
+ shouldBeTrue('thisValue === thisArg'); |
+ } |
+ faces.push(face); |
+ }, thisArg); |
+ 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> |