Classes | |
class | wxExpectModalBase< T, E > |
Base class for the expectation of a dialog of the given type T. More... | |
class | wxExpectAny |
Expectation of any kind of modal dialog. More... | |
class | wxTestingModalHook |
Implementation of wxModalDialogHook for use in testing. More... | |
Macros | |
#define | wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook |
Macro determining the class of modal dialog hook to use. More... | |
#define | wxTEST_DIALOG(codeToRun, ...) |
Runs given code with all modal dialogs redirected to wxExpectModal<T> hooks, instead of being shown to the user. More... | |
#define wxTEST_DIALOG | ( | codeToRun, | |
... | |||
) |
Runs given code with all modal dialogs redirected to wxExpectModal<T> hooks, instead of being shown to the user.
This macro is useful for non-interactive tests that need to call a function showing a modal dialog, as it allows to check that the expected dialog is indeed shown and then continues the execution with the provided result instead of blocking.
The first argument is any valid expression, typically a function call. The remaining arguments are wxExpectModal<T> instances defining the dialogs that are expected to be shown, in order of appearance.
Some typical examples:
Sometimes, the code may show more than one dialog:
Notice that wxExpectModal<T> has some convenience methods for further tweaking the expectations. For example, it's possible to mark an expected dialog as optional for situations when a dialog may be shown, but isn't required to, by calling the Optional() method:
#define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook |
Macro determining the class of modal dialog hook to use.
By default defined as wxTestingModalHook but can be predefined before including this file to the name of a custom class inheriting from it to customize its behaviour, e.g. provide better error reporting.