summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-06-30 19:03:48 +0200
committerLiang Qi <liang.qi@qt.io>2018-06-30 18:34:20 +0000
commite75e4b39b78ba05ea2cd45dc96acf99fc89c5915 (patch)
tree7cacceb14541513ed813c7a4e52b2e3c84677ec7 /tests
parent35e005bc4fd790d41a5b5248e85bbdac33fbf043 (diff)
Reduce amount of log output of the qcomplextext autotest
Writing out one test result per line in the test data files is excessive and only bloats the log, given that this algorithm is rarely changed. Task-number: QTQAINFRA-2037 Change-Id: Ib9e568c7ded73d45e4b64671e97d5581a74f8f93 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-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);
}