D11604: kdirlistertest doesn't fail at random

David Faure noreply at phabricator.kde.org
Sat May 5 13:57:39 UTC 2018


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


  Please add QStandardPaths::setTestModeEnabled(true) in initTestCase() so that your (broken, thank you WinE) locally defined mimetypes don't interfer with the test. Then "hardcoding" text/html will be fine again.

INLINE COMMENTS

> kdirlistertest.cpp:222
> +
> +    qDebug() << "Creating new 100 files";
> +    for (int i = 50; i > 0; i--) {

100 new files, you mean? ;)

> kdirlistertest.cpp:236
> +
> +    QVERIFY(m_dirLister.spyStarted.count() < 3); // Updates call started, probably twice
> +    QVERIFY(m_dirLister.spyCompleted.count() < 3); // and completed, probably twice

(so 0 would be fine?)

> kdirlistertest.cpp:516
> +
> +    connect(&m_dirLister, SIGNAL(itemsDeleted(KFileItemList)), this, SLOT(exitLoop()));
> +

with QTRY_* and/or QSignalSpy::wait(), the enterLoop/exitLoop old solution isn't really necessary anymore

> kdirlistertest.cpp:534
> +    m_items.clear();
> +    connect(&m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
> +    m_dirLister.openUrl(QUrl::fromLocalFile(path), KDirLister::NoFlags);

convert to new style connect, as you did for the other code you touched?

> kdirlistertest.cpp:608
>      if (m_refreshedItems.isEmpty()) {
> -        QVERIFY(waitForRefreshedItems()); // refreshItems could come from KDirWatch or KDirNotify.
> +        QTRY_COMPARE(m_refreshedItems.isEmpty(), false);  // could come from KDirWatch or KDirNotify.
>      }

QTRY_VERIFY(!m_refreshedItems.isEmpty());

(same for all other instances)

REPOSITORY
  R241 KIO

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

To: jtamate, #frameworks, dfaure
Cc: apol, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20180505/3b774fee/attachment.html>


More information about the Kde-frameworks-devel mailing list