summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-12-14 00:12:05 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-12-14 00:12:05 (GMT)
commited331fc0bb5e77109d67ca1de45bb978cf045cef (patch)
treedfa528a1e62b30e288d3ad8f52afe3acccd70a82 /tests/auto
parent3d24bcad7c340e1e164b00424f4fde7fd7922c59 (diff)
parent18e3cd65980e1bc01e6af4807cae0bceca25288c (diff)
downloadQt-ed331fc0bb5e77109d67ca1de45bb978cf045cef.zip
Qt-ed331fc0bb5e77109d67ca1de45bb978cf045cef.tar.gz
Qt-ed331fc0bb5e77109d67ca1de45bb978cf045cef.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2: QPointer: thread safety Make sure num_glyphs pass to HarfBuzz is large enough Corrected documentation for QImage::fill(). Fix transformed QPainter::drawGlyphs() for certain paint engines
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qpointer/tst_qpointer.cpp32
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp19
2 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qpointer/tst_qpointer.cpp b/tests/auto/qpointer/tst_qpointer.cpp
index 5a07e41..ce23764 100644
--- a/tests/auto/qpointer/tst_qpointer.cpp
+++ b/tests/auto/qpointer/tst_qpointer.cpp
@@ -73,6 +73,7 @@ private slots:
void castDuringDestruction();
void data() const;
void dataSignature() const;
+ void threadSafety();
};
tst_QPointer::tst_QPointer()
@@ -345,5 +346,36 @@ void tst_QPointer::dataSignature() const
}
}
+class TestRunnable : public QObject, public QRunnable {
+ void run() {
+ QPointer<QObject> obj1 = new QObject;
+ QPointer<QObject> obj2 = new QObject;
+ obj1->moveToThread(thread()); // this is the owner thread
+ obj1->deleteLater(); // the delete will happen in the owner thread
+ obj2->moveToThread(thread()); // this is the owner thread
+ obj2->deleteLater(); // the delete will happen in the owner thread
+ }
+};
+
+void tst_QPointer::threadSafety()
+{
+
+ QThread owner;
+ owner.start();
+
+ QThreadPool pool;
+ for (int i = 0; i < 300; i++) {
+ QPointer<TestRunnable> task = new TestRunnable;
+ task->setAutoDelete(true);
+ task->moveToThread(&owner);
+ pool.start(task);
+ }
+ pool.waitForDone();
+
+ owner.quit();
+ owner.wait();
+}
+
+
QTEST_MAIN(tst_QPointer)
#include "tst_qpointer.moc"
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index dcc43d0..4f4413f 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -125,6 +125,7 @@ private slots:
void lineWidthFromBOM();
void textWidthVsWIdth();
+ void textWithSurrogates_qtbug15679();
private:
QFont testFont;
@@ -1412,6 +1413,24 @@ void tst_QTextLayout::textWidthVsWIdth()
}
}
+void tst_QTextLayout::textWithSurrogates_qtbug15679()
+{
+ QString str = QString::fromUtf8("🀀a🀀");
+ QTextLayout layout(str);
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+
+ qreal x[6];
+ for (int i = 0; i < 6; i++)
+ x[i] = line.cursorToX(i);
+
+ // If the first and third character are using the same
+ // font, they must have the same advance (since they
+ // are surrogate pairs, we need to add two for each
+ // character)
+ QCOMPARE(x[2] - x[0], x[5] - x[3]);
+}
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"