DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::networking::testing Namespace Reference

Classes

class  ReplyResponseMock
 A mock implementation of the networking::ReplyResponse interface for testing purposes. It is specifically designed to facilitate testing by simulating the behavior of a network response. It enables controlled testing of network interactions without requiring actual network calls. It provides the mechanisms to mock common methods of a network reply, such as retrieving attributes, errors, URLs, error strings, and data content. Additionally, it includes functionality to simulate multiple consecutive network replies over a defined interval using timers. More...
 
struct  RequestSenderMock
 A mock implementation of the networking::RequestSender interface for testing purposes. It is designed to support unit testing of components that rely on sending network requests by mocking the functionality of the RequestSender interface. It eliminates the need for actual network communication during tests, enabling controlled and reproducible test environments. More...
 

Functions

DRN_NETWORKING_TESTING_EXPORT void waitForSignal (const ::QSignalSpy &spy, std::chrono::milliseconds waitFor)
 Waits for a specific signal to be emitted within a given timeout duration. It is useful in testing scenarios to verify if a signal has been emitted within the specified time. It helps validate asynchronous behavior in components that rely on signals to notify changes or complete operations.
 
DRN_NETWORKING_TESTING_EXPORT void waitForSignal (const ::QSignalSpy &spy, std::chrono::milliseconds waitFor, const ::qint32 minCount)
 Waits for a specific signal to be emitted within a given timeout duration. It is useful in testing scenarios to verify if a signal has been emitted within the specified time. It helps validate asynchronous behavior in components that rely on signals to notify changes or complete operations.
 

Function Documentation

◆ waitForSignal() [1/2]

DRN_NETWORKING_TESTING_EXPORT void drn::networking::testing::waitForSignal ( const ::QSignalSpy & spy,
std::chrono::milliseconds waitFor )

Waits for a specific signal to be emitted within a given timeout duration. It is useful in testing scenarios to verify if a signal has been emitted within the specified time. It helps validate asynchronous behavior in components that rely on signals to notify changes or complete operations.

The signal is monitored using a QSignalSpy object, which tracks signal emissions. If the signal is emitted within the specified timeout, the function completes successfully. Otherwise, the function blocks until the timeout expires.

Parameters
spyThe QSignalSpy instance that observes the signal to be tested.
waitForThe maximum duration to wait for the signal to be emitted.

Usage:

  • Use this method in test cases involving asynchronous signal emissions.
  • Make sure the QSignalSpy is properly connected to the desired signal before calling this function.

◆ waitForSignal() [2/2]

DRN_NETWORKING_TESTING_EXPORT void drn::networking::testing::waitForSignal ( const ::QSignalSpy & spy,
std::chrono::milliseconds waitFor,
const ::qint32 minCount )

Waits for a specific signal to be emitted within a given timeout duration. It is useful in testing scenarios to verify if a signal has been emitted within the specified time. It helps validate asynchronous behavior in components that rely on signals to notify changes or complete operations.

The signal is monitored using a QSignalSpy object, which tracks signal emissions. If the signal is emitted within the specified timeout, the function completes successfully. Otherwise, the function blocks until the timeout expires.

Parameters
spyThe QSignalSpy instance that observes the signal to be tested.
waitForThe maximum duration to wait for the signal to be emitted.
minCountThe minimum number of signal emissions required to stop waiting.

Usage:

  • Use this method in test cases involving asynchronous signal emissions.
  • Make sure the QSignalSpy is properly connected to the desired signal before calling this function.