From e75e4b39b78ba05ea2cd45dc96acf99fc89c5915 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 30 Jun 2018 19:03:48 +0200 Subject: 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 --- tests/auto/other/qcomplextext/tst_qcomplextext.cpp | 144 ++++++++------------- 1 file changed, 56 insertions(+), 88 deletions(-) (limited to 'tests/auto/other/qcomplextext') 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("data"); - QTest::addColumn("paragraphDirection"); - QTest::addColumn>("resolvedLevels"); - QTest::addColumn>("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 parts = line.split(';'); - QVERIFY(parts.size() == 5); - - QString data; - QList 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 resolvedLevels; - QList 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 visualOrder; - QList 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 &resolvedLevels, const QVector &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, resolvedLevels); - QFETCH(QVector, 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 parts = line.split(';'); + QVERIFY(parts.size() == 5); - testBidiString(data, paragraphDirection, resolvedLevels, visualOrder); + QString data; + QList 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 resolvedLevels; + QList 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 visualOrder; + QList 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("data"); - QTest::addColumn("paragraphDirection"); - QTest::addColumn>("resolvedLevels"); - QTest::addColumn>("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, resolvedLevels); - QFETCH(QVector, visualOrder); - - testBidiString(data, paragraphDirection, resolvedLevels, visualOrder); } -- cgit v1.2.3