summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Zelenskiy <lev.zelenskiy@nokia.com>2012-02-06 13:11:10 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-06 06:33:47 +0100
commit51ca5582c2475ea91fe2d86793f000f7bed41f51 (patch)
tree2a00218178d6e1857540d24fde06afd6c58c360a
parent0d9a5cc5b39db46701af1a6944c8c6f31e75ae6f (diff)
QMediaPlayer::setPosition: do not check isSeekable and do not bound by duration
To allow setPosition to be called in stopped state we no longer check if the player is in seekable state and allow position to be greater than duration. Unit test has been updated accordingly. Change-Id: I29447ffe797a7cc3dcc80d20b2527e9eda493ab6 Reviewed-by: Michael Goddard <michael.goddard@nokia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
-rw-r--r--src/multimedia/playback/qmediaplayer.cpp4
-rw-r--r--tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp5
2 files changed, 2 insertions, 7 deletions
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp
index 1542cff0..5333b7f9 100644
--- a/src/multimedia/playback/qmediaplayer.cpp
+++ b/src/multimedia/playback/qmediaplayer.cpp
@@ -601,10 +601,10 @@ void QMediaPlayer::setPosition(qint64 position)
{
Q_D(QMediaPlayer);
- if (d->control == 0 || !isSeekable())
+ if (d->control == 0)
return;
- d->control->setPosition(qBound(qint64(0), position, duration()));
+ d->control->setPosition(qMax(position, 0ll));
}
void QMediaPlayer::setVolume(int v)
diff --git a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp
index 0d3b0959..17162b48 100644
--- a/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp
+++ b/tests/auto/unit/qmediaplayer/tst_qmediaplayer.cpp
@@ -379,11 +379,6 @@ void tst_QMediaPlayer::testPosition()
QCOMPARE(player->position(), qint64(0));
QCOMPARE(spy.count(), position == 0 ? 0 : 1); }
- mockService->setPosition(position);
- { QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));
- player->setPosition(duration + 1);
- QCOMPARE(player->position(), duration);
- QCOMPARE(spy.count(), position == duration ? 0 : 1); }
}
else {
QSignalSpy spy(player, SIGNAL(positionChanged(qint64)));