@xian xian released this Mar 3, 2017 · 2144 commits to master since this release

Assets 2

Robolectric 3.3 fixes some long-standing bugs (notably PowerMock and Mockito integration) and adds some significant new features. Details below.

New Features

Android Simulation Changes

  • <array> resources are now supported [issue #2064].
  • Context#getExternalFilesDirs now supported [issue #2818].
  • Implemented android.opengl.Matrix [issue #2893].
  • Implemented a bunch of methods in PackageManager: [issue #2913].
    • checkSignatures()
    • getDefaultActivityIcon()
    • getInstalledApplications()
    • getInstallerPackageName() and setInstallerPackageName()
    • getPackageSizeInfo() (Use addPackage() to control behavior.)
    • getPermissionInfo() (Use manifest or addPermissionInfo() to control behavior.)
    • resolveContentProvider()
  • Implemented a bunch of methods in AccountManager: [issue #2906].
    • All methods which return a AccountManagerFuture will now post their work to the specified Handler, so it will be deferred or executed immediately depending on the state of its Scheduler.
  • Added initial support for WifiP2pManager [issue #2933].
  • View.getGlobalVisibleRect() now uses the framework implementation unless setGlobalVisibleRect() has been called.

API Changes:

  • Several classes have moved to new packages. See Migration Guide for details [issue #2873].
  • PackageManager's behavior is moving from a subclass to a shadow. See the Migration Guide [issue #2887]
  • Deprecated RuntimeEnvironment.getPackageManager(). Use Android APIs instead.
  • Deprecated ShadowConfiguration. Use Configuration directly instead.
  • Deprecated ShadowView#getQualifiers(). Use Robolectric.getQualifiers() instead.
  • Deprecated *Controller.withIntent() and .attach() [issue #2938].
  • Removed deprecated ShadowLocation. Note that Location.equals() is no longer shadowed with special equality rules. [issue #2932]
  • Removed deprecated ShadowNotification.getProgressBar(), ShadowDrawable.reset(), ShadowContentResolver.registerProvider(), ShadowContentResolver.getContentObserver(), ShadowImageView.getImageResourceId(), and ShadowImageView.getImageBitmap() [issue #2932].
  • Removed deprecated ShadowIntentFilter.
  • Removed deprecated RoboAttributeSet and Attribute class. Use Robolectric.buildAttributeSet() instead.
  • Removed deprecated MultiApiRobolectricTestRunner [issue #2924].
  • The jars that comprise Robolectric have changed a bit. If your build system doesn't automatically pull in dependencies, see this post on (hermetic builds)[http://robolectric.org/blog/2017/03/01/hermetic-builds/] for more info.

Bug Fixes:

  • Fixed: PowerMock broken [issue #2208].
  • Fixed: Mockito experimental mocking of finals is broken [issue #2677].
  • Fixed a bug causing styleable attribute lookup in application resources to fail sometimes [issue #2878].
  • Fixed a bug which caused non-layout resources to be seen as layouts [issue #2882].
  • Fixed View.getWindowId() to behave more like Android [issue #2888].
  • Fixed a bug in BitmapRegionDecoder [issue #2926].
  • Fixed a bug in PackageMAnager.queryIntentContentProviders() [issue #2927].

Known Issues:

  • Some styles may still not resolve properly [issue #2787].

Use Robolectric:

testCompile "org.robolectric:robolectric:3.3"

Find more details here.