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

QSignalSpy: wait for specific signal

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • None
    • Testing: qtestlib
    • None

    Description

      i have some use cases in the qtmultimedia unit tests, where i want to wait for a specific signal to be emitted. something like:

      class MyClass 
      {
      signals:
          void mySignal(int);
      };
      
      MyClass instance;
      QSignalSpy spy(instance, &MyClass::mySignal);
      
      spy.waitFor(42);
      

      it would be great to have support for this kind of use cases in one way or another. though it may also be interesting to investigate the use of more complex matchers (like e.g. supported by gmock https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md#using-simple-matchers)

      Attachments

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

        Activity

          People

            macadder Jason McDonald
            timblechmann tim blechmann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes