Files
app_Settings/tests/robotests/src/com/android/settings/widget/DonutViewTest.java
Daniel Nishi f5ba67dc40 Fix a crash in Storage Settings.
This prevents a NullPtrException when the DonutView attempts to shrink
the percentage sign. By gracefully falling back when we don't understand
the percentage sign, we can avoid a crash.

Change-Id: I0b0770ce4b51eb30817dc556636f86476f4cd1bf
Fixes: 77653937
Test: Robotest -- screenshot attached
2018-04-09 10:21:50 -07:00

20 lines
558 B
Java

package com.android.settings.widget;
import android.content.Context;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
public class DonutViewTest {
@Test
public void getPercentageStringSpannable_doesntCrashForMissingPercentage() {
Context context = RuntimeEnvironment.application;
DonutView.getPercentageStringSpannable(context.getResources(), "50%", "h");
}
}