Clean up the command line tool interactive help output. (#80903)
This commit is contained in:
@@ -9,7 +9,6 @@ import 'platform.dart';
|
||||
import 'terminal.dart';
|
||||
|
||||
const String fire = '🔥';
|
||||
const String image = '🖼️';
|
||||
const int maxLineWidth = 84;
|
||||
|
||||
/// Encapsulates the help text construction and printing.
|
||||
@@ -32,9 +31,13 @@ class CommandHelp {
|
||||
|
||||
final OutputPreferences _outputPreferences;
|
||||
|
||||
// COMMANDS IN ALPHABETICAL ORDER.
|
||||
// Uppercase first, then lowercase.
|
||||
// When updating this, update all the tests in command_help_test.dart accordingly.
|
||||
|
||||
late final CommandHelpOption I = _makeOption(
|
||||
'I',
|
||||
'Toggle oversized image inversion $image.',
|
||||
'Toggle oversized image inversion.',
|
||||
'debugInvertOversizedImages',
|
||||
);
|
||||
|
||||
@@ -44,6 +47,11 @@ class CommandHelp {
|
||||
'debugDumpLayerTree',
|
||||
);
|
||||
|
||||
late final CommandHelpOption M = _makeOption(
|
||||
'M',
|
||||
'Write SkSL shaders to a unique file in the project directory.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption P = _makeOption(
|
||||
'P',
|
||||
'Toggle performance overlay.',
|
||||
@@ -75,7 +83,7 @@ class CommandHelp {
|
||||
|
||||
late final CommandHelpOption b = _makeOption(
|
||||
'b',
|
||||
'Toggle the platform brightness setting (dark and light mode).',
|
||||
'Toggle platform brightness (dark and light mode).',
|
||||
'debugBrightnessOverride',
|
||||
);
|
||||
|
||||
@@ -94,17 +102,27 @@ class CommandHelp {
|
||||
'Run source code generators.'
|
||||
);
|
||||
|
||||
late final CommandHelpOption h = _makeOption(
|
||||
late final CommandHelpOption hWithDetails = _makeOption(
|
||||
'h',
|
||||
'Repeat this help message.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption hWithoutDetails = _makeOption(
|
||||
'h',
|
||||
'List all available interactive commands.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption i = _makeOption(
|
||||
'i',
|
||||
'Toggle widget inspector.',
|
||||
'WidgetsApp.showWidgetInspectorOverride',
|
||||
);
|
||||
|
||||
late final CommandHelpOption k = _makeOption(
|
||||
'k',
|
||||
'Toggle CanvasKit rendering.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption o = _makeOption(
|
||||
'o',
|
||||
'Simulate different operating systems.',
|
||||
@@ -147,17 +165,11 @@ class CommandHelp {
|
||||
late final CommandHelpOption z = _makeOption(
|
||||
'z',
|
||||
'Toggle elevation checker.',
|
||||
'debugCheckElevationsEnabled',
|
||||
);
|
||||
|
||||
late final CommandHelpOption k = _makeOption(
|
||||
'k',
|
||||
'Toggle CanvasKit rendering.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption M = _makeOption(
|
||||
'M',
|
||||
'Write SkSL shaders to a unique file in the project directory.',
|
||||
);
|
||||
// When updating the list above, see the notes above the list regarding order
|
||||
// and tests.
|
||||
|
||||
CommandHelpOption _makeOption(String key, String description, [
|
||||
String inParenthesis = '',
|
||||
|
||||
@@ -1449,7 +1449,6 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
commandHelp.s.print();
|
||||
}
|
||||
if (supportsServiceProtocol) {
|
||||
commandHelp.b.print();
|
||||
commandHelp.w.print();
|
||||
commandHelp.t.print();
|
||||
if (isRunningDebug) {
|
||||
@@ -1457,21 +1456,24 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
commandHelp.S.print();
|
||||
commandHelp.U.print();
|
||||
commandHelp.i.print();
|
||||
commandHelp.I.print();
|
||||
commandHelp.p.print();
|
||||
commandHelp.I.print();
|
||||
commandHelp.o.print();
|
||||
commandHelp.b.print();
|
||||
commandHelp.z.print();
|
||||
commandHelp.g.print();
|
||||
} else {
|
||||
commandHelp.S.print();
|
||||
commandHelp.U.print();
|
||||
}
|
||||
// Performance related features: `P` should precede `a`, which should precede `M`.
|
||||
commandHelp.P.print();
|
||||
commandHelp.a.print();
|
||||
if (supportsWriteSkSL) {
|
||||
commandHelp.M.print();
|
||||
}
|
||||
// `P` should precede `a`
|
||||
commandHelp.P.print();
|
||||
commandHelp.a.print();
|
||||
if (isRunningDebug) {
|
||||
commandHelp.g.print();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -213,8 +213,10 @@ class ColdRunner extends ResidentRunner {
|
||||
globals.printStatus('Flutter run key commands.');
|
||||
if (details) {
|
||||
printHelpDetails();
|
||||
commandHelp.hWithDetails.print();
|
||||
} else {
|
||||
commandHelp.hWithoutDetails.print();
|
||||
}
|
||||
commandHelp.h.print(); // TODO(ianh): print different message if details is false
|
||||
if (_didAttach) {
|
||||
commandHelp.d.print();
|
||||
}
|
||||
|
||||
@@ -1081,7 +1081,6 @@ class HotRunner extends ResidentRunner {
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
void printHelp({ @required bool details }) {
|
||||
globals.printStatus('Flutter run key commands.');
|
||||
@@ -1089,15 +1088,17 @@ class HotRunner extends ResidentRunner {
|
||||
if (supportsRestart) {
|
||||
commandHelp.R.print();
|
||||
}
|
||||
commandHelp.h.print(); // TODO(ianh): print different message if "details" is false
|
||||
if (details) {
|
||||
printHelpDetails();
|
||||
commandHelp.hWithDetails.print();
|
||||
} else {
|
||||
commandHelp.hWithoutDetails.print();
|
||||
}
|
||||
if (_didAttach) {
|
||||
commandHelp.d.print();
|
||||
}
|
||||
commandHelp.c.print();
|
||||
commandHelp.q.print();
|
||||
if (details) {
|
||||
printHelpDetails();
|
||||
}
|
||||
globals.printStatus('');
|
||||
if (debuggingOptions.buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
||||
globals.printStatus('💪 Running with sound null safety 💪', emphasis: true);
|
||||
|
||||
@@ -49,19 +49,20 @@ void _testMessageLength({
|
||||
expectedWidth += ansiMetaCharactersLength;
|
||||
}
|
||||
|
||||
expect(
|
||||
commandHelp.I.toString().length,
|
||||
lessThanOrEqualTo(expectedWidth),
|
||||
);
|
||||
expect(commandHelp.I.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.L.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.M.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.P.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.R.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.S.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.U.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.a.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.b.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.c.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.d.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.g.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.h.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.hWithDetails.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.hWithoutDetails.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.i.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.k.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.o.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
@@ -99,16 +100,22 @@ void main() {
|
||||
wrapColumn: maxLineWidth,
|
||||
);
|
||||
|
||||
expect(commandHelp.I.toString(), startsWith('\x1B[1mI\x1B[22m'));
|
||||
expect(commandHelp.L.toString(), startsWith('\x1B[1mL\x1B[22m'));
|
||||
expect(commandHelp.M.toString(), startsWith('\x1B[1mM\x1B[22m'));
|
||||
expect(commandHelp.P.toString(), startsWith('\x1B[1mP\x1B[22m'));
|
||||
expect(commandHelp.R.toString(), startsWith('\x1B[1mR\x1B[22m'));
|
||||
expect(commandHelp.S.toString(), startsWith('\x1B[1mS\x1B[22m'));
|
||||
expect(commandHelp.U.toString(), startsWith('\x1B[1mU\x1B[22m'));
|
||||
expect(commandHelp.a.toString(), startsWith('\x1B[1ma\x1B[22m'));
|
||||
expect(commandHelp.b.toString(), startsWith('\x1B[1mb\x1B[22m'));
|
||||
expect(commandHelp.c.toString(), startsWith('\x1B[1mc\x1B[22m'));
|
||||
expect(commandHelp.d.toString(), startsWith('\x1B[1md\x1B[22m'));
|
||||
expect(commandHelp.g.toString(), startsWith('\x1B[1mg\x1B[22m'));
|
||||
expect(commandHelp.h.toString(), startsWith('\x1B[1mh\x1B[22m'));
|
||||
expect(commandHelp.hWithDetails.toString(), startsWith('\x1B[1mh\x1B[22m'));
|
||||
expect(commandHelp.hWithoutDetails.toString(), startsWith('\x1B[1mh\x1B[22m'));
|
||||
expect(commandHelp.i.toString(), startsWith('\x1B[1mi\x1B[22m'));
|
||||
expect(commandHelp.k.toString(), startsWith('\x1B[1mk\x1B[22m'));
|
||||
expect(commandHelp.o.toString(), startsWith('\x1B[1mo\x1B[22m'));
|
||||
expect(commandHelp.p.toString(), startsWith('\x1B[1mp\x1B[22m'));
|
||||
expect(commandHelp.q.toString(), startsWith('\x1B[1mq\x1B[22m'));
|
||||
@@ -119,22 +126,25 @@ void main() {
|
||||
expect(commandHelp.z.toString(), startsWith('\x1B[1mz\x1B[22m'));
|
||||
});
|
||||
|
||||
testWithoutContext('commands L,P,S,U,a,i,o,p,t,w should have a grey bolden parenthetical text', () {
|
||||
testWithoutContext('commands that should have a grey bolden parenthetical text', () {
|
||||
final CommandHelp commandHelp = _createCommandHelp(
|
||||
ansi: true,
|
||||
wrapColumn: maxLineWidth,
|
||||
);
|
||||
|
||||
expect(commandHelp.L.toString(), endsWith('\x1B[90m(debugDumpLayerTree)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.P.toString(), endsWith('\x1B[90m(WidgetsApp.showPerformanceOverlay)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.S.toString(), endsWith('\x1B[90m(debugDumpSemantics)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.U.toString(), endsWith('\x1B[90m(debugDumpSemantics)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.a.toString(), endsWith('\x1B[90m(debugProfileWidgetBuilds)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.i.toString(), endsWith('\x1B[90m(WidgetsApp.showWidgetInspectorOverride)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.o.toString(), endsWith('\x1B[90m(defaultTargetPlatform)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.p.toString(), endsWith('\x1B[90m(debugPaintSizeEnabled)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.t.toString(), endsWith('\x1B[90m(debugDumpRenderTree)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.w.toString(), endsWith('\x1B[90m(debugDumpApp)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.I.toString(), endsWith('\x1B[90m(debugInvertOversizedImages)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.L.toString(), endsWith('\x1B[90m(debugDumpLayerTree)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.P.toString(), endsWith('\x1B[90m(WidgetsApp.showPerformanceOverlay)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.S.toString(), endsWith('\x1B[90m(debugDumpSemantics)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.U.toString(), endsWith('\x1B[90m(debugDumpSemantics)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.a.toString(), endsWith('\x1B[90m(debugProfileWidgetBuilds)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.b.toString(), endsWith('\x1B[90m(debugBrightnessOverride)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.i.toString(), endsWith('\x1B[90m(WidgetsApp.showWidgetInspectorOverride)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.o.toString(), endsWith('\x1B[90m(defaultTargetPlatform)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.p.toString(), endsWith('\x1B[90m(debugPaintSizeEnabled)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.t.toString(), endsWith('\x1B[90m(debugDumpRenderTree)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.w.toString(), endsWith('\x1B[90m(debugDumpApp)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.z.toString(), endsWith('\x1B[90m(debugCheckElevationsEnabled)\x1B[39m\x1B[22m'));
|
||||
});
|
||||
|
||||
testWithoutContext('should not create a help text longer than maxLineWidth without ansi support', () {
|
||||
@@ -175,24 +185,29 @@ void main() {
|
||||
wrapColumn: maxLineWidth,
|
||||
);
|
||||
|
||||
expect(commandHelp.L.toString(), equals('\x1B[1mL\x1B[22m Dump layer tree to the console. \x1B[90m(debugDumpLayerTree)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.P.toString(), equals('\x1B[1mP\x1B[22m Toggle performance overlay. \x1B[90m(WidgetsApp.showPerformanceOverlay)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.I.toString(), equals('\x1B[1mI\x1B[22m Toggle oversized image inversion. \x1B[90m(debugInvertOversizedImages)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.L.toString(), equals('\x1B[1mL\x1B[22m Dump layer tree to the console. \x1B[90m(debugDumpLayerTree)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.M.toString(), equals('\x1B[1mM\x1B[22m Write SkSL shaders to a unique file in the project directory.'));
|
||||
expect(commandHelp.P.toString(), equals('\x1B[1mP\x1B[22m Toggle performance overlay. \x1B[90m(WidgetsApp.showPerformanceOverlay)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.R.toString(), equals('\x1B[1mR\x1B[22m Hot restart.'));
|
||||
expect(commandHelp.S.toString(), equals('\x1B[1mS\x1B[22m Dump accessibility tree in traversal order. \x1B[90m(debugDumpSemantics)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.U.toString(), equals('\x1B[1mU\x1B[22m Dump accessibility tree in inverse hit test order. \x1B[90m(debugDumpSemantics)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.a.toString(), equals('\x1B[1ma\x1B[22m Toggle timeline events for all widget build methods. \x1B[90m(debugProfileWidgetBuilds)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.S.toString(), equals('\x1B[1mS\x1B[22m Dump accessibility tree in traversal order. \x1B[90m(debugDumpSemantics)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.U.toString(), equals('\x1B[1mU\x1B[22m Dump accessibility tree in inverse hit test order. \x1B[90m(debugDumpSemantics)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.a.toString(), equals('\x1B[1ma\x1B[22m Toggle timeline events for all widget build methods. \x1B[90m(debugProfileWidgetBuilds)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.b.toString(), equals('\x1B[1mb\x1B[22m Toggle platform brightness (dark and light mode). \x1B[90m(debugBrightnessOverride)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.c.toString(), equals('\x1B[1mc\x1B[22m Clear the screen'));
|
||||
expect(commandHelp.d.toString(), equals('\x1B[1md\x1B[22m Detach (terminate "flutter run" but leave application running).'));
|
||||
expect(commandHelp.g.toString(), equals('\x1B[1mg\x1B[22m Run source code generators.'));
|
||||
expect(commandHelp.h.toString(), equals('\x1B[1mh\x1B[22m Repeat this help message.'));
|
||||
expect(commandHelp.i.toString(), equals('\x1B[1mi\x1B[22m Toggle widget inspector. \x1B[90m(WidgetsApp.showWidgetInspectorOverride)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.o.toString(), equals('\x1B[1mo\x1B[22m Simulate different operating systems. \x1B[90m(defaultTargetPlatform)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.p.toString(), equals('\x1B[1mp\x1B[22m Toggle the display of construction lines. \x1B[90m(debugPaintSizeEnabled)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.hWithDetails.toString(), equals('\x1B[1mh\x1B[22m Repeat this help message.'));
|
||||
expect(commandHelp.hWithoutDetails.toString(), equals('\x1B[1mh\x1B[22m List all available interactive commands.'));
|
||||
expect(commandHelp.i.toString(), equals('\x1B[1mi\x1B[22m Toggle widget inspector. \x1B[90m(WidgetsApp.showWidgetInspectorOverride)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.o.toString(), equals('\x1B[1mo\x1B[22m Simulate different operating systems. \x1B[90m(defaultTargetPlatform)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.p.toString(), equals('\x1B[1mp\x1B[22m Toggle the display of construction lines. \x1B[90m(debugPaintSizeEnabled)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.q.toString(), equals('\x1B[1mq\x1B[22m Quit (terminate the application on the device).'));
|
||||
expect(commandHelp.r.toString(), equals('\x1B[1mr\x1B[22m Hot reload. $fire$fire$fire'));
|
||||
expect(commandHelp.s.toString(), equals('\x1B[1ms\x1B[22m Save a screenshot to flutter.png.'));
|
||||
expect(commandHelp.t.toString(), equals('\x1B[1mt\x1B[22m Dump rendering tree to the console. \x1B[90m(debugDumpRenderTree)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.w.toString(), equals('\x1B[1mw\x1B[22m Dump widget hierarchy to the console. \x1B[90m(debugDumpApp)\x1B[39m\x1b[22m'));
|
||||
expect(commandHelp.z.toString(), equals('\x1B[1mz\x1B[22m Toggle elevation checker.'));
|
||||
expect(commandHelp.t.toString(), equals('\x1B[1mt\x1B[22m Dump rendering tree to the console. \x1B[90m(debugDumpRenderTree)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.w.toString(), equals('\x1B[1mw\x1B[22m Dump widget hierarchy to the console. \x1B[90m(debugDumpApp)\x1B[39m\x1B[22m'));
|
||||
expect(commandHelp.z.toString(), equals('\x1B[1mz\x1B[22m Toggle elevation checker. \x1B[90m(debugCheckElevationsEnabled)\x1B[39m\x1B[22m'));
|
||||
});
|
||||
|
||||
testWithoutContext('should create the correct help text without ansi support', () {
|
||||
@@ -201,15 +216,20 @@ void main() {
|
||||
wrapColumn: maxLineWidth,
|
||||
);
|
||||
|
||||
expect(commandHelp.I.toString(), equals('I Toggle oversized image inversion. (debugInvertOversizedImages)'));
|
||||
expect(commandHelp.M.toString(), equals('M Write SkSL shaders to a unique file in the project directory.'));
|
||||
expect(commandHelp.L.toString(), equals('L Dump layer tree to the console. (debugDumpLayerTree)'));
|
||||
expect(commandHelp.P.toString(), equals('P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)'));
|
||||
expect(commandHelp.R.toString(), equals('R Hot restart.'));
|
||||
expect(commandHelp.S.toString(), equals('S Dump accessibility tree in traversal order. (debugDumpSemantics)'));
|
||||
expect(commandHelp.U.toString(), equals('U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)'));
|
||||
expect(commandHelp.a.toString(), equals('a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)'));
|
||||
expect(commandHelp.b.toString(), equals('b Toggle platform brightness (dark and light mode). (debugBrightnessOverride)'));
|
||||
expect(commandHelp.c.toString(), equals('c Clear the screen'));
|
||||
expect(commandHelp.d.toString(), equals('d Detach (terminate "flutter run" but leave application running).'));
|
||||
expect(commandHelp.g.toString(), equals('g Run source code generators.'));
|
||||
expect(commandHelp.h.toString(), equals('h Repeat this help message.'));
|
||||
expect(commandHelp.hWithDetails.toString(), equals('h Repeat this help message.'));
|
||||
expect(commandHelp.hWithoutDetails.toString(), equals('h List all available interactive commands.'));
|
||||
expect(commandHelp.i.toString(), equals('i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)'));
|
||||
expect(commandHelp.o.toString(), equals('o Simulate different operating systems. (defaultTargetPlatform)'));
|
||||
expect(commandHelp.p.toString(), equals('p Toggle the display of construction lines. (debugPaintSizeEnabled)'));
|
||||
@@ -218,7 +238,7 @@ void main() {
|
||||
expect(commandHelp.s.toString(), equals('s Save a screenshot to flutter.png.'));
|
||||
expect(commandHelp.t.toString(), equals('t Dump rendering tree to the console. (debugDumpRenderTree)'));
|
||||
expect(commandHelp.w.toString(), equals('w Dump widget hierarchy to the console. (debugDumpApp)'));
|
||||
expect(commandHelp.z.toString(), equals('z Toggle elevation checker.'));
|
||||
expect(commandHelp.z.toString(), equals('z Toggle elevation checker. (debugCheckElevationsEnabled)'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1465,7 +1465,7 @@ void main() {
|
||||
expect(testLogger.statusText, isEmpty);
|
||||
}));
|
||||
|
||||
testUsingContext('ResidentRunner printHelpDetails', () => testbed.run(() {
|
||||
testUsingContext('ResidentRunner printHelpDetails hot runner', () => testbed.run(() {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
||||
|
||||
residentRunner.printHelp(details: true);
|
||||
@@ -1484,25 +1484,56 @@ void main() {
|
||||
'Flutter run key commands.',
|
||||
commandHelp.r,
|
||||
commandHelp.R,
|
||||
commandHelp.h,
|
||||
commandHelp.c,
|
||||
commandHelp.q,
|
||||
commandHelp.s,
|
||||
commandHelp.b,
|
||||
commandHelp.w,
|
||||
commandHelp.t,
|
||||
commandHelp.L,
|
||||
commandHelp.S,
|
||||
commandHelp.U,
|
||||
commandHelp.i,
|
||||
commandHelp.I,
|
||||
commandHelp.p,
|
||||
commandHelp.I,
|
||||
commandHelp.o,
|
||||
commandHelp.b,
|
||||
commandHelp.z,
|
||||
commandHelp.g,
|
||||
commandHelp.M,
|
||||
commandHelp.P,
|
||||
commandHelp.a,
|
||||
commandHelp.M,
|
||||
commandHelp.g,
|
||||
commandHelp.hWithDetails,
|
||||
commandHelp.c,
|
||||
commandHelp.q,
|
||||
'',
|
||||
'💪 Running with sound null safety 💪',
|
||||
'',
|
||||
'An Observatory debugger and profiler on FakeDevice is available at: null',
|
||||
'',
|
||||
].join('\n')
|
||||
));
|
||||
}));
|
||||
|
||||
testUsingContext('ResidentRunner printHelp hot runner', () => testbed.run(() {
|
||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
||||
|
||||
residentRunner.printHelp(details: false);
|
||||
|
||||
final CommandHelp commandHelp = residentRunner.commandHelp;
|
||||
|
||||
// supports service protocol
|
||||
expect(residentRunner.supportsServiceProtocol, true);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, true);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, true);
|
||||
// commands
|
||||
expect(testLogger.statusText, equals(
|
||||
<dynamic>[
|
||||
'Flutter run key commands.',
|
||||
commandHelp.r,
|
||||
commandHelp.R,
|
||||
commandHelp.hWithoutDetails,
|
||||
commandHelp.c,
|
||||
commandHelp.q,
|
||||
'',
|
||||
'💪 Running with sound null safety 💪',
|
||||
'',
|
||||
@@ -1538,7 +1569,40 @@ void main() {
|
||||
<dynamic>[
|
||||
'Flutter run key commands.',
|
||||
commandHelp.s,
|
||||
commandHelp.h,
|
||||
commandHelp.hWithDetails,
|
||||
commandHelp.c,
|
||||
commandHelp.q,
|
||||
''
|
||||
].join('\n')
|
||||
));
|
||||
}));
|
||||
|
||||
testUsingContext('ResidentRunner printHelp cold runner', () => testbed.run(() {
|
||||
fakeVmServiceHost = null;
|
||||
residentRunner = ColdRunner(
|
||||
<FlutterDevice>[
|
||||
mockFlutterDevice,
|
||||
],
|
||||
stayResident: false,
|
||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.release),
|
||||
target: 'main.dart',
|
||||
devtoolsHandler: createNoOpHandler,
|
||||
);
|
||||
residentRunner.printHelp(details: false);
|
||||
|
||||
final CommandHelp commandHelp = residentRunner.commandHelp;
|
||||
|
||||
// does not supports service protocol
|
||||
expect(residentRunner.supportsServiceProtocol, false);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, false);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, false);
|
||||
// commands
|
||||
expect(testLogger.statusText, equals(
|
||||
<dynamic>[
|
||||
'Flutter run key commands.',
|
||||
commandHelp.hWithoutDetails,
|
||||
commandHelp.c,
|
||||
commandHelp.q,
|
||||
''
|
||||
|
||||
@@ -542,7 +542,7 @@ void main() {
|
||||
'Flutter run key commands.',
|
||||
startsWith('r Hot reload.'),
|
||||
'R Hot restart.',
|
||||
'h Repeat this help message.',
|
||||
'h List all available interactive commands.',
|
||||
'd Detach (terminate "flutter run" but leave application running).',
|
||||
'c Clear the screen',
|
||||
'q Quit (terminate the application on the device).',
|
||||
@@ -555,25 +555,25 @@ void main() {
|
||||
'Flutter run key commands.',
|
||||
startsWith('r Hot reload.'),
|
||||
'R Hot restart.',
|
||||
'h Repeat this help message.',
|
||||
'd Detach (terminate "flutter run" but leave application running).',
|
||||
'c Clear the screen',
|
||||
'q Quit (terminate the application on the device).',
|
||||
'b Toggle the platform brightness setting (dark and light mode). (debugBrightnessOverride)',
|
||||
'w Dump widget hierarchy to the console. (debugDumpApp)',
|
||||
't Dump rendering tree to the console. (debugDumpRenderTree)',
|
||||
'L Dump layer tree to the console. (debugDumpLayerTree)',
|
||||
'S Dump accessibility tree in traversal order. (debugDumpSemantics)',
|
||||
'U Dump accessibility tree in inverse hit test order. (debugDumpSemantics)',
|
||||
'i Toggle widget inspector. (WidgetsApp.showWidgetInspectorOverride)',
|
||||
startsWith('I Toggle oversized image inversion'),
|
||||
'p Toggle the display of construction lines. (debugPaintSizeEnabled)',
|
||||
'I Toggle oversized image inversion. (debugInvertOversizedImages)',
|
||||
'o Simulate different operating systems. (defaultTargetPlatform)',
|
||||
'z Toggle elevation checker.',
|
||||
'g Run source code generators.',
|
||||
'M Write SkSL shaders to a unique file in the project directory.',
|
||||
'b Toggle platform brightness (dark and light mode). (debugBrightnessOverride)',
|
||||
'z Toggle elevation checker. (debugCheckElevationsEnabled)',
|
||||
'P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)',
|
||||
'a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)',
|
||||
'M Write SkSL shaders to a unique file in the project directory.',
|
||||
'g Run source code generators.',
|
||||
'h Repeat this help message.',
|
||||
'd Detach (terminate "flutter run" but leave application running).',
|
||||
'c Clear the screen',
|
||||
'q Quit (terminate the application on the device).',
|
||||
'',
|
||||
contains('Running with sound null safety'),
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user