summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-05 17:28:30 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-05 17:28:30 (GMT)
commit186f75db32bdc177bdbc192552cf7275d9723c85 (patch)
treec34cddab358b7ad15582a274841f88c902226665 /tests
parent420fa181ed9f3947e257dc84f5cf3c8f7c94b9ba (diff)
parent1a802007ca53aa0bd5fa5e474700660df6edf97b (diff)
downloadQt-186f75db32bdc177bdbc192552cf7275d9723c85.zip
Qt-186f75db32bdc177bdbc192552cf7275d9723c85.tar.gz
Qt-186f75db32bdc177bdbc192552cf7275d9723c85.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Compile fix for Windows Mobile and OpenGLES2 Wrong dirty region after row selection in right-to-left mode in QTableView Fixes: Mysql truncation of integer values + some autotest cleanup
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp101
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp26
2 files changed, 112 insertions, 15 deletions
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 41b9734..5339132 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -205,6 +205,13 @@ private slots:
void QTBUG_6618();
void QTBUG_6852_data() { generic_data("QMYSQL"); }
void QTBUG_6852();
+ void QTBUG_5765_data() { generic_data("QMYSQL"); }
+ void QTBUG_5765();
+
+#if 0
+ void benchmark_data() { generic_data(); }
+ void benchmark();
+#endif
private:
// returns all database connections
@@ -309,7 +316,14 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "blobstest" )
<< qTableName( "oraRowId" )
<< qTableName( "qtest_batch" )
- << qTableName(QLatin1String("bug6421")).toUpper();
+ << qTableName("bug6421").toUpper()
+ << qTableName("bug5765")
+ << qTableName("bug6852")
+ << qTableName( "qtest_lockedtable" )
+ << qTableName( "Planet" )
+ << qTableName( "task_250026" )
+ << qTableName( "task_234422" )
+ << qTableName("test141895");
if ( db.driverName().startsWith("QPSQL") )
tablenames << qTableName("task_233829");
@@ -320,19 +334,11 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QOCI" ) )
tablenames << qTableName( "qtest_longstr" );
- tablenames << qTableName( "qtest_lockedtable" );
-
- tablenames << qTableName( "Planet" );
+ if (tst_Databases::isSqlServer( db ))
+ db.exec("DROP PROCEDURE " + qTableName("test141895_proc"));
- tablenames << qTableName( "task_250026" );
- tablenames << qTableName( "task_234422" );
-
- if (tst_Databases::isSqlServer( db )) {
- QSqlQuery q( db );
- q.exec("DROP PROCEDURE " + qTableName("test141895_proc"));
- }
-
- tablenames << qTableName("test141895");
+ if (tst_Databases::isMySQL( db ))
+ db.exec("DROP PROCEDURE IF EXISTS "+qTableName("bug6852_proc"));
tst_Databases::safeDropTables( db, tablenames );
@@ -2996,10 +3002,9 @@ void tst_QSqlQuery::QTBUG_6852()
QSKIP( "Test requires MySQL >= 5.0", SkipSingle );
QSqlQuery q(db);
- QString tableName(qTableName(QLatin1String("bug6421"))), procName(qTableName(QLatin1String("bug6421_proc")));
+ QString tableName(qTableName(QLatin1String("bug6852"))), procName(qTableName(QLatin1String("bug6852_proc")));
QVERIFY_SQL(q, exec("DROP PROCEDURE IF EXISTS "+procName));
- tst_Databases::safeDropTable(db, tableName);
QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n"
"MainKey INT NOT NULL,\n"
"OtherTextCol VARCHAR(45) NOT NULL,\n"
@@ -3022,6 +3027,72 @@ void tst_QSqlQuery::QTBUG_6852()
QCOMPARE(q.value(1).toString(), QLatin1String("Disabled"));
}
+void tst_QSqlQuery::QTBUG_5765()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toFloat()<4.1 )
+ QSKIP( "Test requires MySQL >= 4.1", SkipSingle );
+
+ QSqlQuery q(db);
+ QString tableName(qTableName(QLatin1String("bug5765")));
+
+ QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(testval TINYINT(1) DEFAULT 0)"));
+ q.prepare("INSERT INTO "+tableName+" SET testval = :VALUE");
+ q.bindValue(":VALUE", 1);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":VALUE", 12);
+ QVERIFY_SQL(q, exec());
+ q.bindValue(":VALUE", 123);
+ QVERIFY_SQL(q, exec());
+ QString sql="select testval from "+tableName;
+ QVERIFY_SQL(q, exec(sql));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 12);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 123);
+ QVERIFY_SQL(q, prepare(sql));
+ QVERIFY_SQL(q, exec());
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 1);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 12);
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toInt(), 123);
+}
+
+#if 0
+void tst_QSqlQuery::benchmark()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+ if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
+ QSKIP( "Test requires MySQL >= 5.0", SkipSingle );
+
+ QSqlQuery q(db);
+ QString tableName(qTableName(QLatin1String("benchmark")));
+
+ tst_Databases::safeDropTable( db, tableName );
+
+ QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n"
+ "MainKey INT NOT NULL,\n"
+ "OtherTextCol VARCHAR(45) NOT NULL,\n"
+ "PRIMARY KEY(`MainKey`))"));
+
+ int i=1;
+
+ QBENCHMARK {
+ QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES("+QString::number(i)+", \"Value"+QString::number(i)+"\")"));
+ i++;
+ }
+
+ tst_Databases::safeDropTable( db, tableName );
+}
+#endif
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index a5cbbd4..35fba52 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -200,6 +200,7 @@ private slots:
void taskQTBUG_4516_clickOnRichTextLabel();
void taskQTBUG_5237_wheelEventOnHeader();
void taskQTBUG_8585_crashForNoGoodReason();
+ void taskQTBUG_7774_RtoLVisualRegionForSelection();
void mouseWheel_data();
void mouseWheel();
@@ -3994,5 +3995,30 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason()
}
+class TableView7774 : public QTableView
+{
+public:
+ QRegion visualRegionForSelection(const QItemSelection &selection) const
+ {
+ return QTableView::visualRegionForSelection(selection);
+ }
+};
+
+void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection()
+{
+ TableView7774 view;
+ QStandardItemModel model(5,5);
+ view.setModel(&model);
+ view.setLayoutDirection(Qt::RightToLeft);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ QItemSelectionRange range(model.index(2, 0), model.index(2, model.columnCount() - 1));
+ QItemSelection selection;
+ selection << range;
+ QRegion region = view.visualRegionForSelection(selection);
+ QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight()));
+}
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"