Check button's states on Proteus tests

47 views
Skip to first unread message

Javier Uribe

unread,
Nov 6, 2017, 8:29:50 AM11/6/17
to tryton
I'd like to know if there is a way of checking the button's states on a Proteus test. For example, I'd like to test if a button is invisible.

Sergi Almacellas Abellana

unread,
Nov 6, 2017, 8:38:12 AM11/6/17
to try...@googlegroups.com
Hi Javier,

El 06/11/17 a les 14:08, Javier Uribe ha escrit:
> I'd like to know if there is a way of checking the button's states on a Proteus test. For example, I'd like to test if a button is invisible.

Button definitions are not fetched on proteus. That's because buttons
are linked to views and proteus does not understand views as you have
access to the full model definition.


--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Javier Uribe

unread,
Nov 6, 2017, 9:35:08 AM11/6/17
to tryton
It's a pity but good to know. Thanks for the info.

Sergi Almacellas Abellana

unread,
Nov 6, 2017, 9:36:53 AM11/6/17
to try...@googlegroups.com
El 06/11/17 a les 15:20, Javier Uribe ha escrit:
> El lunes, 6 de noviembre de 2017, 14:38:12 (UTC+1), Sergi Almacellas Abellana escribió:
>> Hi Javier,
>>
>> El 06/11/17 a les 14:08, Javier Uribe ha escrit:
>>> I'd like to know if there is a way of checking the button's states on a Proteus test. For example, I'd like to test if a button is invisible.
>> Button definitions are not fetched on proteus. That's because buttons
>> are linked to views and proteus does not understand views as you have
>> access to the full model definition.

> It's a pity but good to know.

Indeed it will be good to know what's your use case and why you need to
test the buttons states.

Giving a little bit of context on what you are trying to achieve will help.

Cédric Krier

unread,
Nov 6, 2017, 9:40:06 AM11/6/17
to try...@googlegroups.com
On 2017-11-06 14:38, Sergi Almacellas Abellana wrote:
> Hi Javier,
>
> El 06/11/17 a les 14:08, Javier Uribe ha escrit:
> > I'd like to know if there is a way of checking the button's states on a Proteus test. For example, I'd like to test if a button is invisible.
>
> Button definitions are not fetched on proteus. That's because buttons
> are linked to views and proteus does not understand views as you have
> access to the full model definition.

But you could call fields_view_get and evaluate the pyson statement.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Javier Uribe

unread,
Nov 7, 2017, 3:50:07 AM11/7/17
to tryton
That'd be great. So, can I call that method on Proteus tests? Then I could test Pyson statements and it'd be very useful.

Cédric Krier

unread,
Nov 7, 2017, 4:40:06 AM11/7/17
to tryton
On 2017-11-07 00:41, Javier Uribe wrote:
> El lunes, 6 de noviembre de 2017, 15:40:06 (UTC+1), Cédric Krier escribió:
> > But you could call fields_view_get and evaluate the pyson statement.
>
> That'd be great. So, can I call that method on Proteus tests? Then I
> could test Pyson statements and it'd be very useful.

Yes you can call from proteus any RPC method, you just have to append
at the end the context dictionary.
proteus embed a pyson library so you should be able to evaluate the
expression with the _EvalEnvironment.
But it is probably cumbersome to test PYSON statement as they should be
quiet simple. There are more chance to have bugs in your testing code
then in the PYSON statement, so does it still deserve a test?

Javier Uribe

unread,
Nov 7, 2017, 7:55:08 AM11/7/17
to tryton
Thank you so much and in this particular case it deserves it because it was a tricky pyson statement with Morgan's laws applied.

Cédric Krier

unread,
Nov 7, 2017, 9:00:08 AM11/7/17
to tryton
On 2017-11-07 04:46, Javier Uribe wrote:
> Thank you so much and in this particular case it deserves it because
> it was a tricky pyson statement with Morgan's laws applied.

Then you should probably move the computation into a Function field
which will be much more easier to test.
Reply all
Reply to author
Forward
0 new messages