-
-
Notifications
You must be signed in to change notification settings - Fork 26
Fix active workout video page #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../src/commonTest/kotlin/com/devil/phoenixproject/presentation/WorkoutHudVideoWiringTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| package com.devil.phoenixproject.presentation | ||
|
|
||
| import com.devil.phoenixproject.testutil.readProjectFile | ||
| import kotlin.test.Test | ||
| import kotlin.test.assertNotNull | ||
| import kotlin.test.assertTrue | ||
|
|
||
| /** Source-level guard for issue #643: active-workout HUD keeps its video page. */ | ||
| class WorkoutHudVideoWiringTest { | ||
|
|
||
| @Test | ||
| fun activeHudKeepsVideoPageBetweenMetricsAndStats() { | ||
| val src = readWorkoutHudSource() | ||
|
|
||
| assertTrue( | ||
| src.contains("exerciseRepository: ExerciseRepository") && | ||
| src.contains("enableVideoPlayback: Boolean"), | ||
| "WorkoutHud must accept video dependencies instead of dropping the preference/repository.", | ||
| ) | ||
| assertTrue( | ||
| src.contains("rememberPagerState(pageCount = { 3 })"), | ||
| "WorkoutHud must expose Metrics, Video, and Stats pages.", | ||
| ) | ||
| assertTrue( | ||
| src.contains("1 -> InstructionPage(") && src.contains("2 -> StatsPage("), | ||
| "WorkoutHud must keep the video page between metrics and stats.", | ||
| ) | ||
| assertTrue( | ||
| src.contains("Video Playback Disabled") && src.contains("VideoPlayer("), | ||
| "InstructionPage must render the disabled state and exercise video player.", | ||
| ) | ||
| assertTrue( | ||
| src.contains("selectedExerciseId = workoutParameters.selectedExerciseId") && | ||
| src.contains("currentExercise?.exercise?.id ?: selectedExerciseId"), | ||
| "InstructionPage must load a selected exercise video when an active workout has no routine.", | ||
| ) | ||
| assertTrue( | ||
| src.contains("var videoEntity by remember(currentExerciseIndex, exerciseId)") && | ||
| src.contains("var isLoading by remember(currentExerciseIndex, exerciseId)"), | ||
| "InstructionPage state must reset when either the routine position or exercise changes.", | ||
| ) | ||
| } | ||
|
|
||
| @Test | ||
| fun workoutTabForwardsVideoSettingsIntoActiveHud() { | ||
| val src = readWorkoutTabSource() | ||
| val hudCall = src.substringAfter("WorkoutHud(", missingDelimiterValue = "") | ||
| .substringBefore("RepQualityIndicator", missingDelimiterValue = "") | ||
| assertTrue(hudCall.isNotEmpty(), "WorkoutTab must call WorkoutHud for connected active workouts.") | ||
|
|
||
| assertTrue( | ||
| hudCall.contains("exerciseRepository = exerciseRepository,") && | ||
| hudCall.contains("enableVideoPlayback = enableVideoPlayback,"), | ||
| "WorkoutTab must forward ExerciseRepository and enableVideoPlayback into WorkoutHud.", | ||
| ) | ||
| } | ||
|
|
||
| private fun readWorkoutHudSource(): String { | ||
| val src = readProjectFile("src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/WorkoutHud.kt") | ||
| assertNotNull(src, "Could not locate WorkoutHud.kt") | ||
| return src | ||
| } | ||
|
|
||
| private fun readWorkoutTabSource(): String { | ||
| val src = readProjectFile("src/commonMain/kotlin/com/devil/phoenixproject/presentation/screen/WorkoutTab.kt") | ||
| assertNotNull(src, "Could not locate WorkoutTab.kt") | ||
| return src | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.