Allow filtering devices to only those supported by current project (#31446)
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/base/file_system.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
@@ -9,6 +10,7 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/linux/application_package.dart';
|
||||
import 'package:flutter_tools/src/linux/linux_device.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:process/process.dart';
|
||||
|
||||
@@ -59,6 +61,27 @@ void main() {
|
||||
Platform: () => notLinux,
|
||||
});
|
||||
});
|
||||
|
||||
testUsingContext('LinuxDevice.isSupportedForProject is true with editable host app', () async {
|
||||
fs.file('pubspec.yaml').createSync();
|
||||
fs.file('.packages').createSync();
|
||||
fs.directory('linux').createSync();
|
||||
final FlutterProject flutterProject = await FlutterProject.current();
|
||||
|
||||
expect(LinuxDevice().isSupportedForProject(flutterProject), true);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => MemoryFileSystem(),
|
||||
});
|
||||
|
||||
testUsingContext('LinuxDevice.isSupportedForProject is false with no host app', () async {
|
||||
fs.file('pubspec.yaml').createSync();
|
||||
fs.file('.packages').createSync();
|
||||
final FlutterProject flutterProject = await FlutterProject.current();
|
||||
|
||||
expect(LinuxDevice().isSupportedForProject(flutterProject), false);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => MemoryFileSystem(),
|
||||
});
|
||||
}
|
||||
|
||||
class MockPlatform extends Mock implements Platform {}
|
||||
|
||||
Reference in New Issue
Block a user