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

QTest's signal dumper is not listing resulting slot invocations in some scenarios

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12
    • Testing: qtestlib
    • None
    • All

    Description

      In QTest's documentation and help-text it is listed that the signal dumper will list signal emissions and resulting slot invocations. Signal emissions are indeed listed, but slot invocations are not

       -vs                 : Log every signal emission and resulting slot invocations
      

      The issue only occurs with QueuedConnections (this is possibly 'intended') and the new-style connect syntax.

      E.g., the two following functions yield different output.

      void tst_Signaldumper::oneSlot()
      {
          SignalSlotClass signalSlotOwner;
          // parameterless to parameterless
          auto connection = connect(&signalSlotOwner, &SignalSlotClass::signalWithoutParameters,
                                    &signalSlotOwner, &SignalSlotClass::slotWithoutParameters);
          emit signalSlotOwner.signalWithoutParameters();
      }
      

      vs

      void tst_Signaldumper::oneSlotOldSyntax()
      {
          SignalSlotClass signalSlotOwner;
          // parameterless to parameterless
          auto connection = connect(&signalSlotOwner, SIGNAL(signalWithoutParameters()),
                                    &signalSlotOwner, SLOT(slotWithoutParameters()));
          emit signalSlotOwner.signalWithoutParameters();
      }
      

      Has the output:

      INFO   : tst_Signaldumper::initTestCase() Signal: QThread(55653adb8160) started ()
      PASS   : tst_Signaldumper::initTestCase()
      INFO   : tst_Signaldumper::oneSlot(direct) Signal: SignalSlotClass(7ffe14e6c870) signalWithoutParameters ()
      PASS   : tst_Signaldumper::oneSlot(direct)
      INFO   : tst_Signaldumper::oneSlotOldSyntax(direct) Signal: SignalSlotClass(7ffe14e6c890) signalWithoutParameters ()
      INFO   : tst_Signaldumper::oneSlotOldSyntax(direct)     Slot: SignalSlotClass(7ffe14e6c890) slotWithoutParameters()
      PASS   : tst_Signaldumper::oneSlotOldSyntax(direct)
      PASS   : tst_Signaldumper::cleanupTestCase()
      INFO   : tst_Signaldumper::UnknownTestFunc() Signal: QThread(55653adb8160) finished ()
      

      Note how oneSlotOldSyntax has slot invocations, and oneSlot does not.

      Attachments

        Issue Links

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

          Activity

            People

              cnn Qt Core & Network
              manordheim MÃ¥rten Nordheim
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes