89
static void cleanState(QQmlEngine **e)
92
qmlClearTypeRegistrations();
94
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
95
QCoreApplication::processEvents();
98
void tst_qqmlenginecleanup::test_valueTypeProviderModule()
100
// this test ensures that a module which installs a value type
101
// provider can be reinitialized after multiple calls to
102
// qmlClearTypeRegistrations() without causing cycles in the
103
// value type provider list.
105
QUrl testFile1 = testFileUrl("testFile1.qml");
106
QUrl testFile2 = testFileUrl("testFile2.qml");
107
bool noCycles = false;
108
for (int i = 0; i < 20; ++i) {
110
QQmlComponent c(e, this);
111
c.loadUrl(i % 2 == 0 ? testFile1 : testFile2); // this will hang if cycles exist.
118
// this test ensures that no crashes occur due to using
119
// a dangling QQmlType pointer in the type compiler
120
// which results from qmlClearTypeRegistrations()
121
QUrl testFile3 = testFileUrl("testFile3.qml");
122
bool noDangling = false;
123
for (int i = 0; i < 20; ++i) {
125
QQmlComponent c(e, this);
126
c.loadUrl(i % 2 == 0 ? testFile1 : testFile3); // this will crash if dangling ptr exists.
88
133
QTEST_MAIN(tst_qqmlenginecleanup)
90
135
#include "tst_qqmlenginecleanup.moc"