Changeset View
Changeset View
Standalone View
Standalone View
tests/auto/qmljsc/testmodules.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 56 | { | |||
---|---|---|---|---|---|
58 | compiler->addIncludePath(":/test/"); | 58 | compiler->addIncludePath(":/test/"); | ||
59 | 59 | | |||
60 | ModuleLoading::registerModuleLoader(&JavaScriptModuleLoader::create); | 60 | ModuleLoading::registerModuleLoader(&JavaScriptModuleLoader::create); | ||
61 | ModuleLoading::registerModuleLoader(&QtQmlModuleLoader::create); | 61 | ModuleLoading::registerModuleLoader(&QtQmlModuleLoader::create); | ||
62 | } | 62 | } | ||
63 | 63 | | |||
64 | void TestModules::loadMinimalModule() | 64 | void TestModules::loadMinimalModule() | ||
65 | { | 65 | { | ||
66 | const ImportDescription testImportDescription = {ImportDescription::Kind_ModuleImport, "MinimalModule", 0, 1}; | 66 | IR::Module *module = ModuleLoading::loadModule("MinimalModule", 0, 1); | ||
67 | | ||||
68 | IR::Module *module = ModuleLoading::loadModule(testImportDescription); | | |||
69 | module->waitForLoaded(); | 67 | module->waitForLoaded(); | ||
70 | 68 | | |||
71 | Type *a = module->type("A"); | 69 | Type *a = module->type("A"); | ||
72 | Type *b = module->type("B"); | 70 | Type *b = module->type("B"); | ||
73 | Type *c = module->type("C"); | 71 | Type *c = module->type("C"); | ||
74 | Type *d = module->type("D"); | 72 | Type *d = module->type("D"); | ||
75 | Type *e = module->type("E"); | 73 | Type *e = module->type("E"); | ||
76 | 74 | | |||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | |||||
129 | QCOMPARE(anotherSignal->parameters[0].name, QStringLiteral("arg1")); | 127 | QCOMPARE(anotherSignal->parameters[0].name, QStringLiteral("arg1")); | ||
130 | QCOMPARE(anotherSignal->parameters[0].type, a); | 128 | QCOMPARE(anotherSignal->parameters[0].type, a); | ||
131 | QCOMPARE(anotherSignal->parameters[1].name, QStringLiteral("arg2")); | 129 | QCOMPARE(anotherSignal->parameters[1].name, QStringLiteral("arg2")); | ||
132 | QCOMPARE(anotherSignal->parameters[1].type, a); | 130 | QCOMPARE(anotherSignal->parameters[1].type, a); | ||
133 | } | 131 | } | ||
134 | 132 | | |||
135 | void TestModules::loadQtQml() | 133 | void TestModules::loadQtQml() | ||
136 | { | 134 | { | ||
137 | const ImportDescription qtqmlImportDescription = {ImportDescription::Kind_ModuleImport, "QtQml", 1, 0}; | 135 | IR::Module *qtqmlModule = ModuleLoading::loadModule("QtQml", 1, 0); | ||
138 | IR::Module *qtqmlModule = ModuleLoading::loadModule(qtqmlImportDescription); | | |||
139 | qtqmlModule->waitForLoaded(); | 136 | qtqmlModule->waitForLoaded(); | ||
140 | 137 | | |||
141 | IR::Property *p = 0; | 138 | IR::Property *p = 0; | ||
142 | IR::Method *m = 0; | 139 | IR::Method *m = 0; | ||
143 | IR::Signal *s = 0; | 140 | IR::Signal *s = 0; | ||
144 | 141 | | |||
145 | Type *componentClass = qtqmlModule->type("Component"); | 142 | Type *componentClass = qtqmlModule->type("Component"); | ||
146 | QVERIFY(componentClass); | 143 | QVERIFY(componentClass); | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | |||||
214 | QVERIFY(timerClass->method("start")); | 211 | QVERIFY(timerClass->method("start")); | ||
215 | QVERIFY(timerClass->method("stop")); | 212 | QVERIFY(timerClass->method("stop")); | ||
216 | QVERIFY(s = timerClass->signal("triggered")); | 213 | QVERIFY(s = timerClass->signal("triggered")); | ||
217 | QCOMPARE(s->parameters.count(), 0); | 214 | QCOMPARE(s->parameters.count(), 0); | ||
218 | } | 215 | } | ||
219 | 216 | | |||
220 | void TestModules::loadModule() | 217 | void TestModules::loadModule() | ||
221 | { | 218 | { | ||
222 | const ImportDescription qtqmlImportDescription = {ImportDescription::Kind_ModuleImport, "QtQml", 1, 0}; | 219 | IR::Module *module = ModuleLoading::loadModule("TestModule", 0, 1); | ||
223 | const ImportDescription testImportDescription = {ImportDescription::Kind_ModuleImport, "TestModule", 0, 1}; | 220 | IR::Module *qtqmlModule = ModuleLoading::loadModule("QtQml", 1, 0); | ||
224 | | ||||
225 | IR::Module *module = ModuleLoading::loadModule(testImportDescription); | | |||
226 | IR::Module *qtqmlModule = ModuleLoading::loadModule(qtqmlImportDescription); | | |||
227 | module->waitForLoaded(); | 221 | module->waitForLoaded(); | ||
228 | qtqmlModule->waitForLoaded(); | 222 | qtqmlModule->waitForLoaded(); | ||
229 | 223 | | |||
230 | Type *pastry = module->type("Pastry"); | 224 | Type *pastry = module->type("Pastry"); | ||
231 | Type *cake = module->type("Cake"); | 225 | Type *cake = module->type("Cake"); | ||
232 | Type *pizza = module->type("Pizza"); | 226 | Type *pizza = module->type("Pizza"); | ||
233 | Type *printer = module->type("Printer"); | 227 | Type *printer = module->type("Printer"); | ||
234 | 228 | | |||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |