Home | History | Annotate | Download | only in annotation
      1 package org.robolectric.annotation;
      2 
      3 import java.lang.annotation.Documented;
      4 import java.lang.annotation.ElementType;
      5 import java.lang.annotation.Retention;
      6 import java.lang.annotation.RetentionPolicy;
      7 import java.lang.annotation.Target;
      8 
      9 /**
     10  * Robolectric can check for certain kinds of accessibility bugs while running
     11  * your tests. These are bugs that interfere with services that allow users with
     12  * disabilities to access your UI. When these checks are enabled, calling
     13  * {@code Robolectric.onClick()} will run a series of checks on your UI and
     14  * throw exceptions if errors are present.
     15  */
     16 @Documented
     17 @Retention(RetentionPolicy.RUNTIME)
     18 @Target({ElementType.TYPE, ElementType.METHOD})
     19 public @interface AccessibilityChecks {
     20   enum ForRobolectricVersion { VERSION_3_0, VERSION_3_1, LATEST }
     21 
     22   /**
     23    * Enable or disable accessibility checking.
     24    *
     25    * @return  True if accessibility checking is enabled.
     26    */
     27   boolean enabled() default true;
     28 
     29   /**
     30    * Accessibility checking can be a moving target. As new checks are added to
     31    * Robolectric, these checks may reveal issues with a UI that previously
     32    * passed all checks (but were probably affecting users all along). This
     33    * option forces Robolectric to run only those checks that were present in a
     34    * specified version of Robolectric, which reduces the opportunity for a
     35    * new bug to be discovered in an old test. Note that this option does not
     36    * guarantee that the behavior of individual checks won't change as bugs are
     37    * fixed and/or features added to checks that existed in the specified
     38    * version.
     39    *
     40    * @return  Run all checks corresponding to this version of Robolectric.
     41    */
     42   ForRobolectricVersion forRobolectricVersion() default ForRobolectricVersion.LATEST;
     43 }