I am starting to understand your problem, and I do not know how to solve it, 
except perhaps through design changes.  The approach I mentioned below works 
when the "popups" are complete dialogs that get tested (probably non-modally, 
just to make sure they open and do reasonable things when prodded).  I did not 
use things like #inform: in GUI design.  Instead, I ended up with lots of 
wizard-like interfaces that would trap the user until they fix any problems or 
cancel the attempt.

Another thing that I do (in Dolphin language) is test presenters more than 
dialogs.  My modal dialogs are often very simple wrappers around more complex 
composite presenters that can be easily opened and closed - the tests help 
ensure that.  Testing the dialog itself then largely reduces to making sure it 
opens when/where it should.

Good luck!


________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Alexandre Bergel 
[[email protected]]
Sent: Wednesday, October 13, 2010 8:09 AM
To: [email protected]
Subject: Re: [Pharo-project] modal windows and unit tests

Thanks for your answers. But the problem still persists.
For example, the following does not open the popup:
[self inform:'No cycles' ]
 on: Notification
 do: [:ex | ].

The notification is captured.

However, the following opens the popup:
[StandardWindow new message:'No cycles' ]
 on: Notification
 do: [:ex | ].

Any idea how I can make the popup not open?

Cheers,
Alexandre

On 12 Oct 2010, at 17:42, Schwab,Wilhelm K wrote:

> First, did you open the window (as in it's the point of the test), or did 
> Pharo open it in contradiction to your better judgment?  If the latter, what 
> is happening?
>
> Assuming that you have opened a modal window in a test, there are a couple of 
> ways that I have handled such things in Dolphin.  First, if you can slightly 
> refactor your code, you might be able to open it non-modally, which might 
> help some; however, you really want to dismiss it as part of the test.   
> Regardless of modality, you probably want to store the window in a temporary 
> variable as part of your test and then either send it a message or command to 
> close.
>
> I will take a quick look for something I wrote in Dolphin and reply if it 
> looks like it might have any value.
>
> Bill
>
>
>
> ________________________________________
> From: [email protected] 
> [[email protected]] On Behalf Of Alexandre Bergel 
> [[email protected]]
> Sent: Tuesday, October 12, 2010 3:39 PM
> To: Pharo Development
> Subject: [Pharo-project] modal windows and unit tests
>
> Hi!
>
> A modal window is pop up by one of my tests. Is there a way to capture this 
> situation and simply remove the modal window?
> Apparently, no notification is raised...
>
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [email protected]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.






_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to