diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-01-15 05:35:55 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-01-15 05:35:55 (GMT) |
commit | d2fa5b80d4f40ac67a7a74552390332551563466 (patch) | |
tree | 1ef112b385dbbdd49abefd9b574573f7d21b69bf /tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | |
parent | f0d24ba1eaa1079abef3a1da641b43437dc7df66 (diff) | |
parent | 6c5c2312ca5477a1ec33f43c1673ab65a0dce8bb (diff) | |
download | Qt-d2fa5b80d4f40ac67a7a74552390332551563466.zip Qt-d2fa5b80d4f40ac67a7a74552390332551563466.tar.gz Qt-d2fa5b80d4f40ac67a7a74552390332551563466.tar.bz2 |
Merge branch 'master' of ../../qt/master
Conflicts:
examples/multimedia/audioinput/audioinput.cpp
src/multimedia/audio/qaudiodeviceinfo.cpp
src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
src/multimedia/audio/qaudioformat.cpp
src/multimedia/audio/qaudioinput_win32_p.cpp
src/multimedia/audio/qaudiooutput_win32_p.cpp
tests/auto/qaudioformat/tst_qaudioformat.cpp
Diffstat (limited to 'tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp')
-rw-r--r-- | tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 3131f35..7e75d28 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -96,6 +96,7 @@ private slots: void task_180617(); void task_180617_data() { generic_data(); } + void task_QTBUG_4963_setHeaderDataWithProxyModel(); private: void generic_data(const QString &engine=QString()); @@ -428,6 +429,8 @@ void tst_QSqlQueryModel::setHeaderData() QVERIFY(!model.setHeaderData(5, Qt::Vertical, "foo")); QVERIFY(model.headerData(5, Qt::Vertical).isValid()); + model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + qRegisterMetaType<Qt::Orientation>("Qt::Orientation"); QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int))); QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar")); @@ -437,10 +440,8 @@ void tst_QSqlQueryModel::setHeaderData() QCOMPARE(spy.value(0).value(1).toInt(), 2); QCOMPARE(spy.value(0).value(2).toInt(), 2); - QVERIFY(model.setHeaderData(7, Qt::Horizontal, "foo", Qt::ToolTipRole)); - QVERIFY(model.headerData(7, Qt::Horizontal, Qt::ToolTipRole).isValid()); - - model.setQuery(QSqlQuery("select * from " + qTableName("test"), db)); + QVERIFY(!model.setHeaderData(7, Qt::Horizontal, "foo", Qt::ToolTipRole)); + QVERIFY(!model.headerData(7, Qt::Horizontal, Qt::ToolTipRole).isValid()); bool isToUpper = db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2"); QCOMPARE(model.headerData(0, Qt::Horizontal).toString(), isToUpper ? QString("ID") : QString("id")); @@ -603,5 +604,14 @@ void tst_QSqlQueryModel::task_180617() QCOMPARE(view.rowAt(0), -1); } +void tst_QSqlQueryModel::task_QTBUG_4963_setHeaderDataWithProxyModel() +{ + QSqlQueryModel plainModel; + QSortFilterProxyModel proxyModel; + proxyModel.setSourceModel(&plainModel); + QVERIFY(!plainModel.setHeaderData(0, Qt::Horizontal, QObject::tr("ID"))); + // And it should not crash. +} + QTEST_MAIN(tst_QSqlQueryModel) #include "tst_qsqlquerymodel.moc" |