Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
0274f170
Unverified
Commit
0274f170
authored
Mar 18, 2020
by
Jonah Williams
Committed by
GitHub
Mar 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] have the tool print the current canvaskit mode when toggling (#52841)
parent
83fdf78a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
resident_web_runner.dart
...utter_tools/lib/src/build_runner/resident_web_runner.dart
+2
-1
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+5
-3
resident_web_runner_test.dart
...er_tools/test/general.shard/resident_web_runner_test.dart
+2
-1
terminal_handler_test.dart
...utter_tools/test/general.shard/terminal_handler_test.dart
+12
-0
No files found.
packages/flutter_tools/lib/src/build_runner/resident_web_runner.dart
View file @
0274f170
...
...
@@ -706,10 +706,11 @@ class _ResidentWebRunner extends ResidentWebRunner {
bool
get
supportsCanvasKit
=>
supportsServiceProtocol
;
@override
Future
<
void
>
toggleCanvaskit
()
async
{
Future
<
bool
>
toggleCanvaskit
()
async
{
final
WebDevFS
webDevFS
=
device
.
devFS
as
WebDevFS
;
webDevFS
.
webAssetServer
.
canvasKitRendering
=
!
webDevFS
.
webAssetServer
.
canvasKitRendering
;
await
_wipConnection
?.
sendCommand
(
'Page.reload'
);
return
webDevFS
.
webAssetServer
.
canvasKitRendering
;
}
@override
...
...
packages/flutter_tools/lib/src/resident_runner.dart
View file @
0274f170
...
...
@@ -732,10 +732,11 @@ abstract class ResidentRunner {
throw
'
${fullRestart ? 'Restart' : 'Reload'}
is not supported in
$mode
mode'
;
}
/// Toggle whether canvaskit is being used for rendering.
/// Toggle whether canvaskit is being used for rendering, returning the new
/// state.
///
/// Only supported on the web.
Future
<
void
>
toggleCanvaskit
()
{
Future
<
bool
>
toggleCanvaskit
()
{
throw
Exception
(
'Canvaskit not supported by this runner.'
);
}
...
...
@@ -1207,7 +1208,8 @@ class TerminalHandler {
return
false
;
case
'k'
:
if
(
residentRunner
.
supportsCanvasKit
)
{
await
residentRunner
.
toggleCanvaskit
();
final
bool
result
=
await
residentRunner
.
toggleCanvaskit
();
globals
.
printStatus
(
'
${result ? 'Enabled' : 'Disabled'}
CanvasKit'
);
return
true
;
}
return
false
;
...
...
packages/flutter_tools/test/general.shard/resident_web_runner_test.dart
View file @
0274f170
...
...
@@ -437,9 +437,10 @@ void main() {
expect
(
residentWebRunner
.
supportsCanvasKit
,
true
);
expect
(
webAssetServer
.
canvasKitRendering
,
false
);
await
residentWebRunner
.
toggleCanvaskit
();
final
bool
toggleResult
=
await
residentWebRunner
.
toggleCanvaskit
();
expect
(
webAssetServer
.
canvasKitRendering
,
true
);
expect
(
toggleResult
,
true
);
}));
test
(
'Exits when initial compile fails'
,
()
=>
testbed
.
run
(()
async
{
...
...
packages/flutter_tools/test/general.shard/terminal_handler_test.dart
View file @
0274f170
...
...
@@ -108,6 +108,18 @@ void main() {
verify
(
mockResidentRunner
.
printHelp
(
details:
true
)).
called
(
3
);
});
testUsingContext
(
'k - toggles CanvasKit rendering and prints results'
,
()
async
{
when
(
mockResidentRunner
.
supportsCanvasKit
).
thenReturn
(
true
);
when
(
mockResidentRunner
.
toggleCanvaskit
())
.
thenAnswer
((
Invocation
invocation
)
async
{
return
true
;
});
await
terminalHandler
.
processTerminalInput
(
'k'
);
verify
(
mockResidentRunner
.
toggleCanvaskit
()).
called
(
1
);
});
testUsingContext
(
'i, I - debugToggleWidgetInspector with service protocol'
,
()
async
{
await
terminalHandler
.
processTerminalInput
(
'i'
);
await
terminalHandler
.
processTerminalInput
(
'I'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment