Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package cn.vove7.andro_accessibility_api
* # AppScope
*
* @property packageName String app pkg
* @property pageName String class name of Activity or Dialog
* @property pageName String class name of Activity or Dialog (empty means any page)
* @constructor
*/
data class AppScope(
Expand All @@ -22,4 +22,4 @@ data class AppScope(
that.pageName.endsWith("$$pageName")

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,9 @@ object ScreenAdapter {


fun scalePoints(points: Array<Pair<Int, Int>>): Array<Pair<Float, Float>> {

val ps = Array(points.size) { Pair(0f, 0f) }

val index = 0
points.forEach {
val x =
scaleX(it.first)
val y =
scaleY(it.second)
ps[index] = Pair(x, y)
}
return ps
return points.map { point ->
Pair(scaleX(point.first), scaleY(point.second))
}.toTypedArray()
}

fun scaleX(x: Int): Float = scaleX(x.toFloat())
Expand Down Expand Up @@ -106,4 +97,3 @@ class AdapterRectF : RectF {
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cn.vove7.andro_accessibility_api.utils

import org.junit.Assert.assertEquals
import org.junit.Test

class ResultBoxTest {
@Test
fun setAndNotify_releasesLatchAndReturnsValue() {
val box = ResultBox<String>()

box.setAndNotify("done")

assertEquals(0, box.lock.count)
assertEquals("done", box.blockedGet())
}

@Test
fun blockedGet_returnsValueWithoutThrowingWhenAlreadySet() {
val box = ResultBox(42)

box.setAndNotify(7)

assertEquals(7, box.blockedGet(safely = false))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext

/**
* # actoins
* # actions
*
* Created on 2020/6/10
* @author Vove
Expand Down Expand Up @@ -271,4 +271,4 @@ class TraverseAllAction : Action {
// assert = [ Bottom, SubView ]

}
}
}