Skip to content

0.11.0

Latest

Choose a tag to compare

@sergio-sastre sergio-sastre released this 01 Dec 12:50

What's new

Faster Preview tests

Gradle-based scan-result caching

  • #115 Support saving the scan result inside a Gradle task for JVM libraries.
  • #38 Support saving the scan result in assets inside a Gradle task for instrumentation libraries.

This lets you separate Preview scanning from test execution: run the scan in a Gradle task and use the saved result during test execution.

As a result, Instrumentation Preview screenshot tests no longer need a prior unit test for scanning: the scan can be performed beforehand in a Gradle task.

More accurate Android Preview dimensions

  • #164 Improve the accuracy of the dimensions used for rendering Android Previews.
    Previously, when converting from Dp to Px or vice versa and back, we accepted a margin error of 2f in ScreenSize/ChinSize dimensions due to rounding. This margin error is gone and such conversions are precise now.
    As a result, newly recorded screenshots may have a slightly different size than in previous versions, but they now better reflect the actual Preview dimensions.

New Android Preview device properties

  • #163 Support the new Android Preview device properties introduced in Android Studio Stingray:

    • windowPosture: flat, tabletop, or book
    • pointerPrecision: coarse, fine, blunt, or none
    • keyboardKind: virtual, physical, or none
    • viewingDistance: near, medium, or far
    • hasCamera: true or false
    • hasMicrophone: true or false

    This look something like this inside a Preview:

    @Preview(
        device = "spec:width=673dp,height=841dp," +
            "windowPosture=tabletop," +
            "pointerPrecision=fine," +
            "keyboardKind=physical," +
            "hasCamera=false," +
            "hasMicrophone=false," +
            "viewingDistance=medium"
    )
  • #163 AI Glasses is now named Display Glasses in device identifiers:

    @Preview(device = "name:Display Glasses")

Breaking changes

  • #164 Newly recorded screenshots may have a slightly different size due to more accurate Preview dimensions.
    Please regenerate your screenshot baselines after upgrading if your tests compare against previously recorded screenshots.

    No API-breaking changes are expected.