Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-632

Add QTRY_COMPARE(a, b, timeout=2000) && QTRY_VERIFY(a, timeout=2000)

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Done
    • Icon: P2: Important P2: Important
    • 5.0.0
    • None
    • Testing: qtestlib
    • None

      Sometimes one wants to test for things whose success is delayed, or has a transient success evaluation. For instance, reports from the file system about files created or focus handling.

      One way would be to have a macro like QTRY_VERIFY(expr, timeout) that loops over expr constantly attempting to evaluate it to true, until the timeout happens.

      An alternative is QDELAYED_VERIFY(expr, timeout) that waits until timeout, and then runs expr. The advantage is that expr doesn't have to be sideeffect free, but it on the other hand means it will allways take timeout amount of time to run, and that transient tests are more likely to fail.

      See the top of tst_qtableview.cpp for an example macro.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            jasmcdon Jason McDonald (Closed Nokia Identity. Please assign to "macadder" instead) (Inactive)
            fenglich Frans Englich (closed Nokia identity)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes