/* * Copyright (c) 2025 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import 'package:flutter_test/flutter_test.dart'; import 'package:media_kit/media_kit.dart'; import 'package:splash_video/splash_video.dart'; void main() { group('VideoConfig', () { test('creates with default values', () { const config = VideoConfig(); expect(config.playImmediately, isTrue); expect(config.videoVisibilityEnum, equals(VisibilityEnum.useFullScreen)); expect(config.useSafeArea, isFalse); expect(config.volume, equals(100.0)); expect(config.onPlayerInitialized, isNull); }); test('creates with custom values', () { final config = VideoConfig( playImmediately: false, videoVisibilityEnum: VisibilityEnum.useAspectRatio, useSafeArea: true, volume: 50.0, onPlayerInitialized: (player) {}, ); expect(config.playImmediately, isFalse); expect(config.videoVisibilityEnum, equals(VisibilityEnum.useAspectRatio)); expect(config.useSafeArea, isTrue); expect(config.volume, equals(50.0)); expect(config.onPlayerInitialized, isNotNull); }); test('accepts volume range 0-100', () { const config1 = VideoConfig(volume: 0.0); const config2 = VideoConfig(volume: 100.0); const config3 = VideoConfig(volume: 50.0); expect(config1.volume, equals(0.0)); expect(config2.volume, equals(100.0)); expect(config3.volume, equals(50.0)); }); test('onPlayerInitialized callback can be invoked', () { var callbackInvoked = false; Player? capturedPlayer; final config = VideoConfig( onPlayerInitialized: (player) { callbackInvoked = true; capturedPlayer = player; }, ); final testPlayer = Player(); config.onPlayerInitialized?.call(testPlayer); expect(callbackInvoked, isTrue); expect(capturedPlayer, equals(testPlayer)); testPlayer.dispose(); }); }); group('VisibilityEnum', () { test('has all expected values', () { expect(VisibilityEnum.values.length, equals(3)); expect(VisibilityEnum.values, contains(VisibilityEnum.useFullScreen)); expect(VisibilityEnum.values, contains(VisibilityEnum.useAspectRatio)); expect(VisibilityEnum.values, contains(VisibilityEnum.none)); }); test('values are unique', () { final values = VisibilityEnum.values.toSet(); expect(values.length, equals(VisibilityEnum.values.length)); }); }); }