normalise signal/slot signatures [QtSql tests]
Change-Id: I06573bc2ad58378dd835565cd07d711bfc760411 Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
parent
6444d36e5d
commit
848c88c7a2
@ -2048,7 +2048,7 @@ void tst_QSqlDatabase::eventNotificationIBase()
|
|||||||
q.exec(QString("DROP PROCEDURE %1").arg(procedureName));
|
q.exec(QString("DROP PROCEDURE %1").arg(procedureName));
|
||||||
q.exec(QString("CREATE PROCEDURE %1\nAS BEGIN\nPOST_EVENT '%1';\nEND;").arg(procedureName));
|
q.exec(QString("CREATE PROCEDURE %1\nAS BEGIN\nPOST_EVENT '%1';\nEND;").arg(procedureName));
|
||||||
q.exec(QString("EXECUTE PROCEDURE %1").arg(procedureName));
|
q.exec(QString("EXECUTE PROCEDURE %1").arg(procedureName));
|
||||||
QSignalSpy spy(driver, SIGNAL(notification(const QString&)));
|
QSignalSpy spy(driver, SIGNAL(notification(QString)));
|
||||||
db.commit(); // No notifications are posted until the transaction is committed.
|
db.commit(); // No notifications are posted until the transaction is committed.
|
||||||
QTest::qWait(300); // Interbase needs some time to post the notification and call the driver callback.
|
QTest::qWait(300); // Interbase needs some time to post the notification and call the driver callback.
|
||||||
// This happends from another thread, and we have to process events in order for the
|
// This happends from another thread, and we have to process events in order for the
|
||||||
@ -2072,7 +2072,7 @@ void tst_QSqlDatabase::eventNotificationPSQL()
|
|||||||
QString payload = "payload";
|
QString payload = "payload";
|
||||||
QSqlDriver &driver=*(db.driver());
|
QSqlDriver &driver=*(db.driver());
|
||||||
QVERIFY_SQL(driver, subscribeToNotification(procedureName));
|
QVERIFY_SQL(driver, subscribeToNotification(procedureName));
|
||||||
QSignalSpy spy(db.driver(), SIGNAL(notification(const QString&,QSqlDriver::NotificationSource,const QVariant&)));
|
QSignalSpy spy(db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant)));
|
||||||
query.exec(QString("NOTIFY \"%1\", '%2'").arg(procedureName).arg(payload));
|
query.exec(QString("NOTIFY \"%1\", '%2'").arg(procedureName).arg(payload));
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
|
@ -235,7 +235,7 @@ void tst_QSqlQueryModel::removeColumn()
|
|||||||
DBTestModel model;
|
DBTestModel model;
|
||||||
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db));
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db));
|
||||||
model.fetchMore();
|
model.fetchMore();
|
||||||
QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex, int, int)));
|
QSignalSpy spy(&model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)));
|
||||||
|
|
||||||
QCOMPARE(model.columnCount(), 3);
|
QCOMPARE(model.columnCount(), 3);
|
||||||
QVERIFY(model.removeColumn(0));
|
QVERIFY(model.removeColumn(0));
|
||||||
@ -323,7 +323,7 @@ void tst_QSqlQueryModel::insertColumn()
|
|||||||
const QString nameColumn(isToUpper ? "NAME" : "name");
|
const QString nameColumn(isToUpper ? "NAME" : "name");
|
||||||
const QString titleColumn(isToUpper ? "TITLE" : "title");
|
const QString titleColumn(isToUpper ? "TITLE" : "title");
|
||||||
|
|
||||||
QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex, int, int)));
|
QSignalSpy spy(&model, SIGNAL(columnsInserted(QModelIndex,int,int)));
|
||||||
|
|
||||||
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
|
QCOMPARE(model.data(model.index(0, 0)).toInt(), 1);
|
||||||
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
|
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
|
||||||
@ -455,7 +455,7 @@ void tst_QSqlQueryModel::setHeaderData()
|
|||||||
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db));
|
model.setQuery(QSqlQuery("select * from " + qTableName("test", __FILE__), db));
|
||||||
|
|
||||||
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
||||||
QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)));
|
QSignalSpy spy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
|
||||||
QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar"));
|
QVERIFY(model.setHeaderData(2, Qt::Horizontal, "bar"));
|
||||||
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar"));
|
QCOMPARE(model.headerData(2, Qt::Horizontal).toString(), QString("bar"));
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
@ -491,7 +491,7 @@ void tst_QSqlQueryModel::fetchMore()
|
|||||||
|
|
||||||
// If the driver doesn't return the query size fetchMore() causes the
|
// If the driver doesn't return the query size fetchMore() causes the
|
||||||
// model to grow and new signals are emitted
|
// model to grow and new signals are emitted
|
||||||
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex, int, int)));
|
QSignalSpy rowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
if (!db.driver()->hasFeature(QSqlDriver::QuerySize)) {
|
if (!db.driver()->hasFeature(QSqlDriver::QuerySize)) {
|
||||||
model.fetchMore();
|
model.fetchMore();
|
||||||
int newRowCount = model.rowCount();
|
int newRowCount = model.rowCount();
|
||||||
@ -524,7 +524,7 @@ void tst_QSqlQueryModel::withSortFilterProxyModel()
|
|||||||
|
|
||||||
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
||||||
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
||||||
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
|
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__), db));
|
model.setQuery(QSqlQuery("SELECT * FROM " + qTableName("test3", __FILE__), db));
|
||||||
view.scrollToBottom();
|
view.scrollToBottom();
|
||||||
|
|
||||||
@ -576,8 +576,8 @@ void tst_QSqlQueryModel::setQueryWithNoRowsInResultSet()
|
|||||||
CHECK_DATABASE(db);
|
CHECK_DATABASE(db);
|
||||||
|
|
||||||
QSqlQueryModel model;
|
QSqlQueryModel model;
|
||||||
QSignalSpy modelRowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)));
|
QSignalSpy modelRowsAboutToBeInsertedSpy(&model, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)));
|
||||||
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
|
QSignalSpy modelRowsInsertedSpy(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
|
|
||||||
// The query's result set will be empty so no signals should be emitted!
|
// The query's result set will be empty so no signals should be emitted!
|
||||||
QSqlQuery query(db);
|
QSqlQuery query(db);
|
||||||
|
@ -941,7 +941,7 @@ void tst_QSqlTableModel::removeRow()
|
|||||||
|
|
||||||
// headerDataChanged must be emitted by the model since the row won't vanish until select
|
// headerDataChanged must be emitted by the model since the row won't vanish until select
|
||||||
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
||||||
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)));
|
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
|
||||||
|
|
||||||
QVERIFY(model.removeRow(1));
|
QVERIFY(model.removeRow(1));
|
||||||
QCOMPARE(headerDataChangedSpy.count(), 1);
|
QCOMPARE(headerDataChangedSpy.count(), 1);
|
||||||
@ -1028,7 +1028,7 @@ void tst_QSqlTableModel::removeRows()
|
|||||||
QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex
|
QVERIFY(!model.removeRows(1, 0, model.index(2, 0))); // can't pass a valid modelindex
|
||||||
|
|
||||||
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
qRegisterMetaType<Qt::Orientation>("Qt::Orientation");
|
||||||
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation, int, int)));
|
QSignalSpy headerDataChangedSpy(&model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)));
|
||||||
QVERIFY(model.removeRows(0, 2, QModelIndex()));
|
QVERIFY(model.removeRows(0, 2, QModelIndex()));
|
||||||
QCOMPARE(headerDataChangedSpy.count(), 2);
|
QCOMPARE(headerDataChangedSpy.count(), 2);
|
||||||
QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1);
|
QCOMPARE(headerDataChangedSpy.at(0).at(1).toInt(), 1);
|
||||||
@ -1677,7 +1677,7 @@ void tst_QSqlTableModel::insertRecordsInLoop()
|
|||||||
|
|
||||||
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
QSignalSpy modelAboutToBeResetSpy(&model, SIGNAL(modelAboutToBeReset()));
|
||||||
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
QSignalSpy modelResetSpy(&model, SIGNAL(modelReset()));
|
||||||
QSignalSpy spyRowsInserted(&model, SIGNAL(rowsInserted(const QModelIndex &, int, int)));
|
QSignalSpy spyRowsInserted(&model, SIGNAL(rowsInserted(QModelIndex,int,int)));
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
QVERIFY(model.insertRecord(model.rowCount(), record));
|
QVERIFY(model.insertRecord(model.rowCount(), record));
|
||||||
QCOMPARE(spyRowsInserted.at(i).at(1).toInt(), i+3); // The table already contains three rows
|
QCOMPARE(spyRowsInserted.at(i).at(1).toInt(), i+3); // The table already contains three rows
|
||||||
|
Loading…
x
Reference in New Issue
Block a user