paint in Vaadin7

In some of our tests we need to be able to paint a vaadin component to make sure that it will behave correctly. For that we use the “paint” method available on the Component interface.

This has moved now to LegacyComponent and not all components implement it. What is the recommended way of triggering the painting of a vaadin component from a unit test?

Thanks,
S.

What do you mean when you say you need to be able to “paint a vaadin component”? If a component does not implement LegacyComponent there is nothing to “paint” and hopefully no core component will implement LegacyComponent in the future but instead only use state and RPC.

I mean that painting fully resolve the component and makes sure that it’s ready to be sent on the client. In our test suites we have regression test where CSS inject, for instance, was messing with the component painting. So in some of our tests, we “paint” the component to make sure that this issue will not happen again.

It’s not a problem in vaadin but in our code. But we can’t validate the fix unless we call this method.

So I guess my question is which method can I call on a component to “fully resolve it” for the client.

Thanks,
S.

If you want to emulate what the framework does before “painting” the component then for LegacyComponents you should call paint as you have been doing but then you should also call beforeClientResponse() for all components which gives the components a possibility to update state variables right before they are sent to the client.