1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.8
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/macos/macos_workflow.dart';
import '../../src/common.dart';
import '../../src/fakes.dart';
final FakePlatform macOS = FakePlatform(
operatingSystem: 'macos',
);
final FakePlatform linux = FakePlatform(
operatingSystem: 'linux',
);
void main() {
testWithoutContext('Applies to macOS platform', () {
final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
platform: macOS,
featureFlags: TestFeatureFlags(isMacOSEnabled: true),
);
expect(macOSWorkflow.appliesToHostPlatform, true);
expect(macOSWorkflow.canListDevices, true);
expect(macOSWorkflow.canLaunchDevices, true);
expect(macOSWorkflow.canListEmulators, false);
});
testWithoutContext('Does not apply to non-macOS platform', () {
final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
platform: linux,
featureFlags: TestFeatureFlags(isMacOSEnabled: true),
);
expect(macOSWorkflow.appliesToHostPlatform, false);
expect(macOSWorkflow.canListDevices, false);
expect(macOSWorkflow.canLaunchDevices, false);
expect(macOSWorkflow.canListEmulators, false);
});
testWithoutContext('Does not apply when feature is disabled', () {
final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
platform: macOS,
featureFlags: TestFeatureFlags(isMacOSEnabled: false),
);
expect(macOSWorkflow.appliesToHostPlatform, false);
expect(macOSWorkflow.canListDevices, false);
expect(macOSWorkflow.canLaunchDevices, false);
expect(macOSWorkflow.canListEmulators, false);
});
}