@Before public void setUp() { Display display = new Display(); parent = new Shell(display); video = new Video("http://test.com", parent); playbackListener = mock(PlaybackListener.class); presentationListener = mock(PresentationListener.class); new Button(parent, SWT.PUSH); lifeCycleAdapter = (AbstractWidgetLCA) video.getAdapter(WidgetLifeCycleAdapter.class); environment.newRequest(); }
@Test public void testFiresPresentationChangeToFullScreenOnce() { environment.getRemoteObject().setHandler(new VideoOperationHandler(video)); video.addPresentationListener(presentationListener); environment.newRequest(); JsonObject parameters = new JsonObject(); parameters.add(PROPERTY_PRESENTATION, Presentation.FULL_SCREEN.name()); environment.dispatchNotify(Constants.EVENT_PRESENTATION, parameters); verify(presentationListener).presentationChanged(Presentation.FULL_SCREEN); assertFalse(hasOperation(WidgetUtil.getId(video), SET, null)); }
@Test public void testRendersPlaybackPlayOnce() { environment.getRemoteObject().setHandler(new VideoOperationHandler(video)); video.addPlaybackListener(playbackListener); environment.newRequest(); JsonObject parameters = new JsonObject(); parameters.add(PROPERTY_PLAYBACK, Playback.PLAY.name()); environment.dispatchNotify(Constants.EVENT_PLAYBACK, parameters); verify(playbackListener).playbackChanged(Playback.PLAY); assertFalse(hasOperation(WidgetUtil.getId(video), SET, null)); }