Fix tst_qv4debugger on Android
tst_qv4debugger::conditionalBreakPointInQml() failed on Android because dependencies were not available. This patch moves qml code from strings to file, thus exposing it to the build system. This way, the build system can take care of the dependencies. Pick-to: 6.2 6.3 Fixes: QTBUG-102416 Task-number: QTBUG-101865 Change-Id: Icd6ef43a45642f68e749137a963ee2ebfe462bce Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
parent
82c723fef9
commit
b7fd8ab10b
|
@ -4,6 +4,12 @@
|
|||
## tst_qv4debugger Test:
|
||||
#####################################################################
|
||||
|
||||
# Collect test data
|
||||
file(GLOB_RECURSE test_data_glob
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
data/*)
|
||||
list(APPEND test_data ${test_data_glob})
|
||||
|
||||
qt_internal_add_test(tst_qv4debugger
|
||||
SOURCES
|
||||
../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp ../../../../../src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.h
|
||||
|
@ -18,7 +24,19 @@ qt_internal_add_test(tst_qv4debugger
|
|||
Qt::GuiPrivate
|
||||
Qt::Network
|
||||
Qt::QmlPrivate
|
||||
Qt::QuickTestUtilsPrivate
|
||||
TESTDATA ${test_data}
|
||||
)
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_extend_target(tst_qv4debugger CONDITION ANDROID OR IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR=\\\":/data\\\"
|
||||
)
|
||||
|
||||
qt_internal_extend_target(tst_qv4debugger CONDITION NOT ANDROID AND NOT IOS
|
||||
DEFINES
|
||||
QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
|
||||
)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
import QtQml 2.0
|
||||
QtObject {
|
||||
id: root
|
||||
property int foo: 42
|
||||
property bool success: false
|
||||
Component.onCompleted: {
|
||||
success = true; // break here
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QtQuickTestUtils/private/qmlutils_p.h>
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#include "qv4datacollector.h"
|
||||
|
@ -289,10 +290,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class tst_qv4debugger : public QObject
|
||||
class tst_qv4debugger : public QQmlDataTest
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_qv4debugger();
|
||||
|
||||
private slots:
|
||||
void init();
|
||||
void cleanup();
|
||||
|
@ -507,24 +511,17 @@ void tst_qv4debugger::conditionalBreakPointInQml()
|
|||
debuggerAgent->addDebugger(v4Debugger);
|
||||
debuggerAgent->moveToThread(debugThread.data());
|
||||
|
||||
QQmlComponent component(&engine);
|
||||
component.setData("import QtQml 2.0\n"
|
||||
"QtObject {\n"
|
||||
" id: root\n"
|
||||
" property int foo: 42\n"
|
||||
" property bool success: false\n"
|
||||
" Component.onCompleted: {\n"
|
||||
" success = true;\n" // breakpoint here
|
||||
" }\n"
|
||||
"}\n", QUrl("test.qml"));
|
||||
const QString qmlFileName("conditionalBreakPointInQml.qml");
|
||||
const QString qmlFilePath(testFile(qmlFileName));
|
||||
QQmlComponent component(&engine, qmlFilePath);
|
||||
|
||||
v4Debugger->addBreakPoint("test.qml", 7, "root.foo == 42");
|
||||
v4Debugger->addBreakPoint(qmlFileName, 7, "root.foo == 42");
|
||||
|
||||
QScopedPointer<QObject> obj(component.create());
|
||||
QCOMPARE(obj->property("success").toBool(), true);
|
||||
|
||||
QCOMPARE(debuggerAgent->m_statesWhenPaused.count(), 1);
|
||||
QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).fileName, QStringLiteral("test.qml"));
|
||||
QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).fileName, qmlFileName);
|
||||
QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).lineNumber, 7);
|
||||
|
||||
debugThread->quit();
|
||||
|
@ -944,6 +941,8 @@ void tst_qv4debugger::signalParameters()
|
|||
QCOMPARE(obj->property("resultCallbackExternal").toString(), QLatin1String("unset"));
|
||||
}
|
||||
|
||||
tst_qv4debugger::tst_qv4debugger() : QQmlDataTest(QT_QMLTEST_DATADIR) { }
|
||||
|
||||
QTEST_MAIN(tst_qv4debugger)
|
||||
|
||||
#include "tst_qv4debugger.moc"
|
||||
|
|
Loading…
Reference in New Issue