@Test public void should_show_popup_menu_at_item_matching_pattern() { showWindow(); driver.click(list); ClickRecorder recorder = ClickRecorder.attachTo(list); driver.showPopupMenu(list, "o.*"); assertThat(recorder).clicked(RIGHT_BUTTON); assertThat(isVisible(popupMenu)).isTrue(); assertThat(locationToIndex(recorder.pointClicked())).isEqualTo(0); assertThatCellReaderWasCalled(); }
@Test public void should_click_Component_at_given_point() { showWindow(); Point center = centerOf(window.button); Point where = new Point(center.x + 1, center.y + 1); ClickRecorder clickRecorder = ClickRecorder.attachTo(window.button); driver.click(window.button, where); assertThat(clickRecorder).wasClicked().clickedAt(where).timesClicked(1); }
@Test public void should_throw_error_if_Component_is_not_showing_on_the_screen() { ClickRecorder clickRecorder = ClickRecorder.attachTo(window.button); try { driver.click(window.button, new Point(10, 10)); failWhenExpectingException(); } catch (IllegalStateException e) { assertThatErrorCauseIsNotShowingComponent(e); } assertThat(clickRecorder).wasNotClicked(); }
@RunsInEDT final void assertThatColumnWasClicked(ClickRecorder recorder, int columnIndex) { int columnAtPoint = columnAtPoint(tableHeader, recorder.pointClicked()); assertThat(columnAtPoint).isEqualTo(columnIndex); }