Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access new Bitmap.writeToTestStorage API #1139

Closed
yogurtearl opened this issue Sep 30, 2021 · 3 comments · Fixed by #1146 or #1147
Closed

Can't access new Bitmap.writeToTestStorage API #1139

yogurtearl opened this issue Sep 30, 2021 · 3 comments · Fixed by #1146 or #1147

Comments

@yogurtearl
Copy link
Contributor

yogurtearl commented Sep 30, 2021

Description

A couple of things related to the new Bitmap.writeToTestStorage API added in #1106 :

  • Can't access it thru a gradle build... it might be because there is no /META-INF/androidx.test.core.kotlin_module inside the aar? Are you missing a keep_rule for that file like you have for the ktx artifact?
  • was it intentional to put this in core and not core-ktx ?
  • do you want to be able to call these new APIs from Java? if so, might need to make @JvmStatic versions of those functions.
  • The new methods are missing from the api/current.txt

That is a lot for one issue, should I break these out into separate issues?

Steps to Reproduce

  • Create a android gradle project
  • add androidTestImplementation 'androidx.test:core:1.4.1-alpha02'
  • add import androidx.test.core.graphics.BitmapStorage.writeToTestStorage to a test
  • try to compile the tests.

Expected Results

No error

Actual Results

Get a compile error.
e: app/src/androidTest/java/com/example/ExampleInstrumentedTest.kt: (17, 36): Unresolved reference: BitmapStorage

@brettchabot
Copy link
Collaborator

Wow thanks for all the feedback. Clearly I should have written a gradle test before release. I'll answer the points one by one

  1. re gradle build access: Good catch, I'll look into it
  2. Yes it was intentional to put these into core not core-ktx. androidx.test is going kotlin first, hopefully long term the core-ktx artifact can be deprecated
  3. yes the APIs are intended to be usable from Java, I'll take a look
  4. Its intentional that the APIs are missing from api/current.txt. They are currently marked @ExperimentalTestApi - we want more soak time / usage before locking down the APIs

copybara-service bot pushed a commit that referenced this issue Oct 1, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
copybara-service bot pushed a commit that referenced this issue Oct 2, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
copybara-service bot pushed a commit that referenced this issue Oct 2, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
copybara-service bot pushed a commit that referenced this issue Oct 2, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
copybara-service bot pushed a commit that referenced this issue Oct 2, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
copybara-service bot pushed a commit that referenced this issue Oct 2, 2021
- Generate kotlin_module files in locations matching maven
  artifact name, and ensure they are retained in produced .aar/classes.jar to ensure extension functions are recognized
- Don't rename ListenableFuture in espresso core - since androidx.test.core uses the actual ListenableFuture dependency
- Bump version to prep for next release

There is still an issue with the ViewInteraction.captureToImage extension, which gradle does not recognize for an unknown reason.

Partially fixes #1139

PiperOrigin-RevId: 400057476
@brettchabot brettchabot reopened this Oct 2, 2021
@brettchabot
Copy link
Collaborator

Bitmap.writeToTestStorage is accessible from both kotlin and java. But there is still an issue with ViewInteraction.captureToBitmap

@brettchabot
Copy link
Collaborator

PTAL at the androidx.test:core:1.4.1-alpha03 release.

I'm working on a testing sample too which seems to work for me. LMK if you have any more issues
android/testing-samples#405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants