|
@@ -198,7 +198,7 @@ public class SideMenuControllerTest extends BaseTest {
|
198
|
198
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
|
199
|
199
|
verify(center, times(1)).handleBack(any());
|
200
|
200
|
|
201
|
|
- uut.mergeOptions(SideMenuTestHelper.LEFT_OPEN);
|
|
201
|
+ openLeftMenu();
|
202
|
202
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
|
203
|
203
|
verify(center, times(1)).handleBack(any());
|
204
|
204
|
}
|
|
@@ -209,8 +209,72 @@ public class SideMenuControllerTest extends BaseTest {
|
209
|
209
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
|
210
|
210
|
verify(center, times(1)).handleBack(any());
|
211
|
211
|
|
212
|
|
- uut.mergeOptions(SideMenuTestHelper.RIGHT_OPEN);
|
|
212
|
+ openRightMenu();
|
213
|
213
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
|
214
|
214
|
verify(center, times(1)).handleBack(any());
|
215
|
215
|
}
|
|
216
|
+
|
|
217
|
+ @Test
|
|
218
|
+ public void leftMenuOpen_visibilityEventsAreEmitted() {
|
|
219
|
+ ViewController spy = spy(left);
|
|
220
|
+ uut.setLeftController(spy);
|
|
221
|
+ activity.setContentView(uut.getView());
|
|
222
|
+
|
|
223
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.LEFT)).isFalse();
|
|
224
|
+ verify(spy, times(0)).onViewAppeared();
|
|
225
|
+
|
|
226
|
+ openLeftMenu();
|
|
227
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.LEFT)).isTrue();
|
|
228
|
+ verify(spy).onViewAppeared();
|
|
229
|
+
|
|
230
|
+ closeLeft();
|
|
231
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.LEFT)).isFalse();
|
|
232
|
+ verify(spy).onViewDisappear();
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ @Test
|
|
236
|
+ public void rightMenuOpen_visibilityEventsAreEmitted() {
|
|
237
|
+ ViewController spy = spy(right);
|
|
238
|
+ uut.setRightController(spy);
|
|
239
|
+ activity.setContentView(uut.getView());
|
|
240
|
+
|
|
241
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.RIGHT)).isFalse();
|
|
242
|
+ verify(spy, times(0)).onViewAppeared();
|
|
243
|
+
|
|
244
|
+ openRightMenu();
|
|
245
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.RIGHT)).isTrue();
|
|
246
|
+ verify(spy).onViewAppeared();
|
|
247
|
+
|
|
248
|
+ closeRightMenu();
|
|
249
|
+ assertThat(uut.getView().isDrawerOpen(Gravity.RIGHT)).isFalse();
|
|
250
|
+ verify(spy).onViewDisappear();
|
|
251
|
+ }
|
|
252
|
+
|
|
253
|
+ private void openLeftMenu() {
|
|
254
|
+ Options options = new Options();
|
|
255
|
+ options.sideMenuRootOptions.left.visible = new Bool(true);
|
|
256
|
+ options.sideMenuRootOptions.left.animate = new Bool(false);
|
|
257
|
+ uut.mergeOptions(options);
|
|
258
|
+ }
|
|
259
|
+
|
|
260
|
+ private void openRightMenu() {
|
|
261
|
+ Options options = new Options();
|
|
262
|
+ options.sideMenuRootOptions.right.visible = new Bool(true);
|
|
263
|
+ options.sideMenuRootOptions.right.animate = new Bool(false);
|
|
264
|
+ uut.mergeOptions(options);
|
|
265
|
+ }
|
|
266
|
+
|
|
267
|
+ private void closeLeft() {
|
|
268
|
+ Options options = new Options();
|
|
269
|
+ options.sideMenuRootOptions.left.visible = new Bool(false);
|
|
270
|
+ options.sideMenuRootOptions.left.animate = new Bool(false);
|
|
271
|
+ uut.mergeOptions(options);
|
|
272
|
+ }
|
|
273
|
+
|
|
274
|
+ private void closeRightMenu() {
|
|
275
|
+ Options options = new Options();
|
|
276
|
+ options.sideMenuRootOptions.right.visible = new Bool(false);
|
|
277
|
+ options.sideMenuRootOptions.right.animate = new Bool(false);
|
|
278
|
+ uut.mergeOptions(options);
|
|
279
|
+ }
|
216
|
280
|
}
|