summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-08 23:56:32 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-08 23:56:32 (GMT)
commitff222b3ece43664a4f599c8a6b0275d2aa72cc4d (patch)
tree0d0e8bcc20b8cf668904946d344b3b85964519fa /tests/auto
parent3b1a0c4877faa9d1d50372f2128c06530ae4b2d4 (diff)
parentde5ce297da04d1246711d28095d6cd1f52cfc97b (diff)
downloadQt-ff222b3ece43664a4f599c8a6b0275d2aa72cc4d.zip
Qt-ff222b3ece43664a4f599c8a6b0275d2aa72cc4d.tar.gz
Qt-ff222b3ece43664a4f599c8a6b0275d2aa72cc4d.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: Make generate uid3 (symbian) work on 64 bit host platform. Updated the docs for QPainter::begin/endNativePainting() Compile fix for network benchmarks. Add a pixmap modification hook to blur pixmap filter cache Delete benchmark examples (qtestlib-simple and qtwidgets). Restructure tests/benchmarks directory. Fixed QImagReader::setAutoDetectImageFormat() to work with plugins. QLineEdit: regression: read-only line edits would eat shortcuts. QGraphicsItem: Do not crash at exit if there is static QGraphicsItem. Make QTextCodec reentrant.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp29
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp21
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp46
4 files changed, 98 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 7b54a3b..7c1b97e 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -90,6 +90,8 @@ Q_DECLARE_METATYPE(QRectF)
#define COMPARE_REGIONS QTRY_COMPARE
#endif
+static QGraphicsRectItem staticItem; //QTBUG-7629, we should not crash at exit.
+
static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton)
{
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 121a8fa..99244c2 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1633,6 +1633,35 @@ void tst_QImageReader::autoDetectImageFormat()
QVERIFY(reader.canRead());
QVERIFY(!reader.read().isNull());
}
+
+#ifdef QTEST_HAVE_JPEG
+ {
+ QImageReader io(prefix + "YCbCr_rgb.jpg");
+ io.setAutoDetectImageFormat(false);
+ // This should fail since no format string is given
+ QImage image;
+ QVERIFY(!io.read(&image));
+ }
+ {
+ QImageReader io(prefix + "YCbCr_rgb.jpg", "jpg");
+ io.setAutoDetectImageFormat(false);
+ QImage image;
+ QVERIFY(io.read(&image));
+ }
+#endif
+ {
+ QImageReader io(prefix + "tst7.png");
+ io.setAutoDetectImageFormat(false);
+ // This should fail since no format string is given
+ QImage image;
+ QVERIFY(!io.read(&image));
+ }
+ {
+ QImageReader io(prefix + "tst7.png", "png");
+ io.setAutoDetectImageFormat(false);
+ QImage image;
+ QVERIFY(io.read(&image));
+ }
}
void tst_QImageReader::fileNameProbing()
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 7283916..69e7699 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -271,6 +271,7 @@ private slots:
void taskQTBUG_4401_enterKeyClearsPassword();
void taskQTBUG_4679_moveToStartEndOfBlock();
void taskQTBUG_4679_selectToStartEndOfBlock();
+ void taskQTBUG_7395_readOnlyShortcut();
protected slots:
#ifdef QT3_SUPPORT
@@ -3638,5 +3639,25 @@ void tst_QLineEdit::taskQTBUG_4679_selectToStartEndOfBlock()
#endif // Q_OS_MAC
}
+void tst_QLineEdit::taskQTBUG_7395_readOnlyShortcut()
+{
+ //ReadOnly QLineEdit should not intercept shortcut.
+ QLineEdit le;
+ le.setReadOnly(true);
+
+ QAction action(QString::fromLatin1("hello"), &le);
+ action.setShortcut(QString::fromLatin1("p"));
+ QSignalSpy spy(&action, SIGNAL(triggered()));
+ le.addAction(&action);
+
+ le.show();
+ QApplication::setActiveWindow(&le);
+ QTest::qWaitForWindowShown(&le);
+ le.setFocus();
+ QTRY_VERIFY(le.hasFocus());
+ QTest::keyClick(0, Qt::Key_P);
+ QCOMPARE(spy.count(), 1);
+}
+
QTEST_MAIN(tst_QLineEdit)
#include "tst_qlineedit.moc"
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index eb348fb..65b0448 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -47,6 +47,8 @@
#include <qtextdocument.h>
#include <time.h>
#include <qprocess.h>
+#include <QtConcurrentMap>
+#include <QThreadPool>
#ifdef Q_OS_SYMBIAN
#define SRCDIR ""
@@ -58,6 +60,9 @@ class tst_QTextCodec : public QObject
Q_OBJECT
private slots:
+
+ void threadSafety();
+
void toUnicode_data();
void toUnicode();
void codecForName_data();
@@ -1904,5 +1909,46 @@ void tst_QTextCodec::toLocal8Bit()
}
#endif
+static QByteArray loadAndConvert(const QByteArray &codecName)
+{
+ QTextCodec *c = QTextCodec::codecForName(codecName);
+ if (!c) {
+ qDebug() << "WARNING " << codecName << " not found? ";
+ return QByteArray();
+ }
+ QString str = QString::fromLatin1(codecName);
+ QByteArray b = c->fromUnicode(str);
+ c->toUnicode(b);
+ return codecName;
+}
+
+static int loadAndConvertMIB(int mib)
+{
+ QTextCodec *c = QTextCodec::codecForMib(mib);
+ if (!c) {
+ qDebug() << "WARNING " << mib << " not found? ";
+ return 0;
+ }
+ QString str = QString::number(mib);
+ QByteArray b = c->fromUnicode(str);
+ c->toUnicode(b);
+ return mib;
+}
+
+
+void tst_QTextCodec::threadSafety()
+{
+ QThreadPool::globalInstance()->setMaxThreadCount(12);
+
+ QList<QByteArray> codecList = QTextCodec::availableCodecs();
+ QFuture<QByteArray> res = QtConcurrent::mapped(codecList, loadAndConvert);
+
+ QList<int> mibList = QTextCodec::availableMibs();
+ QFuture<int> res2 = QtConcurrent::mapped(mibList, loadAndConvertMIB);
+
+ QCOMPARE(res.results(), codecList);
+ QCOMPARE(res2.results(), mibList);
+}
+
QTEST_MAIN(tst_QTextCodec)
#include "tst_qtextcodec.moc"