diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-10-15 07:57:10 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-10-15 07:57:35 (GMT) |
commit | a814aba657288942b5beed70a2110446420f981c (patch) | |
tree | dd112e5838b9daf6aeb01d31a409f8a438047e0d /tests/auto | |
parent | e479ba841f62cc4af709e97f8085d7779e14e3e9 (diff) | |
parent | 1a62cb6ba07ef64e5101cbfca85bb539075742d5 (diff) | |
download | Qt-a814aba657288942b5beed70a2110446420f981c.zip Qt-a814aba657288942b5beed70a2110446420f981c.tar.gz Qt-a814aba657288942b5beed70a2110446420f981c.tar.bz2 |
Merge commit origin/4.6 into team-widgets/4.6
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qpainter/tst_qpainter.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsidebar/tst_qsidebar.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 23 | ||||
-rw-r--r-- | tests/auto/qsqldriver/tst_qsqldriver.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qsqlquery/tst_qsqlquery.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 5 |
9 files changed, 57 insertions, 13 deletions
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 6b580df..ecc0594 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -137,6 +137,8 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db ) QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); } + else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if ( tst_Databases::isMSAccess( db ) ) { diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp index 237f29d..68e8ce8 100644 --- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp +++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp @@ -107,6 +107,8 @@ void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db ) if ( !db.isValid() ) return; QSqlQuery q( db ); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) QVERIFY_SQL(q, exec( "create table " + qTableName( "qtest" ) + " ( id int not null, t_varchar varchar(40) not null," diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 9515d87..e4f267d 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -1554,7 +1554,7 @@ void tst_QPainter::drawClippedEllipse_data() void tst_QPainter::drawClippedEllipse() { QFETCH(QRect, rect); -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) if (sizeof(qreal) != sizeof(double)) QSKIP("Test only works for qreal==double", SkipAll); #endif diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp index 7b157f6..b810305 100644 --- a/tests/auto/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/qsidebar/tst_qsidebar.cpp @@ -122,6 +122,12 @@ void tst_QSidebar::addUrls() QSidebar qsidebar; qsidebar.init(&fsmodel, emptyUrls); QAbstractItemModel *model = qsidebar.model(); +#if defined(Q_OS_SYMBIAN) + // On Symbian, QDir::rootPath() and QDir::home() are same. + QDir testDir = QDir::currentPath(); +#else + QDir testDir = QDir::home(); +#endif // default QCOMPARE(model->rowCount(), 0); @@ -146,13 +152,13 @@ void tst_QSidebar::addUrls() // test inserting with already existing rows QList<QUrl> moreUrls; - moreUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + moreUrls << QUrl::fromLocalFile(testDir.absolutePath()); qsidebar.addUrls(moreUrls, -1); QCOMPARE(model->rowCount(), 3); // make sure invalid urls are still added QList<QUrl> badUrls; - badUrls << QUrl::fromLocalFile(QDir::home().absolutePath() + "/I used to exist"); + badUrls << QUrl::fromLocalFile(testDir.absolutePath() + "/I used to exist"); qsidebar.addUrls(badUrls, 0); QCOMPARE(model->rowCount(), 4); @@ -179,30 +185,30 @@ void tst_QSidebar::addUrls() QList<QUrl> doubleUrls; //tow exact same paths, we have only one entry - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 1); // Two paths that are effectively pointing to the same location - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath() + "/."); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath() + "/."); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 1); #if defined(Q_OS_WIN) //Windows is case insensitive so no duplicate entries in that case - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath().toUpper()); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 1); #else //Two different paths we should have two entries - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath()); - doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath()); + doubleUrls << QUrl::fromLocalFile(testDir.absolutePath().toUpper()); qsidebar.setUrls(emptyUrls); qsidebar.addUrls(doubleUrls, 1); QCOMPARE(qsidebar.urls().size(), 2); diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 7149fab..13d68ff 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -304,10 +304,11 @@ void tst_QSqlDatabase::createTestTables(QSqlDatabase db) // ### stupid workaround until we find a way to hardcode this // in the MySQL server startup script q.exec("set table_type=innodb"); - if (tst_Databases::isSqlServer(db)) { + else if (tst_Databases::isSqlServer(db)) { QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON")); QVERIFY_SQL(q, exec("SET IMPLICIT_TRANSACTIONS OFF")); - } + } else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); // please never ever change this table; otherwise fix all tests ;) if (tst_Databases::isMSAccess(db)) { @@ -334,6 +335,12 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) { if (!db.isValid()) return; + + if(tst_Databases::isPostgreSQL(db)) { + QSqlQuery q(db); + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + } + // drop the view first, otherwise we'll get dependency problems tst_Databases::safeDropViews(db, QStringList() << qTableName("qtest_view") << qTableName("qtest_view2")); @@ -1019,6 +1026,10 @@ void tst_QSqlDatabase::recordPSQL() }; QSqlQuery q(db); + + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + q.exec("drop sequence " + qTableName("qtestfields") + "_t_bigserial_seq"); q.exec("drop sequence " + qTableName("qtestfields") + "_t_serial_seq"); // older psql cut off the table name @@ -1494,6 +1505,11 @@ void tst_QSqlDatabase::psql_schemas() QSKIP("server does not support schemas", SkipSingle); QSqlQuery q(db); + + if(tst_Databases::isPostgreSQL(db)) { + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + } + QVERIFY_SQL(q, exec("CREATE SCHEMA " + qTableName("qtestschema"))); QString table = qTableName("qtestschema") + '.' + qTableName("qtesttable"); @@ -1529,6 +1545,9 @@ void tst_QSqlDatabase::psql_escapedIdentifiers() QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + QString schemaName = qTableName("qtestScHeMa"); QString tableName = qTableName("qtest"); QString field1Name = QString("fIeLdNaMe"); diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp index 8fc38a7..5322b97 100644 --- a/tests/auto/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp @@ -85,6 +85,9 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) { QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) ); QVERIFY_SQL( q, exec("create table " + qTableName("relTEST1") + diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 5ed9cfa..546c105 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -333,6 +333,8 @@ void tst_QSqlQuery::createTestTables( QSqlDatabase db ) // ### stupid workaround until we find a way to hardcode this // in the MySQL server startup script q.exec( "set table_type=innodb" ); + else if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); if(tst_Databases::isPostgreSQL(db)) QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest" ) + " (id serial NOT NULL, t_varchar varchar(20), t_char char(20), primary key(id)) WITH OIDS" ) ); @@ -1645,6 +1647,9 @@ void tst_QSqlQuery::prepare_bind_exec() QString createQuery; + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) ) createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(20) null)"; else if ( db.driverName().startsWith( "QMYSQL" ) && useUnicode ) diff --git a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp index 391219b..3131f35 100644 --- a/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp +++ b/tests/auto/qsqlquerymodel/tst_qsqlquerymodel.cpp @@ -158,6 +158,8 @@ void tst_QSqlQueryModel::createTestTables(QSqlDatabase db) { dropTestTables(db); QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); QVERIFY_SQL( q, exec("create table " + qTableName("test") + "(id integer not null, name varchar(20), title integer, primary key (id))")); QVERIFY_SQL( q, exec("create table " + qTableName("test2") + "(id integer not null, title varchar(20), primary key (id))")); QVERIFY_SQL( q, exec("create table " + qTableName("test3") + "(id integer not null, primary key (id))")); diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 5405cb6..653d944 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -143,6 +143,8 @@ void tst_QSqlTableModel::dropTestTables() for (int i = 0; i < dbs.dbNames.count(); ++i) { QSqlDatabase db = QSqlDatabase::database(dbs.dbNames.at(i)); QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); QStringList tableNames; tableNames << qTableName("test") @@ -659,6 +661,9 @@ void tst_QSqlTableModel::primaryKeyOrder() QSqlQuery q(db); + if(tst_Databases::isPostgreSQL(db)) + QVERIFY_SQL( q, exec("set client_min_messages='warning'")); + QVERIFY_SQL( q, exec("create table "+qTableName("foo")+"(a varchar(20), id int not null primary key, b varchar(20))")); QSqlTableModel model(0, db); |