summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-08 12:32:48 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-08 12:32:48 (GMT)
commit466ac1c7d93d3f5dea35f1a6e214907899772ae3 (patch)
tree8253e96351c5620e390a2d68fdb1520e2f2725bd /tests
parentc2d213becf8f96257789ebeb3ab074733da36424 (diff)
parent7724c474a941ea3516da6102a16b30ca254afe53 (diff)
downloadQt-466ac1c7d93d3f5dea35f1a6e214907899772ae3.zip
Qt-466ac1c7d93d3f5dea35f1a6e214907899772ae3.tar.gz
Qt-466ac1c7d93d3f5dea35f1a6e214907899772ae3.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: QGraphicsItem: Do not crash at exit if there is static QGraphicsItem. Make QTextCodec reentrant.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp2
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp46
2 files changed, 48 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/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"