summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qanimationgroup/tst_qanimationgroup.cpp84
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp31
-rw-r--r--tests/auto/qcssparser/tst_qcssparser.cpp3
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp261
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp43
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp74
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp220
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp72
-rw-r--r--tests/auto/qlabel/tst_qlabel.cpp8
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp16
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp27
-rw-r--r--tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp136
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp20
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp506
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp19
-rw-r--r--tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp10
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp4
-rw-r--r--tests/auto/qwidgetaction/tst_qwidgetaction.cpp2
-rw-r--r--tests/auto/uiloader/baseline/css_itemview_task258382.ui179
19 files changed, 1079 insertions, 636 deletions
diff --git a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
index 81c51eddde..b4e4a491fd 100644
--- a/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
+++ b/tests/auto/qanimationgroup/tst_qanimationgroup.cpp
@@ -165,9 +165,9 @@ void tst_QAnimationGroup::emptyGroup()
QCOMPARE(groupStateChangedSpy.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
@@ -180,9 +180,9 @@ void tst_QAnimationGroup::emptyGroup()
group.start();
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(2).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(3).first()),
QAnimationGroup::Stopped);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
@@ -259,54 +259,54 @@ void tst_QAnimationGroup::setCurrentTime()
QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped);
QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(sequence->currentTime(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 1);
- QCOMPARE(a2_s_o1->currentTime(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 1);
- QCOMPARE(a1_s_o3->currentTime(), 0);
- QCOMPARE(a1_p_o1->currentTime(), 1);
- QCOMPARE(a1_p_o2->currentTime(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 1);
- QCOMPARE(notTimeDriven->currentTime(), 1);
- QCOMPARE(loopsForever->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 1);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 1);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
// Current time = 250
group.setCurrentTime(250);
- QCOMPARE(group.currentTime(), 250);
- QCOMPARE(sequence->currentTime(), 250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 0);
- QCOMPARE(a1_p_o1->currentTime(), 250);
- QCOMPARE(a1_p_o2->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 0);
QCOMPARE(a1_p_o2->currentLoop(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 250);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
QCOMPARE(loopsForever->currentLoop(), 1);
QCOMPARE(sequence->currentAnimation(), a2_s_o1);
// Current time = 251
group.setCurrentTime(251);
- QCOMPARE(group.currentTime(), 251);
- QCOMPARE(sequence->currentTime(), 251);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(sequence->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 1);
QCOMPARE(a2_s_o1->currentLoop(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 251);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 1);
- QCOMPARE(a1_p_o1->currentTime(), 250);
- QCOMPARE(a1_p_o2->currentTime(), 1);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
QCOMPARE(a1_p_o2->currentLoop(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 251);
- QCOMPARE(loopsForever->currentTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 251);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
QCOMPARE(sequence->currentAnimation(), a2_s_o1);
}
@@ -356,7 +356,7 @@ void tst_QAnimationGroup::addChildTwice()
parent->addAnimation(subGroup);
QCOMPARE(parent->animationCount(), 1);
- parent->clearAnimations();
+ parent->clear();
QCOMPARE(parent->animationCount(), 0);
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 51a7ff8142..18ebddcdaa 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -57,6 +57,7 @@
#include <qtreewidget.h>
#include <qtablewidget.h>
#include <qscrollbar.h>
+#include <qboxlayout.h>
#ifdef Q_WS_MAC
#include <qmacstyle_mac.h>
#elif defined Q_WS_X11
@@ -154,6 +155,7 @@ private slots:
void removeItem();
void resetModel();
void keyBoardNavigationWithMouse();
+ void task_QTBUG_1071_changingFocusEmitsActivated();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -813,21 +815,25 @@ void tst_QComboBox::autoCompletionCaseSensitivity()
// case insensitive
testWidget->clearEditText();
+ QSignalSpy spyReturn(testWidget, SIGNAL(activated(int)));
testWidget->setAutoCompletionCaseSensitivity(Qt::CaseInsensitive);
QVERIFY(testWidget->autoCompletionCaseSensitivity() == Qt::CaseInsensitive);
QTest::keyClick(testWidget->lineEdit(), Qt::Key_A);
qApp->processEvents();
QCOMPARE(testWidget->currentText(), QString("aww"));
+ QCOMPARE(spyReturn.count(), 0);
QTest::keyClick(testWidget->lineEdit(), Qt::Key_B);
qApp->processEvents();
// autocompletions preserve userkey-case from 4.2
QCOMPARE(testWidget->currentText(), QString("abCDEF"));
+ QCOMPARE(spyReturn.count(), 0);
QTest::keyClick(testWidget->lineEdit(), Qt::Key_Enter);
qApp->processEvents();
QCOMPARE(testWidget->currentText(), QString("aBCDEF")); // case restored to item's case
+ QCOMPARE(spyReturn.count(), 1);
testWidget->clearEditText();
QTest::keyClick(testWidget->lineEdit(), 'c');
@@ -2500,6 +2506,31 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
QTRY_COMPARE(combo.currentText(), QString::number(final));
}
+void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated()
+{
+ QWidget w;
+ QVBoxLayout layout(&w);
+ QComboBox cb;
+ cb.setEditable(true);
+ QSignalSpy spy(&cb, SIGNAL(activated(int)));
+ cb.addItem("0");
+ cb.addItem("1");
+ cb.addItem("2");
+ QLineEdit edit;
+ layout.add(&cb);
+ layout.add(&edit);
+
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ cb.clearEditText();
+ cb.setFocus();
+ QApplication::processEvents();
+ QTest::keyClick(0, '1');
+ QCOMPARE(spy.count(), 0);
+ edit.setFocus();
+ QTRY_VERIFY(edit.hasFocus());
+ QTRY_COMPARE(spy.count(), 1);
+}
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"
diff --git a/tests/auto/qcssparser/tst_qcssparser.cpp b/tests/auto/qcssparser/tst_qcssparser.cpp
index 150f131f02..3580252c7f 100644
--- a/tests/auto/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/qcssparser/tst_qcssparser.cpp
@@ -1556,8 +1556,11 @@ void tst_QCssParser::extractFontFamily_data()
QTest::newRow("shorthand") << "font: 12pt Times New Roman" << QString("Times New Roman");
QTest::newRow("shorthand multiple quote") << "font: 12pt invalid, \"Times New Roman\" " << QString("Times New Roman");
QTest::newRow("shorthand multiple") << "font: 12pt invalid, Times New Roman " << QString("Times New Roman");
+ QTest::newRow("invalid spaces") << "font-family: invalid spaces, Times New Roman " << QString("Times New Roman");
+ QTest::newRow("invalid spaces quotes") << "font-family: 'invalid spaces', 'Times New Roman' " << QString("Times New Roman");
}
+
void tst_QCssParser::extractFontFamily()
{
QFETCH(QString, css);
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index c8a9facc2b..cc96edbee3 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -79,9 +79,6 @@ private slots:
void delete_anchor();
void conflicts();
void sizePolicy();
- void expandingSequence();
- void expandingSequenceFairDistribution();
- void expandingParallel();
void floatConflict();
void infiniteMaxSizes();
void simplifiableUnfeasible();
@@ -342,8 +339,10 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
QCOMPARE(checkReverseDirection(p), true);
- QVERIFY(usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
delete p;
delete view;
@@ -1609,217 +1608,6 @@ void tst_QGraphicsAnchorLayout::conflicts()
delete p;
}
-void tst_QGraphicsAnchorLayout::expandingSequence()
-{
- QSizeF min(10, 10);
- QSizeF pref(50, 10);
- QSizeF max(100, 10);
-
- QGraphicsWidget *a = createItem(min, pref, max, "a");
- QGraphicsWidget *b = createItem(min, pref, max, "b");
-
- b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
- QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
- l->setContentsMargins(0, 0, 0, 0);
-
- // horizontal
- setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
- setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0);
- setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight, 0);
-
- // vertical
- l->addAnchors(l, a, Qt::Vertical);
- l->addAnchors(l, b, Qt::Vertical);
-
- QCOMPARE(l->count(), 2);
-
- QGraphicsWidget p;
- p.setLayout(l);
-
- QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize);
- QCOMPARE(layoutMinimumSize.width(), qreal(20));
-
- QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height());
- p.resize(layoutExpandedSize);
-
- QCOMPARE(a->geometry().size(), pref);
- QCOMPARE(b->geometry().size(), max);
-
- QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
- QCOMPARE(layoutMaximumSize.width(), qreal(200));
-
- if (hasSimplification) {
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
- }
-}
-
-void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
-{
- QSizeF min(10, 10);
- QSizeF pref(50, 10);
- QSizeF max(100, 10);
-
- QGraphicsWidget *a = createItem(min, pref, max, "a");
- QGraphicsWidget *b = createItem(min, pref, max, "b");
- QGraphicsWidget *c = createItem(min, pref, max, "c");
- QGraphicsWidget *d = createItem(min, pref, max, "d");
-
- b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- d->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
- QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
- l->setContentsMargins(0, 0, 0, 0);
-
- // horizontal
- setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
- setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0);
- setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
- setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0);
- setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0);
-
- // vertical
- l->addAnchors(l, a, Qt::Vertical);
- l->addAnchors(l, b, Qt::Vertical);
- l->addAnchors(l, c, Qt::Vertical);
- l->addAnchors(l, d, Qt::Vertical);
-
- QCOMPARE(l->count(), 4);
-
- QGraphicsWidget p;
- p.setLayout(l);
-
- QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize);
- QCOMPARE(layoutMinimumSize.width(), qreal(40));
-
- QSizeF layoutPartialExpandedSize((2 * pref.width()) + (2 * (pref.width() + 10)),
- layoutMinimumSize.height());
- p.resize(layoutPartialExpandedSize);
-
- QCOMPARE(a->geometry().size(), pref);
- QCOMPARE(b->geometry().size(), pref + QSizeF(10, 0));
- QCOMPARE(c->geometry().size(), pref);
- QCOMPARE(d->geometry().size(), pref + QSizeF(10, 0));
-
- QSizeF layoutExpandedSize((2 * pref.width()) + (2 * max.width()),
- layoutMinimumSize.height());
- p.resize(layoutExpandedSize);
-
- QCOMPARE(a->geometry().size(), pref);
- QCOMPARE(b->geometry().size(), max);
- QCOMPARE(c->geometry().size(), pref);
- QCOMPARE(d->geometry().size(), max);
-
- QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
- QCOMPARE(layoutMaximumSize.width(), qreal(400));
-
- if (hasSimplification) {
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
- }
-
- // Now we change D to have more "room for growth" from its preferred size
- // to its maximum size. We expect a proportional fair distribution. Note that
- // this seems to not conform with what QGraphicsLinearLayout does.
- d->setMaximumSize(QSizeF(150, 10));
-
- QSizeF newLayoutExpandedSize((2 * pref.width()) + (max.width() + 150),
- layoutMinimumSize.height());
- p.resize(newLayoutExpandedSize);
-
- QCOMPARE(a->geometry().size(), pref);
- QCOMPARE(b->geometry().size(), max);
- QCOMPARE(c->geometry().size(), pref);
- QCOMPARE(d->geometry().size(), QSizeF(150, 10));
-
- QSizeF newLayoutPartialExpandedSize((4 * pref.width()) + 75,
- layoutMinimumSize.height());
- p.resize(newLayoutPartialExpandedSize);
-
- QCOMPARE(a->geometry().size(), pref);
- QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0));
- QCOMPARE(c->geometry().size(), pref);
- QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0));
-
- if (hasSimplification) {
- QVERIFY(!usedSimplex(l, Qt::Horizontal));
- QVERIFY(!usedSimplex(l, Qt::Vertical));
- }
-}
-
-void tst_QGraphicsAnchorLayout::expandingParallel()
-{
- QSizeF min(10, 10);
- QSizeF pref(50, 10);
- QSizeF max(100, 10);
- QSizeF max2(100, 50);
-
- QGraphicsWidget *a = createItem(min, pref, max, "a");
- QGraphicsWidget *b = createItem(min, pref, max, "b");
- QGraphicsWidget *c = createItem(min, pref, max2, "c");
-
- b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
-
- QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
- l->setContentsMargins(0, 0, 0, 0);
-
- // horizontal
- setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
- setAnchor(l, l, Qt::AnchorLeft, b, Qt::AnchorLeft, 0);
-
- setAnchor(l, a, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
- setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
-
- setAnchor(l, c, Qt::AnchorRight, l, Qt::AnchorRight, 0);
-
- // vertical
- l->addAnchors(l, c, Qt::Vertical);
- setAnchor(l, l, Qt::AnchorTop, a, Qt::AnchorTop, 0);
- setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorVerticalCenter, 0);
- setAnchor(l, b, Qt::AnchorTop, c, Qt::AnchorVerticalCenter, 0);
- setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
-
- QCOMPARE(l->count(), 3);
-
- QGraphicsWidget p;
- p.setLayout(l);
-
- QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize);
- QCOMPARE(layoutMinimumSize.width(), qreal(20));
-
- QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height());
- p.resize(layoutExpandedSize);
-
- QCOMPARE(a->geometry().size(), max);
- QCOMPARE(b->geometry().size(), max);
- QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20));
-
- QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
- QCOMPARE(layoutMaximumSize.width(), qreal(200));
-
- //
- // Change the parallel connection to a paralell connection of b with a center...
- //
- QGraphicsAnchor *anchor = l->anchor(b, Qt::AnchorRight, c, Qt::AnchorLeft);
- delete anchor;
- setAnchor(l, b, Qt::AnchorRight, a, Qt::AnchorHorizontalCenter, 0);
- a->setMaximumSize(max + QSizeF(100, 0));
-
- QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize);
- QCOMPARE(newLayoutMinimumSize.width(), qreal(30));
-
- QSizeF newLayoutExpandedSize = layoutExpandedSize + QSizeF(100, 0);
- p.resize(newLayoutExpandedSize);
-
- QCOMPARE(a->geometry().size(), max + QSizeF(100, 0));
- QCOMPARE(b->geometry().size(), max);
- QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20));
-
- QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
- QCOMPARE(newLayoutMaximumSize.width(), qreal(300));
-}
-
void tst_QGraphicsAnchorLayout::floatConflict()
{
QGraphicsWidget *a = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "a");
@@ -1882,6 +1670,7 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
QGraphicsWidget *b = createItem(min, pref, max, "b");
QGraphicsWidget *c = createItem(min, pref, max, "c");
QGraphicsWidget *d = createItem(min, pref, max, "d");
+ QGraphicsWidget *e = createItem(min, pref, max, "e");
//<!-- Trunk -->
setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
@@ -1889,34 +1678,32 @@ void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0);
setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0);
-
- a->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
- c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ setAnchor(l, b, Qt::AnchorHorizontalCenter, e, Qt::AnchorLeft, 0);
+ setAnchor(l, e, Qt::AnchorRight, c, Qt::AnchorHorizontalCenter, 0);
QGraphicsWidget p;
p.setLayout(l);
+ QCOMPARE(int(p.effectiveSizeHint(Qt::MaximumSize).width()),
+ QWIDGETSIZE_MAX);
+
p.resize(200, 10);
QCOMPARE(a->geometry(), QRectF(0, 0, 50, 10));
QCOMPARE(b->geometry(), QRectF(50, 0, 50, 10));
QCOMPARE(c->geometry(), QRectF(100, 0, 50, 10));
QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10));
- if (!hasSimplification)
- QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
-
p.resize(1000, 10);
- QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10));
- QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10));
- QCOMPARE(c->geometry(), QRectF(500, 0, 450, 10));
- QCOMPARE(d->geometry(), QRectF(950, 0, 50, 10));
-
- qreal expMaxSize = (QWIDGETSIZE_MAX - 100.0) / 2;
- p.resize(QWIDGETSIZE_MAX, 10);
- QCOMPARE(a->geometry(), QRectF(0, 0, expMaxSize, 10));
- QCOMPARE(b->geometry(), QRectF(expMaxSize, 0, 50, 10));
- QCOMPARE(c->geometry(), QRectF(expMaxSize + 50, 0, expMaxSize, 10));
- QCOMPARE(d->geometry(), QRectF(QWIDGETSIZE_MAX - 50, 0, 50, 10));
+ QCOMPARE(a->geometry(), QRectF(0, 0, 250, 10));
+ QCOMPARE(b->geometry(), QRectF(250, 0, 250, 10));
+ QCOMPARE(c->geometry(), QRectF(500, 0, 250, 10));
+ QCOMPARE(d->geometry(), QRectF(750, 0, 250, 10));
+
+ p.resize(40000, 10);
+ QCOMPARE(a->geometry(), QRectF(0, 0, 10000, 10));
+ QCOMPARE(b->geometry(), QRectF(10000, 0, 10000, 10));
+ QCOMPARE(c->geometry(), QRectF(20000, 0, 10000, 10));
+ QCOMPARE(d->geometry(), QRectF(30000, 0, 10000, 10));
}
void tst_QGraphicsAnchorLayout::simplifiableUnfeasible()
@@ -1951,7 +1738,7 @@ void tst_QGraphicsAnchorLayout::simplifiableUnfeasible()
if (hasSimplification)
QVERIFY(!usedSimplex(l, Qt::Horizontal));
- // Now we make it valid again
+ // Now we make it valid
b->setMinimumWidth(100);
l->invalidate();
@@ -1979,9 +1766,9 @@ void tst_QGraphicsAnchorLayout::simplificationVsOrder()
QSizeF pref(20, 10);
QSizeF max(50, 10);
- QGraphicsWidget *a = createItem(min, pref, max);
- QGraphicsWidget *b = createItem(min, pref, max);
- QGraphicsWidget *c = createItem(min, pref, max);
+ QGraphicsWidget *a = createItem(min, pref, max, "A");
+ QGraphicsWidget *b = createItem(min, pref, max, "B");
+ QGraphicsWidget *c = createItem(min, pref, max, "C");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 1c7a159e34..4f8a4780ac 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -162,10 +162,14 @@ Q_DECLARE_METATYPE(AnchorItemSizeHintList)
class TestWidget : public QGraphicsWidget
{
public:
- inline TestWidget(QGraphicsItem *parent = 0)
+ inline TestWidget(QGraphicsItem *parent = 0, const QString &name = QString())
: QGraphicsWidget(parent)
{
setContentsMargins( 0,0,0,0 );
+ if (name.isEmpty())
+ setData(0, QString::fromAscii("w%1").arg(int(this)));
+ else
+ setData(0, name);
}
~TestWidget()
{
@@ -1664,6 +1668,18 @@ inline QGraphicsLayoutItem *getItem(
return widgets[index];
}
+static QRectF truncate(QRectF original)
+{
+ QRectF result;
+
+ result.setX(qRound(original.x() * 1000000) / 1000000.0);
+ result.setY(qRound(original.y() * 1000000) / 1000000.0);
+ result.setWidth(qRound(original.width() * 1000000) / 1000000.0);
+ result.setHeight(qRound(original.height() * 1000000) / 1000000.0);
+
+ return result;
+}
+
void tst_QGraphicsAnchorLayout1::testBasicLayout()
{
QFETCH(QSizeF, size);
@@ -1684,7 +1700,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
// Create dummy widgets
QList<QGraphicsWidget *> widgets;
for (int i = 0; i < widgetCount; ++i) {
- TestWidget *w = new TestWidget;
+ TestWidget *w = new TestWidget(0, QString::fromAscii("W%1").arg(i));
widgets << w;
}
@@ -1704,19 +1720,18 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
widget->setLayout(layout);
widget->setContentsMargins(0,0,0,0);
- widget->setMinimumSize(size);
- widget->setMaximumSize(size);
-
-// QTest::qWait(500); // layouting is asynchronous..
+ widget->resize(size);
+ QCOMPARE(widget->size(), size);
// Validate
for (int i = 0; i < result.count(); ++i) {
const BasicLayoutTestResult item = result[i];
- QCOMPARE(widgets[item.index]->geometry(), item.rect);
+ QRectF expected = truncate(item.rect);
+ QRectF actual = truncate(widgets[item.index]->geometry());
+
+ QCOMPARE(expected, actual);
}
- // ###: not supported yet
-/*
// Test mirrored mode
widget->setLayoutDirection(Qt::RightToLeft);
layout->activate();
@@ -1731,7 +1746,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QCOMPARE(widgets[item.index]->geometry(), mirroredRect);
delete widgets[item.index];
}
-*/
+
delete widget;
}
@@ -2212,8 +2227,8 @@ void tst_QGraphicsAnchorLayout1::testRemoveCenterAnchor()
widget->setLayout(layout);
widget->setContentsMargins(0,0,0,0);
- widget->setMinimumSize(size);
- widget->setMaximumSize(size);
+ widget->resize(size);
+ QCOMPARE(widget->size(), size);
// Validate
for (int i = 0; i < result.count(); ++i) {
@@ -3053,8 +3068,8 @@ void tst_QGraphicsAnchorLayout1::testComplexCases()
widget->setLayout(layout);
widget->setContentsMargins(0,0,0,0);
- widget->setMinimumSize(size);
- widget->setMaximumSize(size);
+ widget->resize(size);
+ QCOMPARE(widget->size(), size);
// QTest::qWait(500); // layouting is asynchronous..
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 3bc6db5472..d65c6ecdb2 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -401,6 +401,7 @@ private slots:
void modality_clickFocus();
void modality_keyEvents();
void itemIsInFront();
+ void scenePosChange();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -4229,6 +4230,8 @@ protected:
break;
case QGraphicsItem::ItemOpacityHasChanged:
break;
+ case QGraphicsItem::ItemScenePositionHasChanged:
+ break;
}
return itemChangeReturnValue.isValid() ? itemChangeReturnValue : value;
}
@@ -9677,5 +9680,76 @@ void tst_QGraphicsItem::itemIsInFront()
QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2child1), false);
}
+class ScenePosChangeTester : public ItemChangeTester
+{
+public:
+ ScenePosChangeTester()
+ { }
+ ScenePosChangeTester(QGraphicsItem *parent) : ItemChangeTester(parent)
+ { }
+};
+
+void tst_QGraphicsItem::scenePosChange()
+{
+ ScenePosChangeTester* root = new ScenePosChangeTester;
+ ScenePosChangeTester* child1 = new ScenePosChangeTester(root);
+ ScenePosChangeTester* grandChild1 = new ScenePosChangeTester(child1);
+ ScenePosChangeTester* child2 = new ScenePosChangeTester(root);
+ ScenePosChangeTester* grandChild2 = new ScenePosChangeTester(child2);
+
+ child1->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
+ grandChild2->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
+
+ QGraphicsScene scene;
+ scene.addItem(root);
+
+ // ignore uninteresting changes
+ child1->clear();
+ child2->clear();
+ grandChild1->clear();
+ grandChild2->clear();
+
+ // move whole tree
+ root->moveBy(1.0, 1.0);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+
+ // move subtree
+ child2->moveBy(1.0, 1.0);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2);
+
+ // reparent
+ grandChild2->setParentItem(child1);
+ child1->moveBy(1.0, 1.0);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3);
+
+ // change flags
+ grandChild1->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
+ grandChild2->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, false);
+ QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants()
+ child1->moveBy(1.0, 1.0);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+ QCOMPARE(grandChild2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 3);
+
+ // remove
+ scene.removeItem(grandChild1);
+ delete grandChild2; grandChild2 = 0;
+ QCoreApplication::processEvents(); // QGraphicsScenePrivate::_q_updateScenePosDescendants()
+ root->moveBy(1.0, 1.0);
+ QCOMPARE(child1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 4);
+ QCOMPARE(grandChild1->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+ QCOMPARE(child2->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 0);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 0589994841..9a561ebc11 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -225,6 +225,7 @@ private slots:
void focusItem();
void focusItemLostFocus();
void setFocusItem();
+ void setFocusItem_inactive();
void mouseGrabberItem();
void hoverEvents_siblings();
void hoverEvents_parentChild();
@@ -267,6 +268,7 @@ private slots:
void initialFocus_data();
void initialFocus();
void polishItems();
+ void isActive();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -1453,6 +1455,13 @@ void tst_QGraphicsScene::focusItemLostFocus()
item->clearFocus();
}
+class ClearTestItem : public QGraphicsRectItem
+{
+public:
+ ~ClearTestItem() { qDeleteAll(items); }
+ QList<QGraphicsItem *> items;
+};
+
void tst_QGraphicsScene::clear()
{
QGraphicsScene scene;
@@ -1463,6 +1472,19 @@ void tst_QGraphicsScene::clear()
scene.clear();
QVERIFY(scene.items().isEmpty());
QCOMPARE(scene.sceneRect(), QRectF(0, 0, 100, 100));
+
+ ClearTestItem *firstItem = new ClearTestItem;
+ QGraphicsItem *secondItem = new QGraphicsRectItem;
+ firstItem->items += secondItem;
+
+ scene.setItemIndexMethod(QGraphicsScene::NoIndex);
+ scene.addItem(firstItem);
+ scene.addItem(secondItem);
+ QCOMPARE(scene.items().at(0), firstItem);
+ QCOMPARE(scene.items().at(1), secondItem);
+ // must not crash even if firstItem deletes secondItem
+ scene.clear();
+ QVERIFY(scene.items().isEmpty());
}
void tst_QGraphicsScene::setFocusItem()
@@ -1514,6 +1536,26 @@ void tst_QGraphicsScene::setFocusItem()
QVERIFY(!item2->hasFocus());
}
+void tst_QGraphicsScene::setFocusItem_inactive()
+{
+ QGraphicsScene scene;
+ QGraphicsItem *item = scene.addText("Qt");
+ QVERIFY(!scene.focusItem());
+ QVERIFY(!scene.hasFocus());
+ scene.setFocusItem(item);
+ QVERIFY(!scene.hasFocus());
+ QVERIFY(!scene.focusItem());
+ item->setFlag(QGraphicsItem::ItemIsFocusable);
+
+ for (int i = 0; i < 3; ++i) {
+ scene.setFocusItem(item);
+ QCOMPARE(scene.focusItem(), item);
+ QVERIFY(!item->hasFocus());
+ }
+
+}
+
+
void tst_QGraphicsScene::mouseGrabberItem()
{
QGraphicsScene scene;
@@ -3110,6 +3152,7 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
QVERIFY(!view->viewport()->hasFocus());
QVERIFY(!scene.hasFocus());
QVERIFY(!item->hasFocus());
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
// Check that the correct item regains focus.
widget.show();
@@ -3117,8 +3160,10 @@ void tst_QGraphicsScene::tabFocus_sceneWithFocusableItems()
widget.activateWindow();
QTest::qWaitForWindowShown(&widget);
QTRY_VERIFY(view->hasFocus());
+ QTRY_VERIFY(scene.isActive());
QVERIFY(view->viewport()->hasFocus());
QVERIFY(scene.hasFocus());
+ QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item));
QVERIFY(item->hasFocus());
}
@@ -3910,5 +3955,180 @@ void tst_QGraphicsScene::polishItems()
QMetaObject::invokeMethod(&scene,"_q_polishItems");
}
+void tst_QGraphicsScene::isActive()
+{
+ QGraphicsScene scene1;
+ QVERIFY(!scene1.isActive());
+ QGraphicsScene scene2;
+ QVERIFY(!scene2.isActive());
+
+ {
+ QWidget toplevel1;
+ QHBoxLayout *layout = new QHBoxLayout;
+ toplevel1.setLayout(layout);
+ QGraphicsView *view1 = new QGraphicsView(&scene1);
+ QGraphicsView *view2 = new QGraphicsView(&scene2);
+ layout->addWidget(view1);
+ layout->addWidget(view2);
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ view1->setVisible(false);
+
+ toplevel1.show();
+ QApplication::setActiveWindow(&toplevel1);
+ QTest::qWaitForWindowShown(&toplevel1);
+ QTRY_COMPARE(QApplication::activeWindow(), &toplevel1);
+
+ QVERIFY(!scene1.isActive()); //it is hidden;
+ QVERIFY(scene2.isActive());
+
+ view1->show();
+ QVERIFY(scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view2->hide();
+
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ toplevel1.hide();
+ QTest::qWait(12);
+ QTRY_VERIFY(!scene1.isActive());
+ QTRY_VERIFY(!scene2.isActive());
+
+ toplevel1.show();
+ QApplication::setActiveWindow(&toplevel1);
+ QApplication::processEvents();
+ QTRY_COMPARE(QApplication::activeWindow(), &toplevel1);
+
+ QTRY_VERIFY(scene1.isActive());
+ QTRY_VERIFY(!scene2.isActive());
+
+ view2->show();
+ QVERIFY(scene1.isActive());
+ QVERIFY(scene2.isActive());
+ }
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ {
+ QWidget toplevel2;
+ QHBoxLayout *layout = new QHBoxLayout;
+ toplevel2.setLayout(layout);
+ QGraphicsView *view1 = new QGraphicsView(&scene1);
+ QGraphicsView *view2 = new QGraphicsView();
+ layout->addWidget(view1);
+ layout->addWidget(view2);
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ toplevel2.show();
+ QApplication::setActiveWindow(&toplevel2);
+ QTest::qWaitForWindowShown(&toplevel2);
+ QTRY_COMPARE(QApplication::activeWindow(), &toplevel2);
+
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ view2->setScene(&scene2);
+
+ QVERIFY(scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view1->setScene(&scene2);
+ QVERIFY(!scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view1->hide();
+ QVERIFY(!scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view1->setScene(&scene1);
+ QVERIFY(!scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view1->show();
+
+ view1->show();
+ QVERIFY(scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view2->hide();
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ QGraphicsView topLevelView;
+ topLevelView.show();
+ QApplication::setActiveWindow(&topLevelView);
+ QTest::qWaitForWindowShown(&topLevelView);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&topLevelView));
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ topLevelView.setScene(&scene1);
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ view2->show();
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ view1->hide();
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ QApplication::setActiveWindow(&toplevel2);
+ QTRY_COMPARE(QApplication::activeWindow(), &toplevel2);
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+
+ }
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ {
+ QWidget toplevel3;
+ QHBoxLayout *layout = new QHBoxLayout;
+ toplevel3.setLayout(layout);
+ QGraphicsView *view1 = new QGraphicsView(&scene1);
+ QGraphicsView *view2 = new QGraphicsView(&scene2);
+ layout->addWidget(view1);
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ toplevel3.show();
+ QApplication::setActiveWindow(&toplevel3);
+ QTest::qWaitForWindowShown(&toplevel3);
+ QTRY_COMPARE(QApplication::activeWindow(), &toplevel3);
+
+ QVERIFY(scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+ layout->addWidget(view2);
+ QApplication::processEvents();
+ QVERIFY(scene1.isActive());
+ QVERIFY(scene2.isActive());
+
+ view1->setParent(0);
+ QVERIFY(!scene1.isActive());
+ QVERIFY(scene2.isActive());
+ delete view1;
+ }
+
+ QVERIFY(!scene1.isActive());
+ QVERIFY(!scene2.isActive());
+
+}
+
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index f07453cea4..9c6aa393e6 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -217,6 +217,7 @@ private slots:
void update();
void inputMethodSensitivity();
void inputContextReset();
+ void defaultClipIntersectToView();
// task specific tests below me
void task172231_untransformableItems();
@@ -3692,6 +3693,77 @@ void tst_QGraphicsView::inputContextReset()
QCOMPARE(inputContext.resets, 0);
}
+class ViewClipTester : public QGraphicsView
+{
+public:
+ ViewClipTester(QGraphicsScene *scene = 0)
+ : QGraphicsView(scene)
+ { }
+ QRegion clipRegion;
+
+protected:
+ void drawBackground(QPainter *painter, const QRectF &rect)
+ {
+ clipRegion = painter->clipRegion();
+ }
+};
+
+class ItemClipTester : public QGraphicsRectItem
+{
+public:
+ ItemClipTester() : QGraphicsRectItem(0, 0, 20, 20)
+ {
+ setBrush(Qt::blue);
+ }
+ QRegion clipRegion;
+
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
+ {
+ clipRegion = painter->clipRegion();
+ QGraphicsRectItem::paint(painter, option, widget);
+ }
+};
+
+void tst_QGraphicsView::defaultClipIntersectToView()
+{
+ QGraphicsScene scene;
+ ItemClipTester *tester = new ItemClipTester;
+ scene.addItem(tester);
+
+ ViewClipTester view(&scene);
+ view.setAlignment(Qt::AlignTop | Qt::AlignLeft);
+ view.setFrameStyle(0);
+ view.resize(200, 200);
+ view.show();
+ QTRY_COMPARE(QApplication::activeWindow(), (QWidget *)&view);
+
+ QRect viewRect(0, 0, 200, 200);
+ QCOMPARE(view.clipRegion, QRegion(viewRect));
+ QCOMPARE(tester->clipRegion, QRegion(viewRect));
+
+ view.viewport()->update(0, 0, 5, 5);
+ view.viewport()->update(10, 10, 5, 5);
+ qApp->processEvents();
+ viewRect = QRect(0, 0, 15, 15);
+ QCOMPARE(view.clipRegion, QRegion(viewRect));
+ QCOMPARE(tester->clipRegion, QRegion(viewRect));
+
+ view.scale(2, 2);
+ qApp->processEvents();
+
+ viewRect.moveTop(-viewRect.height());
+ viewRect = QRect(0, 0, 100, 100);
+ QCOMPARE(view.clipRegion, QRegion(viewRect));
+ QCOMPARE(tester->clipRegion, QRegion(viewRect));
+
+ view.viewport()->update(0, 0, 5, 5);
+ view.viewport()->update(10, 10, 5, 5);
+ qApp->processEvents();
+ viewRect = QRect(0, 0, 8, 8);
+ QCOMPARE(view.clipRegion, QRegion(viewRect));
+ QCOMPARE(tester->clipRegion, QRegion(viewRect));
+}
+
void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
{
QGraphicsView view;
diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp
index 9eae9c9b53..9d957a5b60 100644
--- a/tests/auto/qlabel/tst_qlabel.cpp
+++ b/tests/auto/qlabel/tst_qlabel.cpp
@@ -328,14 +328,14 @@ void tst_QLabel::eventPropagation_data()
QTest::addColumn<bool>("propagation");
QTest::newRow("plain text1") << QString("plain text") << int(Qt::LinksAccessibleByMouse) << int(Qt::NoFocus) << true;
- QTest::newRow("plain text2") << QString("plain text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << false;
+ QTest::newRow("plain text2") << QString("plain text") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << true;
QTest::newRow("plain text3") << QString("plain text") << (int)Qt::TextSelectableByMouse << (int)Qt::ClickFocus << false;
QTest::newRow("plain text4") << QString("plain text") << (int)Qt::NoTextInteraction << (int)Qt::NoFocus << true;
- QTest::newRow("rich text1") << QString("<b>rich text</b>") << (int)Qt::LinksAccessibleByMouse << (int)Qt::NoFocus << false;
- QTest::newRow("rich text2") << QString("<b>rich text</b>") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << false;
+ QTest::newRow("rich text1") << QString("<b>rich text</b>") << (int)Qt::LinksAccessibleByMouse << (int)Qt::NoFocus << true;
+ QTest::newRow("rich text2") << QString("<b>rich text</b>") << (int)Qt::TextSelectableByKeyboard << (int)Qt::ClickFocus << true;
QTest::newRow("rich text3") << QString("<b>rich text</b>") << (int)Qt::TextSelectableByMouse << (int)Qt::ClickFocus << false;
QTest::newRow("rich text4") << QString("<b>rich text</b>") << (int)Qt::NoTextInteraction << (int)Qt::NoFocus << true;
- QTest::newRow("rich text4") << QString("<b>rich text</b>") << (int)Qt::LinksAccessibleByKeyboard << (int)Qt::StrongFocus << false;
+ QTest::newRow("rich text4") << QString("<b>rich text</b>") << (int)Qt::LinksAccessibleByKeyboard << (int)Qt::StrongFocus << true;
if (!test_box)
test_box = new Widget;
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index c6769596f8..b4dfbbad47 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -260,6 +260,7 @@ private slots:
void task233101_cursorPosAfterInputMethod();
void task241436_passwordEchoOnEditRestoreEchoMode();
void task248948_redoRemovedSelection();
+ void taskQTBUG_4401_enterKeyClearsPassword();
protected slots:
#ifdef QT3_SUPPORT
@@ -3532,5 +3533,20 @@ void tst_QLineEdit::task248948_redoRemovedSelection()
QCOMPARE(testWidget->text(), QLatin1String("ab"));
}
+void tst_QLineEdit::taskQTBUG_4401_enterKeyClearsPassword()
+{
+ QString password("Wanna guess?");
+
+ testWidget->setText(password);
+ testWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ testWidget->setFocus();
+ testWidget->selectAll();
+ QApplication::setActiveWindow(testWidget);
+ QTRY_VERIFY(testWidget->hasFocus());
+
+ QTest::keyPress(testWidget, Qt::Key_Enter);
+ QTRY_COMPARE(testWidget->text(), password);
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index a5ff153b7c..1c8fecf96b 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -121,6 +121,7 @@ private slots:
void taskQTBUG_2233_scrollHiddenItems();
void taskQTBUG_633_changeModelData();
void taskQTBUG_435_deselectOnViewportClick();
+ void taskQTBUG_2678_spacingAndWrappedText();
};
// Testing get/set functions
@@ -1787,13 +1788,13 @@ void tst_QListView::task262152_setModelColumnNavigate()
view.show();
QTest::qWaitForWindowShown(&view);
- QTest::qWait(100);
+ QTest::qWait(120);
QTest::keyClick(&view, Qt::Key_Down);
- QTest::qWait(100);
- QCOMPARE(view.currentIndex(), model.index(1,1));
+ QTest::qWait(30);
+ QTRY_COMPARE(view.currentIndex(), model.index(1,1));
QTest::keyClick(&view, Qt::Key_Down);
- QTest::qWait(100);
- QCOMPARE(view.currentIndex(), model.index(2,1));
+ QTest::qWait(30);
+ QTRY_COMPARE(view.currentIndex(), model.index(2,1));
}
@@ -1861,7 +1862,7 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick()
view.setSelectionMode(QAbstractItemView::ExtendedSelection);
view.selectAll();
QCOMPARE(view.selectionModel()->selectedIndexes().count(), model.rowCount());
-
+
QPoint p = view.visualRect(model.index(model.rowCount() - 1)).center() + QPoint(0, 20);
//first the left button
@@ -1876,5 +1877,19 @@ void tst_QListView::taskQTBUG_435_deselectOnViewportClick()
QVERIFY(!view.selectionModel()->hasSelection());
}
+void tst_QListView::taskQTBUG_2678_spacingAndWrappedText()
+{
+ static const QString lorem("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.");
+ QStringListModel model(QStringList() << lorem << lorem << "foo" << lorem << "bar" << lorem << lorem);
+ QListView w;
+ w.setModel(&model);
+ w.setViewMode(QListView::ListMode);
+ w.setWordWrap(true);
+ w.setSpacing(10);
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ QCOMPARE(w.horizontalScrollBar()->minimum(), w.horizontalScrollBar()->maximum());
+}
+
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"
diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
index 8d937e9ab5..a26e0eb61f 100644
--- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
+++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp
@@ -119,8 +119,8 @@ class TestAnimation : public QVariantAnimation
Q_OBJECT
public:
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
- virtual void updateState(QAbstractAnimation::State oldState,
- QAbstractAnimation::State newState)
+ virtual void updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
{
Q_UNUSED(oldState)
Q_UNUSED(newState)
@@ -135,8 +135,8 @@ public:
TestAnimation2(int duration, QAbstractAnimation *animation) : QVariantAnimation(animation), m_duration(duration) {}
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
- virtual void updateState(QAbstractAnimation::State oldState,
- QAbstractAnimation::State newState)
+ virtual void updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
{
Q_UNUSED(oldState)
Q_UNUSED(newState)
@@ -223,33 +223,33 @@ void tst_QParallelAnimationGroup::setCurrentTime()
QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped);
QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(a1_p_o1->currentTime(), 1);
- QCOMPARE(a1_p_o2->currentTime(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 1);
- QCOMPARE(notTimeDriven->currentTime(), 1);
- QCOMPARE(loopsForever->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 1);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 1);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
// Current time = 250
group.setCurrentTime(250);
- QCOMPARE(group.currentTime(), 250);
- QCOMPARE(a1_p_o1->currentTime(), 250);
- QCOMPARE(a1_p_o2->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 0);
QCOMPARE(a1_p_o2->currentLoop(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 250);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
QCOMPARE(loopsForever->currentLoop(), 1);
// Current time = 251
group.setCurrentTime(251);
- QCOMPARE(group.currentTime(), 251);
- QCOMPARE(a1_p_o1->currentTime(), 250);
- QCOMPARE(a1_p_o2->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(a1_p_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_p_o2->currentLoopTime(), 1);
QCOMPARE(a1_p_o2->currentLoop(), 1);
- QCOMPARE(a1_p_o3->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 251);
- QCOMPARE(loopsForever->currentTime(), 1);
+ QCOMPARE(a1_p_o3->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 251);
+ QCOMPARE(loopsForever->currentLoopTime(), 1);
}
void tst_QParallelAnimationGroup::stateChanged()
@@ -278,18 +278,18 @@ void tst_QParallelAnimationGroup::stateChanged()
group.start();
//all the animations should be started
QCOMPARE(spy1.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Running);
QCOMPARE(spy2.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Running);
QCOMPARE(spy3.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Running);
QCOMPARE(spy4.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Running);
group.setCurrentTime(1500); //anim1 should be finished
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(spy1.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Stopped);
QCOMPARE(spy2.count(), 1); //no change
QCOMPARE(spy3.count(), 1); //no change
QCOMPARE(spy4.count(), 1); //no change
@@ -298,7 +298,7 @@ void tst_QParallelAnimationGroup::stateChanged()
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(spy1.count(), 2); //no change
QCOMPARE(spy2.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Stopped);
QCOMPARE(spy3.count(), 1); //no change
QCOMPARE(spy4.count(), 1); //no change
@@ -307,9 +307,9 @@ void tst_QParallelAnimationGroup::stateChanged()
QCOMPARE(spy1.count(), 2); //no change
QCOMPARE(spy2.count(), 2); //no change
QCOMPARE(spy3.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Stopped);
QCOMPARE(spy4.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Stopped);
//cleanup
spy1.clear();
@@ -326,22 +326,22 @@ void tst_QParallelAnimationGroup::stateChanged()
QCOMPARE(spy1.count(), 0);
QCOMPARE(spy2.count(), 0);
QCOMPARE(spy3.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Running);
QCOMPARE(spy4.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Running);
group.setCurrentTime(1500); //anim2 should be started
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(spy1.count(), 0); //no change
QCOMPARE(spy2.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Running);
QCOMPARE(spy3.count(), 1); //no change
QCOMPARE(spy4.count(), 1); //no change
group.setCurrentTime(500); //anim1 is finally also started
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(spy1.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Running);
QCOMPARE(spy2.count(), 1); //no change
QCOMPARE(spy3.count(), 1); //no change
QCOMPARE(spy4.count(), 1); //no change
@@ -349,13 +349,13 @@ void tst_QParallelAnimationGroup::stateChanged()
group.setCurrentTime(0); //everything should be stopped
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(spy1.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy1.last().first()), TestAnimation::Stopped);
QCOMPARE(spy2.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy2.last().first()), TestAnimation::Stopped);
QCOMPARE(spy3.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy3.last().first()), TestAnimation::Stopped);
QCOMPARE(spy4.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy4.last().first()), TestAnimation::Stopped);
}
void tst_QParallelAnimationGroup::clearGroup()
@@ -375,9 +375,9 @@ void tst_QParallelAnimationGroup::clearGroup()
children[i] = group.animationAt(i);
}
- group.clearAnimations();
+ group.clear();
QCOMPARE(group.animationCount(), 0);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
for (int i = 0; i < animationCount; ++i)
QVERIFY(children[i].isNull());
}
@@ -460,9 +460,9 @@ void tst_QParallelAnimationGroup::updateChildrenWithRunningGroup()
QCOMPARE(groupStateChangedSpy.count(), 1);
QCOMPARE(childStateChangedSpy.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(childStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(childStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
// starting directly a running child will not have any effect
@@ -501,13 +501,13 @@ void tst_QParallelAnimationGroup::deleteChildrenWithRunningGroup()
QCOMPARE(anim1->state(), QAnimationGroup::Running);
QTest::qWait(80);
- QVERIFY(group.currentTime() > 0);
+ QVERIFY(group.currentLoopTime() > 0);
delete anim1;
QVERIFY(group.animationCount() == 0);
QCOMPARE(group.duration(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 0); //that's the invariant
+ QCOMPARE(group.currentLoopTime(), 0); //that's the invariant
}
void tst_QParallelAnimationGroup::startChildrenWithStoppedGroup()
@@ -622,11 +622,11 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
anim2.start();
anim2.pause();
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(1).first()),
QAnimationGroup::Paused);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
@@ -636,15 +636,15 @@ void tst_QParallelAnimationGroup::startGroupWithRunningChild()
group.start();
QCOMPARE(stateChangedSpy1.count(), 3);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(1).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(2).first()),
QAnimationGroup::Running);
QCOMPARE(stateChangedSpy2.count(), 4);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(2).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(3).first()),
QAnimationGroup::Running);
QCOMPARE(group.state(), QAnimationGroup::Running);
@@ -687,19 +687,19 @@ void tst_QParallelAnimationGroup::zeroDurationAnimation()
group.start();
QCOMPARE(stateChangedSpy1.count(), 2);
QCOMPARE(finishedSpy1.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(stateChangedSpy2.count(), 1);
QCOMPARE(finishedSpy2.count(), 0);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy1.at(0).first()),
QAnimationGroup::Running);
QCOMPARE(stateChangedSpy3.count(), 1);
QCOMPARE(finishedSpy3.count(), 0);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy3.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy3.at(0).first()),
QAnimationGroup::Running);
@@ -762,9 +762,9 @@ void tst_QParallelAnimationGroup::stopUncontrolledAnimations()
group.start();
QCOMPARE(stateChangedSpy.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(group.state(), QAnimationGroup::Running);
@@ -915,9 +915,9 @@ void tst_QParallelAnimationGroup::loopCount()
group.setCurrentTime(currentGroupTime);
- QCOMPARE(anim1.currentTime(), expected1.time);
- QCOMPARE(anim2.currentTime(), expected2.time);
- QCOMPARE(anim3.currentTime(), expected3.time);
+ QCOMPARE(anim1.currentLoopTime(), expected1.time);
+ QCOMPARE(anim2.currentLoopTime(), expected2.time);
+ QCOMPARE(anim3.currentLoopTime(), expected3.time);
if (expected1.state >=0)
QCOMPARE(int(anim1.state()), expected1.state);
@@ -968,22 +968,22 @@ void tst_QParallelAnimationGroup::pauseResume()
QCOMPARE(anim->state(), QAnimationGroup::Running);
QCOMPARE(spy.count(), 1);
spy.clear();
- const int currentTime = group.currentTime();
- QCOMPARE(anim->currentTime(), currentTime);
+ const int currentTime = group.currentLoopTime();
+ QCOMPARE(anim->currentLoopTime(), currentTime);
group.pause();
QCOMPARE(group.state(), QAnimationGroup::Paused);
- QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Paused);
- QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
QCOMPARE(spy.count(), 1);
spy.clear();
group.resume();
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
QCOMPARE(spy.count(), 1);
group.stop();
@@ -991,10 +991,10 @@ void tst_QParallelAnimationGroup::pauseResume()
new TestAnimation2(500, &group);
group.start();
QCOMPARE(spy.count(), 1); //the animation should have been started
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().at(1)), TestAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Running);
group.setCurrentTime(250); //end of first animation
QCOMPARE(spy.count(), 2); //the animation should have been stopped
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().at(1)), TestAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(spy.last().first()), TestAnimation::Stopped);
group.pause();
QCOMPARE(spy.count(), 2); //this shouldn't have changed
group.resume();
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 56c1ced81b..f41fff128a 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -225,7 +225,7 @@ void tst_QPropertyAnimation::setCurrentTime()
animation.setLoopCount(loopCount);
animation.setCurrentTime(currentTime);
- QCOMPARE(animation.currentTime(), testCurrentTime);
+ QCOMPARE(animation.currentLoopTime(), testCurrentTime);
QCOMPARE(animation.currentLoop(), testCurrentLoop);
}
@@ -280,7 +280,7 @@ void tst_QPropertyAnimation::statesAndSignals()
QCOMPARE(anim->state(), QAnimationGroup::Stopped);
QCOMPARE(runningSpy.count(), 1); //anim must have stopped
QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(anim->currentTime(), 0);
+ QCOMPARE(anim->currentLoopTime(), 0);
QCOMPARE(anim->currentLoop(), 0);
QCOMPARE(currentLoopSpy.count(), 2);
runningSpy.clear();
@@ -291,7 +291,7 @@ void tst_QPropertyAnimation::statesAndSignals()
QCOMPARE(runningSpy.count(), 2); //started and stopped again
runningSpy.clear();
QCOMPARE(finishedSpy.count(), 1);
- QCOMPARE(anim->currentTime(), 100);
+ QCOMPARE(anim->currentLoopTime(), 100);
QCOMPARE(anim->currentLoop(), 2);
QCOMPARE(currentLoopSpy.count(), 4);
@@ -312,7 +312,7 @@ void tst_QPropertyAnimation::statesAndSignals()
QCOMPARE(anim->currentLoop(), 2);
QCOMPARE(runningSpy.count(), 1); // anim has stopped
QCOMPARE(finishedSpy.count(), 2);
- QCOMPARE(anim->currentTime(), 100);
+ QCOMPARE(anim->currentLoopTime(), 100);
delete anim;
}
@@ -864,16 +864,16 @@ void tst_QPropertyAnimation::zeroDurationStart()
//let's check the first state change
const QVariantList firstChange = spy.first();
//old state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Stopped);
//new state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.last()), QAbstractAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(firstChange.first()), QAbstractAnimation::Running);
//let's check the first state change
const QVariantList secondChange = spy.last();
//old state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Running);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Running);
//new state
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.last()), QAbstractAnimation::Stopped);
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(secondChange.first()), QAbstractAnimation::Stopped);
}
#define Pause 1
@@ -1171,9 +1171,9 @@ public:
innerAnim->start();
}
- void updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
- QPropertyAnimation::updateState(oldState, newState);
+ QPropertyAnimation::updateState(newState, oldState);
if (newState == QAbstractAnimation::Stopped)
delete innerAnim;
}
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index f6afc5b7de..28fccac428 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -87,7 +87,7 @@ private slots:
void currentAnimation();
void currentAnimationWithZeroDuration();
void insertAnimation();
- void clearAnimations();
+ void clear();
void pauseResume();
};
@@ -134,8 +134,8 @@ class TestAnimation : public QVariantAnimation
Q_OBJECT
public:
virtual void updateCurrentValue(const QVariant &value) { Q_UNUSED(value)};
- virtual void updateState(QAbstractAnimation::State oldState,
- QAbstractAnimation::State newState)
+ virtual void updateState(QAbstractAnimation::State newState,
+ QAbstractAnimation::State oldState)
{
Q_UNUSED(oldState)
Q_UNUSED(newState)
@@ -208,119 +208,119 @@ void tst_QSequentialAnimationGroup::setCurrentTime()
QCOMPARE(sequence2->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(sequence->currentTime(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 1);
- QCOMPARE(a2_s_o1->currentTime(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 250
group.setCurrentTime(250);
- QCOMPARE(group.currentTime(), 250);
- QCOMPARE(sequence->currentTime(), 250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 251
group.setCurrentTime(251);
- QCOMPARE(group.currentTime(), 251);
- QCOMPARE(sequence->currentTime(), 251);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 251);
+ QCOMPARE(sequence->currentLoopTime(), 251);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 1);
QCOMPARE(a2_s_o1->currentLoop(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 750
group.setCurrentTime(750);
- QCOMPARE(group.currentTime(), 750);
- QCOMPARE(sequence->currentTime(), 750);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 750);
+ QCOMPARE(sequence->currentLoopTime(), 750);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1000
group.setCurrentTime(1000);
- QCOMPARE(group.currentTime(), 1000);
- QCOMPARE(sequence->currentTime(), 1000);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1000);
+ QCOMPARE(sequence->currentLoopTime(), 1000);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1010
group.setCurrentTime(1010);
- QCOMPARE(group.currentTime(), 1010);
- QCOMPARE(sequence->currentTime(), 1010);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1010);
+ QCOMPARE(sequence->currentLoopTime(), 1010);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 10);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 10);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1250
group.setCurrentTime(1250);
- QCOMPARE(group.currentTime(), 1250);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1250);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1500
group.setCurrentTime(1500);
- QCOMPARE(group.currentTime(), 1500);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1500);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1750
group.setCurrentTime(1750);
- QCOMPARE(group.currentTime(), 1750);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 500);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 250);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
// Current time = 2000
group.setCurrentTime(2000);
- QCOMPARE(group.currentTime(), 1750);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 500);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 250);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
}
void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
@@ -357,40 +357,40 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
QCOMPARE(notTimeDriven->state(), QAnimationGroup::Stopped);
QCOMPARE(loopsForever->state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(sequence->currentTime(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 1);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(notTimeDriven->currentTime(), 0);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
// Current time = 250
group.setCurrentTime(250);
- QCOMPARE(group.currentTime(), 250);
- QCOMPARE(sequence->currentTime(), 250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(notTimeDriven->currentTime(), 0);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 250);
+ QCOMPARE(sequence->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
// Current time = 500
group.setCurrentTime(500);
- QCOMPARE(group.currentTime(), 500);
- QCOMPARE(sequence->currentTime(), 500);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 0);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 500);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 0);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), notTimeDriven);
// Current time = 505
group.setCurrentTime(505);
- QCOMPARE(group.currentTime(), 505);
- QCOMPARE(sequence->currentTime(), 500);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 5);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 505);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 5);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), notTimeDriven);
QCOMPARE(sequence->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped);
@@ -400,12 +400,12 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
// Current time = 750 (end of notTimeDriven animation)
group.setCurrentTime(750);
- QCOMPARE(group.currentTime(), 750);
- QCOMPARE(sequence->currentTime(), 500);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 250);
- QCOMPARE(loopsForever->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 750);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), loopsForever);
QCOMPARE(sequence->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped);
@@ -415,13 +415,13 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
// Current time = 800 (as notTimeDriven was finished at 750, loopsforever should still run)
group.setCurrentTime(800);
- QCOMPARE(group.currentTime(), 800);
+ QCOMPARE(group.currentLoopTime(), 800);
QCOMPARE(group.currentAnimation(), loopsForever);
- QCOMPARE(sequence->currentTime(), 500);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(notTimeDriven->currentTime(), 250);
- QCOMPARE(loopsForever->currentTime(), 50);
+ QCOMPARE(sequence->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(notTimeDriven->currentLoopTime(), 250);
+ QCOMPARE(loopsForever->currentLoopTime(), 50);
loopsForever->stop(); // this should stop the group
@@ -466,26 +466,26 @@ void tst_QSequentialAnimationGroup::seekingForwards()
QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o3->state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(sequence->currentTime(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 1);
- QCOMPARE(a2_s_o1->currentTime(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// Current time = 1500
group.setCurrentTime(1500);
- QCOMPARE(group.currentTime(), 1500);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1500);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 250);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
// this will restart the group
group.start();
@@ -499,15 +499,15 @@ void tst_QSequentialAnimationGroup::seekingForwards()
// Current time = 1750
group.setCurrentTime(1750);
- QCOMPARE(group.currentTime(), 1750);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 500);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 250);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
}
void tst_QSequentialAnimationGroup::seekingBackwards()
@@ -537,15 +537,15 @@ void tst_QSequentialAnimationGroup::seekingBackwards()
// Current time = 1600
group.setCurrentTime(1600);
- QCOMPARE(group.currentTime(), 1600);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1600);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 350);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 100);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 350);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 100);
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(sequence->state(), QAnimationGroup::Stopped);
@@ -556,22 +556,22 @@ void tst_QSequentialAnimationGroup::seekingBackwards()
// Seeking backwards, current time = 1
group.setCurrentTime(1);
- QCOMPARE(group.currentTime(), 1);
- QCOMPARE(sequence->currentTime(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
"hence they don't reset from their current animation", Continue);
- QCOMPARE(a2_s_o1->currentTime(), 0);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 0);
QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
"hence they don't reset from their current animation", Continue);
QCOMPARE(a2_s_o1->currentLoop(), 0);
QEXPECT_FAIL("", "rewinding in nested groups is considered as a restart from the children,"
"hence they don't reset from their current animation", Continue);
- QCOMPARE(a3_s_o1->currentTime(), 0);
- QCOMPARE(sequence2->currentTime(), 0);
- QCOMPARE(a1_s_o2->currentTime(), 0);
- QCOMPARE(a1_s_o3->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
+ QCOMPARE(sequence2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 0);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 0);
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(sequence->state(), QAnimationGroup::Running);
@@ -582,15 +582,15 @@ void tst_QSequentialAnimationGroup::seekingBackwards()
// Current time = 2000
group.setCurrentTime(2000);
- QCOMPARE(group.currentTime(), 1750);
- QCOMPARE(sequence->currentTime(), 1250);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 1250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 2);
- QCOMPARE(a3_s_o1->currentTime(), 250);
- QCOMPARE(sequence2->currentTime(), 500);
- QCOMPARE(a1_s_o2->currentTime(), 250);
- QCOMPARE(a1_s_o3->currentTime(), 250);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
+ QCOMPARE(sequence2->currentLoopTime(), 500);
+ QCOMPARE(a1_s_o2->currentLoopTime(), 250);
+ QCOMPARE(a1_s_o3->currentLoopTime(), 250);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
QCOMPARE(sequence->state(), QAnimationGroup::Stopped);
@@ -612,7 +612,7 @@ static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates
}
QList<QVariant> args = spy.at(i);
QAbstractAnimation::State st = expectedStates.at(i);
- QAbstractAnimation::State actual = qVariantValue<QAbstractAnimation::State>(args.value(1));
+ QAbstractAnimation::State actual = qVariantValue<QAbstractAnimation::State>(args.first());
if (equals && actual != st) {
equals = false;
break;
@@ -672,14 +672,14 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
// Current time = 1751
group.setCurrentTime(1751);
- QCOMPARE(group.currentTime(), 1751);
- QCOMPARE(sequence->currentTime(), 751);
+ QCOMPARE(group.currentLoopTime(), 1751);
+ QCOMPARE(sequence->currentLoopTime(), 751);
QCOMPARE(sequence->currentLoop(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 1);
QCOMPARE(a3_s_o1->currentLoop(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 1);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 1);
QCOMPARE(group.state(), QAnimationGroup::Paused);
QCOMPARE(sequence->state(), QAnimationGroup::Paused);
@@ -696,20 +696,20 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
<< QAbstractAnimation::Running
<< QAbstractAnimation::Stopped)));
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(1).first()),
QAnimationGroup::Paused);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(2).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(3).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(4).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(a1StateChangedSpy.at(4).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(1).first()),
QAnimationGroup::Paused);
group.resume();
@@ -720,17 +720,17 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a3_s_o1->state(), QAnimationGroup::Running);
- QVERIFY(group.currentTime() >= 1751);
- QVERIFY(sequence->currentTime() >= 751);
+ QVERIFY(group.currentLoopTime() >= 1751);
+ QVERIFY(sequence->currentLoopTime() >= 751);
QCOMPARE(sequence->currentLoop(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 1);
QCOMPARE(a3_s_o1->currentLoop(), 0);
- QVERIFY(a3_s_o1->currentTime() >= 1);
+ QVERIFY(a3_s_o1->currentLoopTime() >= 1);
QCOMPARE(seqStateChangedSpy.count(), 3); // Running,Paused,Running
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(2).first()),
QAnimationGroup::Running);
group.pause();
@@ -741,23 +741,23 @@ void tst_QSequentialAnimationGroup::pauseAndResume()
QCOMPARE(a2_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a3_s_o1->state(), QAnimationGroup::Paused);
- QVERIFY(group.currentTime() >= 1751);
- QVERIFY(sequence->currentTime() >= 751);
+ QVERIFY(group.currentLoopTime() >= 1751);
+ QVERIFY(sequence->currentLoopTime() >= 751);
QCOMPARE(sequence->currentLoop(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 1);
QCOMPARE(a3_s_o1->currentLoop(), 0);
- QVERIFY(a3_s_o1->currentTime() >= 1);
+ QVERIFY(a3_s_o1->currentLoopTime() >= 1);
QCOMPARE(seqStateChangedSpy.count(), 4); // Running,Paused,Running,Paused
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(3).first()),
QAnimationGroup::Paused);
group.stop();
QCOMPARE(seqStateChangedSpy.count(), 5); // Running,Paused,Running,Paused,Stopped
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(4).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(4).first()),
QAnimationGroup::Stopped);
}
@@ -797,20 +797,20 @@ void tst_QSequentialAnimationGroup::restart()
for (int i = 0; i < 3; i++) {
QCOMPARE(animsStateChanged[i]->count(), 4);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(1).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(2).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(animsStateChanged[i]->at(3).first()),
QAnimationGroup::Stopped);
}
QCOMPARE(seqStateChangedSpy.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(seqStateChangedSpy.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(seqCurrentAnimChangedSpy.count(), 6);
@@ -855,15 +855,15 @@ void tst_QSequentialAnimationGroup::looping()
// Current time = 1750
group.setCurrentTime(1750);
- QCOMPARE(group.currentTime(), 1750);
- QCOMPARE(sequence->currentTime(), 750);
+ QCOMPARE(group.currentLoopTime(), 1750);
+ QCOMPARE(sequence->currentLoopTime(), 750);
QCOMPARE(sequence->currentLoop(), 1);
- QCOMPARE(a1_s_o1->currentTime(), 250);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 250);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 1);
// this animation is at the beginning because it is the current one inside sequence
QCOMPARE(a3_s_o1->currentLoop(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 0);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 0);
QCOMPARE(sequence->currentAnimation(), a3_s_o1);
QCOMPARE(group.state(), QAnimationGroup::Paused);
@@ -890,16 +890,16 @@ void tst_QSequentialAnimationGroup::looping()
// Looping, current time = duration + 1
group.setCurrentTime(group.duration() + 1);
- QCOMPARE(group.currentTime(), 1);
+ QCOMPARE(group.currentLoopTime(), 1);
QCOMPARE(group.currentLoop(), 1);
- QCOMPARE(sequence->currentTime(), 1);
+ QCOMPARE(sequence->currentLoopTime(), 1);
QCOMPARE(sequence->currentLoop(), 0);
- QCOMPARE(a1_s_o1->currentTime(), 1);
- QCOMPARE(a2_s_o1->currentTime(), 250);
+ QCOMPARE(a1_s_o1->currentLoopTime(), 1);
+ QCOMPARE(a2_s_o1->currentLoopTime(), 250);
QCOMPARE(a2_s_o1->currentLoop(), 1);
// this animation is at the end because it was run on the previous loop
QCOMPARE(a3_s_o1->currentLoop(), 0);
- QCOMPARE(a3_s_o1->currentTime(), 250);
+ QCOMPARE(a3_s_o1->currentLoopTime(), 250);
QCOMPARE(group.state(), QAnimationGroup::Paused);
QCOMPARE(sequence->state(), QAnimationGroup::Paused);
@@ -934,7 +934,7 @@ void tst_QSequentialAnimationGroup::startDelay()
QTest::qWait(500);
- QVERIFY(group.currentTime() == 375);
+ QVERIFY(group.currentLoopTime() == 375);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
}
@@ -958,9 +958,9 @@ void tst_QSequentialAnimationGroup::clearGroup()
children[i] = group.animationAt(i);
}
- group.clearAnimations();
+ group.clear();
QCOMPARE(group.animationCount(), 0);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
for (int i = 0; i < animationCount; ++i)
QVERIFY(children[i].isNull());
}
@@ -1130,9 +1130,9 @@ void tst_QSequentialAnimationGroup::updateChildrenWithRunningGroup()
QCOMPARE(groupStateChangedSpy.count(), 1);
QCOMPARE(childStateChangedSpy.count(), 1);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(groupStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(childStateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(childStateChangedSpy.at(0).first()),
QAnimationGroup::Running);
// starting directly a running child will not have any effect
@@ -1171,13 +1171,13 @@ void tst_QSequentialAnimationGroup::deleteChildrenWithRunningGroup()
QCOMPARE(anim1->state(), QAnimationGroup::Running);
QTest::qWait(100);
- QVERIFY(group.currentTime() > 0);
+ QVERIFY(group.currentLoopTime() > 0);
delete anim1;
QCOMPARE(group.animationCount(), 0);
QCOMPARE(group.duration(), 0);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), 0); //that's the invariant
+ QCOMPARE(group.currentLoopTime(), 0); //that's the invariant
}
void tst_QSequentialAnimationGroup::startChildrenWithStoppedGroup()
@@ -1320,9 +1320,9 @@ void tst_QSequentialAnimationGroup::startGroupWithRunningChild()
QCOMPARE(anim2->state(), QAnimationGroup::Running);
QCOMPARE(stateChangedSpy2.count(), 4);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(2).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(2).first()),
QAnimationGroup::Stopped);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(3).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy2.at(3).first()),
QAnimationGroup::Running);
group.stop();
@@ -1359,9 +1359,9 @@ void tst_QSequentialAnimationGroup::zeroDurationAnimation()
group.start();
QCOMPARE(stateChangedSpy.count(), 2);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(0).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(0).first()),
QAnimationGroup::Running);
- QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(1).at(1)),
+ QCOMPARE(qVariantValue<QAbstractAnimation::State>(stateChangedSpy.at(1).first()),
QAnimationGroup::Stopped);
QCOMPARE(anim1->state(), QAnimationGroup::Stopped);
@@ -1426,14 +1426,14 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
group.start();
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running);
- QCOMPARE(group.currentTime(), 0);
- QCOMPARE(notTimeDriven.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven.currentLoopTime(), 0);
QTest::qWait(300); //wait for the end of notTimeDriven
QCOMPARE(notTimeDriven.state(), QAnimationGroup::Stopped);
- const int actualDuration = notTimeDriven.currentTime();
+ const int actualDuration = notTimeDriven.currentLoopTime();
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(group.currentTime(), actualDuration);
+ QCOMPARE(group.currentLoopTime(), actualDuration);
QCOMPARE(spy.count(), 1);
//2nd case:
@@ -1444,7 +1444,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
group.setCurrentTime(300);
QCOMPARE(group.state(), QAnimationGroup::Stopped);
- QCOMPARE(notTimeDriven.currentTime(), actualDuration);
+ QCOMPARE(notTimeDriven.currentLoopTime(), actualDuration);
QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim));
//3rd case:
@@ -1453,8 +1453,8 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
group.start();
QCOMPARE(group.state(), QAnimationGroup::Running);
QCOMPARE(notTimeDriven.state(), QAnimationGroup::Running);
- QCOMPARE(group.currentTime(), 0);
- QCOMPARE(notTimeDriven.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
+ QCOMPARE(notTimeDriven.currentLoopTime(), 0);
QCOMPARE(animStateChangedSpy.count(), 0);
@@ -1467,12 +1467,12 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation()
QTest::qWait(300); //wait for the end of anim
QCOMPARE(anim.state(), QAnimationGroup::Stopped);
- QCOMPARE(anim.currentTime(), anim.duration());
+ QCOMPARE(anim.currentLoopTime(), anim.duration());
//we should simply be at the end
QCOMPARE(spy.count(), 1);
QCOMPARE(animStateChangedSpy.count(), 2);
- QCOMPARE(group.currentTime(), notTimeDriven.currentTime() + anim.currentTime());
+ QCOMPARE(group.currentLoopTime(), notTimeDriven.currentLoopTime() + anim.currentLoopTime());
}
void tst_QSequentialAnimationGroup::addRemoveAnimation()
@@ -1481,48 +1481,48 @@ void tst_QSequentialAnimationGroup::addRemoveAnimation()
QSequentialAnimationGroup group;
QCOMPARE(group.duration(), 0);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
QAbstractAnimation *anim1 = new QPropertyAnimation;
group.addAnimation(anim1);
QCOMPARE(group.duration(), 250);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), anim1);
//let's append an animation
QAbstractAnimation *anim2 = new QPropertyAnimation;
group.addAnimation(anim2);
QCOMPARE(group.duration(), 500);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), anim1);
//let's prepend an animation
QAbstractAnimation *anim0 = new QPropertyAnimation;
- group.insertAnimationAt(0, anim0);
+ group.insertAnimation(0, anim0);
QCOMPARE(group.duration(), 750);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
QCOMPARE(group.currentAnimation(), anim0); //anim0 has become the new currentAnimation
group.setCurrentTime(300); //anim0 | anim1 | anim2
- QCOMPARE(group.currentTime(), 300);
+ QCOMPARE(group.currentLoopTime(), 300);
QCOMPARE(group.currentAnimation(), anim1);
- QCOMPARE(anim1->currentTime(), 50);
+ QCOMPARE(anim1->currentLoopTime(), 50);
group.removeAnimation(anim0); //anim1 | anim2
- QCOMPARE(group.currentTime(), 50);
+ QCOMPARE(group.currentLoopTime(), 50);
QCOMPARE(group.currentAnimation(), anim1);
- QCOMPARE(anim1->currentTime(), 50);
+ QCOMPARE(anim1->currentLoopTime(), 50);
group.setCurrentTime(0);
- group.insertAnimationAt(0, anim0); //anim0 | anim1 | anim2
+ group.insertAnimation(0, anim0); //anim0 | anim1 | anim2
group.setCurrentTime(300);
- QCOMPARE(group.currentTime(), 300);
+ QCOMPARE(group.currentLoopTime(), 300);
QCOMPARE(group.currentAnimation(), anim1);
- QCOMPARE(anim1->currentTime(), 50);
+ QCOMPARE(anim1->currentLoopTime(), 50);
group.removeAnimation(anim1); //anim0 | anim2
- QCOMPARE(group.currentTime(), 250);
+ QCOMPARE(group.currentLoopTime(), 250);
QCOMPARE(group.currentAnimation(), anim2);
- QCOMPARE(anim0->currentTime(), 250);
+ QCOMPARE(anim0->currentLoopTime(), 250);
}
void tst_QSequentialAnimationGroup::currentAnimation()
@@ -1595,15 +1595,15 @@ class SequentialAnimationGroup : public QSequentialAnimationGroup
{
Q_OBJECT
public slots:
- void clearAnimations()
+ void clear()
{
- QSequentialAnimationGroup::clearAnimations();
+ QSequentialAnimationGroup::clear();
}
void refill()
{
stop();
- clearAnimations();
+ clear();
new DummyPropertyAnimation(this);
start();
}
@@ -1611,11 +1611,11 @@ public slots:
};
-void tst_QSequentialAnimationGroup::clearAnimations()
+void tst_QSequentialAnimationGroup::clear()
{
SequentialAnimationGroup group;
QPointer<QAbstractAnimation> anim1 = new DummyPropertyAnimation(&group);
- group.connect(anim1, SIGNAL(finished()), SLOT(clearAnimations()));
+ group.connect(anim1, SIGNAL(finished()), SLOT(clear()));
new DummyPropertyAnimation(&group);
QCOMPARE(group.animationCount(), 2);
@@ -1623,7 +1623,7 @@ void tst_QSequentialAnimationGroup::clearAnimations()
QTest::qWait(anim1->duration() + 100);
QCOMPARE(group.animationCount(), 0);
QCOMPARE(group.state(), QAbstractAnimation::Stopped);
- QCOMPARE(group.currentTime(), 0);
+ QCOMPARE(group.currentLoopTime(), 0);
anim1 = new DummyPropertyAnimation(&group);
group.connect(anim1, SIGNAL(finished()), SLOT(refill()));
@@ -1649,22 +1649,22 @@ void tst_QSequentialAnimationGroup::pauseResume()
QCOMPARE(anim->state(), QAnimationGroup::Running);
QCOMPARE(spy.count(), 1);
spy.clear();
- const int currentTime = group.currentTime();
- QCOMPARE(anim->currentTime(), currentTime);
+ const int currentTime = group.currentLoopTime();
+ QCOMPARE(anim->currentLoopTime(), currentTime);
group.pause();
QCOMPARE(group.state(), QAnimationGroup::Paused);
- QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Paused);
- QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
QCOMPARE(spy.count(), 1);
spy.clear();
group.resume();
QCOMPARE(group.state(), QAnimationGroup::Running);
- QCOMPARE(group.currentTime(), currentTime);
+ QCOMPARE(group.currentLoopTime(), currentTime);
QCOMPARE(anim->state(), QAnimationGroup::Running);
- QCOMPARE(anim->currentTime(), currentTime);
+ QCOMPARE(anim->currentLoopTime(), currentTime);
QCOMPARE(spy.count(), 1);
}
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index 227ca6f254..f571e8a87d 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -197,6 +197,7 @@ private slots:
void task259308_scrollVerticalHeaderSwappedSections();
void task191545_dragSelectRows();
void taskQTBUG_5062_spansInconsistency();
+ void taskQTBUG_4516_clickOnRichTextLabel();
void mouseWheel_data();
void mouseWheel();
@@ -3885,6 +3886,24 @@ void tst_QTableView::taskQTBUG_5062_spansInconsistency()
VERIFY_SPANS_CONSISTENCY(&view);
}
+void tst_QTableView::taskQTBUG_4516_clickOnRichTextLabel()
+{
+ QTableView view;
+ QStandardItemModel model(5,5);
+ view.setModel(&model);
+ QLabel label("rich text");
+ label.setTextFormat(Qt::RichText);
+ view.setIndexWidget(model.index(1,1), &label);
+ view.setCurrentIndex(model.index(0,0));
+ QCOMPARE(view.currentIndex(), model.index(0,0));
+
+ QTest::mouseClick(&label, Qt::LeftButton);
+ QCOMPARE(view.currentIndex(), model.index(1,1));
+
+
+}
+
+
void tst_QTableView::changeHeaderData()
{
QTableView view;
diff --git a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
index 8c4d8fdabd..4dc732cd60 100644
--- a/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
+++ b/tests/auto/qtextdocumentfragment/tst_qtextdocumentfragment.cpp
@@ -2197,6 +2197,16 @@ void tst_QTextDocumentFragment::html_quotedFontFamily()
setHtml("<div style='font-family: \"Foo Bar\";'>Test</div>");
QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar"));
+
+ setHtml("<div style='font-family: \"Foo Bar\";'>Test</div>");
+ QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar"));
+
+ setHtml("<div style='font-family: Foo\n Bar;'>Test</div>");
+ QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar"));
+
+ setHtml("<div style='font-family: Foo\n Bar, serif, \"bar foo\";'>Test</div>");
+ QCOMPARE(doc->begin().begin().fragment().charFormat().fontFamily(), QString("Foo Bar,serif,bar foo"));
+
}
void tst_QTextDocumentFragment::defaultFont()
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 90e6c5ca83..58f059b7d8 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -3669,11 +3669,11 @@ void tst_QTreeView::doubleClickedWithSpans()
//end the previous edition
QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
- QTest::qWait(100);
+ QTest::qWait(150);
QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p);
QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p);
QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p);
- QCOMPARE(spy.count(), 2);
+ QTRY_COMPARE(spy.count(), 2);
}
QTEST_MAIN(tst_QTreeView)
diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
index 50b3337592..d25738fc38 100644
--- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
+++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
@@ -395,7 +395,9 @@ void tst_QWidgetAction::releaseWidgetCrash()
QMainWindow *w = new QMainWindow;
QAction *a = new CrashedAction(w);
QMenu *menu = w->menuBar()->addMenu("Test");
+ menu->addAction("foo");
menu->addAction(a);
+ menu->addAction("bar");
delete w;
}
diff --git a/tests/auto/uiloader/baseline/css_itemview_task258382.ui b/tests/auto/uiloader/baseline/css_itemview_task258382.ui
new file mode 100644
index 0000000000..11c56b4ba2
--- /dev/null
+++ b/tests/auto/uiloader/baseline/css_itemview_task258382.ui
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Form</class>
+ <widget class="QWidget" name="Form">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>437</width>
+ <height>352</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">::item { border: 1px solid black; background-color: purple; }
+::item {margin-left: 20px; }
+
+QAbstractItemView { selection-background-color: red;
+show-decoration- selected: 0;
+ }
+
+::item:selected { background-color: yellow; }</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QTreeWidget" name="treeWidget">
+ <column>
+ <property name="text">
+ <string>1</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>New Subitem</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>New Subitem</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>New Item</string>
+ </property>
+ </item>
+ </item>
+ </item>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QTableWidget" name="tableWidget">
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <row>
+ <property name="text">
+ <string>New Row</string>
+ </property>
+ </row>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>New Column</string>
+ </property>
+ </column>
+ <item row="0" column="0">
+ <property name="text">
+ <string>mljkh mh mjl</string>
+ </property>
+ </item>
+ <item row="0" column="1">
+ <property name="text">
+ <string>h jlh mjklh </string>
+ </property>
+ </item>
+ <item row="0" column="2">
+ <property name="text">
+ <string>mjklh mlhj mjlh m</string>
+ </property>
+ </item>
+ <item row="1" column="3">
+ <property name="text">
+ <string>mlhj lmhj </string>
+ </property>
+ </item>
+ <item row="2" column="0">
+ <property name="text">
+ <string>mlkj l</string>
+ </property>
+ </item>
+ <item row="2" column="1">
+ <property name="text">
+ <string>mlkj </string>
+ </property>
+ </item>
+ <item row="2" column="2">
+ <property name="text">
+ <string>mlkj lmkj </string>
+ </property>
+ </item>
+ <item row="2" column="3">
+ <property name="text">
+ <string>mlkhj mlh</string>
+ </property>
+ </item>
+ <item row="3" column="1">
+ <property name="text">
+ <string>mlkj lmkj </string>
+ </property>
+ </item>
+ <item row="4" column="0">
+ <property name="text">
+ <string>mlkj lmkj </string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>