mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Make debugSemantics available to profile mode (#58620)
This commit is contained in:
parent
e216eec7b4
commit
c5318f7f07
@ -190,6 +190,7 @@ Future<void> runDemos(List<String> demos, FlutterDriver driver) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main([List<String> args = const <String>[]]) {
|
void main([List<String> args = const <String>[]]) {
|
||||||
|
final bool withSemantics = args.contains('--with_semantics');
|
||||||
group('flutter gallery transitions', () {
|
group('flutter gallery transitions', () {
|
||||||
FlutterDriver driver;
|
FlutterDriver driver;
|
||||||
setUpAll(() async {
|
setUpAll(() async {
|
||||||
@ -197,8 +198,7 @@ void main([List<String> args = const <String>[]]) {
|
|||||||
|
|
||||||
// Wait for the first frame to be rasterized.
|
// Wait for the first frame to be rasterized.
|
||||||
await driver.waitUntilFirstFrameRasterized();
|
await driver.waitUntilFirstFrameRasterized();
|
||||||
|
if (withSemantics) {
|
||||||
if (args.contains('--with_semantics')) {
|
|
||||||
print('Enabeling semantics...');
|
print('Enabeling semantics...');
|
||||||
await driver.setSemantics(true);
|
await driver.setSemantics(true);
|
||||||
}
|
}
|
||||||
@ -214,6 +214,12 @@ void main([List<String> args = const <String>[]]) {
|
|||||||
await driver.close();
|
await driver.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('find.bySemanticsLabel', () async {
|
||||||
|
// Assert that we can use semantics related finders in profile mode.
|
||||||
|
final int id = await driver.getSemanticsId(find.bySemanticsLabel('Material'));
|
||||||
|
expect(id, greaterThan(-1));
|
||||||
|
}, skip: !withSemantics);
|
||||||
|
|
||||||
test('all demos', () async {
|
test('all demos', () async {
|
||||||
// Collect timeline data for just a limited set of demos to avoid OOMs.
|
// Collect timeline data for just a limited set of demos to avoid OOMs.
|
||||||
final Timeline timeline = await driver.traceAction(
|
final Timeline timeline = await driver.traceAction(
|
||||||
|
@ -2482,15 +2482,13 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
|
|||||||
/// render objects in production, obtain a [SemanticsHandle] from
|
/// render objects in production, obtain a [SemanticsHandle] from
|
||||||
/// [PipelineOwner.ensureSemantics].
|
/// [PipelineOwner.ensureSemantics].
|
||||||
///
|
///
|
||||||
/// Only valid when asserts are enabled. In release builds, always returns
|
/// Only valid in debug and profile mode. In release builds, always returns
|
||||||
/// null.
|
/// null.
|
||||||
SemanticsNode get debugSemantics {
|
SemanticsNode get debugSemantics {
|
||||||
SemanticsNode result;
|
if (!kReleaseMode) {
|
||||||
assert(() {
|
return _semantics;
|
||||||
result = _semantics;
|
}
|
||||||
return true;
|
return null;
|
||||||
}());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Removes all semantics from this render object and its descendants.
|
/// Removes all semantics from this render object and its descendants.
|
||||||
|
Loading…
Reference in New Issue
Block a user