[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 ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Alexandre Bergel [alexandre@bergel.eu] 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Alexandre Bergel [alexandre@bergel.eu] 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Indeed this raises no Notification of any kind. In that case I would say replace StandardWindow new message: 'No Cycles'. with UIManager default inform: 'No Cycles'. if you can. I guess the first expression is also just an example? Because this just instantiates a StandardWindow to have a modal Dialog on top of that invisible window.
From what I've seen in the system I would say that latter expression will make the Dialog modal to the active window. If it is the case that the Dialog should be modal to a non active window I have to pass for now! :)
Alex
Ok, thanks Alex. I turned the usage to StandardWindow for UIManager. I had to do exclude from the test the action that uses StandardWindow :-( Thanks to all you! Cheers, Alexandre On 13 Oct 2010, at 09:39, Alexander LazareviÄ wrote:
Indeed this raises no Notification of any kind. In that case I would say replace
StandardWindow new message: 'No Cycles'.
with
UIManager default inform: 'No Cycles'.
if you can.
I guess the first expression is also just an example? Because this just instantiates a StandardWindow to have a modal Dialog on top of that invisible window. From what I've seen in the system I would say that latter expression will make the Dialog modal to the active window. If it is the case that the Dialog should be modal to a non active window I have to pass for now! :)
Alex
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Alexandre Bergel [alexandre@bergel.eu] Sent: Wednesday, October 13, 2010 8:09 AM To: Pharo-project@lists.gforge.inria.fr 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: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Alexandre Bergel [alexandre@bergel.eu] 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
I was just looking at something similar. I guess for modal windows that are a kind of DialogWindow something like this should work [UIManager default confirm: 'Got milk?'] on: ProvideAnswerNotification do: [:ex | ex resume: (ex messageText = 'Got milk?')] But which modal windows do pop up in your scenario, that do not send a notification? Regards, Alex 2010/10/12 Alexandre Bergel <alexandre@bergel.eu>:
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
The tests I am finding in my Dolphin image create/show a presenter, do some things to it, and then use #ensure: to evaluate aPresenter topShell presenter exit. after which it forces a check of the finalization queue and a GC; I probably did that out of an abundance of caution. Bill ________________________________________ From: pharo-project-bounces@lists.gforge.inria.fr [pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Alexandre Bergel [alexandre@bergel.eu] 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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (3)
-
Alexander LazareviÄ -
Alexandre Bergel -
Schwab,Wilhelm K