• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.robolectric.shadows;
2 
3 import android.graphics.PathIterator;
4 import org.robolectric.annotation.Implementation;
5 import org.robolectric.annotation.Implements;
6 import org.robolectric.annotation.InDevelopment;
7 import org.robolectric.versioning.AndroidVersions.U;
8 import org.robolectric.versioning.AndroidVersions.V;
9 
10 /** Shadow for {@link PathIterator} in LEGACY graphics. */
11 @Implements(
12     value = PathIterator.class,
13     minSdk = U.SDK_INT,
14     isInAndroidSdk = false /* disable shadowOf generation */)
15 public class ShadowPathIterator {
16 
17   /**
18    * By default, Robolectric instrumentation of this native method will cause it to return zero,
19    * which conveys {@link PathIterator#VERB_MOVE}. To avoid infinite loops, update it to return
20    * {@link PathIterator#VERB_DONE}.
21    */
22   @Implementation
nNext(long nativeIterator, long pointsAddress)23   protected static int nNext(long nativeIterator, long pointsAddress) {
24     return PathIterator.VERB_DONE;
25   }
26 
27   /** Also shadow the upcoming indevelopment nNextHost */
28   @InDevelopment
29   @Implementation(minSdk = V.SDK_INT)
nNextHost(long nativeIterator, float[] points)30   protected static int nNextHost(long nativeIterator, float[] points) {
31     return PathIterator.VERB_DONE;
32   }
33 }
34