macos_workflow_test.dart 1.69 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'package:flutter_tools/src/base/platform.dart';
6 7
import 'package:flutter_tools/src/macos/macos_workflow.dart';

8
import '../../src/common.dart';
9
import '../../src/fakes.dart';
10

11 12 13 14
final FakePlatform macOS = FakePlatform(
  operatingSystem: 'macos',
);

15
final FakePlatform linux = FakePlatform();
16

17
void main() {
18 19 20 21 22
  testWithoutContext('Applies to macOS platform', () {
    final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
      platform: macOS,
      featureFlags: TestFeatureFlags(isMacOSEnabled: true),
    );
23 24 25 26 27

    expect(macOSWorkflow.appliesToHostPlatform, true);
    expect(macOSWorkflow.canListDevices, true);
    expect(macOSWorkflow.canLaunchDevices, true);
    expect(macOSWorkflow.canListEmulators, false);
28 29 30 31 32 33 34
  });

  testWithoutContext('Does not apply to non-macOS platform', () {
    final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
      platform: linux,
      featureFlags: TestFeatureFlags(isMacOSEnabled: true),
    );
35 36 37 38 39

    expect(macOSWorkflow.appliesToHostPlatform, false);
    expect(macOSWorkflow.canListDevices, false);
    expect(macOSWorkflow.canLaunchDevices, false);
    expect(macOSWorkflow.canListEmulators, false);
40 41 42 43 44
  });

  testWithoutContext('Does not apply when feature is disabled', () {
    final MacOSWorkflow macOSWorkflow = MacOSWorkflow(
      platform: macOS,
45
      featureFlags: TestFeatureFlags(),
46
    );
47 48 49 50 51

    expect(macOSWorkflow.appliesToHostPlatform, false);
    expect(macOSWorkflow.canListDevices, false);
    expect(macOSWorkflow.canLaunchDevices, false);
    expect(macOSWorkflow.canListEmulators, false);
52
  });
53
}