Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 706edbd7 authored by Jan Althaus's avatar Jan Althaus Committed by Android (Google) Code Review
Browse files

Merge "Fixing broken logging of OTHER events" into pi-dev

parents 2946fba3 35b30576
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ public final class SelectionEvent implements Parcelable {
            case SelectionEvent.ACTION_ABANDON:  // fall through
            case SelectionEvent.ACTION_SELECT_ALL:  // fall through
            case SelectionEvent.ACTION_RESET:  // fall through
            case SelectionEvent.ACTION_OTHER:  // fall through
                return;
            default:
                throw new IllegalArgumentException(
+25 −0
Original line number Diff line number Diff line
@@ -29,6 +29,31 @@ import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public class SelectionEventTest {

    @Test
    public void testCreateSelectionActionEvent_valid() {
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_OVERTYPE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_COPY);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_PASTE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_CUT);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SHARE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SMART_SHARE);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_DRAG);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_ABANDON);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_OTHER);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_SELECT_ALL);
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.ACTION_RESET);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreateSelectionActionEvent_badRange() {
        SelectionEvent.createSelectionActionEvent(0, -1, SelectionEvent.ACTION_OVERTYPE);
    }

    @Test(expected = IllegalArgumentException.class)
    public void testCreateSelectionActionEvent_badAction() {
        SelectionEvent.createSelectionActionEvent(0, 1, SelectionEvent.EVENT_SELECTION_STARTED);
    }

    @Test
    public void testParcel() {
        final SelectionEvent event = SelectionEvent.createSelectionStartedEvent(