| 359 | } |
| 360 | |
| 361 | void TestQMakeFile::qtIncludeDirs() |
| 362 | { |
| 363 | QFETCH(QString, fileContents); |
| 364 | QFETCH(QStringList, modules); |
| 365 | |
| 366 | QMap<QString, QString> moduleMap; |
| 367 | moduleMap[QStringLiteral("core")] = QStringLiteral("QtCore"); |
| 368 | moduleMap[QStringLiteral("gui")] = QStringLiteral("QtGui"); |
| 369 | moduleMap[QStringLiteral("network")] = QStringLiteral("QtNetwork"); |
| 370 | moduleMap[QStringLiteral("opengl")] = QStringLiteral("QtOpenGL"); |
| 371 | moduleMap[QStringLiteral("phonon")] = QStringLiteral("Phonon"); |
| 372 | moduleMap[QStringLiteral("script")] = QStringLiteral("QtScript"); |
| 373 | moduleMap[QStringLiteral("scripttools")] = QStringLiteral("QtScriptTools"); |
| 374 | moduleMap[QStringLiteral("sql")] = QStringLiteral("QtSql"); |
| 375 | moduleMap[QStringLiteral("svg")] = QStringLiteral("QtSvg"); |
| 376 | moduleMap[QStringLiteral("webkit")] = QStringLiteral("QtWebKit"); |
| 377 | moduleMap[QStringLiteral("xml")] = QStringLiteral("QtXml"); |
| 378 | moduleMap[QStringLiteral("xmlpatterns")] = QStringLiteral("QtXmlPatterns"); |
| 379 | moduleMap[QStringLiteral("qt3support")] = QStringLiteral("Qt3Support"); |
| 380 | moduleMap[QStringLiteral("designer")] = QStringLiteral("QtDesigner"); |
| 381 | moduleMap[QStringLiteral("uitools")] = QStringLiteral("QtUiTools"); |
| 382 | moduleMap[QStringLiteral("help")] = QStringLiteral("QtHelp"); |
| 383 | moduleMap[QStringLiteral("assistant")] = QStringLiteral("QtAssistant"); |
| 384 | moduleMap[QStringLiteral("qtestlib")] = QStringLiteral("QtTest"); |
| 385 | moduleMap[QStringLiteral("testlib")] = QStringLiteral("QtTest"); |
| 386 | moduleMap[QStringLiteral("qaxcontainer")] = QStringLiteral("ActiveQt"); |
| 387 | moduleMap[QStringLiteral("qaxserver")] = QStringLiteral("ActiveQt"); |
| 388 | moduleMap[QStringLiteral("dbus")] = QStringLiteral("QtDBus"); |
| 389 | moduleMap[QStringLiteral("declarative")] = QStringLiteral("QtDeclarative"); |
| 390 | |
| 391 | QTemporaryFile tmpFile; |
| 392 | tmpFile.open(); |
| 393 | tmpFile.write(fileContents.toUtf8()); |
| 394 | tmpFile.close(); |
| 395 | |
| 396 | QMakeProjectFile file(tmpFile.fileName()); |
| 397 | |
| 398 | const auto qmvars = setDefaultMKSpec(file); |
| 399 | if (qmvars.isEmpty()) { |
| 400 | QSKIP("Problem querying QMake, skipping test function"); |
| 401 | } |
| 402 | |
| 403 | QVERIFY(file.read()); |
| 404 | |
| 405 | const QStringList includes = file.includeDirectories(); |
| 406 | |
| 407 | // should always be there |
| 408 | QVERIFY(includes.contains(qmvars["QT_INSTALL_HEADERS"])); |
| 409 | |
| 410 | for (QMap<QString, QString>::const_iterator it = moduleMap.constBegin(); it != moduleMap.constEnd(); ++it) { |
| 411 | QFileInfo include(qmvars[QStringLiteral("QT_INSTALL_HEADERS")] + "/" + it.value()); |
| 412 | |
| 413 | bool shouldBeIncluded = include.exists(); |
| 414 | if (shouldBeIncluded) { |
| 415 | shouldBeIncluded = modules.contains(it.key()); |
| 416 | if (!shouldBeIncluded) { |
| 417 | for (const auto& module : std::as_const(modules)) { |
| 418 | if (module != it.key() && moduleMap.value(module) == it.value()) { |
nothing calls this directly
no test coverage detected