This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* isCanvasKit implement and test * isCanvasKit implement and test * ++ * forgot license * make isCanvasKit a getter * addressed comments * forgot to change names of integration test files * typo * simplified tests * comments
- Loading branch information
1 parent
49f3ca4
commit c0dddac
Showing
10 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
dev/integration_tests/web_e2e_tests/test_driver/capabilities_integration_canvaskit.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('isCanvasKit returns true in CanvasKit mode', (WidgetTester tester) async { | ||
await tester.pumpAndSettle(); | ||
expect(isCanvasKit, true); | ||
}); | ||
} |
7 changes: 7 additions & 0 deletions
7
dev/integration_tests/web_e2e_tests/test_driver/capabilities_integration_canvaskit_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:integration_test/integration_test_driver.dart' as test; | ||
|
||
Future<void> main() async => test.integrationDriver(); |
15 changes: 15 additions & 0 deletions
15
dev/integration_tests/web_e2e_tests/test_driver/capabilities_integration_html.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('isCanvasKit returns false in HTML mode', (WidgetTester tester) async { | ||
await tester.pumpAndSettle(); | ||
expect(isCanvasKit, false); | ||
}); | ||
} |
7 changes: 7 additions & 0 deletions
7
dev/integration_tests/web_e2e_tests/test_driver/capabilities_integration_html_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:integration_test/integration_test_driver.dart' as test; | ||
|
||
Future<void> main() async => test.integrationDriver(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
/// The dart:io implementation of [isCanvasKit]. | ||
/// | ||
/// This bool shouldn't be used outside of web. | ||
bool get isCanvasKit { | ||
throw UnimplementedError('isCanvasKit is not implemented for dart:io.'); | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/flutter/lib/src/foundation/_capabilities_web.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'package:js/js.dart'; | ||
|
||
// This value is set by the engine. It is used to determine if the application is | ||
// using canvaskit. | ||
@JS('window.flutterCanvasKit') | ||
external Object? get _windowFlutterCanvasKit; | ||
|
||
/// The web implementation of [isCanvasKit] | ||
bool get isCanvasKit => _windowFlutterCanvasKit != null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2014 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import '_capabilities_io.dart' | ||
if (dart.library.js_util) '_capabilities_web.dart' as capabilities; | ||
|
||
/// Returns true if the application is using CanvasKit. | ||
/// | ||
/// Only to be used for web. | ||
bool get isCanvasKit => capabilities.isCanvasKit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters