summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp')
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
index ee50b98733..0371f51961 100644
--- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
+++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp
@@ -78,6 +78,9 @@ private slots:
void thaiIsolatedSaraAm();
void thaiWithZWJ();
void thaiMultipleVowels();
+
+ void shapingDisabledDevanagari();
+ void shapingDisabledLatin();
private:
bool haveTestFonts;
};
@@ -1280,5 +1283,62 @@ void tst_QTextScriptEngine::thaiMultipleVowels()
// If we haven't crashed at this point, then the test has passed.
}
+void tst_QTextScriptEngine::shapingDisabledLatin()
+{
+ QString s("fi");
+
+ QFont font("Calibri");
+ font.setStyleStrategy(QFont::PreferNoShaping);
+
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QList<QGlyphRun> runs = layout.glyphRuns();
+
+ QCOMPARE(runs.size(), 1);
+ QCOMPARE(runs.first().glyphIndexes().size(), 2);
+}
+
+void tst_QTextScriptEngine::shapingDisabledDevanagari()
+{
+ QString s;
+ s += QChar(0x0915); // KA
+ s += QChar(0x094D); // VIRAMA
+ s += QChar(0x0915); // KA
+
+
+ QList<QGlyphRun> normalRuns;
+ {
+ QTextLayout layout(s);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ normalRuns = layout.glyphRuns();
+ }
+
+ QFont font;
+ font.setStyleStrategy(QFont::PreferNoShaping);
+
+ QList<QGlyphRun> noShapingRuns;
+ {
+ QTextLayout layout(s);
+ layout.setFont(font);
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ noShapingRuns = layout.glyphRuns();
+ }
+
+ // Even though shaping is disabled, Devanagari requires it, so the flag should be ignored.
+ QCOMPARE(normalRuns.size(), 1);
+ QCOMPARE(noShapingRuns.size(), 1);
+ QCOMPARE(noShapingRuns.first().glyphIndexes().size(), normalRuns.first().glyphIndexes().size());
+}
+
QTEST_MAIN(tst_QTextScriptEngine)
#include "tst_qtextscriptengine.moc"