tst_qqmljsscope: Fix test module importing
The name of the module's folder should match the URI and application binary dir should be provided as an extra import path for the module to be discoverable Change-Id: I00d67593d18dc86c0929f8a64b2c165221a4758a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
6390cc5d24
commit
ffe017b92c
|
@ -36,4 +36,4 @@ qt_internal_extend_target(tst_qqmljsscope CONDITION NOT ANDROID AND NOT IOS
|
|||
QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
|
||||
)
|
||||
|
||||
add_subdirectory(testmodule)
|
||||
add_subdirectory(QQmlJSScopeTests)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import QtQml
|
||||
import QQmlJSScopeTests // own import
|
||||
QtObject { }
|
|
@ -136,6 +136,11 @@ public:
|
|||
{
|
||||
QLibraryInfo::path(QLibraryInfo::QmlImportsPath),
|
||||
dataDirectory(),
|
||||
// Note: to be able to import the QQmlJSScopeTests
|
||||
// correctly, we need an additional import path. Use
|
||||
// this application's binary directory as done by
|
||||
// QQmlImportDatabase
|
||||
QCoreApplication::applicationDirPath(),
|
||||
},
|
||||
nullptr)
|
||||
{
|
||||
|
@ -159,6 +164,10 @@ void tst_qqmljsscope::initTestCase()
|
|||
QFile f(fi.absoluteFilePath());
|
||||
QVERIFY(f.open(QIODevice::ReadOnly));
|
||||
}
|
||||
|
||||
// test that we can import the module shipped with this test: if we have no
|
||||
// errors / warnings, it is a success
|
||||
QVERIFY(run(u"importOwnModule.qml"_s));
|
||||
}
|
||||
|
||||
void tst_qqmljsscope::orderedBindings()
|
||||
|
|
Loading…
Reference in New Issue