Просмотр исходного кода

Fix color dialog test that never quits

Remove timer to avoid race condition so that test quits after
dialog is shown.

Fixes #385
Steve Pieper лет назад: 11
Родитель
Сommit
beb61fc08e
1 измененных файлов с 4 добавлено и 6 удалено
  1. 4 6
      Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp

+ 4 - 6
Libs/Widgets/Testing/Cpp/ctkColorDialogTest1.cpp

@@ -25,6 +25,7 @@
 // CTK includes
 #include "ctkColorDialog.h"
 #include "ctkColorPickerButton.h"
+#include "ctkTest.h"
 
 // STD includes
 #include <cstdlib>
@@ -89,12 +90,9 @@ int ctkColorDialogTest1(int argc, char * argv [] )
   // the following is only in interactive mode
   if (argc < 2 || QString(argv[1]) != "-I" )
     {
-    QTimer::singleShot(200, &colorDialog, SLOT(accept()));
-    }
-  // the following is only in interactive mode
-  if (argc < 2 || QString(argv[1]) != "-I" )
-    {
-    QTimer::singleShot(400, &app, SLOT(quit()));
+    QTest::qWaitForWindowShown(&colorDialog);
+    colorDialog.accept();
+    return EXIT_SUCCESS;
     }
 
   return app.exec();