summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro1
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp37
-rw-r--r--tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp2
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp4
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp11
-rw-r--r--tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro2
-rw-r--r--tests/auto/qitemmodel/qitemmodel.pro3
-rw-r--r--tests/auto/qrect/tst_qrect.cpp2
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h14
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp8
-rw-r--r--tests/auto/qsqldriver/tst_qsqldriver.cpp8
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp65
-rw-r--r--tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp48
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp2
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp118
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp28
-rw-r--r--tests/auto/qwizard/tst_qwizard.cpp22
17 files changed, 204 insertions, 171 deletions
diff --git a/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro b/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro
index 114be8e..f4aea32 100644
--- a/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro
+++ b/tests/auto/declarative/simplecanvasitem/simplecanvasitem.pro
@@ -1,5 +1,6 @@
load(qttest_p4)
contains(QT_CONFIG,declarative): QT += declarative
+contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl
SOURCES += tst_simplecanvasitem.cpp
# Define SRCDIR equal to test's source directory
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index 74126f8..2d89639 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -132,6 +132,11 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
if ( !db.isValid() )
return;
QSqlQuery q( db );
+
+ if (tst_Databases::isSqlServer(db)) {
+ QVERIFY_SQL(q, exec("SET ANSI_DEFAULTS ON"));
+ }
+
// 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,"
@@ -301,7 +306,8 @@ void tst_Q3SqlCursor::insert()
// check that primeInsert returns a valid QSqlRecord
QCOMPARE( (int)irec->count(), 4 );
if ( ( irec->field( 0 ).type() != QVariant::Int ) &&
- ( irec->field( 0 ).type() != QVariant::String ) ) {
+ ( irec->field( 0 ).type() != QVariant::String ) &&
+ ( irec->field( 0 ).type() != QVariant::Double ) ) {
QFAIL( QString( "Wrong datatype %1 for field 'ID'"
" (expected Int or String)" ).arg( QVariant::typeToName( irec->field( 0 ).type() ) ) );
}
@@ -533,13 +539,18 @@ void tst_Q3SqlCursor::unicode()
cur.del();
if ( res != utf8str ) {
- int i;
- for ( i = 0; i < (int)res.length(); ++i ) {
- if ( res[ i ] != utf8str[ i ] )
- break;
- }
- QFAIL( QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 ) );
+ int i;
+ for ( i = 0; i < (int)res.length(); ++i ) {
+ if ( res[ i ] != utf8str[ i ] )
+ break;
+ }
+ if(db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2"))
+ qWarning() << "Needs someone with more Unicode knowledge than I have to fix:" << QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 );
+ else
+ QFAIL( QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 ) );
}
+ if(db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2"))
+ QEXPECT_FAIL("", "See above message", Continue);
QVERIFY( res == utf8str );
}
@@ -747,12 +758,12 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() {
QString tableName = qTableName("qtestws");
QSqlQuery q(db);
- q.exec(QString("DROP TABLE %1").arg(tableName));
+ tst_Databases::safeDropTable(db, tableName);
QString query = QString("CREATE TABLE %1 (id int, \"first Name\" varchar(20), "
- "lastName varchar(20))");
- QVERIFY_SQL(q, exec(query.arg(tableName)));
+ "lastName varchar(20))").arg(tableName);
+ QVERIFY_SQL(q, exec(query));
- Q3SqlCursor cur(QString("%1").arg(tableName), true, db);
+ Q3SqlCursor cur(tableName, true, db);
cur.select();
QSqlRecord *r = cur.primeInsert();
@@ -768,8 +779,8 @@ void tst_Q3SqlCursor::insertFieldNameContainsWS() {
QVERIFY(cur.value(0) == 1);
QCOMPARE(cur.value(1).toString(), QString("Kong"));
QCOMPARE(cur.value(2).toString(), QString("Harald"));
-
- q.exec(QString("DROP TABLE %1").arg(tableName));
+
+ tst_Databases::safeDropTable(db, tableName);
}
diff --git a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
index d026cbf..ec1f805 100644
--- a/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
+++ b/tests/auto/q3sqlselectcursor/tst_q3sqlselectcursor.cpp
@@ -114,7 +114,7 @@ void tst_Q3SqlSelectCursor::createTestTables( QSqlDatabase db )
void tst_Q3SqlSelectCursor::dropTestTables( QSqlDatabase db )
{
- tst_Databases::safeDropTables( db, QStringList() << qTableName( "qtest" ) );
+ tst_Databases::safeDropTable( db, qTableName( "qtest" ) );
}
void tst_Q3SqlSelectCursor::populateTestTables( QSqlDatabase db )
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 0e3df53..78fbf32 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -239,10 +239,6 @@ void tst_QByteArray::qUncompress()
QTEST(::qUncompress(in), "out");
-#if defined Q_WS_MAC && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
- QSKIP("Corrupt data causes this test to lock up on Mac OS X Panther", SkipSingle);
-#endif
-
QTEST(::qUncompress(in + "blah"), "out");
}
#endif
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 981efeb..7552f18 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -173,6 +173,7 @@ private slots:
void sceneBoundingRect();
void childrenBoundingRect();
void childrenBoundingRectTransformed();
+ void childrenBoundingRect2();
void group();
void setGroup();
void nestedGroups();
@@ -2995,6 +2996,16 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed()
QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250));
}
+void tst_QGraphicsItem::childrenBoundingRect2()
+{
+ QGraphicsItemGroup box;
+ QGraphicsLineItem l1(0, 0, 100, 0, &box);
+ QGraphicsLineItem l2(100, 0, 100, 100, &box);
+ QGraphicsLineItem l3(0, 0, 0, 100, &box);
+ // Make sure lines (zero with/height) are included in the childrenBoundingRect.
+ QCOMPARE(box.childrenBoundingRect(), QRectF(0, 0, 100, 100));
+}
+
void tst_QGraphicsItem::group()
{
QGraphicsScene scene;
diff --git a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
index 0755055..2e41fcd 100644
--- a/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
+++ b/tests/auto/qhttpnetworkreply/qhttpnetworkreply.pro
@@ -1,5 +1,5 @@
load(qttest_p4)
SOURCES += tst_qhttpnetworkreply.cpp
-INCLUDEPATH += $$(QTDIR)/src/3rdparty/zlib
+INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/zlib
QT = core network
diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro
index c51f4c7..38c615b 100644
--- a/tests/auto/qitemmodel/qitemmodel.pro
+++ b/tests/auto/qitemmodel/qitemmodel.pro
@@ -1,6 +1,5 @@
-CONFIG += qtestlib
+load(qttest_p4)
SOURCES += tst_qitemmodel.cpp
-TARGET = tst_qitemmodel
QT += sql
diff --git a/tests/auto/qrect/tst_qrect.cpp b/tests/auto/qrect/tst_qrect.cpp
index cdb5560..5a91636 100644
--- a/tests/auto/qrect/tst_qrect.cpp
+++ b/tests/auto/qrect/tst_qrect.cpp
@@ -4125,6 +4125,7 @@ void tst_QRect::unitedRect_data()
QTest::newRow("test 13") << QRect() << QRect(10, 10, 10, 10) << QRect(10, 10, 10, 10);
QTest::newRow("test 14") << QRect(10, 10, 10, 10) << QRect() << QRect(10, 10, 10, 10);
QTest::newRow("test 15") << QRect() << QRect() << QRect();
+ QTest::newRow("test 16") << QRect(0, 0, 100, 0) << QRect(0, 0, 0, 100) << QRect(0, 0, 100, 100);
}
void tst_QRect::unitedRect()
@@ -4160,6 +4161,7 @@ void tst_QRect::unitedRectF_data()
QTest::newRow("test 13") << QRectF() << QRectF(10, 10, 10, 10) << QRectF(10, 10, 10, 10);
QTest::newRow("test 14") << QRectF(10, 10, 10, 10) << QRectF() << QRectF(10, 10, 10, 10);
QTest::newRow("test 15") << QRectF() << QRectF() << QRectF();
+ QTest::newRow("test 16") << QRectF(0, 0, 100, 0) << QRectF(0, 0, 0, 100) << QRectF(0, 0, 100, 100);
}
void tst_QRect::unitedRectF()
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index a490a2f..b81182a 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -238,8 +238,8 @@ public:
// addDb( "QIBASE", "/opt/firebird/databases/testdb.fdb", "testuser", "Ee4Gabf6_", "firebird2-nokia.trolltech.com.au" ); // Firebird 2.1.1
// use in-memory database to prevent local files
- addDb("QSQLITE", ":memory:");
-// addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
+// addDb("QSQLITE", ":memory:");
+ addDb( "QSQLITE", QDir::toNativeSeparators(QDir::tempPath()+"/foo.db") );
// addDb( "QSQLITE2", QDir::toNativeSeparators(QDir::tempPath()+"/foo2.db") );
// addDb( "QODBC3", "DRIVER={SQL SERVER};SERVER=iceblink.nokia.troll.no\\ICEBLINK", "troll", "trond", "" );
// addDb( "QODBC3", "DRIVER={SQL Native Client};SERVER=silence.nokia.troll.no\\SQLEXPRESS", "troll", "trond", "" );
@@ -333,6 +333,11 @@ public:
}
}
+ static void safeDropTable( QSqlDatabase db, const QString& tableName )
+ {
+ safeDropTables(db, QStringList() << tableName);
+ }
+
static void safeDropViews( QSqlDatabase db, const QStringList &viewNames )
{
if ( isMSAccess( db ) ) // Access is sooo stupid.
@@ -354,6 +359,11 @@ public:
}
}
+ static void safeDropView( QSqlDatabase db, const QString& tableName )
+ {
+ safeDropViews(db, QStringList() << tableName);
+ }
+
// returns the type name of the blob datatype for the database db.
// blobSize is only used if the db doesn't have a generic blob type
static QString blobTypeName( QSqlDatabase db, int blobSize = 10000 )
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index cce4602..f697488 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -249,7 +249,7 @@ struct FieldDef {
// excluding the primary key field
static int createFieldTable(const FieldDef fieldDefs[], QSqlDatabase db)
{
- tst_Databases::safeDropTables(db, QStringList() << qTableName("qtestfields"));
+ tst_Databases::safeDropTable(db, qTableName("qtestfields"));
QSqlQuery q(db);
// construct a create table statement consisting of all fieldtypes
QString qs = "create table " + qTableName("qtestfields");
@@ -357,6 +357,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
tableNames << (qTableName("qtest") + " test");
tst_Databases::safeDropTables(db, tableNames);
+ tst_Databases::safeDropView(db, qTableName("qtest_view"));
}
void tst_QSqlDatabase::populateTestTables(QSqlDatabase db)
@@ -540,11 +541,6 @@ void tst_QSqlDatabase::tables()
QVERIFY(tables.contains(qTableName("temp_tab"), Qt::CaseInsensitive));
QVERIFY(tables.contains(qTableName("qtest"), Qt::CaseInsensitive));
- if (tst_Databases::isMSAccess(db))
- QSqlQuery("drop table " + qTableName("qtest_view"), db);
- else
- QSqlQuery("drop view " + qTableName("qtest_view"), db);
-
if (db.driverName().startsWith("QPSQL")) {
QVERIFY(tables.contains(qTableName("qtest") + " test"));
}
diff --git a/tests/auto/qsqldriver/tst_qsqldriver.cpp b/tests/auto/qsqldriver/tst_qsqldriver.cpp
index bbd7483..d8f7747 100644
--- a/tests/auto/qsqldriver/tst_qsqldriver.cpp
+++ b/tests/auto/qsqldriver/tst_qsqldriver.cpp
@@ -85,9 +85,7 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db)
{
QSqlQuery q(db);
- QStringList tableNames;
- tableNames << qTableName( "relTEST1" );
- tst_Databases::safeDropTables( db, tableNames );
+ tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) );
QVERIFY_SQL( q, exec("create table " + qTableName("relTEST1") +
" (id int not null primary key, name varchar(20), title_key int, another_title_key int)"));
@@ -105,11 +103,9 @@ void tst_QSqlDriver::initTestCase()
void tst_QSqlDriver::cleanupTestCase()
{
- QStringList tableNames;
- tableNames << qTableName( "relTEST1" );
foreach (const QString &dbName, dbs.dbNames) {
QSqlDatabase db = QSqlDatabase::database(dbName);
- tst_Databases::safeDropTables( db, tableNames );
+ tst_Databases::safeDropTable( db, qTableName( "relTEST1" ) );
}
dbs.close();
}
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 825db6c..9604fa8 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -289,7 +289,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "bindtest" )
<< qTableName( "more_results" )
<< qTableName( "blobstest" )
- << qTableName( "oraRowId" );
+ << qTableName( "oraRowId" )
+ << qTableName( "qtest_batch" );
if ( db.driverName().startsWith("QSQLITE") )
tablenames << qTableName( "record_sqlite" );
@@ -303,6 +304,7 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
tablenames << qTableName( "Planet" );
#endif
tablenames << qTableName( "task_250026" );
+ tablenames << qTableName( "task_234422" );
tst_Databases::safeDropTables( db, tablenames );
}
@@ -1902,71 +1904,48 @@ void tst_QSqlQuery::batchExec()
QSKIP( "Database can't do BatchOperations", SkipSingle );
QSqlQuery q( db );
+ QString tableName = qTableName( "qtest_batch" );
- q.exec( "drop table " + qTableName( "qtest_batch" ) );
-
- QVERIFY_SQL( q, exec( "create table " + qTableName( "qtest_batch" ) + " (id int, name varchar(20), dt date, num numeric(8, 4))" ) );
-
- QVERIFY_SQL( q, prepare( "insert into " + qTableName( "qtest_batch" ) + " (id, name, dt, num) values (?, ?, ?, ?)" ) );
+ QVERIFY_SQL( q, exec( "create table " + tableName + " (id int, name varchar(20), dt date, num numeric(8, 4))" ) );
+ QVERIFY_SQL( q, prepare( "insert into " + tableName + " (id, name, dt, num) values (?, ?, ?, ?)" ) );
QVariantList intCol;
-
intCol << 1 << 2 << QVariant( QVariant::Int );
QVariantList charCol;
-
charCol << QLatin1String( "harald" ) << QLatin1String( "boris" ) << QVariant( QVariant::String );
QVariantList dateCol;
-
QDateTime dt = QDateTime( QDate::currentDate(), QTime( 1, 2, 3 ) );
-
dateCol << dt << dt.addDays( -1 ) << QVariant( QVariant::DateTime );
QVariantList numCol;
-
numCol << 2.3 << 3.4 << QVariant( QVariant::Double );
q.addBindValue( intCol );
-
q.addBindValue( charCol );
-
q.addBindValue( dateCol );
-
q.addBindValue( numCol );
QVERIFY_SQL( q, execBatch() );
-
- QVERIFY_SQL( q, exec( "select id, name, dt, num from " + qTableName( "qtest_batch" ) + " order by id" ) );
+ QVERIFY_SQL( q, exec( "select id, name, dt, num from " + tableName + " order by id" ) );
QVERIFY( q.next() );
-
QCOMPARE( q.value( 0 ).toInt(), 1 );
-
QCOMPARE( q.value( 1 ).toString(), QString( "harald" ) );
-
QCOMPARE( q.value( 2 ).toDateTime(), dt );
-
QCOMPARE( q.value( 3 ).toDouble(), 2.3 );
QVERIFY( q.next() );
-
QCOMPARE( q.value( 0 ).toInt(), 2 );
-
QCOMPARE( q.value( 1 ).toString(), QString( "boris" ) );
-
QCOMPARE( q.value( 2 ).toDateTime(), dt.addDays( -1 ) );
-
QCOMPARE( q.value( 3 ).toDouble(), 3.4 );
QVERIFY( q.next() );
-
QVERIFY( q.value( 0 ).isNull() );
-
QVERIFY( q.value( 1 ).isNull() );
-
QVERIFY( q.value( 2 ).isNull() );
-
QVERIFY( q.value( 3 ).isNull() );
}
@@ -2344,6 +2323,8 @@ void tst_QSqlQuery::sqlite_finish()
QString tableName = qTableName( "qtest_lockedtable" );
QSqlQuery q( db );
+
+ tst_Databases::safeDropTable( db2, tableName );
q.exec( "CREATE TABLE " + tableName + " (pk_id INTEGER PRIMARY KEY, whatever TEXT)" );
q.exec( "INSERT INTO " + tableName + " values(1, 'whatever')" );
q.exec( "INSERT INTO " + tableName + " values(2, 'whatever more')" );
@@ -2361,7 +2342,8 @@ void tst_QSqlQuery::sqlite_finish()
q.finish();
QVERIFY_SQL( q2, exec( "DELETE FROM " + tableName + " WHERE pk_id=2" ) );
QCOMPARE( q2.numRowsAffected(), 1 );
- q.exec( "DROP TABLE " + tableName );
+
+ tst_Databases::safeDropTable( db2, tableName );
}
QSqlDatabase::removeDatabase( "sqlite_finish_sqlite" );
@@ -2574,71 +2556,47 @@ void tst_QSqlQuery::blobsPreparedQuery()
QString tableName = qTableName( "blobstest" );
QSqlQuery q( db );
-
q.setForwardOnly( true ); // This is needed to make the test work with DB2.
-
QString shortBLOB( "abc" );
-
QString longerBLOB( "abcdefghijklmnopqrstuvxyz¿äëïöü¡ " );
// In PostgreSQL a BLOB is not called a BLOB, but a BYTEA! :-)
// ... and in SQL Server it can be called a lot, but IMAGE will do.
QString typeName( "BLOB" );
-
if ( db.driverName().startsWith( "QPSQL" ) )
typeName = "BYTEA";
else if ( db.driverName().startsWith( "QODBC" ) )
typeName = "IMAGE";
QVERIFY_SQL( q, exec( QString( "CREATE TABLE %1(id INTEGER, data %2)" ).arg( tableName ).arg( typeName ) ) );
-
q.prepare( QString( "INSERT INTO %1(id, data) VALUES(:id, :data)" ).arg( tableName ) );
-
q.bindValue( ":id", 1 );
-
q.bindValue( ":data", shortBLOB.toAscii() );
-
QVERIFY_SQL( q, exec() );
q.bindValue( ":id", 2 );
-
q.bindValue( ":data", longerBLOB.toAscii() );
-
QVERIFY_SQL( q, exec() );
// Two executions and result sets
q.prepare( QString( "SELECT data FROM %1 WHERE id = ?" ).arg( tableName ) );
-
q.bindValue( 0, QVariant( 1 ) );
-
QVERIFY_SQL( q, exec() );
-
QVERIFY_SQL( q, next() );
-
QCOMPARE( q.value( 0 ).toString(), shortBLOB );
q.bindValue( 0, QVariant( 2 ) );
-
QVERIFY_SQL( q, exec() );
-
QVERIFY_SQL( q, next() );
-
QCOMPARE( q.value( 0 ).toString(), longerBLOB );
// Only one execution and result set
q.prepare( QString( "SELECT id, data FROM %1 ORDER BY id" ).arg( tableName ) );
-
QVERIFY_SQL( q, exec() );
-
QVERIFY_SQL( q, next() );
-
QCOMPARE( q.value( 1 ).toString(), shortBLOB );
-
QVERIFY_SQL( q, next() );
-
QCOMPARE( q.value( 1 ).toString(), longerBLOB );
-
- q.exec( QString( "DROP TABLE %1" ).arg( tableName ) );
}
// There were problems with navigating past the end of a table returning an error on mysql
@@ -2792,7 +2750,6 @@ void tst_QSqlQuery::task_234422()
QString tableName = qTableName( "task_234422" );
- query.exec("DROP TABLE " + tableName);
QVERIFY_SQL(query,exec("CREATE TABLE " + tableName + " (id int primary key, "
"name varchar(20), homecountry varchar(2))"));
for (int i = 0; i < m_airlines.count(); ++i) {
diff --git a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
index 4588af8..e2dace8 100644
--- a/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
+++ b/tests/auto/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp
@@ -86,6 +86,9 @@ private slots:
void escapedRelations();
void escapedTableName();
void whiteSpaceInIdentifiers();
+
+private:
+ void dropTestTables( QSqlDatabase db );
};
@@ -100,18 +103,9 @@ void tst_QSqlRelationalTableModel::initTestCase_data()
void tst_QSqlRelationalTableModel::recreateTestTables(QSqlDatabase db)
{
- QSqlQuery q(db);
-
- QStringList tableNames;
- tableNames << qTableName( "reltest1" )
- << qTableName( "reltest2" )
- << qTableName( "reltest3" )
- << qTableName( "reltest4" )
- << qTableName( "reltest5" )
- << db.driver()->escapeIdentifier(qTableName( "rel test6" ), QSqlDriver::TableName)
- << db.driver()->escapeIdentifier(qTableName( "rel test7" ), QSqlDriver::TableName);
- tst_Databases::safeDropTables( db, tableNames );
+ dropTestTables(db);
+ QSqlQuery q(db);
QVERIFY_SQL( q, exec("create table " + qTableName("reltest1") +
" (id int not null primary key, name varchar(20), title_key int, another_title_key int)"));
QVERIFY_SQL( q, exec("insert into " + qTableName("reltest1") + " values(1, 'harry', 1, 2)"));
@@ -157,20 +151,27 @@ void tst_QSqlRelationalTableModel::initTestCase()
void tst_QSqlRelationalTableModel::cleanupTestCase()
{
+ foreach (const QString &dbName, dbs.dbNames) {
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE( db );
+ dropTestTables( QSqlDatabase::database(dbName) );
+ }
+ dbs.close();
+}
+
+void tst_QSqlRelationalTableModel::dropTestTables( QSqlDatabase db )
+{
QStringList tableNames;
tableNames << qTableName( "reltest1" )
<< qTableName( "reltest2" )
<< qTableName( "reltest3" )
<< qTableName( "reltest4" )
- << qTableName( "reltest5" );
- foreach (const QString &dbName, dbs.dbNames) {
- QSqlDatabase db = QSqlDatabase::database(dbName);
- QStringList tables = tableNames;
- tables << db.driver()->escapeIdentifier(qTableName( "rel test6" ), QSqlDriver::TableName)
- << db.driver()->escapeIdentifier(qTableName( "rel test7" ), QSqlDriver::TableName);
- tst_Databases::safeDropTables( db, tables );
- }
- dbs.close();
+ << qTableName( "reltest5" )
+ << qTableName( "rel test6", db.driver() )
+ << qTableName( "rel test7", db.driver() )
+ << qTableName("CASETEST1", db.driver() )
+ << qTableName("casetest1", db.driver() );
+ tst_Databases::safeDropTables( db, tableNames );
}
void tst_QSqlRelationalTableModel::init()
@@ -916,11 +917,6 @@ void tst_QSqlRelationalTableModel::casing()
if (db.driverName().startsWith("QSQLITE"))
QSKIP("The casing test for SQLITE is irrelevant since SQLITE is case insensitive", SkipAll);
- QStringList tableNames;
- tableNames << qTableName("CASETEST1", db.driver()).toUpper();
- tableNames << qTableName("casetest1", db.driver());
- tst_Databases::safeDropTables(db, tableNames);
-
QSqlQuery q(db);
QVERIFY_SQL( q, exec("create table " + qTableName("CASETEST1", db.driver()).toUpper() +
" (id int not null primary key, name varchar(20), title_key int, another_title_key int)"));
@@ -974,8 +970,6 @@ void tst_QSqlRelationalTableModel::casing()
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, 2)).toString(), QString("herr"));
-
- tst_Databases::safeDropTables(db, tableNames);
}
void tst_QSqlRelationalTableModel::escapedRelations()
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index aa882be..1445f34 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -899,7 +899,7 @@ void tst_QSqlTableModel::sqlite_attachedDatabase()
QVERIFY_SQL( q, exec("INSERT INTO atest2 VALUES(2, 'attached-atest2')"));
QSqlQuery q2(db);
- tst_Databases::safeDropTables(db, QStringList() << "atest");
+ tst_Databases::safeDropTable(db, "atest");
QVERIFY_SQL(q2, exec("CREATE TABLE atest(id int, text varchar(20))"));
QVERIFY_SQL(q2, exec("INSERT INTO atest VALUES(3, 'main')"));
QVERIFY_SQL(q2, exec("ATTACH DATABASE \""+attachedDb.databaseName()+"\" as adb"));
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 553833c..a859866 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -151,6 +151,8 @@ private slots:
void defaultGlobalRestorePolicy();
void globalRestorePolicySetToRestore();
void globalRestorePolicySetToDoNotRestore();
+
+ void noInitialStateForInitialState();
//void restorePolicyNotInherited();
//void mixedRestoreProperties();
@@ -345,7 +347,7 @@ void tst_QStateMachine::transitionEntersParent()
void tst_QStateMachine::defaultErrorState()
{
QStateMachine machine;
- QVERIFY(machine.errorState() != 0);
+ QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
QState *brokenState = new QState();
brokenState->setObjectName("MyInitialState");
@@ -364,9 +366,7 @@ void tst_QStateMachine::defaultErrorState()
QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'MyInitialState'"));
-
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
+ QCOMPARE(machine.isRunning(), false);
}
class CustomErrorState: public QState
@@ -424,6 +424,7 @@ void tst_QStateMachine::customGlobalErrorState()
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(customErrorState));
QCOMPARE(customErrorState->error, QStateMachine::NoInitialStateError);
@@ -459,6 +460,7 @@ void tst_QStateMachine::customLocalErrorStateInBrokenState()
machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(customErrorState));
QCOMPARE(customErrorState->error, QStateMachine::NoInitialStateError);
@@ -494,8 +496,7 @@ void tst_QStateMachine::customLocalErrorStateInOtherState()
machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
+ QCOMPARE(machine.isRunning(), false);
}
void tst_QStateMachine::customLocalErrorStateInParentOfBrokenState()
@@ -529,6 +530,7 @@ void tst_QStateMachine::customLocalErrorStateInParentOfBrokenState()
machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(customErrorState));
}
@@ -607,6 +609,7 @@ void tst_QStateMachine::errorStateHasChildren()
machine.postEvent(new QEvent(QEvent::Type(QEvent::User + 1)));
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 2);
QVERIFY(machine.configuration().contains(customErrorState));
QVERIFY(machine.configuration().contains(childOfErrorState));
@@ -620,7 +623,6 @@ void tst_QStateMachine::errorStateHasErrors()
customErrorState->setObjectName("customErrorState");
machine.addState(customErrorState);
- QAbstractState *oldErrorState = machine.errorState();
machine.setErrorState(customErrorState);
QState *childOfErrorState = new QState(customErrorState);
@@ -647,8 +649,7 @@ void tst_QStateMachine::errorStateHasErrors()
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'customErrorState'");
QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(oldErrorState)); // Fall back to default
+ QCOMPARE(machine.isRunning(), false);
QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'customErrorState'"));
}
@@ -680,8 +681,7 @@ void tst_QStateMachine::errorStateIsRootState()
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'brokenState'");
QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
+ QCOMPARE(machine.isRunning(), false);
}
void tst_QStateMachine::errorStateEntersParentFirst()
@@ -759,7 +759,6 @@ void tst_QStateMachine::errorStateEntersParentFirst()
void tst_QStateMachine::customErrorStateIsNull()
{
QStateMachine machine;
- QAbstractState *oldErrorState = machine.errorState();
machine.rootState()->setErrorState(0);
QState *initialState = new QState();
@@ -780,8 +779,7 @@ void tst_QStateMachine::customErrorStateIsNull()
QCoreApplication::processEvents();
QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(oldErrorState));
+ QCOMPARE(machine.isRunning(), false);
}
void tst_QStateMachine::clearError()
@@ -797,6 +795,7 @@ void tst_QStateMachine::clearError()
machine.start();
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.error(), QStateMachine::NoInitialStateError);
QCOMPARE(machine.errorString(), QString::fromLatin1("Missing initial state in compound state 'brokenState'"));
@@ -862,6 +861,7 @@ void tst_QStateMachine::historyStateHasNowhereToGo()
machine.postEvent(new QEvent(QEvent::User));
QCoreApplication::processEvents();
+ QCOMPARE(machine.isRunning(), true);
QCOMPARE(machine.configuration().count(), 1);
QVERIFY(machine.configuration().contains(machine.errorState()));
QCOMPARE(machine.error(), QStateMachine::NoDefaultStateInHistoryStateError);
@@ -920,8 +920,7 @@ void tst_QStateMachine::transitionToStateNotInGraph()
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: No common ancestor for targets and source of transition from state 'initialState'");
QCoreApplication::processEvents();
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(qobject_cast<QState*>(machine.rootState())->errorState()));
+ QCOMPARE(machine.isRunning(), false);
}
void tst_QStateMachine::customErrorStateNotInGraph()
@@ -932,7 +931,7 @@ void tst_QStateMachine::customErrorStateNotInGraph()
errorState.setObjectName("errorState");
QTest::ignoreMessage(QtWarningMsg, "QState::setErrorState: error state cannot belong to a different state machine");
machine.setErrorState(&errorState);
- QVERIFY(&errorState != machine.errorState());
+ QCOMPARE(machine.errorState(), reinterpret_cast<QAbstractState *>(0));
QState *initialBrokenState = new QState(machine.rootState());
initialBrokenState->setObjectName("initialBrokenState");
@@ -942,9 +941,8 @@ void tst_QStateMachine::customErrorStateNotInGraph()
machine.start();
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: Missing initial state in compound state 'initialBrokenState'");
QCoreApplication::processEvents();
-
- QCOMPARE(machine.configuration().count(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
+
+ QCOMPARE(machine.isRunning(), false);
}
void tst_QStateMachine::restoreProperties()
@@ -1019,8 +1017,7 @@ void tst_QStateMachine::addAndRemoveState()
{
QStateMachine machine;
QStatePrivate *root_d = QStatePrivate::get(machine.rootState());
- QCOMPARE(root_d->childStates().size(), 1); // the error state
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)machine.errorState());
+ QCOMPARE(root_d->childStates().size(), 0);
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: cannot add null state");
machine.addState(0);
@@ -1031,9 +1028,8 @@ void tst_QStateMachine::addAndRemoveState()
machine.addState(s1);
QCOMPARE(s1->machine(), &machine);
QCOMPARE(s1->parentState(), machine.rootState());
- QCOMPARE(root_d->childStates().size(), 2);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)machine.errorState());
- QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s1);
+ QCOMPARE(root_d->childStates().size(), 1);
+ QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: state has already been added to this machine");
machine.addState(s1);
@@ -1042,24 +1038,21 @@ void tst_QStateMachine::addAndRemoveState()
QCOMPARE(s2->parentState(), (QState*)0);
machine.addState(s2);
QCOMPARE(s2->parentState(), machine.rootState());
- QCOMPARE(root_d->childStates().size(), 3);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)machine.errorState());
- QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s1);
- QCOMPARE(root_d->childStates().at(2), (QAbstractState*)s2);
+ QCOMPARE(root_d->childStates().size(), 2);
+ QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s1);
+ QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s2);
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::addState: state has already been added to this machine");
machine.addState(s2);
machine.removeState(s1);
QCOMPARE(s1->parentState(), (QState*)0);
- QCOMPARE(root_d->childStates().size(), 2);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)machine.errorState());
- QCOMPARE(root_d->childStates().at(1), (QAbstractState*)s2);
+ QCOMPARE(root_d->childStates().size(), 1);
+ QCOMPARE(root_d->childStates().at(0), (QAbstractState*)s2);
machine.removeState(s2);
QCOMPARE(s2->parentState(), (QState*)0);
- QCOMPARE(root_d->childStates().size(), 1);
- QCOMPARE(root_d->childStates().at(0), (QAbstractState*)machine.errorState());
+ QCOMPARE(root_d->childStates().size(), 0);
QTest::ignoreMessage(QtWarningMsg, "QStateMachine::removeState: cannot remove null state");
machine.removeState(0);
@@ -1067,10 +1060,10 @@ void tst_QStateMachine::addAndRemoveState()
{
QStateMachine machine2;
{
- char warning[256];
- sprintf(warning, "QStateMachine::removeState: state %p's machine (%p) is different from this machine (%p)",
- machine2.rootState(), &machine2, &machine);
- QTest::ignoreMessage(QtWarningMsg, warning);
+ QString warning;
+ warning.sprintf("QStateMachine::removeState: state %p's machine (%p) is different from this machine (%p)",
+ machine2.rootState(), &machine2, &machine);
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
machine.removeState(machine2.rootState());
}
// ### check this behavior
@@ -1129,9 +1122,9 @@ void tst_QStateMachine::stateEntryAndExit()
QCOMPARE(trans->sourceState(), (QState*)s2);
QCOMPARE(trans->targetState(), (QAbstractState*)s3);
{
- char warning[256];
- sprintf(warning, "QState::removeTransition: transition %p's source state (%p) is different from this state (%p)", trans, s2, s1);
- QTest::ignoreMessage(QtWarningMsg, warning);
+ QString warning;
+ warning.sprintf("QState::removeTransition: transition %p's source state (%p) is different from this state (%p)", trans, s2, s1);
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
s1->removeTransition(trans);
}
s2->removeTransition(trans);
@@ -1147,9 +1140,9 @@ void tst_QStateMachine::stateEntryAndExit()
machine.setInitialState(s1);
QCOMPARE(machine.initialState(), (QAbstractState*)s1);
{
- char warning[256];
- sprintf(warning, "QState::setInitialState: state %p is not a child of this state (%p)", machine.rootState(), machine.rootState());
- QTest::ignoreMessage(QtWarningMsg, warning);
+ QString warning;
+ warning.sprintf("QState::setInitialState: state %p is not a child of this state (%p)", machine.rootState(), machine.rootState());
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
machine.setInitialState(machine.rootState());
QCOMPARE(machine.initialState(), (QAbstractState*)s1);
}
@@ -1614,9 +1607,9 @@ void tst_QStateMachine::parallelStates()
s1_2_1->addTransition(s1_2_f);
s1_2->setInitialState(s1_2_1);
{
- char warning[256];
- sprintf(warning, "QState::setInitialState: ignoring attempt to set initial state of parallel state group %p", s1);
- QTest::ignoreMessage(QtWarningMsg, warning);
+ QString warning;
+ warning.sprintf("QState::setInitialState: ignoring attempt to set initial state of parallel state group %p", s1);
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
s1->setInitialState(0);
}
machine.addState(s1);
@@ -2286,9 +2279,9 @@ void tst_QStateMachine::historyStates()
QCOMPARE(s0h->defaultState(), (QAbstractState*)0);
s0h->setDefaultState(s00);
QCOMPARE(s0h->defaultState(), (QAbstractState*)s00);
- char warning[256];
- sprintf(warning, "QHistoryState::setDefaultState: state %p does not belong to this history state's group (%p)", s0, s0);
- QTest::ignoreMessage(QtWarningMsg, warning);
+ QString warning;
+ warning.sprintf("QHistoryState::setDefaultState: state %p does not belong to this history state's group (%p)", s0, s0);
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
s0h->setDefaultState(s0);
QState *s1 = new QState(root);
QFinalState *s2 = new QFinalState(root);
@@ -2393,12 +2386,10 @@ void tst_QStateMachine::targetStateWithNoParent()
QSignalSpy finishedSpy(&machine, SIGNAL(finished()));
machine.start();
QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: No common ancestor for targets and source of transition from state 's1'");
- QTRY_COMPARE(machine.isRunning(), true);
QTRY_COMPARE(startedSpy.count(), 1);
- QCOMPARE(stoppedSpy.count(), 0);
+ QCOMPARE(machine.isRunning(), false);
+ QCOMPARE(stoppedSpy.count(), 1);
QCOMPARE(finishedSpy.count(), 0);
- QCOMPARE(machine.configuration().size(), 1);
- QVERIFY(machine.configuration().contains(machine.errorState()));
QCOMPARE(machine.error(), QStateMachine::NoCommonAncestorForTransitionError);
}
@@ -2453,6 +2444,25 @@ void tst_QStateMachine::defaultGlobalRestorePolicy()
QCOMPARE(propertyHolder->property("b").toInt(), 4);
}
+void tst_QStateMachine::noInitialStateForInitialState()
+{
+ QStateMachine machine;
+
+ QState *initialState = new QState(machine.rootState());
+ initialState->setObjectName("initialState");
+ machine.setInitialState(initialState);
+
+ QState *childState = new QState(initialState);
+
+ QTest::ignoreMessage(QtWarningMsg, "Unrecoverable error detected in running state machine: "
+ "Missing initial state in compound state 'initialState'");
+ machine.start();
+ QCoreApplication::processEvents();
+
+ QCOMPARE(machine.isRunning(), false);
+ QCOMPARE(int(machine.error()), int(QStateMachine::NoInitialStateError));
+}
+
/*
void tst_QStateMachine::restorePolicyNotInherited()
{
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 6727b05..dd9a3e0 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -252,6 +252,7 @@ private slots:
void moveChild_data();
void moveChild();
+ void showAndMoveChild();
void subtractOpaqueSiblings();
@@ -5318,6 +5319,33 @@ void tst_QWidget::moveChild()
parent.color);
}
+void tst_QWidget::showAndMoveChild()
+{
+ QWidget parent(0, Qt::FramelessWindowHint);
+ parent.resize(300, 300);
+ parent.setPalette(Qt::red);
+ parent.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&parent);
+#endif
+ QTest::qWait(200);
+
+ const QPoint tlwOffset = parent.geometry().topLeft();
+ QWidget child(&parent);
+ child.resize(100, 100);
+ child.setPalette(Qt::blue);
+ child.setAutoFillBackground(true);
+
+ // Ensure that the child is repainted correctly when moved right after show.
+ // NB! Do NOT processEvents() (or qWait()) in between show() and move().
+ child.show();
+ child.move(150, 150);
+ qApp->processEvents();
+
+ VERIFY_COLOR(child.geometry().translated(tlwOffset), Qt::blue);
+ VERIFY_COLOR(QRegion(parent.geometry()) - child.geometry().translated(tlwOffset), Qt::red);
+}
+
void tst_QWidget::subtractOpaqueSiblings()
{
#ifdef QT_MAC_USE_COCOA
diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp
index 71e1c3e..e5074b3 100644
--- a/tests/auto/qwizard/tst_qwizard.cpp
+++ b/tests/auto/qwizard/tst_qwizard.cpp
@@ -112,6 +112,7 @@ private slots:
void task161658_alignments();
void task177022_setFixedSize();
void task248107_backButton();
+ void task255350_fieldObjectDestroyed();
/*
Things that could be added:
@@ -2517,5 +2518,26 @@ void tst_QWizard::task248107_backButton()
QCOMPARE(wizard.currentPage(), &page1);
}
+class WizardPage_task255350 : public QWizardPage
+{
+public:
+ QLineEdit *lineEdit;
+ WizardPage_task255350()
+ : lineEdit(new QLineEdit)
+ {
+ registerField("dummy*", lineEdit);
+ }
+};
+
+void tst_QWizard::task255350_fieldObjectDestroyed()
+{
+ QWizard wizard;
+ WizardPage_task255350 *page = new WizardPage_task255350;
+ int id = wizard.addPage(page);
+ delete page->lineEdit;
+ wizard.removePage(id); // don't crash!
+ delete page;
+}
+
QTEST_MAIN(tst_QWizard)
#include "tst_qwizard.moc"