D10119: baloo-widgets: Create test to assert metaDataRequestFinished is emitted once only

Elvis Angelaccio noreply at phabricator.kde.org
Thu Feb 8 21:20:32 GMT 2018


elvisangelaccio requested changes to this revision.
elvisangelaccio added a comment.
This revision now requires changes to proceed.


  In https://phabricator.kde.org/D10119#202934, @michaelh wrote:
  
  > @elvisangelaccio: https://phabricator.kde.org/D10113 currently fails  `shouldSignalOnceWithoutFile()` and `shouldSignalOnceWithEmptyFile()` for reasons I don't understand. The correct code path is taken, but no signal is emitted in `src/filemetadatawidget.cpp:119`
  >  I hadn't pushed https://phabricator.kde.org/D10113 because I was waiting for your comment on this.
  
  
  Ah sorry, I hadn't realized this.

INLINE COMMENTS

> filemetadatawidgettest.cpp:62
> +    m_widget->setItems(KFileItemList() << QUrl());
> +    QVERIFY(spy.wait(500));
> +    QCOMPARE(spy.count(), 1);

>From the documentation of `QSignalSpy::wait()`:

  Starts an event loop that runs until the given signal is received. Optionally the event loop can return earlier on a timeout (in milliseconds).
  
  Returns true if the signal was emitted at least once in timeout milliseconds, otherwise returns false.

The signal IS emitted, but //before// you create the nested event loop. So `wait()` returns false because "no signal was emitted at least once in 500 ms".

Just remove this `QVERIFY()`, we don't need it.

REPOSITORY
  R824 Baloo Widgets

REVISION DETAIL
  https://phabricator.kde.org/D10119

To: michaelh, elvisangelaccio, smithjd, vhanda, ngraham, #dolphin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20180208/5fac48ae/attachment.htm>


More information about the kfm-devel mailing list