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

Unified Diff: test/codegen/lib/html/fontface_loaded_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 years, 8 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 | « test/codegen/lib/html/filteredelementlist_test.dart ('k') | test/codegen/lib/html/fontface_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/codegen/lib/html/fontface_loaded_test.dart
diff --git a/test/codegen/lib/html/fontface_loaded_test.dart b/test/codegen/lib/html/fontface_loaded_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8a80f5d4d500fc8cd7938e107f2b6c2a6f8358ba
--- /dev/null
+++ b/test/codegen/lib/html/fontface_loaded_test.dart
@@ -0,0 +1,53 @@
+library fontface_loaded_test;
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+
+import 'dart:async';
+import 'dart:isolate';
+import 'dart:html';
+
+class NullTreeSanitizer implements NodeTreeSanitizer {
+ void sanitizeTree(Node node) {}
+}
+
+main() {
+ useHtmlConfiguration();
+
+ var style = new Element.html(
+ '''
+ <style>
+ @font-face {
+ font-family: 'Ahem';
+ src: url(/root_dart/tests/html/Ahem.ttf);
+ font-style: italic;
+ font-weight: 300;
+ unicode-range: U+0-3FF;
+ font-variant: small-caps;
+ -webkit-font-feature-settings: "dlig" 1;
+ /* font-stretch property is not supported */
+ }
+ </style>
+ ''',
+ treeSanitizer: new NullTreeSanitizer());
+ document.head.append(style);
+
+ test('document fonts - temporary', () {
+ var atLeastOneFont = false;
+ var loaded = [];
+ document.fonts.forEach((FontFace fontFace, _, __) {
+ atLeastOneFont = true;
+ Future f1 = fontFace.loaded;
+ Future f2 = fontFace.loaded;
+ loaded.add(fontFace.load());
+ loaded.add(f1);
+ loaded.add(f2);
+ });
+ expect(atLeastOneFont, isTrue);
+ return Future.wait(loaded).then(expectAsync((_) {
+ document.fonts.forEach((fontFace, _, __) {
+ expect(fontFace.status, 'loaded');
+ });
+ }));
+ });
+}
« no previous file with comments | « test/codegen/lib/html/filteredelementlist_test.dart ('k') | test/codegen/lib/html/fontface_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698