summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro5
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp42
-rw-r--r--tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp9
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp36
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp1
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp4
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp58
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp23
-rw-r--r--tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp8
-rw-r--r--tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp62
-rw-r--r--tests/auto/qspinbox/tst_qspinbox.cpp5
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp16
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp28
-rw-r--r--tests/benchmarks/qdir/tst_qdir.cpp37
14 files changed, 320 insertions, 14 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d5d72a7..92d29ae 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -148,7 +148,6 @@ SUBDIRS += \
qfontmetrics \
qftp \
qgetputenv \
- qgl \
qglobal \
qgraphicseffect \
qgraphicseffectsource \
@@ -458,7 +457,9 @@ SUBDIRS += \
rcc \
windowsmobile
-!wince*:SUBDIRS += $$Q3SUBDIRS
+contains(QT_CONFIG,opengl):SUBDIRS += qgl
+
+contains(QT_CONFIG,qt3support):!wince*:SUBDIRS += $$Q3SUBDIRS
contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
mac: {
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index db840f4..6479829 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -46,6 +46,7 @@
#include <qstandarditemmodel.h>
#include <qapplication.h>
#include <qlistview.h>
+#include <qlistwidget.h>
#include <qtableview.h>
#include <qtreeview.h>
#include <qtreewidget.h>
@@ -224,6 +225,7 @@ private slots:
void shiftArrowSelectionAfterScrolling();
void shiftSelectionAfterRubberbandSelection();
void ctrlRubberbandSelection();
+ void QTBUG6407_extendedSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1433,5 +1435,45 @@ void tst_QAbstractItemView::ctrlRubberbandSelection()
QVERIFY(selected.contains(index2));
}
+void tst_QAbstractItemView::QTBUG6407_extendedSelection()
+{
+ QListWidget view;
+ view.setSelectionMode(QAbstractItemView::ExtendedSelection);
+ for(int i = 0; i < 50; ++i)
+ view.addItem(QString::number(i));
+
+ view.resize(200,200);
+
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
+
+ view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum());
+ QTest::qWait(20);
+
+ QModelIndex index49 = view.model()->index(49,0);
+ QPoint p = view.visualRect(index49).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p);
+ QCOMPARE(view.currentIndex(), index49);
+ QCOMPARE(view.selectedItems().count(), 1);
+
+ QModelIndex index47 = view.model()->index(47,0);
+ p = view.visualRect(index47).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p);
+ QCOMPARE(view.currentIndex(), index47);
+ QCOMPARE(view.selectedItems().count(), 3); //49, 48, 47;
+
+ QModelIndex index44 = view.model()->index(44,0);
+ p = view.visualRect(index44).center();
+ QVERIFY(view.viewport()->rect().contains(p));
+ QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p);
+ QCOMPARE(view.currentIndex(), index44);
+ QCOMPARE(view.selectedItems().count(), 6); //49 .. 44;
+
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
index 157c39d..7f03153 100644
--- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
+++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp
@@ -1065,17 +1065,20 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate()
//we use the French delimiters here
QString textFromValue (double value) const
- {
+ {
return locale().toString(value);
}
} spinbox;
spinbox.show();
spinbox.activateWindow();
spinbox.setFocus();
+ QApplication::setActiveWindow(&spinbox);
QTest::qWaitForWindowShown(&spinbox);
- QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
+ QTRY_VERIFY(spinbox.hasFocus());
+ QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow());
+ QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator
- QTest::keyClick(0, Qt::Key_0); // let's insert a 0
+ QTest::keyClick(0, Qt::Key_0); // let's insert a 0
QCOMPARE(spinbox.value(), 10000.);
spinbox.clearFocus(); //make sure the value is correctly formatted
QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index a8017ff..38abc3d 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -4211,6 +4211,42 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid()
//If there are in the list that's bad, we crash...
QVERIFY(!QGraphicsScenePrivate::get(&scene)->topLevelItems.contains(static_cast<QGraphicsItem *>(child)));
+ //Other case
+ QGraphicsScene scene2;
+ // works with bsp tree index
+ scene2.setItemIndexMethod(QGraphicsScene::NoIndex);
+
+ QGraphicsView view2(&scene2);
+
+ // first add the blue rect
+ QGraphicsRectItem* const item1 = new QGraphicsRectItem(QRect( 10, 10, 10, 10 ));
+ item1->setPen(QColor(Qt::blue));
+ item1->setBrush(Qt::blue);
+ scene2.addItem(item1);
+
+ // then add the red rect
+ QGraphicsRectItem* const item2 = new QGraphicsRectItem(5, 5, 10, 10);
+ item2->setPen(QColor(Qt::red));
+ item2->setBrush(Qt::red);
+ scene2.addItem(item2);
+
+ // now the blue one is visible on top of the red one -> swap them (important for the bug)
+ item1->setZValue(1.0);
+ item2->setZValue(0.0);
+
+ view2.show();
+
+ // handle events as a real life app would do
+ QApplication::processEvents();
+
+ // now delete the red rect
+ delete item2;
+
+ // handle events as a real life app would do
+ QApplication::processEvents();
+
+ //We should not crash
+
}
void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache()
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 4f4761c..fa2b9bd 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3362,6 +3362,7 @@ void tst_QLineEdit::task174640_editingFinished()
QApplication::setActiveWindow(&mw);
mw.activateWindow();
QTest::qWaitForWindowShown(&mw);
+ QTRY_COMPARE(&mw, QApplication::activeWindow());
QSignalSpy editingFinishedSpy(le1, SIGNAL(editingFinished()));
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 24a553f..98001c8 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -1787,8 +1787,10 @@ void tst_QListView::task262152_setModelColumnNavigate()
view.setModelColumn(1);
view.show();
+ QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- QTest::qWait(120);
+ QTest::qWait(30);
+ QTRY_COMPARE(static_cast<QWidget *>(&view), QApplication::activeWindow());
QTest::keyClick(&view, Qt::Key_Down);
QTest::qWait(30);
QTRY_COMPARE(view.currentIndex(), model.index(1,1));
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8b71349..67d1972 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -41,7 +41,7 @@
#include <QtTest/QtTest>
-
+#include "../../shared/util.h"
#include <qpainter.h>
#include <qapplication.h>
@@ -67,6 +67,11 @@
#include <qqueue.h>
+#include <qgraphicsview.h>
+#include <qgraphicsscene.h>
+#include <qgraphicsproxywidget.h>
+#include <qlayout.h>
+
#if defined(Q_OS_SYMBIAN)
# define SRCDIR "."
#endif
@@ -244,6 +249,8 @@ private slots:
void setPenColorOnImage();
void setPenColorOnPixmap();
+ void QTBUG5939_attachPainterPrivate();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -4404,6 +4411,55 @@ void tst_QPainter::setPenColorOnPixmap()
setPenColor(p);
}
+class TestProxy : public QGraphicsProxyWidget
+{
+public:
+ TestProxy() : QGraphicsProxyWidget() {}
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+ {
+ QGraphicsProxyWidget::paint(painter, option, widget);
+ deviceTransform = painter->deviceTransform();
+ }
+ QTransform deviceTransform;
+};
+
+class TestWidget : public QWidget
+{
+Q_OBJECT
+public:
+ TestWidget() : QWidget(), painted(false) {}
+ void paintEvent(QPaintEvent *)
+ {
+ QPainter p(this);
+ deviceTransform = p.deviceTransform();
+ worldTransform = p.worldTransform();
+ painted = true;
+ }
+ QTransform deviceTransform;
+ QTransform worldTransform;
+ bool painted;
+};
+
+void tst_QPainter::QTBUG5939_attachPainterPrivate()
+{
+ QWidget *w = new QWidget();
+ QGraphicsScene *scene = new QGraphicsScene();
+ QGraphicsView *view = new QGraphicsView(scene, w);
+ view->move(50 ,50);
+ TestProxy *proxy = new TestProxy();
+ TestWidget *widget = new TestWidget();
+ proxy->setWidget(widget);
+ scene->addItem(proxy);
+ proxy->rotate(45);
+ w->resize(scene->sceneRect().size().toSize());
+
+ w->show();
+ QTRY_VERIFY(widget->painted);
+
+ QVERIFY(widget->worldTransform.isIdentity());
+ QCOMPARE(widget->deviceTransform, proxy->deviceTransform);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 44adf7e..a47cabb 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -1630,6 +1630,29 @@ void tst_QScriptExtQObject::connectAndDisconnect()
m_myObject->emitMySignalWithVariantArg(123);
QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
+ QCOMPARE(m_engine->evaluate("signalArgs[0]").toNumber(), 123.0);
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.disconnect(myHandler)").isUndefined());
+
+ // signal with argument type that's unknown to the meta-type system
+ m_myObject->clearConnectedSignal();
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithScriptEngineArg.connect(myHandler)").isUndefined());
+ QCOMPARE(m_myObject->connectedSignal().constData(), SIGNAL(mySignalWithScriptEngineArg(QScriptEngine*)));
+ m_engine->evaluate("gotSignal = false");
+ QTest::ignoreMessage(QtWarningMsg, "QScriptEngine: Unable to handle unregistered datatype 'QScriptEngine*' when invoking handler of signal MyQObject::mySignalWithScriptEngineArg(QScriptEngine*)");
+ m_myObject->emitMySignalWithScriptEngineArg(m_engine);
+ QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
+ QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
+ QVERIFY(m_engine->evaluate("signalArgs[0]").isUndefined());
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithScriptEngineArg.disconnect(myHandler)").isUndefined());
+
+ // signal with QVariant arg: argument conversion should work
+ m_myObject->clearConnectedSignal();
+ QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.connect(myHandler)").isUndefined());
+ QCOMPARE(m_myObject->connectedSignal().constData(), SIGNAL(mySignalWithVariantArg(QVariant)));
+ m_engine->evaluate("gotSignal = false");
+ m_myObject->emitMySignalWithVariantArg(123);
+ QCOMPARE(m_engine->evaluate("gotSignal").toBoolean(), true);
+ QCOMPARE(m_engine->evaluate("signalArgs.length").toNumber(), 1.0);
QVERIFY(m_engine->evaluate("signalArgs[0]").isNumber());
QCOMPARE(m_engine->evaluate("signalArgs[0]").toNumber(), 123.0);
QVERIFY(m_engine->evaluate("myObject.mySignalWithVariantArg.disconnect(myHandler)").isUndefined());
diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
index 35f05d1..518cdbf 100644
--- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
+++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp
@@ -202,9 +202,9 @@ void tst_QSystemLock::processes()
QStringList scripts;
for (int i = 0; i < readOnly; ++i)
- scripts.append(QFileInfo(SRCDIR "lackey/scripts/ systemlock_read.js").absoluteFilePath() );
+ scripts.append(QFileInfo(SRCDIR "/../lackey/scripts/systemlock_read.js").absoluteFilePath() );
for (int i = 0; i < readWrite; ++i)
- scripts.append(QFileInfo(SRCDIR "lackey/scripts/systemlock_readwrite.js").absoluteFilePath());
+ scripts.append(QFileInfo(SRCDIR "/../lackey/scripts/systemlock_readwrite.js").absoluteFilePath());
QList<QProcess*> consumers;
unsigned int failedProcesses = 0;
@@ -213,8 +213,8 @@ void tst_QSystemLock::processes()
QStringList arguments = QStringList() << scripts.at(i);
QProcess *p = new QProcess;
p->setProcessChannelMode(QProcess::ForwardedChannels);
-
- p->start(QFileInfo(SRCDIR "lackey/lackey").absoluteFilePath(), arguments);
+
+ p->start("../lackey/lackey", arguments);
// test, if the process could be started.
if (p->waitForStarted(2000))
diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
index 87e0533..f923739 100644
--- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
+++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp
@@ -73,6 +73,7 @@ private slots:
void updateSoftKeysCompressed();
void handleCommand();
void checkSoftkeyEnableStates();
+ void noMergingOverWindowBoundary();
private: // utils
inline void simulateSymbianCommand(int command)
@@ -235,5 +236,66 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates()
QCOMPARE(spy1.count(), 5);
}
+/*
+ This tests that the softkeys are not merged over window boundaries. I.e. dialogs
+ don't get softkeys of base widget by default - QTBUG-6163.
+*/
+void tst_QSoftKeyManager::noMergingOverWindowBoundary()
+{
+ // Create base window against which the dialog softkeys will ve verified
+ QWidget base;
+
+ QAction* baseLeft = new QAction(tr("BaseLeft"), &base);
+ baseLeft->setSoftKeyRole(QAction::PositiveSoftKey);
+ base.addAction(baseLeft);
+
+ QAction* baseRight = new QAction(tr("BaseRight"), &base);
+ baseRight->setSoftKeyRole(QAction::NegativeSoftKey);
+ base.addAction(baseRight);
+
+ base.showMaximized();
+ QApplication::processEvents();
+
+ QSignalSpy baseLeftSpy(baseLeft, SIGNAL(triggered()));
+ QSignalSpy baseRightSpy(baseRight, SIGNAL(triggered()));
+
+ //Verify that both base softkeys emit triggered signals
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 1);
+ QCOMPARE(baseRightSpy.count(), 1);
+ baseLeftSpy.clear();
+ baseRightSpy.clear();
+
+ // Verify that no softkey merging when using dialog without parent
+ QDialog dlg;
+ dlg.show();
+
+ QApplication::processEvents();
+
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 0);
+ QCOMPARE(baseRightSpy.count(), 0);
+
+ // Ensure base view has focus again
+ dlg.hide();
+ base.showMaximized();
+
+ // Verify that no softkey merging when using dialog with parent
+ QDialog dlg2(&base);
+ dlg2.show();
+
+ QApplication::processEvents();
+
+ simulateSymbianCommand(s60CommandStart);
+ simulateSymbianCommand(s60CommandStart + 1);
+
+ QCOMPARE(baseLeftSpy.count(), 0);
+ QCOMPARE(baseRightSpy.count(), 0);
+}
+
QTEST_MAIN(tst_QSoftKeyManager)
#include "tst_qsoftkeymanager.moc"
diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp
index cd65135..e5e63a0 100644
--- a/tests/auto/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/qspinbox/tst_qspinbox.cpp
@@ -1025,7 +1025,7 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate()
//we use the French delimiters here
QString textFromValue (int value) const
- {
+ {
return locale().toString(value);
}
@@ -1033,7 +1033,10 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate()
spinbox.show();
spinbox.activateWindow();
spinbox.setFocus();
+ QApplication::setActiveWindow(&spinbox);
QTest::qWaitForWindowShown(&spinbox);
+ QTRY_VERIFY(spinbox.hasFocus());
+ QTRY_COMPARE(static_cast<QWidget *>(&spinbox), QApplication::activeWindow());
QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value()));
spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator
QTest::keyClick(0, Qt::Key_0); // let's insert a 0
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index fe7c3ea..f840ca6 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -86,6 +86,8 @@ private slots:
void open();
void tables_data() { generic_data(); }
void tables();
+ void oci_tables_data() { generic_data("QOCI"); }
+ void oci_tables();
void transaction_data() { generic_data(); }
void transaction();
void eventNotification_data() { generic_data(); }
@@ -380,6 +382,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db)
if (db.driverName().startsWith("QOCI")) {
q.exec("drop user "+qTableName("CREATOR")+" cascade");
q.exec("drop user "+qTableName("APPUSER")+" cascade");
+ q.exec("DROP TABLE system."+qTableName("mypassword"));
}
}
@@ -2481,5 +2484,18 @@ void tst_QSqlDatabase::mysql_savepointtest()
QVERIFY_SQL(q, exec("savepoint foo"));
}
+void tst_QSqlDatabase::oci_tables()
+{
+ QFETCH(QString, dbName);
+ QSqlDatabase db = QSqlDatabase::database(dbName);
+ CHECK_DATABASE(db);
+ QSqlQuery q(db);
+ QString systemTableName("system."+qTableName("mypassword"));
+ QVERIFY_SQL(q, exec("CREATE TABLE "+systemTableName+"(name VARCHAR(20))"));
+ QVERIFY(!db.tables().contains(systemTableName.toUpper()));
+ qDebug() << db.tables(QSql::SystemTables);
+ QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper()));
+}
+
QTEST_MAIN(tst_QSqlDatabase)
#include "tst_qsqldatabase.moc"
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 4264a70..a8908fd 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -199,6 +199,8 @@ private slots:
void QTBUG_5251_data() { generic_data("QPSQL"); }
void QTBUG_5251();
+ void QTBUG_6421_data() { generic_data("QOCI"); }
+ void QTBUG_6421();
private:
// returns all database connections
@@ -302,7 +304,8 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db )
<< qTableName( "more_results" )
<< qTableName( "blobstest" )
<< qTableName( "oraRowId" )
- << qTableName( "qtest_batch" );
+ << qTableName( "qtest_batch" )
+ << qTableName(QLatin1String("bug6421")).toUpper();
if ( db.driverName().startsWith("QPSQL") )
tablenames << qTableName("task_233829");
@@ -2935,5 +2938,28 @@ void tst_QSqlQuery::QTBUG_5251()
}
+void tst_QSqlQuery::QTBUG_6421()
+{
+ QFETCH( QString, dbName );
+ QSqlDatabase db = QSqlDatabase::database( dbName );
+ CHECK_DATABASE( db );
+
+ QSqlQuery q(db);
+ QString tableName=qTableName(QLatin1String("bug6421")).toUpper();
+
+ QVERIFY_SQL(q, exec("create table "+tableName+"(COL1 char(10), COL2 char(10), COL3 char(10))"));
+ QVERIFY_SQL(q, exec("create index INDEX1 on "+tableName+" (COL1 desc)"));
+ QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)"));
+ QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)"));
+ q.setForwardOnly(true);
+ QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='"+tableName+"'"));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\""));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toString(), QLatin1String("\"COL2\""));
+ QVERIFY_SQL(q, next());
+ QCOMPARE(q.value(0).toString(), QLatin1String("\"COL3\""));
+}
+
QTEST_MAIN( tst_QSqlQuery )
#include "tst_qsqlquery.moc"
diff --git a/tests/benchmarks/qdir/tst_qdir.cpp b/tests/benchmarks/qdir/tst_qdir.cpp
index fd558d3..64c6ba1 100644
--- a/tests/benchmarks/qdir/tst_qdir.cpp
+++ b/tests/benchmarks/qdir/tst_qdir.cpp
@@ -78,6 +78,8 @@ public slots:
temp.rmdir(QLatin1String("test_speed"));
}
private slots:
+ void baseline() {}
+
void sizeSpeed() {
QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QBENCHMARK {
@@ -88,6 +90,18 @@ private slots:
}
}
}
+ void sizeSpeedIterator() {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ QBENCHMARK {
+ QDirIterator dit(testdir.path(), QDir::Files);
+ while (dit.hasNext()) {
+ dit.fileInfo().isDir();
+ dit.fileInfo().size();
+ dit.next();
+ }
+ }
+ }
+
void sizeSpeedWithoutFilter() {
QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
QBENCHMARK {
@@ -97,6 +111,18 @@ private slots:
}
}
}
+ void sizeSpeedWithoutFilterIterator() {
+ QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
+ QBENCHMARK {
+ QDirIterator dit(testdir.path());
+ while (dit.hasNext()) {
+ dit.fileInfo().isDir();
+ dit.fileInfo().size();
+ dit.next();
+ }
+ }
+ }
+
void sizeSpeedWithoutFileInfoList() {
QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
testdir.setSorting(QDir::Unsorted);
@@ -108,6 +134,7 @@ private slots:
}
}
}
+
void iDontWantAnyStat() {
QDir testdir(QDir::tempPath() + QLatin1String("/test_speed"));
testdir.setSorting(QDir::Unsorted);
@@ -119,8 +146,16 @@ private slots:
}
}
}
+ void iDontWantAnyStatIterator() {
+ QBENCHMARK {
+ QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed"));
+ while (dit.hasNext()) {
+ dit.next();
+ }
+ }
+ }
- void testLowLevel() {
+ void sizeSpeedWithoutFilterLowLevel() {
#ifdef Q_OS_WIN
const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16();
wchar_t appendedPath[MAX_PATH];