diff options
Diffstat (limited to 'tests/auto/qmake')
12 files changed, 72 insertions, 11 deletions
diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index 9d87c06..26b4cb8 100644 --- a/tests/auto/qmake/testcompiler.cpp +++ b/tests/auto/qmake/testcompiler.cpp @@ -261,3 +261,17 @@ bool TestCompiler::removeMakefile( const QString &workPath ) else return true; } + +QString TestCompiler::commandOutput() const +{ +#ifndef Q_OS_WIN + return testOutput_.join("\n"); +#else + return testOutput_.join("\r\n"); +#endif +} + +void TestCompiler::clearCommandOutput() +{ + testOutput_.clear(); +} diff --git a/tests/auto/qmake/testcompiler.h b/tests/auto/qmake/testcompiler.h index 0f98b20..b51dd1f 100644 --- a/tests/auto/qmake/testcompiler.h +++ b/tests/auto/qmake/testcompiler.h @@ -70,6 +70,10 @@ public: bool exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ); // removes the makefile bool removeMakefile( const QString &workPath ); + // returns each line of stdout of the last command append with a "new line" character(s) to suit the platform + QString commandOutput() const; + // clear the results of storage of stdout for running previous commands + void clearCommandOutput(); private: bool runCommand( QString cmdLine ); diff --git a/tests/auto/qmake/testdata/bundle-spaces/some-file b/tests/auto/qmake/testdata/bundle-spaces/some-file index e69de29..9975dba 100644 --- a/tests/auto/qmake/testdata/bundle-spaces/some-file +++ b/tests/auto/qmake/testdata/bundle-spaces/some-file @@ -0,0 +1,6 @@ +all: + C:\git\qt-kinetic-animations\bin\qmake qdir.pro -o Makefile -spec win32-msvc2008 + nmake -f Makefile +first: all +qmake: + C:\git\qt-kinetic-animations\bin\qmake qdir.pro -o Makefile -spec win32-msvc2008 diff --git a/tests/auto/qmake/testdata/findDeps/findDeps.pro b/tests/auto/qmake/testdata/findDeps/findDeps.pro index e0a2b86..43577b5 100644 --- a/tests/auto/qmake/testdata/findDeps/findDeps.pro +++ b/tests/auto/qmake/testdata/findDeps/findDeps.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Thu Mar 12 11:08:20 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findDeps DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h \ diff --git a/tests/auto/qmake/testdata/findMocs/findMocs.pro b/tests/auto/qmake/testdata/findMocs/findMocs.pro index daa3c7f..1469b4c 100644 --- a/tests/auto/qmake/testdata/findMocs/findMocs.pro +++ b/tests/auto/qmake/testdata/findMocs/findMocs.pro @@ -1,11 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Wed Mar 11 16:11:09 2009 -###################################################################### - TEMPLATE = app -TARGET = +TARGET = findMocs DEPENDPATH += . INCLUDEPATH += . +DESTDIR = ./ # Input HEADERS += object1.h object2.h object3.h object4.h object5.h object6.h object7.h diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro index 9ed92f96..5e089e4 100644 --- a/tests/auto/qmake/testdata/functions/functions.pro +++ b/tests/auto/qmake/testdata/functions/functions.pro @@ -46,7 +46,7 @@ isEmpty( CONFIG ) { } #include -include( infiletest.pro ) +include( infiletest.pro, "", true ) !contains( DEFINES, QT_DLL ) { message( "FAILED: include function: $$DEFINES" ) } diff --git a/tests/auto/qmake/testdata/include_function/existing_file.pri b/tests/auto/qmake/testdata/include_function/existing_file.pri new file mode 100644 index 0000000..8b9aaca --- /dev/null +++ b/tests/auto/qmake/testdata/include_function/existing_file.pri @@ -0,0 +1,3 @@ +QT = +CONFIG = console +SOURCES = main.cpp diff --git a/tests/auto/qmake/testdata/include_function/include_existing_file.pro b/tests/auto/qmake/testdata/include_function/include_existing_file.pro new file mode 100644 index 0000000..424062a --- /dev/null +++ b/tests/auto/qmake/testdata/include_function/include_existing_file.pro @@ -0,0 +1,7 @@ +# Test to see if include(), by default, succeeds when the specific file +# to include exists +include(existing_file.pri) + +# Test to see if by specifying full set of parameters to include() +# succeeds when the specified filed to include exists +include(existing_file.pri, "", false) diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file.pro b/tests/auto/qmake/testdata/include_function/include_missing_file.pro new file mode 100644 index 0000000..0b59981 --- /dev/null +++ b/tests/auto/qmake/testdata/include_function/include_missing_file.pro @@ -0,0 +1,3 @@ +# Test to see if include(), by default, fails when the specific file +# to include does not exist +include(missing_file.pri) diff --git a/tests/auto/qmake/testdata/include_function/include_missing_file2.pro b/tests/auto/qmake/testdata/include_function/include_missing_file2.pro new file mode 100644 index 0000000..542b9ff --- /dev/null +++ b/tests/auto/qmake/testdata/include_function/include_missing_file2.pro @@ -0,0 +1,3 @@ +# Specifying full set of parameters to include() to test that a warning +# is shown for this non-existing file. +include(missing_file.pri, "", false) diff --git a/tests/auto/qmake/testdata/include_function/main.cpp b/tests/auto/qmake/testdata/include_function/main.cpp new file mode 100644 index 0000000..0a8e3d3 --- /dev/null +++ b/tests/auto/qmake/testdata/include_function/main.cpp @@ -0,0 +1,4 @@ +int main(int /*argc*/, char ** /*argv*/) +{ + return 0; +} diff --git a/tests/auto/qmake/tst_qmake.cpp b/tests/auto/qmake/tst_qmake.cpp index ce03555..b457164 100644 --- a/tests/auto/qmake/tst_qmake.cpp +++ b/tests/auto/qmake/tst_qmake.cpp @@ -88,6 +88,7 @@ private slots: // Test requires make void bundle_spaces(); #endif + void includefunction(); private: TestCompiler test_compiler; @@ -125,10 +126,12 @@ void tst_qmake::cleanupTestCase() void tst_qmake::init() { + test_compiler.clearCommandOutput(); } void tst_qmake::cleanup() { + test_compiler.clearCommandOutput(); } void tst_qmake::simple_app() @@ -438,6 +441,26 @@ void tst_qmake::bundle_spaces() } #endif // Q_OS_WIN +void tst_qmake::includefunction() +{ + QString workDir = base_path + "/testdata/include_function"; + QString warningMsg("Unable to find file for inclusion"); + QVERIFY(test_compiler.qmake( workDir, "include_existing_file")); + QVERIFY(!test_compiler.commandOutput().contains(warningMsg)); + + // test include() usage on a missing file + test_compiler.clearCommandOutput(); + workDir = base_path + "/testdata/include_function"; + QVERIFY(test_compiler.qmake( workDir, "include_missing_file" )); + QVERIFY(test_compiler.commandOutput().contains(warningMsg)); + + // test include() usage on a missing file when all function parameters are used + test_compiler.clearCommandOutput(); + workDir = base_path + "/testdata/include_function"; + QVERIFY(test_compiler.qmake( workDir, "include_missing_file2" )); + QVERIFY(test_compiler.commandOutput().contains(warningMsg)); +} + QTEST_MAIN(tst_qmake) #include "tst_qmake.moc" |