summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2021-01-25 17:12:11 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2021-01-27 15:16:20 +0100
commit3a5a404a5379cd9595d1cc61486aff11148f4302 (patch)
tree125c0b9206f8d1cc03931f06f7f6cccd6805f0e5 /tests
parent67ced4da5ab6f9bb63303a0850457d7a526866d3 (diff)
Port QMovie to the new property system
Task-number: QTBUG-85520 Task-number: QTBUG-85521 Change-Id: Ib936020260cf01a5221b63fb1eb0ccb23f5553a3 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qmovie/tst_qmovie.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/gui/image/qmovie/tst_qmovie.cpp b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
index a54bf03fb2..c1abeccba5 100644
--- a/tests/auto/gui/image/qmovie/tst_qmovie.cpp
+++ b/tests/auto/gui/image/qmovie/tst_qmovie.cpp
@@ -64,6 +64,7 @@ private slots:
void infiniteLoop();
#endif
void emptyMovie();
+ void bindings();
};
// Testing get/set functions
@@ -230,5 +231,37 @@ void tst_QMovie::emptyMovie()
QCOMPARE(movie.currentFrameNumber(), -1);
}
+void tst_QMovie::bindings()
+{
+ QMovie movie;
+
+ // speed property
+ QCOMPARE(movie.speed(), 100);
+ QProperty<int> speed;
+ movie.bindableSpeed().setBinding(Qt::makePropertyBinding(speed));
+ speed = 50;
+ QCOMPARE(movie.speed(), 50);
+
+ QProperty<int> speedObserver;
+ speedObserver.setBinding([&] { return movie.speed(); });
+ movie.setSpeed(75);
+ QCOMPARE(speedObserver, 75);
+
+ // chacheMode property
+ QCOMPARE(movie.cacheMode(), QMovie::CacheNone);
+ QProperty<QMovie::CacheMode> cacheMode;
+ movie.bindableCacheMode().setBinding(Qt::makePropertyBinding(cacheMode));
+ cacheMode = QMovie::CacheAll;
+ QCOMPARE(movie.cacheMode(), QMovie::CacheAll);
+
+ movie.setCacheMode(QMovie::CacheNone);
+
+ QProperty<QMovie::CacheMode> cacheModeObserver;
+ QCOMPARE(cacheModeObserver, QMovie::CacheNone);
+ cacheModeObserver.setBinding([&] { return movie.cacheMode(); });
+ movie.setCacheMode(QMovie::CacheAll);
+ QCOMPARE(cacheModeObserver, QMovie::CacheAll);
+}
+
QTEST_MAIN(tst_QMovie)
#include "tst_qmovie.moc"