summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/other/qcomplextext/tst_qcomplextext.cpp144
1 files changed, 56 insertions, 88 deletions
diff --git a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
index 812cd8f369..0116e546a0 100644
--- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
+++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp
@@ -48,9 +48,7 @@ private slots:
void bidiInvalidCursorNoMovement_data();
void bidiInvalidCursorNoMovement();
- void bidiCharacterTest_data();
void bidiCharacterTest();
- void bidiTest_data();
void bidiTest();
};
@@ -279,67 +277,6 @@ void tst_QComplexText::bidiCursor_PDF()
QVERIFY(line.cursorToX(size) == line.cursorToX(size - 1));
}
-void tst_QComplexText::bidiCharacterTest_data()
-{
- QTest::addColumn<QString>("data");
- QTest::addColumn<int>("paragraphDirection");
- QTest::addColumn<QVector<int>>("resolvedLevels");
- QTest::addColumn<QVector<int>>("visualOrder");
-
- QString testFile = QFINDTESTDATA("data/BidiCharacterTest.txt");
- QFile f(testFile);
- QVERIFY(f.exists());
-
- f.open(QIODevice::ReadOnly);
-
- int linenum = 0;
- while (!f.atEnd()) {
- linenum++;
-
- QByteArray line = f.readLine().simplified();
- if (line.startsWith('#') || line.isEmpty())
- continue;
- QVERIFY(!line.contains('#'));
-
- QList<QByteArray> parts = line.split(';');
- QVERIFY(parts.size() == 5);
-
- QString data;
- QList<QByteArray> dataParts = parts.at(0).split(' ');
- for (const auto &p : dataParts) {
- bool ok;
- data += QChar((ushort)p.toInt(&ok, 16));
- QVERIFY(ok);
- }
-
- int paragraphDirection = parts.at(1).toInt();
-// int resolvedParagraphLevel = parts.at(2).toInt();
-
- QVector<int> resolvedLevels;
- QList<QByteArray> levelParts = parts.at(3).split(' ');
- for (const auto &p : levelParts) {
- if (p == "x") {
- resolvedLevels += -1;
- } else {
- bool ok;
- resolvedLevels += p.toInt(&ok);
- QVERIFY(ok);
- }
- }
-
- QVector<int> visualOrder;
- QList<QByteArray> orderParts = parts.at(4).split(' ');
- for (const auto &p : orderParts) {
- bool ok;
- visualOrder += p.toInt(&ok);
- QVERIFY(ok);
- }
-
- const QByteArray nm = "line #" + QByteArray::number(linenum);
- QTest::newRow(nm.constData()) << data << paragraphDirection << resolvedLevels << visualOrder;
- }
-}
-
static void testBidiString(const QString &data, int paragraphDirection, const QVector<int> &resolvedLevels, const QVector<int> &visualOrder)
{
Q_UNUSED(resolvedLevels);
@@ -421,12 +358,59 @@ static void testBidiString(const QString &data, int paragraphDirection, const QV
void tst_QComplexText::bidiCharacterTest()
{
- QFETCH(QString, data);
- QFETCH(int, paragraphDirection);
- QFETCH(QVector<int>, resolvedLevels);
- QFETCH(QVector<int>, visualOrder);
+ QString testFile = QFINDTESTDATA("data/BidiCharacterTest.txt");
+ QFile f(testFile);
+ QVERIFY(f.exists());
+
+ f.open(QIODevice::ReadOnly);
+
+ int linenum = 0;
+ while (!f.atEnd()) {
+ linenum++;
+
+ QByteArray line = f.readLine().simplified();
+ if (line.startsWith('#') || line.isEmpty())
+ continue;
+ QVERIFY(!line.contains('#'));
+
+ QList<QByteArray> parts = line.split(';');
+ QVERIFY(parts.size() == 5);
- testBidiString(data, paragraphDirection, resolvedLevels, visualOrder);
+ QString data;
+ QList<QByteArray> dataParts = parts.at(0).split(' ');
+ for (const auto &p : dataParts) {
+ bool ok;
+ data += QChar((ushort)p.toInt(&ok, 16));
+ QVERIFY(ok);
+ }
+
+ int paragraphDirection = parts.at(1).toInt();
+// int resolvedParagraphLevel = parts.at(2).toInt();
+
+ QVector<int> resolvedLevels;
+ QList<QByteArray> levelParts = parts.at(3).split(' ');
+ for (const auto &p : levelParts) {
+ if (p == "x") {
+ resolvedLevels += -1;
+ } else {
+ bool ok;
+ resolvedLevels += p.toInt(&ok);
+ QVERIFY(ok);
+ }
+ }
+
+ QVector<int> visualOrder;
+ QList<QByteArray> orderParts = parts.at(4).split(' ');
+ for (const auto &p : orderParts) {
+ bool ok;
+ visualOrder += p.toInt(&ok);
+ QVERIFY(ok);
+ }
+
+ const QByteArray nm = "line #" + QByteArray::number(linenum);
+
+ testBidiString(data, paragraphDirection, resolvedLevels, visualOrder);
+ }
}
ushort unicodeForDirection(const QByteArray &direction)
@@ -466,13 +450,8 @@ ushort unicodeForDirection(const QByteArray &direction)
Q_UNREACHABLE();
}
-void tst_QComplexText::bidiTest_data()
+void tst_QComplexText::bidiTest()
{
- QTest::addColumn<QString>("data");
- QTest::addColumn<int>("paragraphDirection");
- QTest::addColumn<QVector<int>>("resolvedLevels");
- QTest::addColumn<QVector<int>>("visualOrder");
-
QString testFile = QFINDTESTDATA("data/BidiTest.txt");
QFile f(testFile);
QVERIFY(f.exists());
@@ -534,24 +513,13 @@ void tst_QComplexText::bidiTest_data()
const QByteArray nm = "line #" + QByteArray::number(linenum);
if (paragraphDirections & 1)
- QTest::newRow((nm + " (Auto)").constData()) << data << 2 << resolvedLevels << visualOrder;
+ testBidiString(data, 2, resolvedLevels, visualOrder);
if (paragraphDirections & 2)
- QTest::newRow((nm + " (LTR)").constData()) << data << 0 << resolvedLevels << visualOrder;
+ testBidiString(data, 0, resolvedLevels, visualOrder);
if (paragraphDirections & 4)
- QTest::newRow((nm + " (RTL)").constData()) << data << 1 << resolvedLevels << visualOrder;
+ testBidiString(data, 1, resolvedLevels, visualOrder);
}
-
-}
-
-void tst_QComplexText::bidiTest()
-{
- QFETCH(QString, data);
- QFETCH(int, paragraphDirection);
- QFETCH(QVector<int>, resolvedLevels);
- QFETCH(QVector<int>, visualOrder);
-
- testBidiString(data, paragraphDirection, resolvedLevels, visualOrder);
}