summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-29 10:49:57 (GMT)
committerJani Hautakangas <ext-jani.hautakangas@nokia.com>2009-09-29 10:49:57 (GMT)
commitcc910f05b560bf561b45e7d726ffd82f3eb28a7b (patch)
tree3be96de0b4174cf03a7e4a45d96866d7c2f0d7b7 /tests
parent9a7ca912ce72476bda57f2306b38e5f6e928fbf5 (diff)
parent8fe49324d8b58eb1c0945259da00905cca02822c (diff)
downloadQt-cc910f05b560bf561b45e7d726ffd82f3eb28a7b.zip
Qt-cc910f05b560bf561b45e7d726ffd82f3eb28a7b.tar.gz
Qt-cc910f05b560bf561b45e7d726ffd82f3eb28a7b.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp4
-rw-r--r--tests/auto/qpixmapcache/tst_qpixmapcache.cpp22
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp33
3 files changed, 47 insertions, 12 deletions
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index a129f7f..acd23b0 100644
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -379,6 +379,10 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup()
{
+#if defined(Q_OS_SYMBIAN)
+ // give the Symbian app start event queue time to clear
+ QTest::qWait(1000);
+#endif
// test if children can be activated when their group is stopped
QParallelAnimationGroup group;
diff --git a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
index 6d262ba..b487d74 100644
--- a/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
+++ b/tests/auto/qpixmapcache/tst_qpixmapcache.cpp
@@ -171,7 +171,7 @@ void tst_QPixmapCache::setCacheLimit()
QPixmapCache::setCacheLimit(0);
QPixmapCache::setCacheLimit(1000);
QPixmapCache::Key key2 = QPixmapCache::insert(*p1);
- QCOMPARE(getPrivate(key2)->key, 2);
+ QCOMPARE(getPrivate(key2)->key, 1);
QVERIFY(QPixmapCache::find(key, &p2) == 0);
QVERIFY(QPixmapCache::find(key2, &p2) != 0);
QCOMPARE(p2, *p1);
@@ -200,7 +200,7 @@ void tst_QPixmapCache::find()
{
QPixmap p1(10, 10);
p1.fill(Qt::red);
- QPixmapCache::insert("P1", p1);
+ QVERIFY(QPixmapCache::insert("P1", p1));
QPixmap p2;
QVERIFY(QPixmapCache::find("P1", p2));
@@ -222,13 +222,13 @@ void tst_QPixmapCache::find()
QCOMPARE(p1, p2);
QPixmapCache::clear();
+ QPixmapCache::setCacheLimit(128);
key = QPixmapCache::insert(p1);
//The int part of the API
- // make sure it doesn't explode
QList<QPixmapCache::Key> keys;
- for (int i = 0; i < 40000; ++i)
+ for (int i = 0; i < 4000; ++i)
QPixmapCache::insert(p1);
//at that time the first key has been erase because no more place in the cache
@@ -293,8 +293,6 @@ void tst_QPixmapCache::insert()
estimatedNum = (1024 * QPixmapCache::cacheLimit())
/ ((p1.width() * p1.height() * p1.depth()) / 8);
QVERIFY(num <= estimatedNum);
- QPixmapCache::insert(p3);
-
}
void tst_QPixmapCache::replace()
@@ -307,13 +305,16 @@ void tst_QPixmapCache::replace()
p2.fill(Qt::yellow);
QPixmapCache::Key key = QPixmapCache::insert(p1);
+ QCOMPARE(getPrivate(key)->isValid, true);
QPixmap p3;
QVERIFY(QPixmapCache::find(key, &p3) == 1);
- QPixmapCache::replace(key,p2);
+ QPixmapCache::replace(key, p2);
QVERIFY(QPixmapCache::find(key, &p3) == 1);
+ QCOMPARE(getPrivate(key)->isValid, true);
+ QCOMPARE(getPrivate(key)->key, 1);
QCOMPARE(p3.width(), 10);
QCOMPARE(p3.height(), 10);
@@ -392,11 +393,8 @@ void tst_QPixmapCache::clear()
QPixmap p1(10, 10);
p1.fill(Qt::red);
-#ifdef Q_OS_WINCE
- const int numberOfKeys = 10000;
-#else
- const int numberOfKeys = 20000;
-#endif
+ const int numberOfKeys = 40000;
+
for (int i = 0; i < numberOfKeys; ++i)
QVERIFY(QPixmapCache::find("x" + QString::number(i)) == 0);
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 7244d72..37b34bf 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -176,6 +176,7 @@ private slots:
void twoAnimatedTransitions();
void playAnimationTwice();
void nestedTargetStateForAnimation();
+ void polishedSignalTransitionsReuseAnimationGroup();
void animatedGlobalRestoreProperty();
void specificTargetValueOfAnimation();
@@ -3115,6 +3116,38 @@ void tst_QStateMachine::nestedTargetStateForAnimation()
QCOMPARE(counter.counter, 2);
}
+void tst_QStateMachine::polishedSignalTransitionsReuseAnimationGroup()
+{
+ QStateMachine machine;
+ QObject *object = new QObject(&machine);
+ object->setProperty("foo", 0);
+
+ QState *s1 = new QState(&machine);
+ s1->assignProperty(object, "foo", 123);
+ QState *s2 = new QState(&machine);
+ s2->assignProperty(object, "foo", 456);
+ QState *s3 = new QState(&machine);
+ s3->assignProperty(object, "foo", 789);
+ QFinalState *s4 = new QFinalState(&machine);
+
+ QParallelAnimationGroup animationGroup;
+ animationGroup.addAnimation(new QPropertyAnimation(object, "foo"));
+ QSignalSpy animationFinishedSpy(&animationGroup, SIGNAL(finished()));
+ s1->addTransition(s1, SIGNAL(polished()), s2)->addAnimation(&animationGroup);
+ s2->addTransition(s2, SIGNAL(polished()), s3)->addAnimation(&animationGroup);
+ s3->addTransition(s3, SIGNAL(polished()), s4);
+
+ machine.setInitialState(s1);
+ QSignalSpy machineFinishedSpy(&machine, SIGNAL(finished()));
+ machine.start();
+ QTRY_COMPARE(machineFinishedSpy.count(), 1);
+ QCOMPARE(machine.configuration().size(), 1);
+ QVERIFY(machine.configuration().contains(s4));
+ QCOMPARE(object->property("foo").toInt(), 789);
+
+ QCOMPARE(animationFinishedSpy.count(), 2);
+}
+
void tst_QStateMachine::animatedGlobalRestoreProperty()
{
QStateMachine machine;