23
23
import android .animation .TimeInterpolator ;
24
24
import android .os .Build .VERSION_CODES ;
25
25
import androidx .appcompat .app .AppCompatActivity ;
26
+ import android .view .animation .AccelerateInterpolator ;
27
+ import android .view .animation .AnimationUtils ;
26
28
import android .view .animation .Interpolator ;
27
29
import android .view .animation .LinearInterpolator ;
28
30
import android .view .animation .PathInterpolator ;
37
39
import org .robolectric .android .controller .ActivityController ;
38
40
import org .robolectric .annotation .Config ;
39
41
import org .robolectric .annotation .internal .DoNotInstrument ;
42
+ import org .robolectric .shadow .api .Shadow ;
40
43
41
44
@ RunWith (RobolectricTestRunner .class )
42
45
@ Config (sdk = VERSION_CODES .LOLLIPOP )
@@ -53,23 +56,23 @@ public void testResolvesThemeInterpolator() {
53
56
assertThemeInterpolatorIsInstanceOf (
54
57
R .style .Theme_Material3_DayNight ,
55
58
R .attr .motionEasingStandardInterpolator ,
56
- LinearInterpolator .class );
59
+ isAnimationUtilsShadowed () ? LinearInterpolator . class : PathInterpolator .class );
57
60
}
58
61
59
62
@ Test
60
63
public void testCustomInterpolator_resolvesThemeInterpolator () {
61
64
assertThemeInterpolatorIsInstanceOf (
62
65
R .style .Theme_Material3_DayNight_CustomInterpolator ,
63
66
R .attr .motionEasingStandardInterpolator ,
64
- LinearInterpolator .class );
67
+ isAnimationUtilsShadowed () ? LinearInterpolator . class : PathInterpolator .class );
65
68
}
66
69
67
70
@ Test
68
71
public void testCustomAnimInterpolator_resolvesThemeInterpolator () {
69
72
assertThemeInterpolatorIsInstanceOf (
70
73
R .style .Theme_Material3_DayNight_CustomAnimInterpolator ,
71
74
R .attr .motionEasingStandardInterpolator ,
72
- LinearInterpolator .class );
75
+ isAnimationUtilsShadowed () ? LinearInterpolator . class : AccelerateInterpolator .class );
73
76
}
74
77
75
78
@ Test
@@ -125,6 +128,10 @@ public void testMaterialComponentsThemeIncorrectLegacyFormatting_shouldThrowExce
125
128
new DefaultDummyInterpolator ());
126
129
}
127
130
131
+ private boolean isAnimationUtilsShadowed () {
132
+ return Shadow .extract (new AnimationUtils ()) != null ;
133
+ }
134
+
128
135
private void createActivityAndSetTheme (int themeId ) {
129
136
ApplicationProvider .getApplicationContext ().setTheme (themeId );
130
137
activityController = Robolectric .buildActivity (AppCompatActivity .class ).create ();
0 commit comments