summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-16 10:11:46 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-16 10:11:46 (GMT)
commitb6e8943592ec6b2cbc619c35ca90feded0e1e87b (patch)
treebb971d036401ac7eeb1cda928ae764408b48f141 /tests
parent554eedb76ecceca5123992147ed1aa48aabc6662 (diff)
parent82575a9f6123eed3e8581b6e73833924fe47cace (diff)
downloadQt-b6e8943592ec6b2cbc619c35ca90feded0e1e87b.zip
Qt-b6e8943592ec6b2cbc619c35ca90feded0e1e87b.tar.gz
Qt-b6e8943592ec6b2cbc619c35ca90feded0e1e87b.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fixed regression in QPixmap::size() for null pixmaps. Make test less sensitive to platform specifics Doc: Further QML improvements. Doc: Minor improvements to QML-related documentation. The test livelock of QTimer is now expected to work Make sure mapSelectionFromSource does not return a selection with invalid ranges. QEventDispatcherUnix: do not process too many timer if other events need to be processed first Doc: Continued work on the QML documentation. Doc: More work on the QML documentation. Doc: More work on the declarative API documentation. Doc: Some editing and tidying up. Doc: Added a missing file. Doc: Fixed text in license headers.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp39
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp69
2 files changed, 101 insertions, 7 deletions
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 53fefee..66caf4a 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -143,6 +143,7 @@ private slots:
void taskQTBUG_10287_unnecessaryMapCreation();
void testMultipleProxiesWithSelection();
+ void mapSelectionFromSource();
protected:
void buildHierarchy(const QStringList &data, QAbstractItemModel *model);
@@ -3075,6 +3076,44 @@ void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection()
}
+static bool isValid(const QItemSelection &selection) {
+ foreach(const QItemSelectionRange &range, selection)
+ if (!range.isValid())
+ return false;
+ return true;
+}
+
+void tst_QSortFilterProxyModel::mapSelectionFromSource()
+{
+ QStringListModel model;
+ const QStringList initial = QString("bravo charlie delta echo").split(" ");
+ model.setStringList(initial);
+
+ QSortFilterProxyModel proxy;
+ proxy.setDynamicSortFilter(true);
+ proxy.setFilterRegExp("d.*");
+ proxy.setSourceModel(&model);
+
+ // Only "delta" remains.
+ QVERIFY(proxy.rowCount() == 1);
+
+ QItemSelection selection;
+ QModelIndex charlie = model.index(1, 0);
+ selection.append(QItemSelectionRange(charlie, charlie));
+ QModelIndex delta = model.index(2, 0);
+ selection.append(QItemSelectionRange(delta, delta));
+ QModelIndex echo = model.index(3, 0);
+ selection.append(QItemSelectionRange(echo, echo));
+
+ QVERIFY(isValid(selection));
+
+ QItemSelection proxiedSelection = proxy.mapSelectionFromSource(selection);
+
+ // Only "delta" is in the mapped result.
+ QVERIFY(proxiedSelection.size() == 1);
+ QVERIFY(isValid(proxiedSelection));
+}
+
class Model10287 : public QStandardItemModel
{
Q_OBJECT
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index b651187..f23d065 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -87,6 +87,8 @@ private slots:
void cancelLongTimer();
void singleShotStaticFunctionZeroTimeout();
void recurseOnTimeoutAndStopTimer();
+
+ void QTBUG13633_dontBlockEvents();
};
class TimerHelper : public QObject
@@ -269,13 +271,7 @@ void tst_QTimer::livelock()
QCOMPARE(tester.timeoutsForFirst, 1);
QCOMPARE(tester.timeoutsForExtra, 0);
QCOMPARE(tester.timeoutsForSecond, 1);
-#if defined(Q_OS_MAC)
- QEXPECT_FAIL("zero timer", "Posted events source are handled AFTER timers", Continue);
- QEXPECT_FAIL("non-zero timer", "Posted events source are handled AFTER timers", Continue);
-#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
- QEXPECT_FAIL("zero timer", "", Continue);
- QEXPECT_FAIL("non-zero timer", "", Continue);
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (QSysInfo::WindowsVersion < QSysInfo::WV_XP)
QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue);
#elif defined(Q_OS_WINCE)
@@ -668,5 +664,64 @@ void tst_QTimer::recurseOnTimeoutAndStopTimer()
QVERIFY(!t.two->isActive());
}
+
+
+class DontBlockEvents : public QObject
+{
+ Q_OBJECT
+public:
+ DontBlockEvents();
+ void timerEvent(QTimerEvent*);
+
+ int count;
+ int total;
+ QBasicTimer m_timer;
+
+public slots:
+ void paintEvent();
+
+};
+
+DontBlockEvents::DontBlockEvents()
+{
+ count = 0;
+ total = 0;
+
+ //QTBUG-13633 need few unrelated timer running to reproduce the bug.
+ (new QTimer(this))->start(2000);
+ (new QTimer(this))->start(2500);
+ (new QTimer(this))->start(3000);
+ (new QTimer(this))->start(5000);
+ (new QTimer(this))->start(1000);
+ (new QTimer(this))->start(2000);
+
+ m_timer.start(1, this);
+}
+
+void DontBlockEvents::timerEvent(QTimerEvent* event)
+{
+ if (event->timerId() == m_timer.timerId()) {
+ QMetaObject::invokeMethod(this, "paintEvent", Qt::QueuedConnection);
+ m_timer.start(0, this);
+ count++;
+ QCOMPARE(count, 1);
+ total++;
+ }
+}
+
+void DontBlockEvents::paintEvent()
+{
+ count--;
+ QCOMPARE(count, 0);
+}
+
+
+void tst_QTimer::QTBUG13633_dontBlockEvents()
+{
+ DontBlockEvents t;
+ QTest::qWait(60);
+ QVERIFY(t.total > 2);
+}
+
QTEST_MAIN(tst_QTimer)
#include "tst_qtimer.moc"