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

am: 706edbd776

Change-Id: Id4a2866e93e1c03c1e7a6b236175f2faae4cd6f6
This commit is contained in:
Jan Althaus
2018-04-09 06:21:08 -07:00
committed by android-build-merger
2 changed files with 27 additions and 1 deletions

View File

@@ -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(
@@ -653,4 +654,4 @@ public final class SelectionEvent implements Parcelable {
return new SelectionEvent[size];
}
};
}
}

View File

@@ -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(