Skip to content

BUG: 5 tests hang indefinitely on modal dialogs (ModalDialogHang) #1394

@hjmjohnson

Description

@hjmjohnson

Summary

5 tests hang indefinitely because modal dialogs block the QtTesting event playback loop, preventing QApplication::exit() from being reached. They have been temporarily disabled via DISABLED TRUE with the label ModalDialogHang in commit 14241b2.

Affected tests

Test Module Root cause
ctkFontButtonTest CTKWidgets Modal QFontDialog blocks event loop
ctkColorPickerButtonEventTranslatorPlayerTest1 CTKWidgets Modal QColorDialog blocks event loop
ctkDirectoryButtonEventTranslatorPlayerTest1 CTKWidgets Modal file dialog blocks event loop
ctkFileDialogEventTranslatorPlayerTest1 CTKWidgets Modal ctkFileDialog blocks event loop
ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1 CTKVisualizationVTKWidgets Modal dialog blocks event loop

How to reproduce

# These tests will hang until killed (confirmed at 300s timeout)
ctest --test-dir CTK-build -R "ctkFontButtonTest|ctkColorPickerButtonEventTranslatorPlayerTest1|ctkDirectoryButtonEventTranslatorPlayerTest1|ctkFileDialogEventTranslatorPlayerTest1|ctkVTKTextPropertyWidgetEventTranslatorPlayerTest1" --timeout 300

How to force-run disabled tests

# Run only the ModalDialogHang tests (they are DISABLED, so use --force-new-ctest-process)
ctest --test-dir CTK-build -L ModalDialogHang --timeout 300

# Or override DISABLED for all tests
cmake -DCTEST_USE_LAUNCHERS=OFF CTK-build
ctest --test-dir CTK-build -R "ctkFontButtonTest|ctkColorPickerButton" --timeout 300

Note: CTest skips DISABLED tests even when matched by -R or -L. To actually execute them, temporarily remove the DISABLED TRUE property from the relevant CMakeLists.txt.

Suggested fix

The underlying issue is that ctkEventTranslatorPlayerWidget::play() calls QApplication::exit() after all test cases complete, but modal dialogs (exec()) block the playback loop so exit() is never reached. A fix would need to:

  1. Dismiss modal dialogs via QTimer::singleShot before they block (similar to the pattern in CLAUDE.md for Qt5+Qt6 safe modal dialog testing)
  2. Or restructure the event playback to handle modal dialogs asynchronously

Files

  • Libs/Widgets/Testing/Cpp/CMakeLists.txt
  • Libs/Visualization/VTK/Widgets/Testing/Cpp/CMakeLists.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions