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:
parent
1f73d4b87c
commit
0e67553aac
@ -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]
|
|
||||||
*
|
|
@ -8,9 +8,12 @@
|
|||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include <qlist.h>
|
#include <qlist.h>
|
||||||
|
#include <qset.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
class tst_QTextBoundaryFinder : public QObject
|
class tst_QTextBoundaryFinder : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -71,7 +74,7 @@ inline char *toString(const QList<int> &list)
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#ifdef QT_BUILD_INTERNAL
|
#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<QString>("testString");
|
||||||
QTest::addColumn<QList<int> >("expectedBreakPositions");
|
QTest::addColumn<QList<int> >("expectedBreakPositions");
|
||||||
@ -123,6 +126,8 @@ static void generateDataFromFile(const QString &fname)
|
|||||||
QVERIFY(!testString.isEmpty());
|
QVERIFY(!testString.isEmpty());
|
||||||
QVERIFY(!expectedBreakPositions.isEmpty());
|
QVERIFY(!expectedBreakPositions.isEmpty());
|
||||||
|
|
||||||
|
bool skip = false;
|
||||||
|
|
||||||
if (!comments.isEmpty()) {
|
if (!comments.isEmpty()) {
|
||||||
const QStringList lst = comments.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
const QStringList lst = comments.simplified().split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||||
comments.clear();
|
comments.clear();
|
||||||
@ -134,12 +139,18 @@ static void generateDataFromFile(const QString &fname)
|
|||||||
comments += QLatin1Char('x');
|
comments += QLatin1Char('x');
|
||||||
continue;
|
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;
|
comments += part;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray nm = "line #" + QByteArray::number(linenum) + ": " + comments.toLatin1();
|
const QByteArray nm = "line #" + QByteArray::number(linenum) + ": " + comments.toLatin1();
|
||||||
|
|
||||||
|
if (skip)
|
||||||
|
qDebug() << "Skipping" << nm;
|
||||||
|
else
|
||||||
QTest::newRow(nm.constData()) << testString << expectedBreakPositions;
|
QTest::newRow(nm.constData()) << testString << expectedBreakPositions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +211,10 @@ QT_END_NAMESPACE
|
|||||||
|
|
||||||
void tst_QTextBoundaryFinder::graphemeBoundariesDefault_data()
|
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()
|
void tst_QTextBoundaryFinder::graphemeBoundariesDefault()
|
||||||
@ -248,7 +262,10 @@ void tst_QTextBoundaryFinder::sentenceBoundariesDefault()
|
|||||||
|
|
||||||
void tst_QTextBoundaryFinder::lineBoundariesDefault_data()
|
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()
|
void tst_QTextBoundaryFinder::lineBoundariesDefault()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user