Skip to content

Conversation

@j0ker70
Copy link
Contributor

@j0ker70 j0ker70 commented Mar 14, 2025

Issue: #44
Problem: No unit test for AndroidSensorEventListener
Solution: Add unit test for AndroidSensorEventListener.

1. onSensorChanged should update accelerometer and magnetometer readings and call updateOrientationAngles
2. onAccuracyChanged should show toast when accuracy is unreliable
3. onAccuracyChanged should show toast when accuracy is low.
4. updateOrientationAngles should call listener with correct values
5. registerSensor should register listeners
6. unregisterSensorListener should unregister listeners
7. setAzimuthListener should set the listener

Copy link
Member

@MubarakNative MubarakNative left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

robolectric latest version should be: this, also don't mock context mockkStatic("android.content.Context")

@j0ker70 j0ker70 force-pushed the feature/unit-test-AndroidSensorEventListener branch from 06377d6 to d2dd26e Compare March 15, 2025 08:37
@j0ker70 j0ker70 requested a review from MubarakNative March 15, 2025 08:39
@j0ker70
Copy link
Contributor Author

j0ker70 commented Mar 15, 2025

robolectric latest version should be: this, also don't mock context mockkStatic("android.content.Context")

Done

Issue: #44
Problem: No unit test for AndroidSensorEventListener
Solution: Add unit test for AndroidSensorEventListener.

    1. onSensorChanged should update accelerometer and magnetometer readings and call updateOrientationAngles
    2. onAccuracyChanged should show toast when accuracy is unreliable
    3. onAccuracyChanged should show toast when accuracy is low.
    4. updateOrientationAngles should call listener with correct values
    5. registerSensor should register listeners
    6. unregisterSensorListener should unregister listeners
    7. setAzimuthListener should set the listener
@j0ker70 j0ker70 force-pushed the feature/unit-test-AndroidSensorEventListener branch from d2dd26e to 9cd84c1 Compare March 15, 2025 08:48
@j0ker70 j0ker70 requested a review from MubarakNative March 15, 2025 08:48
@MubarakNative
Copy link
Member

Is all test cases are passes ?

@j0ker70
Copy link
Contributor Author

j0ker70 commented Mar 15, 2025

Is all test cases are passes ?

Yes

@j0ker70
Copy link
Contributor Author

j0ker70 commented Mar 16, 2025

@MubarakNative, is there anything I did wrong?

@MubarakNative
Copy link
Member

@j0ker70 Definetly not! Sorry for that if you feel bad, I am currently working on another project i have a nomeantime to review the all test cases and write my own test cases for classes like these ToDegree, CardinalDirection. So i planned to work this PR later, so i close this PR. Now it is open!

If you want to be a part of this app, I will also add you as a collaborator/maintainer (invite you to this project)

@MubarakNative MubarakNative reopened this Mar 16, 2025
@j0ker70
Copy link
Contributor Author

j0ker70 commented Mar 16, 2025

Thank you so much for the opportunity. I accepted your invitation although I don't know much of the workings of this app. I will have to spend some time to understand the workings of the app.

@MubarakNative
Copy link
Member

I don't know much of the workings of this app. I will have to spend some time to understand the workings of the app.

Nothing too fancy here, install the latest version of this app, Checkout its feature according to the codebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants