@Test public void shortArray() { short [] arr = new short[] { 89, 37 }; bundle.putShortArray("foo", arr); assertThat(bundle.getShortArray("foo")).isEqualTo(arr); assertThat(bundle.getShortArray("bar")).isNull(); }
when(bundle.getShortArray(anyString())).thenAnswer(get);
@Test public void getWrongType() { bundle.putFloat("foo", 5f); assertThat(bundle.getCharArray("foo")).isNull(); assertThat(bundle.getInt("foo")).isEqualTo(0); assertThat(bundle.getIntArray("foo")).isNull(); assertThat(bundle.getIntegerArrayList("foo")).isNull(); assertThat(bundle.getShort("foo")).isEqualTo((short) 0); assertThat(bundle.getShortArray("foo")).isNull(); assertThat(bundle.getBoolean("foo")).isFalse(); assertThat(bundle.getBooleanArray("foo")).isNull(); assertThat(bundle.getLong("foo")).isEqualTo(0); assertThat(bundle.getLongArray("foo")).isNull(); assertThat(bundle.getFloatArray("foo")).isNull(); assertThat(bundle.getDouble("foo")).isEqualTo(0.0); assertThat(bundle.getDoubleArray("foo")).isNull(); assertThat(bundle.getString("foo")).isNull(); assertThat(bundle.getStringArray("foo")).isNull(); assertThat(bundle.getStringArrayList("foo")).isNull(); assertThat(bundle.getBundle("foo")).isNull(); assertThat((Parcelable) bundle.getParcelable("foo")).isNull(); assertThat(bundle.getParcelableArray("foo")).isNull(); assertThat(bundle.getParcelableArrayList("foo")).isNull(); bundle.putInt("foo", 1); assertThat(bundle.getFloat("foo")).isEqualTo(0.0f); }
assertArrayEquals(originalBundle.getByteArray(BYTE_ARRAY_KEY), cachedBundle.getByteArray(BYTE_ARRAY_KEY)); assertEquals(originalBundle.getShort(SHORT_KEY), cachedBundle.getShort(SHORT_KEY)); assertArrayEquals(originalBundle.getShortArray(SHORT_ARRAY_KEY), cachedBundle.getShortArray(SHORT_ARRAY_KEY)); assertEquals(originalBundle.getInt(INT_KEY), cachedBundle.getInt(INT_KEY)); assertArrayEquals(originalBundle.getIntArray(INT_ARRAY_KEY), cachedBundle.getIntArray(INT_ARRAY_KEY));
/** * Retrieve extended data from the request. * * @param name The name of the desired item. * @return the value of an item that previously added with putExtra() or * null if no short array value was found. * @see #putExtra(String, short[]) */ public short[] getShortArrayExtra(String name) { return mExtras == null ? null : mExtras.getShortArray(name); }
public short[] getShorts(String key){ if (mBundle != null) { return mBundle.getShortArray(key); } return null; }
public short[] getShortArray(Bundle state, String key) { return state.getShortArray(key + mBaseKey); }
private BufferCallbackTimes(Parcel source) { Bundle in = source.readBundle(getClass().getClassLoader()); mTimeStamps = in.getIntArray("mTimeStamps"); mCallbackDurations = in.getShortArray("mCallbackDurations"); mExpectedBufferPeriod = in.getShort("mExpectedBufferPeriod"); mExceededCapacity = in.getBoolean("mExceededCapacity"); mIndex = in.getInt("mIndex"); }
rgbaValues = getArguments().getShortArray(ARG_RGBA_VALUES);