Piotr Śmietana
Piotr Śmietana

Reputation: 463

ShadowViewTreeObserver missing in Robolectric 3.1

Robolectric 3.0 provided ShadowViewTreeObserver class, but it's missing in Robolectric 3.1.

Official upgrade guide (https://github.com/robolectric/robolectric/wiki/3.0-to-3.1-Upgrade-Guide) tells about shadow methods being removed due to duplication of Android API funtionalities, yet ShadowViewTreeObserver is not mentioned there.

What happened to this class ? Should Android API methods of ViewTreeObserver be used instead of this particular shadow in 3.1 ?

Upvotes: 2

Views: 273

Answers (1)

piotrek1543
piotrek1543

Reputation: 19361

Yes, in Robolectric 3.1.x there's no more ShadowViewTreeObserver class, Check: Overview.

The reason of this change is explained in this merge request Deleting ShadowViewTreeObserver as it reimplements what the real class does. #2308, which has only one commit named

As you would see the answer for your question would be in commit: https://github.com/robolectric/robolectric/pull/2308/commits/e10bddd18ebb3df14423d3743e11772e4fd76e49.

What might be interesting for you it has only one commit, which has solution in name as it is called Deleting ShadowViewTreeObserver. Please use the real class moving forward.

tells about shadow methods being removed due to duplication of Android API funtionalities, yet ShadowViewTreeObserver is not mentioned there.

Seems to they forgot to update their docs ;-)

Hope it will help

Upvotes: 1

Related Questions