Skip to content

Commit

Permalink
🔧 I was passing the angle as it was to the place where the radian sho…
Browse files Browse the repository at this point in the history
…uld be passed, so I corrected the value.
  • Loading branch information
Corvus400 committed Sep 3, 2024
1 parent f9a4bc9 commit 88141c5
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import io.github.droidkaigi.confsched.profilecard.component.ProfileCardFlipCardF
import io.github.droidkaigi.confsched.profilecard.component.ProfileCardFlipCardTestTag
import org.robolectric.util.ReflectionHelpers
import javax.inject.Inject
import kotlin.math.PI

class ProfileCardScreenRobot @Inject constructor(
screenRobot: DefaultScreenRobot,
Expand Down Expand Up @@ -115,64 +116,64 @@ class ProfileCardScreenRobot @Inject constructor(

fun tiltToHorizontal() {
tiltAllAxes(
pitch = 0f,
roll = 0f,
pitch = degreeToRadian(0f),
roll = degreeToRadian(0f),
)
waitUntilIdle()
}

fun tiltToMidRange() {
tiltAllAxes(
pitch = 45f,
roll = 45f,
pitch = degreeToRadian(45f),
roll = degreeToRadian(45f),
)
waitUntilIdle()
}

fun tiltToUpperBound() {
tiltAllAxes(
pitch = 75f,
roll = 75f,
pitch = degreeToRadian(75f),
roll = degreeToRadian(75f),
)
waitUntilIdle()
}

fun tiltPitchOutOfBounds() {
tiltAllAxes(
pitch = -80f,
roll = 0f,
pitch = degreeToRadian(-80f),
roll = degreeToRadian(0f),
)
waitUntilIdle()
}

fun tiltRollOutOfBounds() {
tiltAllAxes(
pitch = 0f,
roll = 80f,
pitch = degreeToRadian(0f),
roll = degreeToRadian(80f),
)
waitUntilIdle()
}

fun tiltBothAxesOutOfBounds() {
tiltAllAxes(
pitch = -80f,
roll = 80f,
pitch = degreeToRadian(-80f),
roll = degreeToRadian(80f),
)
waitUntilIdle()
}

fun tiltToPitchRollBoundary() {
tiltAllAxes(
pitch = -75f,
roll = 75f,
pitch = degreeToRadian(-75f),
roll = degreeToRadian(75f),
)
waitUntilIdle()
}

fun tiltToPitchRollBoundaryOpposite() {
tiltAllAxes(
pitch = 75f,
roll = -75f,
pitch = degreeToRadian(75f),
roll = degreeToRadian(-75f),
)
waitUntilIdle()
}
Expand Down Expand Up @@ -256,4 +257,8 @@ class ProfileCardScreenRobot @Inject constructor(
fun cleanUp() {
cleanUpSensors()
}

private fun degreeToRadian(degree: Float): Float {
return (degree * PI / 180f).toFloat()
}
}

0 comments on commit 88141c5

Please sign in to comment.