This commit is contained in:
@@ -59,3 +59,14 @@ TEST(AudioTest, AudioManagerVolumeClamping) {
|
||||
am.shutdown();
|
||||
std::filesystem::remove(temp_path);
|
||||
}
|
||||
|
||||
TEST(AudioTest, PlayOptionsLoopInfinite) {
|
||||
// Regression: MIX_PlayTrack() must not default to a single pass. Tracks
|
||||
// have to loop forever so playback never runs out mid-scroll; a track that
|
||||
// stops (rather than attenuates) also can't be revived by raising app
|
||||
// volume. Assert the options request infinite looping (-1).
|
||||
SDL_PropertiesID props = AudioManager::createInfiniteLoopOptions();
|
||||
ASSERT_NE(props, 0u);
|
||||
EXPECT_EQ(SDL_GetNumberProperty(props, MIX_PROP_PLAY_LOOPS_NUMBER, 0), -1);
|
||||
SDL_DestroyProperties(props);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,62 @@ TEST(ScrollerStreamsTest, InterleavesSelectedWithDefault)
|
||||
EXPECT_EQ(streams[3].audioFilename, "OriginalAudio.wav");
|
||||
}
|
||||
|
||||
TEST(ScrollerStreamsTest, InterleavedListCyclesBackToFirstSelected)
|
||||
{
|
||||
// Three selected proclamations: the built list must be
|
||||
// [S1, Default, S2, Default, S3, Default]. ScrollerPage advances through
|
||||
// this list with a modulo, so once the trailing default finishes the cycle
|
||||
// restarts at the FIRST selected proclamation — the "always on" default
|
||||
// must never accumulate or take over the queue.
|
||||
ProclamationRecord b;
|
||||
b.id = "B";
|
||||
b.title = "B";
|
||||
b.content = "bbbb";
|
||||
b.selected = true;
|
||||
b.solfeggio_frequency_id = 2;
|
||||
|
||||
ProclamationRecord c;
|
||||
c.id = "C";
|
||||
c.title = "C";
|
||||
c.content = "cccc";
|
||||
c.selected = true;
|
||||
c.solfeggio_frequency_id = 3;
|
||||
|
||||
ProclamationRecord d;
|
||||
d.id = "D";
|
||||
d.title = "D";
|
||||
d.content = "dddd";
|
||||
d.selected = true;
|
||||
d.solfeggio_frequency_id = 4;
|
||||
|
||||
ProclamationRecord def;
|
||||
def.id = kDefaultId;
|
||||
def.title = "Default";
|
||||
def.content = "dddddddddd";
|
||||
def.selected = true;
|
||||
def.solfeggio_frequency_id = 5;
|
||||
|
||||
auto streams = buildStreams({b, def, c, d}, {}, palette(), {}, kDefaultId);
|
||||
|
||||
ASSERT_EQ(streams.size(), 6u);
|
||||
EXPECT_EQ(streams[0].name, "B");
|
||||
EXPECT_EQ(streams[1].name, "Default");
|
||||
EXPECT_EQ(streams[2].name, "C");
|
||||
EXPECT_EQ(streams[3].name, "Default");
|
||||
EXPECT_EQ(streams[4].name, "D");
|
||||
EXPECT_EQ(streams[5].name, "Default");
|
||||
|
||||
// Every default copy is independent playback state (fresh counters), so a
|
||||
// copy finishing its passes advances to the next stream rather than
|
||||
// restarting "the default" forever.
|
||||
for (size_t i = 1; i < streams.size(); i += 2) {
|
||||
EXPECT_EQ(streams[i].name, "Default");
|
||||
EXPECT_EQ(streams[i].completed, 0) << "default copy " << i;
|
||||
EXPECT_EQ(streams[i].wordsPlaced, 0) << "default copy " << i;
|
||||
EXPECT_EQ(streams[i].repeat, kDefaultRepeatCount) << "default copy " << i;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ScrollerStreamsTest, DefaultOnlyWhenNothingSelected)
|
||||
{
|
||||
ProclamationRecord p1;
|
||||
|
||||
Reference in New Issue
Block a user