diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gestures/tst_gestures.cpp | 17 | ||||
-rw-r--r-- | tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qsqldatabase/tst_databases.h | 1 | ||||
-rw-r--r-- | tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 25 | ||||
-rw-r--r-- | tests/auto/qsqldriver/tst_qsqldriver.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp | 8 | ||||
-rw-r--r-- | tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqlthread/tst_qsqlthread.cpp | 2 |
8 files changed, 52 insertions, 23 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 0a6caff..46ed45e 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -474,17 +474,20 @@ void tst_Gestures::finishedWithoutStarted() { GestureWidget widget; widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture); + // the gesture will claim it finished, but it was never started. CustomEvent ev; - QTest::ignoreMessage(QtWarningMsg, "QGestureManager::filterEvent: some gestures were finished even though they've never started"); - for (int i = CustomGesture::SerialFinishedThreshold; - i < CustomGesture::SerialFinishedThreshold+1; ++i) { - ev.serial = i; - QApplication::sendEvent(&widget, &ev); - } + ev.serial = CustomGesture::SerialFinishedThreshold; + QApplication::sendEvent(&widget, &ev); - QCOMPARE(widget.gestureEventsReceived, 0); + QCOMPARE(widget.customEventsReceived, 1); + QCOMPARE(widget.gestureEventsReceived, 2); QCOMPARE(widget.gestureOverrideEventsReceived, 0); + QCOMPARE(widget.events.all.size(), 2); + QCOMPARE(widget.events.started.size(), 1); + QCOMPARE(widget.events.updated.size(), 0); + QCOMPARE(widget.events.finished.size(), 1); + QCOMPARE(widget.events.canceled.size(), 0); } void tst_Gestures::unknownGesture() diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp index 5893687..237f29d 100644 --- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp +++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp @@ -108,8 +108,12 @@ void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db ) return; QSqlQuery q( db ); // please never ever change this table; otherwise fix all tests ;) - QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," - "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); + if (tst_Databases::isMSAccess(db)) + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + "t_char char(40), t_numeric number, primary key (id, t_varchar) )" )); + else + QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," + "t_char char(40), t_numeric numeric(6, 3), primary key (id, t_varchar) )" )); } void tst_Q3SqlSelectCursor::dropTestTables( QSqlDatabase db ) diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h index c5c3663..25b1e2f 100644 --- a/tests/auto/qsqldatabase/tst_databases.h +++ b/tests/auto/qsqldatabase/tst_databases.h @@ -258,6 +258,7 @@ public: // addDb( "QTDS7", "testdb", "testuser", "Ee4Gabf6_", "bq-winserv2008" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2003-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); // addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=bq-winserv2008-x86-01.apac.nokia.com;DATABASE=testdb;PORT=1433", "testuser", "Ee4Gabf6_", "" ); +// addDb( "QODBC", "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:\\dbs\\access\\testdb.mdb", "", "", "" ); } void open() diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index c9c8f5e..7149fab 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -792,8 +792,8 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db) if (val1.type() == QVariant::DateTime || val1.type() == QVariant::Time) qDebug("Received Time: " + val1.toTime().toString("hh:mm:ss.zzz")); QFAIL(QString(" Expected: '%1' Received: '%2' for field %3 (etype %4 rtype %5) in checkValues").arg( - val2.toString()).arg( - val1.toString()).arg( + val2.type() == QVariant::ByteArray ? val2.toByteArray().toHex() : val2.toString()).arg( + val1.type() == QVariant::ByteArray ? val1.toByteArray().toHex() : val1.toString()).arg( fieldDefs[ i ].fieldName()).arg( val2.typeName()).arg( val1.typeName()) @@ -1292,9 +1292,9 @@ void tst_QSqlDatabase::recordAccess() FieldDef("varchar(20)", QVariant::String, QString("Blah1")), FieldDef("single", QVariant::Double, 1.12345), FieldDef("double", QVariant::Double, 1.123456), - FieldDef("byte", QVariant::Int, 255), + FieldDef("byte", QVariant::UInt, 255), #ifdef QT3_SUPPORT - FieldDef("binary", QVariant::ByteArray, Q3CString("Blah2")), + FieldDef("binary(5)", QVariant::ByteArray, Q3CString("Blah2")), #endif FieldDef("long", QVariant::Int, 2147483647), FieldDef("memo", QVariant::String, memo), @@ -1643,7 +1643,10 @@ void tst_QSqlDatabase::precisionPolicy() QSKIP("Driver or database doesn't support setting precision policy", SkipSingle); // Create a test table with some data - QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (id smallint, num numeric(18,5))").arg(tableName))); + if(tst_Databases::isMSAccess(db)) + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (id smallint, num number)").arg(tableName))); + else + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1 (id smallint, num numeric(18,5))").arg(tableName))); QVERIFY_SQL(q, prepare(QString("INSERT INTO %1 VALUES (?, ?)").arg(tableName))); q.bindValue(0, 1); q.bindValue(1, 123); @@ -2007,6 +2010,7 @@ void tst_QSqlDatabase::odbc_bindBoolean() QSKIP("MySql has inconsistent behaviour of bit field type across versions.", SkipSingle); return; } + QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("qtestBindBool") + "(id int, boolvalue bit)")); @@ -2038,6 +2042,8 @@ void tst_QSqlDatabase::odbc_testqGetString() QSqlQuery q(db); if (tst_Databases::isSqlServer(db)) QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(MAX))")); + else if(tst_Databases::isMSAccess(db)) + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue memo)")); else QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))")); @@ -2264,7 +2270,10 @@ void tst_QSqlDatabase::odbc_uintfield() unsigned int val = 4294967295U; QSqlQuery q(db); - q.exec(QString("CREATE TABLE %1(num numeric(10))").arg(tableName)); + if ( tst_Databases::isMSAccess( db ) ) + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(num number)").arg(tableName))); + else + QVERIFY_SQL(q, exec(QString("CREATE TABLE %1(num numeric(10))").arg(tableName))); q.prepare(QString("INSERT INTO %1 VALUES(?)").arg(tableName)); q.addBindValue(val); QVERIFY_SQL(q, exec()); @@ -2440,8 +2449,8 @@ void tst_QSqlDatabase::mysql_savepointtest() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); - if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 ) - QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); + if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toInt()<4.1 ) + QSKIP( "Test requires MySQL >= 4.1", SkipSingle ); QSqlQuery q(db); QVERIFY_SQL(q, exec("begin")); diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index f463c9e..8fc38a7 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -160,7 +160,11 @@ void tst_QSqlDriver::record() //check that we can't get records using incorrect tablename casing that's been quoted rec = db.driver()->record(db.driver()->escapeIdentifier(tablename,QSqlDriver::TableName)); - if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS") || tst_Databases::isSqlServer(db)) + if (tst_Databases::isMySQL(db) + || db.driverName().startsWith("QSQLITE") + || db.driverName().startsWith("QTDS") + || tst_Databases::isSqlServer(db) + || tst_Databases::isMSAccess(db)) QCOMPARE(rec.count(), 4); //mysql, sqlite and tds will match else QCOMPARE(rec.count(), 0); @@ -208,7 +212,11 @@ void tst_QSqlDriver::primaryIndex() tablename = tablename.toUpper(); index = db.driver()->primaryIndex(db.driver()->escapeIdentifier(tablename, QSqlDriver::TableName)); - if (tst_Databases::isMySQL(db) || db.driverName().startsWith("QSQLITE") || db.driverName().startsWith("QTDS") || tst_Databases::isSqlServer(db)) + if (tst_Databases::isMySQL(db) + || db.driverName().startsWith("QSQLITE") + || db.driverName().startsWith("QTDS") + || tst_Databases::isSqlServer(db) + || tst_Databases::isMSAccess(db)) QCOMPARE(index.count(), 1); //mysql will always find the table name regardless of casing else QCOMPARE(index.count(), 0); diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 05d546e..cb24a9f 100644 --- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -837,10 +837,10 @@ void tst_QSqlRelationalTableModel::insertRecordDuplicateFieldNames() QVERIFY_SQL(model, select()); if (db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) { - QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name")).toUpper()).toString(), + QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name_2")).toUpper()).toString(), QString("Trondheim")); } else { - QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name"))).toString(), + QCOMPARE(model.record(1).value(qTableName("reltest4").append(QLatin1String("_name_2"))).toString(), QString("Trondheim")); } @@ -859,9 +859,9 @@ void tst_QSqlRelationalTableModel::insertRecordDuplicateFieldNames() // The duplicate field names is aliased because it's comes from the relation's display column. if(db.driverName().startsWith("QIBASE") || db.driverName().startsWith("QOCI") || db.driverName().startsWith("QDB2")) - QCOMPARE(rec.fieldName(2), (qTableName("reltest4").append(QLatin1String("_name"))).toUpper()); + QCOMPARE(rec.fieldName(2), (qTableName("reltest4").append(QLatin1String("_name_2"))).toUpper()); else - QCOMPARE(rec.fieldName(2), qTableName("reltest4").append(QLatin1String("_name"))); + QCOMPARE(rec.fieldName(2), qTableName("reltest4").append(QLatin1String("_name_2"))); QVERIFY(model.insertRecord(-1, rec)); QCOMPARE(model.data(model.index(2, 2)).toString(), QString("Oslo")); diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 49e087f..5405cb6 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -897,6 +897,8 @@ void tst_QSqlTableModel::sqlite_attachedDatabase() QFETCH(QString, dbName); QSqlDatabase db = QSqlDatabase::database(dbName); CHECK_DATABASE(db); + if(db.databaseName() == ":memory:") + QSKIP(":memory: database, skipping test", SkipSingle); QSqlDatabase attachedDb = QSqlDatabase::cloneDatabase(db, db.driverName() + QLatin1String("attached")); attachedDb.setDatabaseName(db.databaseName()+QLatin1String("attached.dat")); diff --git a/tests/auto/qsqlthread/tst_qsqlthread.cpp b/tests/auto/qsqlthread/tst_qsqlthread.cpp index c088a47..be66e9e 100644 --- a/tests/auto/qsqlthread/tst_qsqlthread.cpp +++ b/tests/auto/qsqlthread/tst_qsqlthread.cpp @@ -404,6 +404,8 @@ void tst_QSqlThread::readWriteThreading() if (db.databaseName() == ":memory:") QSKIP("does not work with in-memory databases", SkipSingle); + else if (tst_Databases::isMSAccess(db)) + QSKIP("does not work with MS Access databases", SkipSingle); SqlProducer producer(db); SqlConsumer consumer(db); |