summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 12:48:01 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-04-10 15:31:45 +0200
commit143c4d3e13a430b951f4f4f8c28db14303f80605 (patch)
tree2b89637b93fc7d81c674106008566010f986d67c /tests/auto/gui/text
parenta7ed81b557d593a8ddb43b71bf4bbf3b44ead070 (diff)
parente5337ad1b1fb02873ce7b5ca8db45f6fd8063352 (diff)
Merge remote-tracking branch 'origin/master' into api_changes
Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
Diffstat (limited to 'tests/auto/gui/text')
-rw-r--r--tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp32
-rw-r--r--tests/auto/gui/text/qfontdatabase/qfontdatabase.pro1
-rw-r--r--tests/auto/gui/text/qfontmetrics/qfontmetrics.pro2
-rw-r--r--tests/auto/gui/text/qglyphrun/qglyphrun.pro2
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp24
5 files changed, 55 insertions, 6 deletions
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
index c609b4a1ed..a33e3cd13b 100644
--- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
+++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp
@@ -47,6 +47,7 @@
#include <qabstracttextdocumentlayout.h>
#include <qimage.h>
#include <qtextobject.h>
+#include <qfontmetrics.h>
class tst_QAbstractTextDocumentLayout : public QObject
{
@@ -59,6 +60,7 @@ public:
private slots:
void getSetCheck();
void maximumBlockCount();
+ void anchorAt();
};
tst_QAbstractTextDocumentLayout::tst_QAbstractTextDocumentLayout()
@@ -152,5 +154,35 @@ void tst_QAbstractTextDocumentLayout::maximumBlockCount()
QCOMPARE(layout.blockCount, 10);
}
+void tst_QAbstractTextDocumentLayout::anchorAt()
+{
+ QTextDocument doc;
+ doc.setHtml("<a href=\"link\">foo</a>");
+ QAbstractTextDocumentLayout *documentLayout = doc.documentLayout();
+ QTextBlock firstBlock = doc.begin();
+ QTextLayout *layout = firstBlock.layout();
+ layout->setPreeditArea(doc.toPlainText().length(), "xxx");
+
+ doc.setPageSize(QSizeF(1000, 1000));
+ QFontMetrics metrics(layout->font());
+ QPointF blockStart = documentLayout->blockBoundingRect(firstBlock).topLeft();
+
+ // anchorAt on start returns link
+ QRect linkBr = metrics.boundingRect("foo");
+ QPointF linkPoint(linkBr.width() + blockStart.x(), (linkBr.height() / 2) + blockStart.y());
+ QCOMPARE(documentLayout->anchorAt(linkPoint), QString("link"));
+
+ // anchorAt() on top of preedit at end should not assert
+ QRect preeditBr = metrics.boundingRect(doc.toPlainText() + "xx");
+ QPointF preeditPoint(preeditBr.width() + blockStart.x(), (preeditBr.height() / 2) + blockStart.y());
+ QCOMPARE(documentLayout->anchorAt(preeditPoint), QString());
+
+ // preedit at start should not return link
+ layout->setPreeditArea(0, "xxx");
+ preeditBr = metrics.boundingRect("xx");
+ preeditPoint = QPointF(preeditBr.width() + blockStart.x(), (preeditBr.height() / 2) + blockStart.y());
+ QCOMPARE(documentLayout->anchorAt(preeditPoint), QString());
+}
+
QTEST_MAIN(tst_QAbstractTextDocumentLayout)
#include "tst_qabstracttextdocumentlayout.moc"
diff --git a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
index 034d08fc8f..c853aaa100 100644
--- a/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
+++ b/tests/auto/gui/text/qfontdatabase/qfontdatabase.pro
@@ -11,4 +11,3 @@ wince* {
}
mac: CONFIG += insignificant_test # QTBUG-23062
-win32:CONFIG += insignificant_test # QTBUG-24193
diff --git a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
index bb0d8e3c4a..f5cf957722 100644
--- a/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
+++ b/tests/auto/gui/text/qfontmetrics/qfontmetrics.pro
@@ -3,5 +3,3 @@ TARGET = tst_qfontmetrics
QT += testlib
SOURCES += tst_qfontmetrics.cpp
RESOURCES += testfont.qrc
-
-win32:CONFIG += insignificant_test # QTBUG-24195
diff --git a/tests/auto/gui/text/qglyphrun/qglyphrun.pro b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
index 97b9806c11..acdff0584f 100644
--- a/tests/auto/gui/text/qglyphrun/qglyphrun.pro
+++ b/tests/auto/gui/text/qglyphrun/qglyphrun.pro
@@ -10,5 +10,3 @@ wince* {
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
}
-
-win32:CONFIG += insignificant_test # QTBUG-24196
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index a88e93c93e..d566f0a20d 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -105,7 +105,7 @@ private slots:
void thaiIsolatedSaraAm();
void thaiWithZWJ();
-
+ void thaiMultipleVowels();
private:
bool haveTestFonts;
};
@@ -1325,5 +1325,27 @@ void tst_QTextScriptEngine::thaiWithZWJ()
QCOMPARE((bool)e->layoutData->glyphLayout.attributes[i].dontPrint, (i == 1 || i == 3));
}
+void tst_QTextScriptEngine::thaiMultipleVowels()
+{
+ QString s(QString::fromUtf8("ส"));
+ for (int i = 0; i < 100; i++)
+ s += QChar(0x0E47); // Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the character
+ s += QChar(0x200D); // Now add a zero width joiner (which adds a circle which is hidden)
+ for (int i = 0; i < 100; i++)
+ s += QChar(0x0E47); //Add lots of "VOWEL SIGN MAI TAI KHU N/S-T" stacked on top of the ZWJ
+
+ for (int i = 0; i < 10; i++)
+ s += s; //Repeat the string to make it more likely to crash if we have a buffer overflow
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QTextEngine *e = layout.engine();
+ e->width(0, s.length()); //force itemize and shape
+
+ // If we haven't crashed at this point, then the test has passed.
+}
+
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"