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
cca12159
Unverified
Commit
cca12159
authored
Nov 12, 2020
by
Michael Goderbauer
Committed by
GitHub
Nov 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Properly initialize RestorationManager in the TestBinding (#70398)
parent
c7f09251
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
restoration.dart
packages/flutter/lib/src/widgets/restoration.dart
+3
-1
binding.dart
packages/flutter_test/lib/src/binding.dart
+6
-3
bindings_restoration_test.dart
packages/flutter_test/test/bindings_restoration_test.dart
+13
-0
No files found.
packages/flutter/lib/src/widgets/restoration.dart
View file @
cca12159
...
...
@@ -301,7 +301,9 @@ class _RootRestorationScopeState extends State<RootRestorationScope> {
@override
void
dispose
()
{
if
(
_rootBucketValid
)
{
ServicesBinding
.
instance
!.
restorationManager
.
removeListener
(
_replaceRootBucket
);
}
super
.
dispose
();
}
...
...
packages/flutter_test/lib/src/binding.dart
View file @
cca12159
...
...
@@ -189,13 +189,16 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
final
TestWindow
_window
;
@override
TestRestorationManager
get
restorationManager
=>
_restorationManager
;
late
TestRestorationManager
_restorationManager
;
TestRestorationManager
get
restorationManager
{
_restorationManager
??=
createRestorationManager
();
return
_restorationManager
!;
}
TestRestorationManager
?
_restorationManager
;
/// Called by the test framework at the beginning of a widget test to
/// prepare the binding for the next test.
void
reset
()
{
_restorationManager
=
createRestorationManager
()
;
_restorationManager
=
null
;
resetGestureBinding
();
}
...
...
packages/flutter_test/test/bindings_restoration_test.dart
0 → 100644
View file @
cca12159
// 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/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
test
(
'Can access restoration manager without crashing'
,
()
{
final
AutomatedTestWidgetsFlutterBinding
binding
=
AutomatedTestWidgetsFlutterBinding
();
expect
(
binding
.
restorationManager
,
isA
<
RestorationManager
>());
});
}
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