diff options
Diffstat (limited to 'Tests')
4 files changed, 33 insertions, 2 deletions
diff --git a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt index a9ccece..a3ba9fb 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt +++ b/Tests/QtAutogen/RerunUicOnFileChange/CMakeLists.txt @@ -26,6 +26,7 @@ macro(rebuild buildName) endmacro() configure_file("${testProjectTemplateDir}/mocwidget.h" "${testProjectSrc}/mocwidget.h" COPYONLY) +configure_file("${testProjectTemplateDir}/mainwindow.h" "${testProjectSrc}/mainwindow.h" COPYONLY) configure_file("${testProjectTemplateDir}/main.cpp" "${testProjectSrc}/main.cpp" COPYONLY) configure_file("${testProjectTemplateDir}/subdir/subdircheck.cpp" "${testProjectSrc}/subdir/subdircheck.cpp" COPYONLY) configure_file("${testProjectTemplateDir}/CMakeLists.txt.in" "${testProjectSrc}/CMakeLists.txt" @ONLY) @@ -103,3 +104,15 @@ execute_process(COMMAND "${testProjectBinDir}/${extra_bin_path}UicOnFileChange" if(NOT result EQUAL "0") message(FATAL_ERROR "Rebuild of UicOnFileChange test result is: ${result}") endif() + +# Check if the generated ui_mainwindow.h rules introduce circular dependency between the generated +# ui_mainwinow.h and timestamp. +# +# The first rebuild updates a timestamp dependency file after "touching" mainwindow.h. +sleep() +execute_process(COMMAND ${CMAKE_COMMAND} -E touch "${testProjectSrc}/mainwindow.h") +rebuild(3) + +# The second rebuild detects if cycling dependency is introduced by deps file. +sleep() +rebuild(4) diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in index 2a1998d..c77075c 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/CMakeLists.txt.in @@ -5,9 +5,13 @@ include("@CMAKE_CURRENT_LIST_DIR@/../AutogenGuiTest.cmake") # Enable CMAKE_AUTOUIC for all targets set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) -add_executable(UicOnFileChange main.cpp mainwindow.ui +add_executable(UicOnFileChange main.cpp mainwindow.ui mainwindow.h subdir/subdircheck.cpp subdir/mainwindowsubdir.ui ) -target_include_directories(UicOnFileChange PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(UicOnFileChange PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/UicOnFileChange_autogen/include" +) target_link_libraries(UicOnFileChange ${QT_QTCORE_TARGET} ${QT_LIBRARIES}) diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp index 3981268..99de13d 100644 --- a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/main.cpp @@ -1,3 +1,4 @@ +#include "mainwindow.h" #include "ui_mainwindow.h" extern bool subdircheck(); diff --git a/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h new file mode 100644 index 0000000..24621ff --- /dev/null +++ b/Tests/QtAutogen/RerunUicOnFileChange/UicOnFileChange/mainwindow.h @@ -0,0 +1,13 @@ +#include <QObject> + +#include "ui_mainwindow.h" + +class MainWindow : public QObject +{ + Q_OBJECT +public: + MainWindow() { mwUi.setupUi(&mw); } + + MocWidget mw; + Ui::Widget mwUi; +}; |