ytai / ioio

Software, firmware and hardware of the IOIO - I/O for Android
Apache License 2.0
747 stars 355 forks source link

Moving everything from Activity to AppCompatActivity #204

Closed topherbuckley closed 4 years ago

topherbuckley commented 4 years ago

Looks like the error is unrelated to what I added.

ioio.examples.holiday.HolidayIOIOSmokeTest > smokeTestSimplyStart[emulator(AVD) - 9] FAILED 
    java.lang.NullPointerException: Attempt to invoke virtual method 'android.hardware.Camera$Parameters android.hardware.Camera.getParameters()' on a null object reference
    at ioio.examples.holiday.HolidayIOIOActivity.onStart(HolidayIOIOActivity.java:176)
Tests on emulator(AVD) - 9 failed: Instrumentation run failed due to 'Process crashed.'

Did this error not come up on any other PR after you introduced the smoke tests? I'm not familiar with espresso testing at all, but do we need to provide anything special for emulating camera hardware? I could simply add a nullpointer check on this, but then I'd think the espresso test would lose the ability to fully test the app. Any suggestions other than a simple if not null around this?

hannesa2 commented 4 years ago

Did this error not come up on any other PR after you introduced the smoke tests?

Nope, it's related to this PR.

Maybe this is a blueprint for your issue https://github.com/hannesa2/LiveEdgeDetection/blob/master/app/src/androidTest/java/info/hannes/liveedgedetection/demo/SmokeTest.kt

topherbuckley commented 4 years ago

Maybe this is a blueprint for your issue https://github.com/hannesa2/LiveEdgeDetection/blob/master/app/src/androidTest/java/info/hannes/liveedgedetection/demo/SmokeTest.kt

I'm not sure what you mean. You think there is something in this smoke test causing the same issue?

Anyways, I just enclosed everything in a nullpointer check and all the espresso tests pass. Looks like your espresso tester does not have a working virtual camera object. HolidayIOIO built and ran just fine on both my phones I test with (Nexus 5, and Pixel 3a).

More info on espresso testing a camera app here, thought I see no reason to test this at this time. I have never needed the camera to interface with the ioioboard.

hannesa2 commented 4 years ago

I didn't investigate, but on the first view it looked for a missing accepted camera permission in Espresso test. That's why I showed you how to solve it

topherbuckley commented 4 years ago

I didn't investigate, but on the first view it looked for a missing accepted camera permission in Espresso test. That's why I showed you how to solve it

Why did you think it was a permission issue? I only saw a null Camera object, so I assumed the espresso test virtual device did not have a camera instance associated with it. I see nothing in the log regarding the word permission.

hannesa2 commented 4 years ago

Every camera needs a permission, and in test it was missing. As I wrote: on the first view ...

topherbuckley commented 4 years ago

Every camera needs a permission, and in test it was missing. As I wrote: on the first view ...

I'm still not seeing why you think it is missing. It is here is it not? This looks very similar to what you have in the "blueprint" you linked as well.

Can you quote something from the failed test showing what you are talking about with regards to permissions? As I said, I get no results from a string search on the raw log for "permission".

Regardless, I'm not sure what this has to do with this PR. If there was something broken about the test, nothing in this PR modifies any test files.

hannesa2 commented 4 years ago

Sorry, as I wrote: I didn't investigate... but it would be better, if I had done it.

I stopped reading after this line method 'android.hardware.Camera$Parameters android.hardware.Camera.getParameters()' and made a misleading hint.

But the tests has done something what's his primary purpose. It found an error !

topherbuckley commented 4 years ago

I'm actually not really sure how HolidayIOIO is supposed to make use of the camera. Without looking at the code, I think it was supposed to adjust the yellow onboard LED according to the average exposure on the camera or something like that. Anyways I think it is a fairly niche use of the IOIOboard, so I don't think its worth spending too much time figuring out the camera usage in the espresso tests. If someone has a use-case with this in the future we can address it then I suppose.