summaryrefslogtreecommitdiffstats
path: root/tests/auto/slideplayer/tst_q3dsslideplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/slideplayer/tst_q3dsslideplayer.cpp')
-rw-r--r--tests/auto/slideplayer/tst_q3dsslideplayer.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/slideplayer/tst_q3dsslideplayer.cpp b/tests/auto/slideplayer/tst_q3dsslideplayer.cpp
index e0ee1f3..85e033e 100644
--- a/tests/auto/slideplayer/tst_q3dsslideplayer.cpp
+++ b/tests/auto/slideplayer/tst_q3dsslideplayer.cpp
@@ -216,6 +216,49 @@ void tst_Q3DSSlidePlayer::tst_playModes()
QCOMPARE(slideChangedSpy.count(), 0);
QCOMPARE(player->slideDeck()->currentSlide(), m_stopAtEnd);
+ // STOP AT END (Already at the end, +rate)
+ // The player is now in paused state (StopAtEnd), changing the state to Playing should move it
+ // back into paused state (StopAtEnd).
+ stateChangeSpy.clear();
+ slideChangedSpy.clear();
+
+ QCOMPARE(player->position(), player->duration());
+
+ player->play();
+ QTRY_COMPARE(player->state(), Q3DSSlidePlayer::PlayerState::Playing);
+ QTRY_COMPARE(player->state(), Q3DSSlidePlayer::PlayerState::Paused);
+
+ // paused -> playing -> paused
+ QCOMPARE(stateChangeSpy.count(), 2);
+ QCOMPARE(slideChangedSpy.count(), 0);
+ QCOMPARE(player->position(), player->duration());
+ QCOMPARE(player->slideDeck()->currentSlide(), m_stopAtEnd);
+
+ // STOP AT END (Already at the end(start), -rate)
+ // Seek to the start and set the rate to a negative value, changing the state to Playing should
+ // move it back into paused state (StopAtEnd).
+ stateChangeSpy.clear();
+ slideChangedSpy.clear();
+
+ player->seek(0.0f);
+ player->setPlaybackRate(-0.5f);
+ QCOMPARE(player->playbackRate(), -0.5f);
+ QCOMPARE(player->position(), 0.0f);
+
+ player->play();
+ QTRY_COMPARE(player->state(), Q3DSSlidePlayer::PlayerState::Playing);
+ QTRY_COMPARE(player->state(), Q3DSSlidePlayer::PlayerState::Paused);
+
+ // paused -> playing -> paused
+ QCOMPARE(stateChangeSpy.count(), 2);
+ QCOMPARE(slideChangedSpy.count(), 0);
+ QCOMPARE(player->position(), 0.0f);
+ QCOMPARE(player->slideDeck()->currentSlide(), m_stopAtEnd);
+
+ // Reset the playback rate!!!
+ player->setPlaybackRate(1.0f);
+ QCOMPARE(player->playbackRate(), 1.0f);
+
// PLAY TO PREVIOUS
player->stop();
QTRY_COMPARE(player->state(), Q3DSSlidePlayer::PlayerState::Stopped);