Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Test setup for tests that require events?
Qt 6.11 is out! See what's new in the release blog

Test setup for tests that require events?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 819 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • fcarneyF Offline
    fcarneyF Offline
    fcarney
    wrote on last edited by
    #1

    I need to test QNetworkRequest objects, or the usage thereof. I am not sure exactly of what happens under the hood as far as events go.

    The questions:
    Do I need an event loop to test the networking system?
    Is there a test setup for event based testing?

    The default test setups seem to be very basic and do not provide event loops, that I can tell. At least in Qt 5.9.7. We are running Qt Creator 4.7.2 if that makes any difference. I originally ran into an issue trying to test QTimer. It would not function in tests with no event loop.

    C++ is a perfectly valid school of magic.

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      The act of typing the question out helped me know what to do. If I want to test events I should run the event loop myself by calling QCoreApplication::processEvents() in my test. Yes, it was sort of obvious.

      Thanks for your help! Hopefully this will help someone else.

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved