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

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: Fix callback arguments 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
« no previous file with comments | « no previous file | LayoutTests/fast/css/fontfaceset-set-operations-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/css/fontfaceset-set-operations-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698