tst_qttextboundaryfinder: ignore unsupported tests

Qt currently has custom implementation for Indic grapheme breaks.

QTBUG-121907 was created to evaluate whether it is better to use
Unicode implementation instead.

Remove BLACKLIST. The remaining tests pass.

Fixes: QTBUG-121529
Task-number: QTBUG-121907
Change-Id: Ifd8fd76aeeba51d08c9f23b867abbf39750fc7d9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Ievgenii Meshcheriakov 2024-02-05 11:32:11 +01:00
parent 1f73d4b87c
commit 0e67553aac
2 changed files with 22 additions and 12 deletions

View File

@ -1,7 +0,0 @@
# QTBUG-121529: Tests need to be updated to Unicode 15.1
[lineBoundariesDefault]
*
# QTBUG-121529: Tests need to be updated to Unicode 15.1
[graphemeBoundariesDefault]
*

View File

@ -8,9 +8,12 @@
#include <qfile.h>
#include <qdebug.h>
#include <qlist.h>
#include <qset.h>
#include <algorithm>
using namespace Qt::Literals::StringLiterals;
class tst_QTextBoundaryFinder : public QObject
{
Q_OBJECT
@ -71,7 +74,7 @@ inline char *toString(const QList<int> &list)
QT_END_NAMESPACE
#ifdef QT_BUILD_INTERNAL
static void generateDataFromFile(const QString &fname)
static void generateDataFromFile(const QString &fname, const QSet<QString> &skipSet = {})
{
QTest::addColumn<QString>("testString");
QTest::addColumn<QList<int> >("expectedBreakPositions");
@ -123,6 +126,8 @@ static void generateDataFromFile(const QString &fname)
QVERIFY(!testString.isEmpty());
QVERIFY(!expectedBreakPositions.isEmpty());
bool skip = false;
if (!comments.isEmpty()) {
const QStringList lst = comments.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts);
comments.clear();
@ -134,13 +139,19 @@ static void generateDataFromFile(const QString &fname)
comments += QLatin1Char('x');
continue;
}
if (part.startsWith(QLatin1Char('(')) && part.endsWith(QLatin1Char(')')))
if (part.startsWith(QLatin1Char('(')) && part.endsWith(QLatin1Char(')'))) {
skip |= skipSet.contains(part.sliced(1, part.length() - 2));
comments += part;
}
}
}
const QByteArray nm = "line #" + QByteArray::number(linenum) + ": " + comments.toLatin1();
QTest::newRow(nm.constData()) << testString << expectedBreakPositions;
if (skip)
qDebug() << "Skipping" << nm;
else
QTest::newRow(nm.constData()) << testString << expectedBreakPositions;
}
}
#endif
@ -200,7 +211,10 @@ QT_END_NAMESPACE
void tst_QTextBoundaryFinder::graphemeBoundariesDefault_data()
{
generateDataFromFile("data/GraphemeBreakTest.txt");
// QTBUG-121907: We are not using Unicode grapheme segmentation for Indic scripts.
QSet<QString> skipSet = {u"ConjunctLinkingScripts_LinkingConsonant"_s};
generateDataFromFile("data/GraphemeBreakTest.txt", skipSet);
}
void tst_QTextBoundaryFinder::graphemeBoundariesDefault()
@ -248,7 +262,10 @@ void tst_QTextBoundaryFinder::sentenceBoundariesDefault()
void tst_QTextBoundaryFinder::lineBoundariesDefault_data()
{
generateDataFromFile("data/LineBreakTest.txt");
// QTBUG-121907: Indic line breaking is not supported
QSet<QString> skipSet = {u"AK"_s, u"AP"_s, u"AS"_s, u"VI"_s, u"VF"_s};
generateDataFromFile("data/LineBreakTest.txt", skipSet);
}
void tst_QTextBoundaryFinder::lineBoundariesDefault()