diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2018-08-01 10:55:23 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2018-08-01 13:08:26 +0000 |
commit | 7780e9b6e4cbaf33c1f5ccae279bbc1ec63ef755 (patch) | |
tree | 2c390ba8460f12b3cdae3d00897b6a4423449d7a /tests/auto/blackbox/tst_blackboxqt.cpp | |
parent | b9db9d860edee00280c46c5db51954c9db28a4ee (diff) |
Qt.core: Make moc rule catch changes to moc_*.cpp inclusions
The problem was that the moc_xxx.cpp artifact gets created from the
xxx.h input, but its file tags depend on whether it gets included by
some cpp file or not. Because changes to such cpp files do not affect
the xxx.h file in any way, the rule was not re-applied in the case such
includes got added or removed.
We fix this by making cpp files an auxiliary input to the moc rule, so
it gets re-applied on changes to those files.
Change-Id: I29b04fac3870f5a370cb7d894bc6ea56a63f6b0e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/tst_blackboxqt.cpp')
-rw-r--r-- | tests/auto/blackbox/tst_blackboxqt.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/blackbox/tst_blackboxqt.cpp b/tests/auto/blackbox/tst_blackboxqt.cpp index 07c583bf1..b6b01d552 100644 --- a/tests/auto/blackbox/tst_blackboxqt.cpp +++ b/tests/auto/blackbox/tst_blackboxqt.cpp @@ -145,6 +145,20 @@ void TestBlackboxQt::dbusInterfaces() QCOMPARE(runQbs(), 0); } +void TestBlackboxQt::includedMocCpp() +{ + QDir::setCurrent(testDataDir + "/included-moc-cpp"); + QCOMPARE(runQbs(), 0); + QVERIFY2(!m_qbsStdout.contains("compiling moc_myobject.cpp"), m_qbsStdout.constData()); + WAIT_FOR_NEW_TIMESTAMP(); + REPLACE_IN_FILE("myobject.cpp", "#include <moc_myobject.cpp", "// #include <moc_myobject.cpp"); + QCOMPARE(runQbs(), 0); + QVERIFY2(m_qbsStdout.contains("compiling moc_myobject.cpp"), m_qbsStdout.constData()); + REPLACE_IN_FILE("myobject.cpp", "// #include <moc_myobject.cpp", "#include <moc_myobject.cpp"); + QCOMPARE(runQbs(), 0); + QVERIFY2(!m_qbsStdout.contains("compiling moc_myobject.cpp"), m_qbsStdout.constData()); +} + void TestBlackboxQt::lrelease() { QDir::setCurrent(testDataDir + QLatin1String("/lrelease")); |