Assert SystemWindow not visible

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Assert SystemWindow not visible

laurent laffont
Hi,

I'm currently exploring ways of doing TDD on GUI.  (Is there a framework for this ?)

How can I know a window has been closed ? #visible always return true. 

self assert: (SystemWindow new openInWorld delete) visible not.

fails.

However this works but a bit "heavy":

(SystemWindow labelled: 'Zork') openInWorld delete.
Smalltalk garbageCollect.

self assert: (SystemWindow allSubInstances 
detect: [:aWindow| aWindow label = 'Zork']
ifNone: [nil]) isNil. 


Laurent Laffont - @lolgzs

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

Benjamin Van Ryseghem (Pharo)
window := (SystemWindow labelled: 'Zork').
window openInWorld delete.
self assert: ((World subMorphs includes: window) not).


I have also looked for a method that can tell me if the window is displayed or not, so I used to use this trick ;)


Ben

On Mar 1, 2011, at 9:06 PM, laurent laffont wrote:

Hi,

I'm currently exploring ways of doing TDD on GUI.  (Is there a framework for this ?)

How can I know a window has been closed ? #visible always return true. 

self assert: (SystemWindow new openInWorld delete) visible not.

fails.

However this works but a bit "heavy":

(SystemWindow labelled: 'Zork') openInWorld delete.
Smalltalk garbageCollect.

self assert: (SystemWindow allSubInstances 
detect: [:aWindow| aWindow label = 'Zork']
ifNone: [nil]) isNil. 


Laurent Laffont - @lolgzs

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

laurent laffont
On Wed, Mar 2, 2011 at 10:15 AM, Benjamin <[hidden email]> wrote:
window := (SystemWindow labelled: 'Zork').
window openInWorld delete.
self assert: ((World subMorphs includes: window) not).


I have also looked for a method that can tell me if the window is displayed or not, so I used to use this trick ;)

Cool ! Thank you Ben.

Laurent.

 


Ben

On Mar 1, 2011, at 9:06 PM, laurent laffont wrote:

Hi,

I'm currently exploring ways of doing TDD on GUI.  (Is there a framework for this ?)

How can I know a window has been closed ? #visible always return true. 

self assert: (SystemWindow new openInWorld delete) visible not.

fails.

However this works but a bit "heavy":

(SystemWindow labelled: 'Zork') openInWorld delete.
Smalltalk garbageCollect.

self assert: (SystemWindow allSubInstances 
detect: [:aWindow| aWindow label = 'Zork']
ifNone: [nil]) isNil. 


Laurent Laffont - @lolgzs

Pharo Smalltalk Screencasts: http://www.pharocasts.com/
Blog: http://magaloma.blogspot.com/


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

Henrik Sperre Johansen
Also note, in 1.2 (I think) onwards, you can subscribe to WindowAnnoncements.
WindowClosed should be announced when the window closes, so something like:
|window closed|
closed := false.
window := SystemWindow labelled: 'Zork'.
window announcer when: WindowClosed do: [closed := false].
window openInWorld delete.
self assert: closed.

should work.

Cheers,
Henry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

Henrik Sperre Johansen
Henrik Sperre Johansen wrote
window announcer when: WindowClosed do: [closed := false].
window openInWorld delete.
self assert: closed.
meant to write [closed := true], of course :)

Cheers,
Henry
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

laurent laffont
Thank you Henry, good example.

Laurent.

On Wed, Mar 2, 2011 at 10:35 AM, Henrik Sperre Johansen <[hidden email]> wrote:

Henrik Sperre Johansen wrote:
>
>
> window announcer when: WindowClosed do: [closed := false].
> window openInWorld delete.
> self assert: closed.
>
>
meant to write [closed := true], of course :)

Cheers,
Henry

--
View this message in context: http://forum.world.st/Assert-SystemWindow-not-visible-tp3330492p3331232.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

Gary Chambers-4

If you don't care whether the window had been opened at all then
sending #isInWorld to the window is another approach.

Regards, Gary
----- Original Message -----
Sent: Wednesday, March 02, 2011 12:37 PM
Subject: Re: [Pharo-project] Assert SystemWindow not visible

Thank you Henry, good example.

Laurent.

On Wed, Mar 2, 2011 at 10:35 AM, Henrik Sperre Johansen <[hidden email]> wrote:

Henrik Sperre Johansen wrote:
>
>
> window announcer when: WindowClosed do: [closed := false].
> window openInWorld delete.
> self assert: closed.
>
>
meant to write [closed := true], of course :)

Cheers,
Henry

--
View this message in context: http://forum.world.st/Assert-SystemWindow-not-visible-tp3330492p3331232.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Assert SystemWindow not visible

laurent laffont
On Mon, Mar 7, 2011 at 11:53 AM, Gary Chambers <[hidden email]> wrote:
If you don't care whether the window had been opened at all then
sending #isInWorld to the window is another approach.

Cool one !

Laurent.
 

Regards, Gary
----- Original Message -----
Sent: Wednesday, March 02, 2011 12:37 PM
Subject: Re: [Pharo-project] Assert SystemWindow not visible

Thank you Henry, good example.

Laurent.

On Wed, Mar 2, 2011 at 10:35 AM, Henrik Sperre Johansen <[hidden email]> wrote:

Henrik Sperre Johansen wrote:
>
>
> window announcer when: WindowClosed do: [closed := false].
> window openInWorld delete.
> self assert: closed.
>
>
meant to write [closed := true], of course :)

Cheers,
Henry

--
View this message in context: http://forum.world.st/Assert-SystemWindow-not-visible-tp3330492p3331232.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.



Loading...