|
@@ -189,6 +189,22 @@ public class ViewControllerTest extends BaseTest {
|
189
|
189
|
verify(spy, times(1)).onViewDisappear();
|
190
|
190
|
}
|
191
|
191
|
|
|
192
|
+ @Test
|
|
193
|
+ public void onDestroy_destroysViewEvenIfHidden() {
|
|
194
|
+ final SimpleViewController.SimpleView[] spy = new SimpleViewController.SimpleView[1];
|
|
195
|
+ ViewController uut = new SimpleViewController(activity, childRegistry, "uut", new Options()) {
|
|
196
|
+ @Override
|
|
197
|
+ protected SimpleView createView() {
|
|
198
|
+ SimpleView view = spy(super.createView());
|
|
199
|
+ spy[0] = view;
|
|
200
|
+ return view;
|
|
201
|
+ }
|
|
202
|
+ };
|
|
203
|
+ assertThat(uut.isViewShown()).isFalse();
|
|
204
|
+ uut.destroy();
|
|
205
|
+ verify(spy[0], times(1)).destroy();
|
|
206
|
+ }
|
|
207
|
+
|
192
|
208
|
@Test
|
193
|
209
|
public void onDestroy_RemovesSelfFromParentIfExists() {
|
194
|
210
|
LinearLayout parent = new LinearLayout(activity);
|