tests/auto/qmake/tst_qmake.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
    88 #ifndef Q_OS_WIN
    88 #ifndef Q_OS_WIN
    89     // Test requires make
    89     // Test requires make
    90     void bundle_spaces();
    90     void bundle_spaces();
    91 #endif
    91 #endif
    92     void includefunction();
    92     void includefunction();
       
    93     void substitutes();
    93 
    94 
    94 private:
    95 private:
    95     TestCompiler test_compiler;
    96     TestCompiler test_compiler;
    96     QString base_path;
    97     QString base_path;
    97 };
    98 };
    98 
    99 
    99 tst_qmake::tst_qmake()
   100 tst_qmake::tst_qmake()
   100 {
   101 {
   101     QString cmd = QString("qmake \"QT_VERSION=%1\"").arg(QT_VERSION);
   102     QString binpath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
       
   103     QString cmd = QString("%2/qmake \"QT_VERSION=%1\"").arg(QT_VERSION).arg(binpath);
   102 #ifdef Q_CC_MSVC
   104 #ifdef Q_CC_MSVC
   103     test_compiler.setBaseCommands( "nmake", cmd );
   105     test_compiler.setBaseCommands( "nmake", cmd );
   104 #elif defined(Q_CC_MINGW)
   106 #elif defined(Q_CC_MINGW)
   105     test_compiler.setBaseCommands( "mingw32-make", cmd );
   107     test_compiler.setBaseCommands( "mingw32-make", cmd );
   106 #elif defined(Q_OS_WIN) && defined(Q_CC_GNU)
   108 #elif defined(Q_OS_WIN) && defined(Q_CC_GNU)
   475     workDir = base_path + "/testdata/include_function";
   477     workDir = base_path + "/testdata/include_function";
   476     QVERIFY(test_compiler.qmake( workDir, "include_missing_file2" ));
   478     QVERIFY(test_compiler.qmake( workDir, "include_missing_file2" ));
   477     QVERIFY(test_compiler.commandOutput().contains(warningMsg));
   479     QVERIFY(test_compiler.commandOutput().contains(warningMsg));
   478 }
   480 }
   479 
   481 
       
   482 void tst_qmake::substitutes()
       
   483 {
       
   484     QString workDir = base_path + "/testdata/substitutes";
       
   485     QVERIFY( test_compiler.qmake( workDir, "test" ));
       
   486     QVERIFY( test_compiler.exists( workDir, "test", Plain, "" ));
       
   487     QVERIFY( test_compiler.exists( workDir, "sub/test2", Plain, "" ));
       
   488     QVERIFY( test_compiler.exists( workDir, "sub/indirect_test.txt", Plain, "" ));
       
   489     QVERIFY( test_compiler.makeDistClean( workDir ));
       
   490 
       
   491     QString buildDir = base_path + "/testdata/substitutes_build";
       
   492     QVERIFY( test_compiler.qmake( workDir, "test", buildDir ));
       
   493     QVERIFY( test_compiler.exists( buildDir, "test", Plain, "" ));
       
   494     QVERIFY( test_compiler.exists( buildDir, "sub/test2", Plain, "" ));
       
   495     QVERIFY( test_compiler.exists( buildDir, "sub/indirect_test.txt", Plain, "" ));
       
   496     QVERIFY( test_compiler.makeDistClean( buildDir ));
       
   497 }
       
   498 
   480 QTEST_MAIN(tst_qmake)
   499 QTEST_MAIN(tst_qmake)
   481 #include "tst_qmake.moc"
   500 #include "tst_qmake.moc"
   482 
   501 
   483 #else // QMAKE_CROSS_COMPILED
   502 #else // QMAKE_CROSS_COMPILED
   484 QTEST_NOOP_MAIN
   503 QTEST_NOOP_MAIN