tests: fix linebylinelex tests for mobile and embedded
Cannot make both builtin test and non-builtin test data cases work when using test data from different test paths. Opt to always use builtin testdata. Fix the globs to correctly include the test files and paths where data is searched from. Fixes: QTBUG-105697 Fixes: QTBUG-123436 Change-Id: I33fc337b3a6fcdfb07f5e9fe12f1075836eb65c3 Reviewed-by: Ari Parkkila <ari.parkkila@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
8bd1fd8c89
commit
033d0e5077
|
@ -1,5 +0,0 @@
|
|||
# QTBUG-105697
|
||||
[testFormatter]
|
||||
android
|
||||
[testLineByLineLex]
|
||||
android
|
|
@ -10,12 +10,12 @@ endif()
|
|||
|
||||
# Collect linebyline test data
|
||||
file(GLOB_RECURSE test_data_glob
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
linebylinelex/data/*)
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
data/*)
|
||||
# Collect qmlformat test data
|
||||
file(GLOB_RECURSE test_data_glob2
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
qmlformat/data/*)
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
../qmlformat/data/*)
|
||||
list(APPEND test_data ${test_data_glob} ${test_data_glob2})
|
||||
|
||||
qt_internal_add_test(tst_linebylinelex
|
||||
|
@ -25,17 +25,5 @@ qt_internal_add_test(tst_linebylinelex
|
|||
Qt::Qml
|
||||
Qt::QuickTestUtilsPrivate
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_linebylinelex CONDITION ANDROID OR IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR=":/"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_linebylinelex CONDITION NOT ANDROID AND NOT IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}/.."
|
||||
BUILTIN_TESTDATA
|
||||
)
|
||||
|
|
|
@ -13,7 +13,7 @@ QT_USE_NAMESPACE
|
|||
using namespace Qt::StringLiterals;
|
||||
using namespace QQmlJS;
|
||||
|
||||
class TestLineByLineLex : public QQmlDataTest
|
||||
class TestLineByLineLex : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
TestLineByLineLex();
|
||||
|
||||
private Q_SLOTS:
|
||||
void initTestCase() override;
|
||||
void initTestCase();
|
||||
|
||||
void testLineByLineLex_data();
|
||||
void testLineByLineLex();
|
||||
|
@ -34,17 +34,14 @@ private:
|
|||
|
||||
QString m_qmljsrootgenPath;
|
||||
QString m_qmltyperegistrarPath;
|
||||
QString m_baseDir;
|
||||
};
|
||||
|
||||
TestLineByLineLex::TestLineByLineLex()
|
||||
: QQmlDataTest(QT_QMLTEST_DATADIR), m_baseDir(QString::fromLocal8Bit(QT_QMLTEST_DATADIR))
|
||||
{
|
||||
}
|
||||
|
||||
void TestLineByLineLex::initTestCase()
|
||||
{
|
||||
QQmlDataTest::initTestCase();
|
||||
}
|
||||
|
||||
void TestLineByLineLex::testLineByLineLex_data()
|
||||
|
@ -59,22 +56,18 @@ void TestLineByLineLex::testLineByLineLex()
|
|||
{
|
||||
QFETCH(QString, filename);
|
||||
|
||||
QString filePath = m_baseDir + u"/linebylinelex/data/"_s + filename;
|
||||
QString filePath = QFINDTESTDATA("data/" + filename);
|
||||
runLex(filePath);
|
||||
}
|
||||
|
||||
void TestLineByLineLex::testFormatter_data()
|
||||
{
|
||||
QTest::addColumn<QString>("filename");
|
||||
QDir formatData(m_baseDir + u"/qmlformat/data"_s);
|
||||
bool hasTestData = false; // ### TODO: fix test to always have data
|
||||
QDir formatData(QFINDTESTDATA("qmlformat/data"));
|
||||
for (const QFileInfo &fInfo :
|
||||
formatData.entryInfoList(QStringList({ u"*.qml"_s, u"*.js"_s }), QDir::Files)) {
|
||||
QTest::newRow(qPrintable(fInfo.fileName())) << fInfo.absoluteFilePath();
|
||||
hasTestData = true;
|
||||
}
|
||||
if (!hasTestData)
|
||||
QSKIP("No test data found!");
|
||||
}
|
||||
|
||||
void TestLineByLineLex::testFormatter()
|
||||
|
|
Loading…
Reference in New Issue