Wrapper.create(mContext) .delegate(content) .focusedHandler(focusedHandler) .unfocusedHandler(unfocusedHandler) .widthPx(10)
@Test public void testFocusedOccupiesHalfViewport() { final TestComponent content = create(mContext).build(); final EventHandler<FocusedVisibleEvent> focusedEventHandler = new EventHandler<>(content, 2); final LithoView lithoView = mountComponent( mContext, mLithoView, Column.create(mContext) .child( Wrapper.create(mContext) .delegate(content) .focusedHandler(focusedEventHandler) .widthPx(10) .heightPx(10)) .build(), true, 10, 10); content.getDispatchedEventHandlers().clear(); lithoView.performIncrementalMount(new Rect(LEFT, 0, RIGHT, 4), true); assertThat(content.getDispatchedEventHandlers()) .doesNotContain(focusedEventHandler); lithoView.performIncrementalMount(new Rect(LEFT, 0, RIGHT, 5), true); assertThat(content.getDispatchedEventHandlers()).contains(focusedEventHandler); }
@Test public void testFocusedOccupiesLessThanHalfViewport() { final TestComponent content = create(mContext).build(); final EventHandler<FocusedVisibleEvent> focusedEventHandler = new EventHandler<>(content, 2); final LithoView lithoView = mountComponent( mContext, mLithoView, Column.create(mContext) .child( Wrapper.create(mContext) .delegate(content) .focusedHandler(focusedEventHandler) .widthPx(10) .heightPx(3)) .build(), true, 10, 10); content.getDispatchedEventHandlers().clear(); lithoView.performIncrementalMount(new Rect(LEFT, 0, RIGHT, 2), true); assertThat(content.getDispatchedEventHandlers()) .doesNotContain(focusedEventHandler); lithoView.performIncrementalMount(new Rect(LEFT, 0, RIGHT, 3), true); assertThat(content.getDispatchedEventHandlers()).contains(focusedEventHandler); }
.visibleHandler(visibleEventHandler1) .invisibleHandler(invisibleEventHandler1) .focusedHandler(focusedEventHandler1) .unfocusedHandler(unfocusedEventHandler1) .fullImpressionHandler(fullImpressionVisibleEventHandler1) .visibleHandler(visibleEventHandler2) .invisibleHandler(invisibleEventHandler2) .focusedHandler(focusedEventHandler2) .unfocusedHandler(unfocusedEventHandler2) .fullImpressionHandler(fullImpressionVisibleEventHandler2) .visibleHandler(visibleEventHandler3) .invisibleHandler(invisibleEventHandler3) .focusedHandler(focusedEventHandler3) .unfocusedHandler(unfocusedEventHandler3) .fullImpressionHandler(fullImpressionVisibleEventHandler3))
.visibleHandler(visibleEventHandler1) .invisibleHandler(invisibleEventHandler1) .focusedHandler(focusedEventHandler1) .unfocusedHandler(unfocusedEventHandler1) .widthPx(10)
.visibleHandler(visibleEventHandler) .invisibleHandler(invisibleEventHandler) .focusedHandler(focusedEventHandler) .unfocusedHandler(unfocusedEventHandler) .fullImpressionHandler(fullImpressionHandler)