/// GENERATED BY testcase_gen. DO NOT MODIFY BY HAND.

// ignore_for_file: deprecated_member_use,constant_identifier_names

import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/foundation.dart';
import 'package:fake_test_app/main.dart' as app;
import 'package:iris_tester/iris_tester.dart';
import 'package:iris_method_channel/iris_method_channel.dart';

void videoDeviceManagerSmokeTestCases() {
  testWidgets(
    'VideoDeviceManager.enumerateVideoDevices',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        await videoDeviceManager.enumerateVideoDevices();
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[VideoDeviceManager.enumerateVideoDevices] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.setDevice',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        String deviceIdUTF8 = "hello";
        await videoDeviceManager.setDevice(
          deviceIdUTF8,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint('[VideoDeviceManager.setDevice] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.getDevice',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        await videoDeviceManager.getDevice();
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint('[VideoDeviceManager.getDevice] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.numberOfCapabilities',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        String deviceIdUTF8 = "hello";
        await videoDeviceManager.numberOfCapabilities(
          deviceIdUTF8,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[VideoDeviceManager.numberOfCapabilities] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.getCapability',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        String deviceIdUTF8 = "hello";
        int deviceCapabilityNumber = 5;
        await videoDeviceManager.getCapability(
          deviceIdUTF8: deviceIdUTF8,
          deviceCapabilityNumber: deviceCapabilityNumber,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[VideoDeviceManager.getCapability] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.startDeviceTest',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        int hwnd = 5;
        await videoDeviceManager.startDeviceTest(
          hwnd,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[VideoDeviceManager.startDeviceTest] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.stopDeviceTest',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        await videoDeviceManager.stopDeviceTest();
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[VideoDeviceManager.stopDeviceTest] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );

  testWidgets(
    'VideoDeviceManager.release',
    (WidgetTester tester) async {
      String engineAppId = const String.fromEnvironment('TEST_APP_ID',
          defaultValue: '<YOUR_APP_ID>');

      RtcEngine rtcEngine = createAgoraRtcEngine();
      await rtcEngine.initialize(RtcEngineContext(
        appId: engineAppId,
        areaCode: AreaCode.areaCodeGlob.value(),
      ));
      await rtcEngine.setParameters('{"rtc.enable_debug_log": true}');

      final videoDeviceManager = rtcEngine.getVideoDeviceManager();

      try {
        await videoDeviceManager.release();
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint('[VideoDeviceManager.release] error: ${e.toString()}');
          rethrow;
        }

        if (e.code != -4) {
          // Only not supported error supported.
          rethrow;
        }
      }

      await videoDeviceManager.release();
      await rtcEngine.release();
    },
//  skip: !(),
  );
}
