Bug #711
closedWTestEnvironment and reentrant eventloops.
0%
Description
(From Antonio Mancina:)
I'm trying to solve the following problem.
In the normal workflow of my application, when the user ask for a new
entity to be created, a modal dialog is created to let the user insert
a name for this entity.
When the corresponding OK button is pressed, a minimal amount of input
verification is done before accepting the data provided by the user
(typically the name must be comprised of valid characters).
I'd like to simulate this with a test environment, in order to test the
bunch of code which verifies the input, but I'm facing the following
problems.
1) If I let a single threaded test environment to instantiate the modal
window by simulating the newEntity button click, it gets stuck on the
emit call (which will end up showing the modal window, but no one is
gonna press the ok button).
2) If I prepare a double threaded environment and let one thread emit
the OK click signal belonging to the modal window, the other thread
stuck on the NewEntityButton~~clicked>emit(), stays there even afterclicked()~~>emit().
the other thread issued the DialogModalOkButton
Since I'm almost new to Wt, I could have missed something in here.
What's the standard way to address such an issue?
Solution: provide signals in WTestEnvironment, which invoked
whenever a recursive eventloop is started, with contextual information
(the dialog or other object involved). A listening slot could
then simulate interaction with the dialog itself:
WTestEnvironment:
Signal<WDialog *>& dialogExecuted(), Signal<WPopupMenu *>& popupMenuExecuted(), ...
Updated by Koen Deforche over 13 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.1.11
Hey,
I've implemented this in git.
Regards,
koen
Updated by Koen Deforche about 13 years ago
- Status changed from Resolved to Closed
Resolved in Wt 3.1.11