Testing interaction with Roassal 2

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

Testing interaction with Roassal 2

Usman Bhatti
Hi Alex,

How do you trigger the menu action of an RTElement programmatically?

In Roassal one, I could do:

menuActivable := (anElement getInteraction: ROMenuActivable).
actionBlock := (menuActivable actionNamed: 'my action').
actionBlock value value: anElement.


In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.

tx,

usman 

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

abergel
Let me check…

Alexandre


On Mar 29, 2014, at 6:05 PM, Usman Bhatti <[hidden email]> wrote:

> Hi Alex,
>
> How do you trigger the menu action of an RTElement programmatically?
>
> In Roassal one, I could do:
>
> menuActivable := (anElement getInteraction: ROMenuActivable).
> actionBlock := (menuActivable actionNamed: 'my action').
> actionBlock value value: anElement.
>
>
> In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.
>
> tx,
>
> usman
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

abergel
In reply to this post by Usman Bhatti
I’ve just checked :-)

I am not sure to understand what is the problem you are facing.

Have you tried:
-=-=-=-=-=-=-=-=-=-=-=-=
| v e |
v := RTView new.
e := (RTBox new size: 50) element.
e @ (RTMenuActivable new item: 'inspect' action: #inspect; item: 'browse' action: [ :o | o class browse ]).
v add: e.
v
-=-=-=-=-=-=-=-=-=-=-=-=

Thanks Juraj for having introduced the class RTMenuActivable!

Cheers,
Alexandre


On Mar 29, 2014, at 6:05 PM, Usman Bhatti <[hidden email]> wrote:

> Hi Alex,
>
> How do you trigger the menu action of an RTElement programmatically?
>
> In Roassal one, I could do:
>
> menuActivable := (anElement getInteraction: ROMenuActivable).
> actionBlock := (menuActivable actionNamed: 'my action').
> actionBlock value value: anElement.
>
>
> In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.
>
> tx,
>
> usman
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

Juraj Kubelka-5
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

Usman Bhatti
In reply to this post by abergel

On Sat, Mar 29, 2014 at 11:25 PM, Alexandre Bergel <[hidden email]> wrote:
I’ve just checked :-)

I am not sure to understand what is the problem you are facing. 

Have you tried:
-=-=-=-=-=-=-=-=-=-=-=-=
| v e |
v := RTView new.
e := (RTBox new size: 50) element.
e @ (RTMenuActivable new item: 'inspect' action: #inspect; item: 'browse' action: [ :o | o class browse ]).
v add: e.
v
-=-=-=-=-=-=-=-=-=-=-=-=


What I am trying to achieve is a way to test the number of menu items on the element in the example above and to trigger the action blocks for each menu item to test its behaviour. Something like:

self assert: element menuItems size equals:2.
element menuItems do: [:each | self shouldnt: (each actionBlock value: element) raise: Error ]

It'll be helpful because I'm trying to adapt my tests to Roassal 2.

tx.

 
Thanks Juraj for having introduced the class RTMenuActivable!

Cheers,
Alexandre


On Mar 29, 2014, at 6:05 PM, Usman Bhatti <[hidden email]> wrote:

> Hi Alex,
>
> How do you trigger the menu action of an RTElement programmatically?
>
> In Roassal one, I could do:
>
> menuActivable := (anElement getInteraction: ROMenuActivable).
> actionBlock := (menuActivable actionNamed: 'my action').
> actionBlock value value: anElement.
>
>
> In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.
>
> tx,
>
> usman
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

abergel
> What I am trying to achieve is a way to test the number of menu items on the element in the example above and to trigger the action blocks for each menu item to test its behaviour. Something like:
>
> self assert: element menuItems size equals:2.
> element menuItems do: [:each | self shouldnt: (each actionBlock value: element) raise: Error ]
>
> It'll be helpful because I'm trying to adapt my tests to Roassal 2.

Ah okay. In that case, I guess you should directly talk to the announcer. For example:
        self assert: element announcer numberOfSubscriptions equals: 2.

I haven’t checked, but I guess you can easily access to the callback.
Let me know how it goes.

Alexandre


>
> tx.
>
>  
> Thanks Juraj for having introduced the class RTMenuActivable!
>
> Cheers,
> Alexandre
>
>
> On Mar 29, 2014, at 6:05 PM, Usman Bhatti <[hidden email]> wrote:
>
> > Hi Alex,
> >
> > How do you trigger the menu action of an RTElement programmatically?
> >
> > In Roassal one, I could do:
> >
> > menuActivable := (anElement getInteraction: ROMenuActivable).
> > actionBlock := (menuActivable actionNamed: 'my action').
> > actionBlock value value: anElement.
> >
> >
> > In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.
> >
> > tx,
> >
> > usman
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

Usman Bhatti



On Sun, Mar 30, 2014 at 10:14 PM, Alexandre Bergel <[hidden email]> wrote:
> What I am trying to achieve is a way to test the number of menu items on the element in the example above and to trigger the action blocks for each menu item to test its behaviour. Something like:
>
> self assert: element menuItems size equals:2.
> element menuItems do: [:each | self shouldnt: (each actionBlock value: element) raise: Error ]
>
> It'll be helpful because I'm trying to adapt my tests to Roassal 2.

Ah okay. In that case, I guess you should directly talk to the announcer. For example:
        self assert: element announcer numberOfSubscriptions equals: 2.

Yes. That was easy to find.
 

I haven’t checked, but I guess you can easily access to the callback.

The access to the callback is not evident because the element does not know about its callbacks; the callbacks are only known by the announcer and announcer provides very limited API to its internal information. Hence my question: how should I gain access to the callbacks of an element to trigger them and test that they do not raise errors.

tx.
usman

 
Let me know how it goes.

Alexandre


>
> tx.
>
>
> Thanks Juraj for having introduced the class RTMenuActivable!
>
> Cheers,
> Alexandre
>
>
> On Mar 29, 2014, at 6:05 PM, Usman Bhatti <[hidden email]> wrote:
>
> > Hi Alex,
> >
> > How do you trigger the menu action of an RTElement programmatically?
> >
> > In Roassal one, I could do:
> >
> > menuActivable := (anElement getInteraction: ROMenuActivable).
> > actionBlock := (menuActivable actionNamed: 'my action').
> > actionBlock value value: anElement.
> >
> >
> > In Roassal 2, I cannot get the menu actions because everything is happening with announcements. How can I trigger the RTMenuActivable for my elements in the view because when generating my events programmatically by simulating mouse-clicks, my image becomes non-responsive after a few tries.
> >
> > tx,
> >
> > usman
> > _______________________________________________
> > Moose-dev mailing list
> > [hidden email]
> > https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Testing interaction with Roassal 2

abergel
> The access to the callback is not evident because the element does not know about its callbacks; the callbacks are only known by the announcer and announcer provides very limited API to its internal information. Hence my question: how should I gain access to the callbacks of an element to trigger them and test that they do not raise errors.

Something like that:
-=-=-=-=-=-=
| e |
e := RTBox element.
e when: TRMouseClick do: [ :evt | Transcript show: 'blah'; cr ].
e announcer subscriptions subscriptionsOf: nil do: [ :evt | evt action value: TRMouseClick new ]
-=-=-=-=-=-=

??

Alexandre

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



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev