[Ktutorial-commits] SF.net SVN: ktutorial:[340] trunk/ktutorial/ktutorial-library/tests/view/ StepW
Status: Alpha
                
                Brought to you by:
                
                    danxuliu
                    
                
            | 
      
      
      From: <dan...@us...> - 2011-10-13 14:29:51
      
     | 
| Revision: 340
          http://ktutorial.svn.sourceforge.net/ktutorial/?rev=340&view=rev
Author:   danxuliu
Date:     2011-10-13 14:29:41 +0000 (Thu, 13 Oct 2011)
Log Message:
-----------
Explicitly process deleteLater() instead of waiting a fixed time.
Modified Paths:
--------------
    trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp
Modified: trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp
===================================================================
--- trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp	2011-10-13 12:48:24 UTC (rev 339)
+++ trunk/ktutorial/ktutorial-library/tests/view/StepWidgetTest.cpp	2011-10-13 14:29:41 UTC (rev 340)
@@ -298,9 +298,10 @@
 
     QTest::mouseClick(closeButton(stepWidget), Qt::LeftButton,
                       Qt::NoModifier, QPoint());
-    //Give it time to die
-    QTest::qWait(500);
 
+    //Process deleteLater()
+    QCoreApplication::sendPostedEvents(stepWidget, QEvent::DeferredDelete);
+
     QCOMPARE(destroyedSpy.count(), 1);
 }
 
@@ -313,7 +314,8 @@
     QSignalSpy destroyedSpy(stepWidget, SIGNAL(destroyed(QObject*)));
 
     QTest::keyClick(stepWidget, Qt::Key_Escape);
-    //Give it time to die
+
+    //Give Close button time to complete the press animation
     QTest::qWait(500);
 
     QCOMPARE(destroyedSpy.count(), 1);
@@ -343,9 +345,10 @@
 
     QTest::mouseClick(closeButton(stepWidget), Qt::LeftButton,
                       Qt::NoModifier, QPoint(), 500);
-    //Give it time to die
-    QTest::qWait(500);
 
+    //Process deleteLater()
+    QCoreApplication::sendPostedEvents(stepWidget, QEvent::DeferredDelete);
+
     QCOMPARE(destroyedSpy.count(), 1);
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |