package com.cottondb.music import android.app.Application import androidx.compose.ui.test.junit4.createComposeRule import com.cottondb.music.faces.AmpFace import com.cottondb.music.faces.MusicMaterial import com.cottondb.specimen.SPECIMEN_SCREEN import com.cottondb.specimen.card import com.cottondb.specimen.specimen import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner import org.robolectric.annotation.Config import org.robolectric.annotation.GraphicsMode /** The amp head (SongAmpFace.swift) as Music's APK carries it, the clock held still. */ @RunWith(RobolectricTestRunner::class) @GraphicsMode(GraphicsMode.Mode.NATIVE) @Config(sdk = [35], qualifiers = SPECIMEN_SCREEN, application = Application::class) class AmpSpecimenTest { @get:Rule val compose = createComposeRule() private val s = PlayerSpecimens private fun shot(name: String, json: String, cover: Boolean, playing: Boolean, elapsed: Double, duration: Double) { compose.mainClock.autoAdvance = false compose.specimen("music", name, 360, 520, MusicMaterial.tolex) { AmpFace(card(json), s.lines, if (cover) s.cover() else null, s.play(playing, elapsed, duration)) } } /** RULE: playing 2:14 into 4:02: the jewel lit, the knob at the share played, the cover round behind the cloth, the volume at seven tenths. */ @Test fun ampPlaying() = shot("amp-playing", s.harbour("song.amp", volume = true), true, true, 134.0, 242.0) /** RULE: paused: the jewel dark, the record standing where it stopped. */ @Test fun ampPaused() = shot("amp-paused", s.harbour("song.amp", volume = true), true, false, 134.0, 242.0) /** RULE: with no cover the blank label behind the cloth is typed, and the sleeve's typeset blank leans upper left. */ @Test fun ampNoCover() = shot("amp-no-cover", s.harbour("song.amp", volume = true), false, true, 61.0, 242.0) /** RULE: a long name takes two lines in the hand on the top band; no volume carried stands the knob at seven o'clock. */ @Test fun ampLongTitle() = shot("amp-long-title", s.largest("song.amp", 403), false, true, 312.0, 403.0) }