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
43249469
Unverified
Commit
43249469
authored
Oct 08, 2021
by
Kenzie (Schmoll) Davisson
Committed by
GitHub
Oct 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add service extensions to expose debug rendering toggles (#91499)
parent
e95b5c22
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
1 deletion
+157
-1
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+30
-0
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+127
-1
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
43249469
...
@@ -109,6 +109,36 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
...
@@ -109,6 +109,36 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture
};
};
},
},
);
);
registerBoolServiceExtension
(
name:
'debugDisableClipLayers'
,
getter:
()
async
=>
debugDisableClipLayers
,
setter:
(
bool
value
)
{
if
(
debugDisableClipLayers
==
value
)
return
Future
<
void
>.
value
();
debugDisableClipLayers
=
value
;
return
_forceRepaint
();
},
);
registerBoolServiceExtension
(
name:
'debugDisablePhysicalShapeLayers'
,
getter:
()
async
=>
debugDisablePhysicalShapeLayers
,
setter:
(
bool
value
)
{
if
(
debugDisablePhysicalShapeLayers
==
value
)
return
Future
<
void
>.
value
();
debugDisablePhysicalShapeLayers
=
value
;
return
_forceRepaint
();
},
);
registerBoolServiceExtension
(
name:
'debugDisableOpacityLayers'
,
getter:
()
async
=>
debugDisableOpacityLayers
,
setter:
(
bool
value
)
{
if
(
debugDisableOpacityLayers
==
value
)
return
Future
<
void
>.
value
();
debugDisableOpacityLayers
=
value
;
return
_forceRepaint
();
},
);
return
true
;
return
true
;
}());
}());
...
...
packages/flutter/test/foundation/service_extensions_test.dart
View file @
43249469
...
@@ -173,7 +173,7 @@ void main() {
...
@@ -173,7 +173,7 @@ void main() {
const
int
disabledExtensions
=
kIsWeb
?
2
:
0
;
const
int
disabledExtensions
=
kIsWeb
?
2
:
0
;
// If you add a service extension... TEST IT! :-)
// If you add a service extension... TEST IT! :-)
// ...then increment this number.
// ...then increment this number.
expect
(
binding
.
extensions
.
length
,
3
0
+
widgetInspectorExtensionCount
-
disabledExtensions
);
expect
(
binding
.
extensions
.
length
,
3
3
+
widgetInspectorExtensionCount
-
disabledExtensions
);
expect
(
console
,
isEmpty
);
expect
(
console
,
isEmpty
);
debugPrint
=
debugPrintThrottled
;
debugPrint
=
debugPrintThrottled
;
...
@@ -612,6 +612,132 @@ void main() {
...
@@ -612,6 +612,132 @@ void main() {
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
});
test
(
'Service extensions - debugDisableClipLayers'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
Future
<
Map
<
String
,
dynamic
>>
pendingResult
;
bool
completed
;
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugDisableClipLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisableClipLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableClipLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisableClipLayers'
,
<
String
,
String
>{
'enabled'
:
'true'
});
completed
=
false
;
pendingResult
.
whenComplete
(()
{
completed
=
true
;
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
expect
(
completed
,
isFalse
);
await
binding
.
doFrame
();
await
binding
.
flushMicrotasks
();
expect
(
completed
,
isTrue
);
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisableClipLayers
,
true
);
result
=
await
binding
.
testExtension
(
'debugDisableClipLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisableClipLayers
,
true
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisableClipLayers'
,
<
String
,
String
>{
'enabled'
:
'false'
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
await
binding
.
doFrame
();
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableClipLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisableClipLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableClipLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - debugDisablePhysicalShapeLayers'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
Future
<
Map
<
String
,
dynamic
>>
pendingResult
;
bool
completed
;
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugDisablePhysicalShapeLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisablePhysicalShapeLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisablePhysicalShapeLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisablePhysicalShapeLayers'
,
<
String
,
String
>{
'enabled'
:
'true'
});
completed
=
false
;
pendingResult
.
whenComplete
(()
{
completed
=
true
;
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
expect
(
completed
,
isFalse
);
await
binding
.
doFrame
();
await
binding
.
flushMicrotasks
();
expect
(
completed
,
isTrue
);
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisablePhysicalShapeLayers
,
true
);
result
=
await
binding
.
testExtension
(
'debugDisablePhysicalShapeLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisablePhysicalShapeLayers
,
true
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisablePhysicalShapeLayers'
,
<
String
,
String
>{
'enabled'
:
'false'
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
await
binding
.
doFrame
();
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisablePhysicalShapeLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisablePhysicalShapeLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisablePhysicalShapeLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - debugDisableOpacityLayers'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
Future
<
Map
<
String
,
dynamic
>>
pendingResult
;
bool
completed
;
expect
(
binding
.
frameScheduled
,
isFalse
);
expect
(
debugDisableOpacityLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisableOpacityLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableOpacityLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisableOpacityLayers'
,
<
String
,
String
>{
'enabled'
:
'true'
});
completed
=
false
;
pendingResult
.
whenComplete
(()
{
completed
=
true
;
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
expect
(
completed
,
isFalse
);
await
binding
.
doFrame
();
await
binding
.
flushMicrotasks
();
expect
(
completed
,
isTrue
);
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisableOpacityLayers
,
true
);
result
=
await
binding
.
testExtension
(
'debugDisableOpacityLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'true'
});
expect
(
debugDisableOpacityLayers
,
true
);
expect
(
binding
.
frameScheduled
,
isFalse
);
pendingResult
=
binding
.
testExtension
(
'debugDisableOpacityLayers'
,
<
String
,
String
>{
'enabled'
:
'false'
});
await
binding
.
flushMicrotasks
();
expect
(
binding
.
frameScheduled
,
isTrue
);
await
binding
.
doFrame
();
expect
(
binding
.
frameScheduled
,
isFalse
);
result
=
await
pendingResult
;
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableOpacityLayers
,
false
);
result
=
await
binding
.
testExtension
(
'debugDisableOpacityLayers'
,
<
String
,
String
>{});
expect
(
result
,
<
String
,
String
>{
'enabled'
:
'false'
});
expect
(
debugDisableOpacityLayers
,
false
);
expect
(
binding
.
frameScheduled
,
isFalse
);
});
test
(
'Service extensions - reassemble'
,
()
async
{
test
(
'Service extensions - reassemble'
,
()
async
{
Map
<
String
,
dynamic
>
result
;
Map
<
String
,
dynamic
>
result
;
Future
<
Map
<
String
,
dynamic
>>
pendingResult
;
Future
<
Map
<
String
,
dynamic
>>
pendingResult
;
...
...
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