Search in sources :

Example 1 with ClickEvent

use of com.karuslabs.commons.graphics.ClickEvent in project Karus-Commons by Pante.

the class CheckBoxTest method click.

@ParameterizedTest
@CsvSource({ "true, 0, 1", "false, 1, 0" })
void click(boolean checked, int check, int uncheck) {
    checkbox.checked = checked;
    ClickEvent event = mock(ClickEvent.class);
    checkbox.click(event);
    verify(checkbox, times(check)).check(event);
    verify(checkbox, times(uncheck)).uncheck(event);
    assertEquals(!checked, checkbox.checked);
}
Also used : ClickEvent(com.karuslabs.commons.graphics.ClickEvent) CsvSource(org.junit.jupiter.params.provider.CsvSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with ClickEvent

use of com.karuslabs.commons.graphics.ClickEvent in project Karus-Commons by Pante.

the class CyclicButtonTest method click.

@Test
void click() {
    button.index = 0;
    ClickEvent event = mock(ClickEvent.class);
    button.click(event);
    verify(button).onClick(event, "a");
    assertEquals("b", button.current());
    assertEquals(1, button.index());
}
Also used : ClickEvent(com.karuslabs.commons.graphics.ClickEvent) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ClickEvent (com.karuslabs.commons.graphics.ClickEvent)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 Test (org.junit.jupiter.api.Test)1 CsvSource (org.junit.jupiter.params.provider.CsvSource)1