Skip to content

Commit

Permalink
Add missing debug vars to debugAssertAllRenderVarsUnset (flutter#91848)
Browse files Browse the repository at this point in the history
  • Loading branch information
goderbauer authored Oct 14, 2021
1 parent ac745b3 commit 9570d35
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/flutter/lib/src/rendering/debug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,12 @@ bool debugAssertAllRenderVarsUnset(String reason, { bool debugCheckIntrinsicSize
debugPrintMarkNeedsPaintStacks ||
debugPrintLayouts ||
debugCheckIntrinsicSizes != debugCheckIntrinsicSizesOverride ||
debugProfileLayoutsEnabled ||
debugProfilePaintsEnabled ||
debugOnProfilePaint != null) {
debugOnProfilePaint != null ||
debugDisableClipLayers ||
debugDisablePhysicalShapeLayers ||
debugDisableOpacityLayers) {
throw FlutterError(reason);
}
return true;
Expand Down
24 changes: 24 additions & 0 deletions packages/flutter/test/rendering/debug_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,28 @@ void main() {
expect(opacityLayer.offset, const Offset(40, 40));
debugDisableOpacityLayers = false;
});

test('debugAssertAllRenderVarsUnset warns when debugProfileLayoutsEnabled set', () {
debugProfileLayoutsEnabled = true;
expect(() => debugAssertAllRenderVarsUnset('ERROR'), throwsFlutterError);
debugProfileLayoutsEnabled = false;
});

test('debugAssertAllRenderVarsUnset warns when debugDisableClipLayers set', () {
debugDisableClipLayers = true;
expect(() => debugAssertAllRenderVarsUnset('ERROR'), throwsFlutterError);
debugDisableClipLayers = false;
});

test('debugAssertAllRenderVarsUnset warns when debugDisablePhysicalShapeLayers set', () {
debugDisablePhysicalShapeLayers = true;
expect(() => debugAssertAllRenderVarsUnset('ERROR'), throwsFlutterError);
debugDisablePhysicalShapeLayers = false;
});

test('debugAssertAllRenderVarsUnset warns when debugDisableOpacityLayers set', () {
debugDisableOpacityLayers = true;
expect(() => debugAssertAllRenderVarsUnset('ERROR'), throwsFlutterError);
debugDisableOpacityLayers = false;
});
}

0 comments on commit 9570d35

Please sign in to comment.