Hey Antonio, 2011/2/2 Antonio Mancina <[email protected]>: > 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).
Well, we never thought about this. I tried to find out what Qt does in this case, but could not get any explanation. > 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 after > the other thread issued the DialogModalOkButton->clicked()->emit(). This is probably not working because only one thread can be involved with Wt objects at a time. > Since I'm almost new to Wt, I could have missed something in here. > What's the standard way to address such an issue? The easy part, it seems to me, is to avoid the reentrant event loop when using WTestEnvironment. But then you still want control over the return value of the exec() method. I see a number of options: - extend the WDialog API with a method for testing only, to set the result that is to be returned by exec(). Not very nice in case the dialog box is buried deep down your integration test - provide virtual methods in WTestEnvironment which are invoked whenever a recursive eventloop is started, with contextual information (the dialog or other object involved), this method could then simulate interaction with the dialog itself - provide signals in WTestEnvironment, which allow the same as supra without requiring to specialize WTestEnvironment Signal<WDialog *>& dialogExecuted(), Signal<WPopupMenu *>& popupMenuExecuted(), ... I think the last approach is nicest ? Regards, koen ------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
