/// 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:iris_tester/iris_tester.dart';
import 'package:iris_method_channel/iris_method_channel.dart';

void generatedTestCases() {
  testWidgets(
    'H265Transcoder.enableTranscode',
    (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 h265Transcoder = rtcEngine.getH265Transcoder();

      try {
        String token = "hello";
        String channel = "hello";
        int uid = 5;
        await h265Transcoder.enableTranscode(
          token: token,
          channel: channel,
          uid: uid,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint('[H265Transcoder.enableTranscode] error: ${e.toString()}');
          rethrow;
        }

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

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

  testWidgets(
    'H265Transcoder.queryChannel',
    (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 h265Transcoder = rtcEngine.getH265Transcoder();

      try {
        String token = "hello";
        String channel = "hello";
        int uid = 5;
        await h265Transcoder.queryChannel(
          token: token,
          channel: channel,
          uid: uid,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint('[H265Transcoder.queryChannel] error: ${e.toString()}');
          rethrow;
        }

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

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

  testWidgets(
    'H265Transcoder.triggerTranscode',
    (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 h265Transcoder = rtcEngine.getH265Transcoder();

      try {
        String token = "hello";
        String channel = "hello";
        int uid = 5;
        await h265Transcoder.triggerTranscode(
          token: token,
          channel: channel,
          uid: uid,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[H265Transcoder.triggerTranscode] error: ${e.toString()}');
          rethrow;
        }

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

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

  testWidgets(
    'H265Transcoder.registerTranscoderObserver',
    (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 h265Transcoder = rtcEngine.getH265Transcoder();

      try {
        H265TranscoderObserver observer = H265TranscoderObserver(
          onEnableTranscode: (H265TranscodeResult result) {},
          onQueryChannel: (H265TranscodeResult result, String originChannel,
              String transcodeChannel) {},
          onTriggerTranscode: (H265TranscodeResult result) {},
        );
        h265Transcoder.registerTranscoderObserver(
          observer,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[H265Transcoder.registerTranscoderObserver] error: ${e.toString()}');
          rethrow;
        }

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

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

  testWidgets(
    'H265Transcoder.unregisterTranscoderObserver',
    (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 h265Transcoder = rtcEngine.getH265Transcoder();

      try {
        H265TranscoderObserver observer = H265TranscoderObserver(
          onEnableTranscode: (H265TranscodeResult result) {},
          onQueryChannel: (H265TranscodeResult result, String originChannel,
              String transcodeChannel) {},
          onTriggerTranscode: (H265TranscodeResult result) {},
        );
        h265Transcoder.unregisterTranscoderObserver(
          observer,
        );
      } catch (e) {
        if (e is! AgoraRtcException) {
          debugPrint(
              '[H265Transcoder.unregisterTranscoderObserver] error: ${e.toString()}');
          rethrow;
        }

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

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