[flutter_tools] scaffolding for Windows UWP template (#78067)

This commit is contained in:
Jonah Williams
2021-03-16 13:43:04 -07:00
committed by GitHub
parent c30fdfbe82
commit 2584afd7ec
8 changed files with 124 additions and 100 deletions

View File

@@ -38,11 +38,14 @@ const String _kNoPlatformsMessage = 'You\'ve created a plugin project that doesn
const String frameworkRevision = '12345678';
const String frameworkChannel = 'omega';
const String _kDisabledPlatformRequestedMessage = 'currently not supported on your local environment.';
// TODO(fujino): replace FakePlatform.fromPlatform() with FakePlatform()
// This needs to be created from the local platform due to re-entrant flutter calls made in this test.
FakePlatform _kNoColorTerminalPlatform() => FakePlatform.fromPlatform(const LocalPlatform())..stdoutSupportsAnsi = false;
final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
Platform: _kNoColorTerminalPlatform,
};
const String samplesIndexJson = '''
[
{ "id": "sample1" },
@@ -702,6 +705,7 @@ void main() {
expect(projectDir.childDirectory('macos'), isNot(exists));
expect(projectDir.childDirectory('windows'), isNot(exists));
expect(projectDir.childDirectory('web'), isNot(exists));
expect(projectDir.childDirectory('winuwp'), isNot(exists));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
});
@@ -720,18 +724,42 @@ void main() {
expect(projectDir.childDirectory('macos'), isNot(exists));
expect(projectDir.childDirectory('windows'), isNot(exists));
expect(projectDir.childDirectory('web'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('linux'),
isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('macos'),
isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('windows'),
isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('web'),
isNot(exists));
expect(projectDir.childDirectory('winuwp'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('linux'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('macos'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('windows'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('web'), isNot(exists));
expect(projectDir.childDirectory('example').childDirectory('winuwp'), isNot(exists));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
});
testUsingContext('app supports Windows UWP if requested', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>[
'create',
'--no-pub',
'--platforms=winuwp',
projectDir.path,
]);
expect(projectDir.childDirectory('linux'), isNot(exists));
expect(projectDir.childDirectory('android'), isNot(exists));
expect(projectDir.childDirectory('ios'), isNot(exists));
expect(projectDir.childDirectory('windows'), isNot(exists));
expect(projectDir.childDirectory('macos'), isNot(exists));
expect(projectDir.childDirectory('web'), isNot(exists));
expect(projectDir.childDirectory('winuwp'), exists);
expect(logger.errorText, isNot(contains(_kNoPlatformsMessage)));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isWindowsUwpEnabled: true),
Logger: () => logger,
});
testUsingContext('app supports Linux if requested', () async {
Cache.flutterRoot = '../..';
@@ -745,13 +773,13 @@ void main() {
projectDir.path,
]);
expect(
projectDir.childDirectory('linux').childFile('CMakeLists.txt'), exists);
expect(projectDir.childDirectory('linux').childFile('CMakeLists.txt'), exists);
expect(projectDir.childDirectory('android'), isNot(exists));
expect(projectDir.childDirectory('ios'), isNot(exists));
expect(projectDir.childDirectory('windows'), isNot(exists));
expect(projectDir.childDirectory('macos'), isNot(exists));
expect(projectDir.childDirectory('web'), isNot(exists));
expect(projectDir.childDirectory('winuwp'), isNot(exists));
expect(logger.errorText, isNot(contains(_kNoPlatformsMessage)));
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(isLinuxEnabled: true),