using System; using Paca.Mobile.Core; using Xunit; namespace Paca.Tests.Mobile; /// /// Gate 191 ~ 194: 모바일 플레이어 제스처 컨트롤 및 백그라운드 PIP 재생 세션 기계적 검증 /// public class MobilePlayerGestureAndPipGateTests { [Theory] [InlineData(100.0, 600, 1000, 60)] // 1000px 화면에서 오른쪽으로 100px 스와이프 -> 10분(600초) 영상 중 60초 앞으로 탐색 [InlineData(-50.0, 600, 1000, -30)] // 왼쪽으로 50px 스와이프 -> 30초 뒤로 탐색 [InlineData(0.0, 600, 1000, 0)] // 이동 없음 public void Gate191_PlayerGesture_Horizontal_Seek_Calculation(double deltaX, double totalDurationSec, double screenWidth, double expectedDeltaSec) { var total = TimeSpan.FromSeconds(totalDurationSec); var seekDelta = PlayerGestureController.CalculateSeekDelta(deltaX, total, screenWidth); Assert.Equal(expectedDeltaSec, Math.Round(seekDelta.TotalSeconds)); } [Fact] public void Gate192_PlayerGesture_Vertical_Brightness_And_Volume_Separation() { // 1. 좌측 영역 (X < 500 in 1000px 화면) -> 밝기 조절 var isLeftZone = PlayerGestureController.IsLeftZone(xPosition: 200, screenWidth: 1000); Assert.True(isLeftZone); // 위로 100px 스와이프 (screenHeight: 1000) -> 밝기 +0.1 var newBrightness = PlayerGestureController.CalculateLevelDelta(currentLevel: 0.5, deltaY: -100, screenHeight: 1000); Assert.Equal(0.6, Math.Round(newBrightness, 2)); // 2. 우측 영역 (X > 500) -> 볼륨 조절 var isRightZone = !PlayerGestureController.IsLeftZone(xPosition: 800, screenWidth: 1000); Assert.True(isRightZone); // 최대치 1.0 초과 방지 클램프 검증 var clampedMax = PlayerGestureController.CalculateLevelDelta(currentLevel: 0.95, deltaY: -200, screenHeight: 1000); Assert.Equal(1.0, clampedMax); // 최소치 0.0 미만 방지 클램프 검증 var clampedMin = PlayerGestureController.CalculateLevelDelta(currentLevel: 0.05, deltaY: 200, screenHeight: 1000); Assert.Equal(0.0, clampedMin); } [Fact] public void Gate193_BackgroundPlaybackSession_Metadata_And_State() { var session = new BackgroundPlaybackSession( TrackTitle: "Lo-Fi Coding Chill Beats", ArtistName: "Paca Ambient Radio", CurrentPosition: TimeSpan.FromMinutes(12), TotalDuration: TimeSpan.FromMinutes(45), IsPlaying: true ); Assert.Equal("Lo-Fi Coding Chill Beats", session.TrackTitle); Assert.True(session.IsPlaying); // 일시정지 상태 전환 var paused = session.TogglePlayPause(); Assert.False(paused.IsPlaying); } [Theory] [InlineData(33, true)] // Android 13 -> PIP 지원 [InlineData(26, true)] // Android 8.0 -> PIP 지원 [InlineData(25, false)] // Android 7.1 -> PIP 미지원 public void Gate194_PipCapability_Evaluation(int androidApiLevel, bool expectedSupported) { var isSupported = PipCapabilityInspector.IsPipSupported(androidApiLevel); Assert.Equal(expectedSupported, isSupported); } }